9437 fix missing summary sub plot update

Summary plot: fix missing sub plot title updates.
Janitor: improve RiuPlotWidget interface.
This commit is contained in:
Kristian Bendiksen 2022-11-29 19:28:57 +01:00 committed by GitHub
parent 14db528c98
commit 99553382f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 17 additions and 11 deletions

View File

@ -209,6 +209,7 @@ void RimSummaryMultiPlot::insertPlot( RimPlot* plot, size_t index )
sumPlot->axisChanged.connect( this, &RimSummaryMultiPlot::onSubPlotAxisChanged ); sumPlot->axisChanged.connect( this, &RimSummaryMultiPlot::onSubPlotAxisChanged );
sumPlot->curvesChanged.connect( this, &RimSummaryMultiPlot::onSubPlotChanged ); sumPlot->curvesChanged.connect( this, &RimSummaryMultiPlot::onSubPlotChanged );
sumPlot->plotZoomedByUser.connect( this, &RimSummaryMultiPlot::onSubPlotZoomed ); sumPlot->plotZoomedByUser.connect( this, &RimSummaryMultiPlot::onSubPlotZoomed );
sumPlot->titleChanged.connect( this, &RimSummaryMultiPlot::onSubPlotChanged );
bool isMinMaxOverridden = m_axisRangeAggregation() != AxisRangeAggregation::NONE; bool isMinMaxOverridden = m_axisRangeAggregation() != AxisRangeAggregation::NONE;
setAutoValueStatesForPlot( sumPlot, isMinMaxOverridden, m_autoAdjustAppearance() ); setAutoValueStatesForPlot( sumPlot, isMinMaxOverridden, m_autoAdjustAppearance() );
@ -550,9 +551,9 @@ void RimSummaryMultiPlot::updatePlotWindowTitle()
setMultiPlotTitle( title ); setMultiPlotTitle( title );
} }
if ( m_autoSubPlotTitle ) for ( auto plot : summaryPlots() )
{ {
for ( auto plot : summaryPlots() ) if ( m_autoSubPlotTitle )
{ {
auto subPlotNameHelper = plot->plotTitleHelper(); auto subPlotNameHelper = plot->plotTitleHelper();
@ -563,11 +564,11 @@ void RimSummaryMultiPlot::updatePlotWindowTitle()
auto plotName = subPlotNameHelper->aggregatedPlotTitle( *m_nameHelper ); auto plotName = subPlotNameHelper->aggregatedPlotTitle( *m_nameHelper );
plot->setPlotTitleVisible( true ); plot->setPlotTitleVisible( true );
plot->setDescription( plotName ); plot->setDescription( plotName );
plot->updatePlotTitle();
} }
plot->updatePlotTitle();
if ( !m_viewer.isNull() ) m_viewer->scheduleTitleUpdate();
} }
if ( !m_viewer.isNull() ) m_viewer->scheduleTitleUpdate();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -715,6 +716,7 @@ void RimSummaryMultiPlot::initAfterRead()
plot->axisChanged.connect( this, &RimSummaryMultiPlot::onSubPlotAxisChanged ); plot->axisChanged.connect( this, &RimSummaryMultiPlot::onSubPlotAxisChanged );
plot->curvesChanged.connect( this, &RimSummaryMultiPlot::onSubPlotChanged ); plot->curvesChanged.connect( this, &RimSummaryMultiPlot::onSubPlotChanged );
plot->plotZoomedByUser.connect( this, &RimSummaryMultiPlot::onSubPlotZoomed ); plot->plotZoomedByUser.connect( this, &RimSummaryMultiPlot::onSubPlotZoomed );
plot->titleChanged.connect( this, &RimSummaryMultiPlot::onSubPlotChanged );
} }
updateStepDimensionFromDefault(); updateStepDimensionFromDefault();
} }

View File

@ -105,6 +105,7 @@ RimSummaryPlot::RimSummaryPlot( bool isCrossPlot )
, curvesChanged( this ) , curvesChanged( this )
, axisChanged( this ) , axisChanged( this )
, plotZoomedByUser( this ) , plotZoomedByUser( this )
, titleChanged( this )
, m_isValid( true ) , m_isValid( true )
{ {
CAF_PDM_InitScriptableObject( "Summary Plot", ":/SummaryPlotLight16x16.png", "", "A Summary Plot" ); CAF_PDM_InitScriptableObject( "Summary Plot", ":/SummaryPlotLight16x16.png", "", "A Summary Plot" );
@ -1485,6 +1486,8 @@ void RimSummaryPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
c->updateCurveNameNoLegendUpdate(); c->updateCurveNameNoLegendUpdate();
} }
} }
titleChanged.send();
} }
if ( changedField == &m_showPlotLegends ) updateLegend(); if ( changedField == &m_showPlotLegends ) updateLegend();

View File

@ -82,6 +82,7 @@ public:
caf::Signal<> curvesChanged; caf::Signal<> curvesChanged;
caf::Signal<RimSummaryPlot*> axisChanged; caf::Signal<RimSummaryPlot*> axisChanged;
caf::Signal<> plotZoomedByUser; caf::Signal<> plotZoomedByUser;
caf::Signal<> titleChanged;
public: public:
RimSummaryPlot( bool isCrossPlot = false ); RimSummaryPlot( bool isCrossPlot = false );

View File

@ -115,8 +115,8 @@ public:
virtual void setPlotTitle( const QString& plotTitle ) = 0; virtual void setPlotTitle( const QString& plotTitle ) = 0;
const QString& plotTitle() const; const QString& plotTitle() const;
void setPlotTitleEnabled( bool enabled ); virtual void setPlotTitleEnabled( bool enabled ) = 0;
bool plotTitleEnabled() const; virtual bool plotTitleEnabled() const = 0;
virtual void setPlotTitleFontSize( int titleFontSize ) = 0; virtual void setPlotTitleFontSize( int titleFontSize ) = 0;
virtual void setLegendFontSize( int fontSize ) = 0; virtual void setLegendFontSize( int fontSize ) = 0;

View File

@ -112,8 +112,8 @@ public:
void setPlotTitle( const QString& plotTitle ) override; void setPlotTitle( const QString& plotTitle ) override;
const QString& plotTitle() const; const QString& plotTitle() const;
void setPlotTitleEnabled( bool enabled ); void setPlotTitleEnabled( bool enabled ) override;
bool plotTitleEnabled() const; bool plotTitleEnabled() const override;
void setPlotTitleFontSize( int titleFontSize ) override; void setPlotTitleFontSize( int titleFontSize ) override;
void setLegendFontSize( int fontSize ) override; void setLegendFontSize( int fontSize ) override;

View File

@ -101,8 +101,8 @@ public:
void setPlotTitle( const QString& plotTitle ) override; void setPlotTitle( const QString& plotTitle ) override;
const QString& plotTitle() const; const QString& plotTitle() const;
void setPlotTitleEnabled( bool enabled ); void setPlotTitleEnabled( bool enabled ) override;
bool plotTitleEnabled() const; bool plotTitleEnabled() const override;
void setPlotTitleFontSize( int titleFontSize ) override; void setPlotTitleFontSize( int titleFontSize ) override;
void setLegendFontSize( int fontSize ) override; void setLegendFontSize( int fontSize ) override;