#5171 Fix legend updates by getting rid of the show/hideEvent crash fix

* The crash is instead fixed by getting rid of deleteLater()
This commit is contained in:
Gaute Lindkvist
2019-12-04 09:13:54 +01:00
parent 3e39866f6f
commit 28a0a3ad06
10 changed files with 44 additions and 25 deletions

View File

@@ -78,9 +78,10 @@ RiuQwtPlotWidget::RiuQwtPlotWidget( RimPlotInterface* plotTrackDefinition, QWidg
//--------------------------------------------------------------------------------------------------
RiuQwtPlotWidget::~RiuQwtPlotWidget()
{
// The destructor may be called later when deleting with QWidget::deleteLater()
// If you are recreating the widget, then calling something that detaches QwtCurves
// here may cause them to detach from the new widget rather than the old.
if ( plotDefinition() )
{
plotDefinition()->detachAllCurves();
}
}
//--------------------------------------------------------------------------------------------------
@@ -543,10 +544,6 @@ bool RiuQwtPlotWidget::eventFilter( QObject* watched, QEvent* event )
void RiuQwtPlotWidget::hideEvent( QHideEvent* event )
{
resetCurveHighlighting();
if ( plotDefinition() )
{
plotDefinition()->detachAllCurves();
}
QwtPlot::hideEvent( event );
}
@@ -561,10 +558,6 @@ void RiuQwtPlotWidget::showEvent( QShowEvent* event )
m_canvasStyleSheet = createCanvasStyleSheet();
m_canvasStyleSheet.applyToWidget( canvas() );
if ( plotDefinition() )
{
plotDefinition()->reattachAllCurves();
}
QwtPlot::showEvent( event );
}