mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#8453 Fix crash when changing plot type (QtCharts <-> Qwt).
This commit is contained in:
parent
258fbddc10
commit
f996b5383a
@ -1011,11 +1011,16 @@ void RimPlotCurve::attach( RiuPlotWidget* plotWidget )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPlotCurve::detach()
|
||||
void RimPlotCurve::detach( bool deletePlotCurve )
|
||||
{
|
||||
if ( m_plotCurve )
|
||||
{
|
||||
m_plotCurve->detach();
|
||||
if ( deletePlotCurve )
|
||||
{
|
||||
delete m_plotCurve;
|
||||
m_plotCurve = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
replotParentPlot();
|
||||
|
@ -122,7 +122,7 @@ public:
|
||||
void setParentPlotAndReplot( RiuPlotWidget* );
|
||||
|
||||
void attach( RiuPlotWidget* );
|
||||
void detach();
|
||||
void detach( bool deletePlotCurve = false );
|
||||
void reattach();
|
||||
bool isSameCurve( const RiuPlotCurve* plotCurve ) const;
|
||||
|
||||
|
@ -310,11 +310,11 @@ void RimEnsembleCurveSet::setParentPlotNoReplot( RiuPlotWidget* plot )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEnsembleCurveSet::detachPlotCurves()
|
||||
void RimEnsembleCurveSet::detachPlotCurves( bool deletePlotCurve )
|
||||
{
|
||||
for ( RimSummaryCurve* curve : m_curves )
|
||||
{
|
||||
curve->detach();
|
||||
curve->detach( deletePlotCurve );
|
||||
}
|
||||
|
||||
if ( m_plotCurveForLegendText )
|
||||
|
@ -95,7 +95,7 @@ public:
|
||||
|
||||
void loadDataAndUpdate( bool updateParentPlot );
|
||||
void setParentPlotNoReplot( RiuPlotWidget* plot );
|
||||
void detachPlotCurves();
|
||||
void detachPlotCurves( bool deletePlotCurve = false );
|
||||
void reattachPlotCurves();
|
||||
|
||||
void addCurve( RimSummaryCurve* curve );
|
||||
|
@ -1525,6 +1525,29 @@ void RimSummaryPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef USE_QTCHARTS
|
||||
if ( changedField == &m_useQtChartsPlot )
|
||||
{
|
||||
// Hide window
|
||||
setShowWindow( false );
|
||||
|
||||
// Detach and destroy plot curves
|
||||
for ( auto c : summaryCurves() )
|
||||
{
|
||||
c->detach( true );
|
||||
}
|
||||
|
||||
for ( auto& curveSet : this->ensembleCurveSetCollection()->curveSets() )
|
||||
{
|
||||
curveSet->detachPlotCurves( true );
|
||||
}
|
||||
|
||||
// Destroy viewer
|
||||
removeMdiWindowFromMdiArea();
|
||||
cleanupBeforeClose();
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( changedField == &m_normalizeCurveYValues )
|
||||
{
|
||||
this->loadDataAndUpdate();
|
||||
|
Loading…
Reference in New Issue
Block a user