diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp index a30526f113..5b5a0f5d50 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp @@ -52,6 +52,7 @@ #include "RimSummaryCaseCollection.h" #include "RimSummaryCurve.h" #include "RimSummaryCurveAutoName.h" +#include "RimSummaryMultiPlot.h" #include "RimSummaryPlot.h" #include "RimTimeStepFilter.h" @@ -151,8 +152,6 @@ RimEnsembleCurveSet::RimEnsembleCurveSet() m_xAddressSelector.uiCapability()->setUiTreeHidden( true ); m_xAddressSelector.uiCapability()->setUiTreeChildrenHidden( true ); - m_xAddressSelector->addressChanged.connect( this, &RimEnsembleCurveSet::onXAxisAddressChanged ); - CAF_PDM_InitField( &m_colorMode, "ColorMode", caf::AppEnum( ColorMode::SINGLE_COLOR_WITH_ALPHA ), "Coloring Mode" ); CAF_PDM_InitField( &m_colorForRealizations, "Color", RiaColorTools::textColor3f(), "Color" ); @@ -998,6 +997,33 @@ void RimEnsembleCurveSet::defineObjectEditorAttribute( QString uiConfigName, caf } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimEnsembleCurveSet::childFieldChangedByUi( const caf::PdmFieldHandle* changedChildField ) +{ + if ( changedChildField == &m_xAddressSelector ) + { + updateAllCurves(); + + // The recommended way to trigger update in a parent object is by using caf::Signal. Here we need to update two parent classes, and + // they are multiple levels away. To avoid a long signal path that is hard to debug, we use firstAncestorOrThisOfType() + + auto summaryPlot = firstAncestorOrThisOfType(); + if ( summaryPlot ) + { + summaryPlot->updateAll(); + summaryPlot->zoomAll(); + } + + auto multiPlot = firstAncestorOrThisOfType(); + if ( multiPlot ) + { + multiPlot->updatePlotTitles(); + } + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -1087,14 +1113,6 @@ void RimEnsembleCurveSet::onCustomObjectiveFunctionChanged( const caf::SignalEmi updateObjectiveFunctionLegend(); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimEnsembleCurveSet::onXAxisAddressChanged( const caf::SignalEmitter* emitter ) -{ - updateAllCurves(); -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h index 97d523a416..2eaaeb6b78 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h @@ -206,6 +206,7 @@ class RimEnsembleCurveSet : public caf::PdmObject, public RimEnsembleCurveSetInt void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void defineObjectEditorAttribute( QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override; + void childFieldChangedByUi( const caf::PdmFieldHandle* changedChildField ) override; void updatePlotAxis(); @@ -221,7 +222,6 @@ class RimEnsembleCurveSet : public caf::PdmObject, public RimEnsembleCurveSetInt void onObjectiveFunctionChanged( const caf::SignalEmitter* emitter ); void onCustomObjectiveFunctionChanged( const caf::SignalEmitter* emitter ); - void onXAxisAddressChanged( const caf::SignalEmitter* emitter ); void setTransparentCurveColor(); void onColorTagClicked( const SignalEmitter* emitter, size_t index );