Fix curves not showing up after moving plots to multi plot (#5070)

* Fix curves not showing up after moving plots to multi plot

* Fix typo in RiuQwtPlotWidget::closeEvent

* Fix incompatibility with release-branch
This commit is contained in:
Gaute Lindkvist 2019-11-21 08:22:33 +01:00 committed by GitHub
parent f0e728d303
commit 5fae9646ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 4 deletions

View File

@ -78,10 +78,9 @@ RiuQwtPlotWidget::RiuQwtPlotWidget( RimPlotInterface* plotTrackDefinition, QWidg
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RiuQwtPlotWidget::~RiuQwtPlotWidget() RiuQwtPlotWidget::~RiuQwtPlotWidget()
{ {
if ( plotDefinition() ) // The destructor may be called later when deleting with QWidget::deleteLater()
{ // If you are recreating the widget, then calling something that detaches QwtCurves
plotDefinition()->detachAllCurves(); // here may cause them to detach from the new widget rather than the old.
}
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -567,6 +566,18 @@ void RiuQwtPlotWidget::showEvent( QShowEvent* event )
QwtPlot::showEvent( event ); QwtPlot::showEvent( event );
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuQwtPlotWidget::closeEvent( QCloseEvent* event )
{
if ( plotDefinition() )
{
plotDefinition()->detachAllCurves();
}
QwtPlot::closeEvent( event );
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

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