Merge pull request #8461 from OPM/8460-plot-curve-fixes

Guard access to QtCharts objects that might be null
Fix visibility of items in legend based on state in parent plot
This commit is contained in:
Magne Sjaastad
2022-01-20 12:52:36 +01:00
committed by GitHub
parent 8f75dcb29f
commit 5ff9f36448
6 changed files with 62 additions and 12 deletions

View File

@@ -761,6 +761,11 @@ void RimSummaryPlot::updateLegend()
if ( plotWidget() )
{
plotWidget()->setInternalLegendVisible( m_showPlotLegends && !isSubPlot() );
for ( auto c : summaryCurves() )
{
c->updateLegendEntryVisibilityNoPlotUpdate();
}
}
reattachAllCurves();
@@ -1525,6 +1530,8 @@ void RimSummaryPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
}
}
if ( changedField == &m_showPlotLegends ) updateLegend();
#ifdef USE_QTCHARTS
if ( changedField == &m_useQtChartsPlot )
{
@@ -2172,7 +2179,7 @@ void RimSummaryPlot::updateCurveNames()
{
for ( auto c : summaryCurves() )
{
c->updateCurveNameNoLegendUpdate();
if ( c->isCurveVisible() ) c->updateCurveNameNoLegendUpdate();
}
}