#8715 Fix multi summary title and legend updates

This commit is contained in:
Magne Sjaastad 2022-03-23 13:35:47 +01:00 committed by GitHub
parent 2aec91e66d
commit f45637b7f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 41 additions and 2 deletions

View File

@ -101,6 +101,9 @@ void RimSummaryMultiPlot::addPlot( RimPlot* plot )
CVF_ASSERT( sumPlot != nullptr );
if ( sumPlot )
{
// Not required to connect signal here, as RimSummaryMultiPlot::insertPlot() will always be called from
// RimMultiPlot::addPlot()
RimMultiPlot::addPlot( plot );
}
}
@ -114,6 +117,7 @@ void RimSummaryMultiPlot::insertPlot( RimPlot* plot, size_t index )
CVF_ASSERT( sumPlot != nullptr );
if ( sumPlot )
{
sumPlot->curvesChanged.connect( this, &RimSummaryMultiPlot::onSubPlotChanged );
RimMultiPlot::insertPlot( plot, index );
}
}
@ -131,9 +135,9 @@ void RimSummaryMultiPlot::addPlot( const std::vector<caf::PdmObjectHandle*>& obj
RimSummaryPlot* plot = new RimSummaryPlot();
plot->enableAutoPlotTitle( true );
addPlot( plot );
plot->handleDroppedObjects( objects );
addPlot( plot );
}
}
@ -508,6 +512,19 @@ bool RimSummaryMultiPlot::handleGlobalWheelEvent( QWheelEvent* wheelEvent )
return false;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryMultiPlot::initAfterRead()
{
RimMultiPlot::initAfterRead();
for ( auto plot : summaryPlots() )
{
plot->curvesChanged.connect( this, &RimSummaryMultiPlot::onSubPlotChanged );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -560,3 +577,12 @@ void RimSummaryMultiPlot::duplicate()
{
duplicatePlot.send( this );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryMultiPlot::onSubPlotChanged( const caf::SignalEmitter* emitter )
{
updatePlotWindowTitle();
applyPlotWindowTitleToWidgets();
}

View File

@ -72,6 +72,9 @@ protected:
bool handleGlobalKeyEvent( QKeyEvent* keyEvent ) override;
bool handleGlobalWheelEvent( QWheelEvent* wheelEvent ) override;
void initAfterRead() override;
private:
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
@ -87,6 +90,7 @@ private:
void updatePlotWindowTitle() override;
void duplicate();
void onSubPlotChanged( const caf::SignalEmitter* emitter );
private:
caf::PdmField<bool> m_autoPlotTitles;

View File

@ -97,6 +97,7 @@ CAF_PDM_SOURCE_INIT( RimSummaryPlot, "SummaryPlot" );
RimSummaryPlot::RimSummaryPlot( bool isCrossPlot )
: RimPlot()
, m_isCrossPlot( isCrossPlot )
, curvesChanged( this )
{
CAF_PDM_InitScriptableObject( "Summary Plot", ":/SummaryPlotLight16x16.png", "", "A Summary Plot" );
@ -1289,6 +1290,8 @@ void RimSummaryPlot::deleteCurves( const std::vector<RimSummaryCurve*>& curves )
RiuPlotMainWindowTools::refreshToolbars();
updateCaseNameHasChanged();
curvesChanged.send();
}
//--------------------------------------------------------------------------------------------------
@ -2046,6 +2049,8 @@ void RimSummaryPlot::handleDroppedObjects( const std::vector<caf::PdmObjectHandl
{
applyDefaultCurveAppearances();
loadDataAndUpdate();
curvesChanged.send();
}
updateConnectedEditors();
@ -2426,6 +2431,7 @@ bool RimSummaryPlot::handleGlobalKeyEvent( QKeyEvent* keyEvent )
void RimSummaryPlot::onCurveCollectionChanged( const SignalEmitter* emitter )
{
updateStackedCurveData();
if ( plotWidget() ) plotWidget()->scheduleReplot();
}
//--------------------------------------------------------------------------------------------------

View File

@ -79,6 +79,9 @@ class RimSummaryPlot : public RimPlot, public RimSummaryDataSourceStepping
Q_OBJECT;
CAF_PDM_HEADER_INIT;
public:
caf::Signal<> curvesChanged;
public:
RimSummaryPlot( bool isCrossPlot = false );
~RimSummaryPlot() override;