Fix crash when closing and reopening plots

This commit is contained in:
Gaute Lindkvist
2019-11-22 15:42:40 +01:00
parent f130163ee8
commit 293290827b
9 changed files with 20 additions and 22 deletions

View File

@@ -527,6 +527,10 @@ bool RiuQwtPlotWidget::eventFilter( QObject* watched, QEvent* event )
void RiuQwtPlotWidget::hideEvent( QHideEvent* event )
{
resetCurveHighlighting();
if ( m_plotDefinition )
{
m_plotDefinition->detachAllCurves();
}
QwtPlot::hideEvent( event );
}
@@ -541,19 +545,11 @@ void RiuQwtPlotWidget::showEvent( QShowEvent* event )
m_canvasStyleSheet = createCanvasStyleSheet();
m_canvasStyleSheet.applyToWidget( canvas() );
QwtPlot::showEvent( event );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuQwtPlotWidget::closeEvent( QCloseEvent* event )
{
if ( m_plotDefinition )
{
m_plotDefinition->detachAllCurves();
m_plotDefinition->reattachAllCurves();
}
QwtPlot::closeEvent( event );
QwtPlot::showEvent( event );
}
//--------------------------------------------------------------------------------------------------

View File

@@ -106,7 +106,6 @@ protected:
bool eventFilter( QObject* watched, QEvent* event ) override;
void hideEvent( QHideEvent* event ) override;
void showEvent( QShowEvent* event ) override;
void closeEvent( QCloseEvent* event ) override;
void applyAxisTitleToQwt( QwtPlot::Axis axis );