mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#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:
@@ -118,7 +118,9 @@ RimFlowCharacteristicsPlot::~RimFlowCharacteristicsPlot()
|
|||||||
|
|
||||||
if ( m_flowCharPlotWidget )
|
if ( m_flowCharPlotWidget )
|
||||||
{
|
{
|
||||||
m_flowCharPlotWidget->deleteLater();
|
m_flowCharPlotWidget->hide();
|
||||||
|
m_flowCharPlotWidget->setParent( nullptr );
|
||||||
|
delete m_flowCharPlotWidget;
|
||||||
m_flowCharPlotWidget = nullptr;
|
m_flowCharPlotWidget = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -159,7 +161,9 @@ void RimFlowCharacteristicsPlot::deleteViewWidget()
|
|||||||
{
|
{
|
||||||
if ( m_flowCharPlotWidget )
|
if ( m_flowCharPlotWidget )
|
||||||
{
|
{
|
||||||
m_flowCharPlotWidget->deleteLater();
|
m_flowCharPlotWidget->hide();
|
||||||
|
m_flowCharPlotWidget->setParent( nullptr );
|
||||||
|
delete m_flowCharPlotWidget;
|
||||||
m_flowCharPlotWidget = nullptr;
|
m_flowCharPlotWidget = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,7 +71,9 @@ RimTofAccumulatedPhaseFractionsPlot::~RimTofAccumulatedPhaseFractionsPlot()
|
|||||||
|
|
||||||
if ( m_tofAccumulatedPhaseFractionsPlotWidget )
|
if ( m_tofAccumulatedPhaseFractionsPlotWidget )
|
||||||
{
|
{
|
||||||
m_tofAccumulatedPhaseFractionsPlotWidget->deleteLater();
|
m_tofAccumulatedPhaseFractionsPlotWidget->hide();
|
||||||
|
m_tofAccumulatedPhaseFractionsPlotWidget->setParent( nullptr );
|
||||||
|
delete m_tofAccumulatedPhaseFractionsPlotWidget;
|
||||||
m_tofAccumulatedPhaseFractionsPlotWidget = nullptr;
|
m_tofAccumulatedPhaseFractionsPlotWidget = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -83,7 +85,9 @@ void RimTofAccumulatedPhaseFractionsPlot::deleteViewWidget()
|
|||||||
{
|
{
|
||||||
if ( m_tofAccumulatedPhaseFractionsPlotWidget )
|
if ( m_tofAccumulatedPhaseFractionsPlotWidget )
|
||||||
{
|
{
|
||||||
m_tofAccumulatedPhaseFractionsPlotWidget->deleteLater();
|
m_tofAccumulatedPhaseFractionsPlotWidget->hide();
|
||||||
|
m_tofAccumulatedPhaseFractionsPlotWidget->setParent( nullptr );
|
||||||
|
delete m_tofAccumulatedPhaseFractionsPlotWidget;
|
||||||
m_tofAccumulatedPhaseFractionsPlotWidget = nullptr;
|
m_tofAccumulatedPhaseFractionsPlotWidget = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,7 +59,9 @@ RimTotalWellAllocationPlot::~RimTotalWellAllocationPlot()
|
|||||||
|
|
||||||
if ( m_wellTotalAllocationPlotWidget )
|
if ( m_wellTotalAllocationPlotWidget )
|
||||||
{
|
{
|
||||||
m_wellTotalAllocationPlotWidget->deleteLater();
|
m_wellTotalAllocationPlotWidget->hide();
|
||||||
|
m_wellTotalAllocationPlotWidget->setParent( nullptr );
|
||||||
|
delete m_wellTotalAllocationPlotWidget;
|
||||||
m_wellTotalAllocationPlotWidget = nullptr;
|
m_wellTotalAllocationPlotWidget = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -71,7 +73,9 @@ void RimTotalWellAllocationPlot::deleteViewWidget()
|
|||||||
{
|
{
|
||||||
if ( m_wellTotalAllocationPlotWidget )
|
if ( m_wellTotalAllocationPlotWidget )
|
||||||
{
|
{
|
||||||
m_wellTotalAllocationPlotWidget->deleteLater();
|
m_wellTotalAllocationPlotWidget->hide();
|
||||||
|
m_wellTotalAllocationPlotWidget->setParent( nullptr );
|
||||||
|
delete m_wellTotalAllocationPlotWidget;
|
||||||
m_wellTotalAllocationPlotWidget = nullptr;
|
m_wellTotalAllocationPlotWidget = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -145,7 +145,9 @@ RimWellAllocationPlot::~RimWellAllocationPlot()
|
|||||||
|
|
||||||
if ( m_wellAllocationPlotWidget )
|
if ( m_wellAllocationPlotWidget )
|
||||||
{
|
{
|
||||||
m_wellAllocationPlotWidget->deleteLater();
|
m_wellAllocationPlotWidget->hide();
|
||||||
|
m_wellAllocationPlotWidget->setParent( nullptr );
|
||||||
|
delete m_wellAllocationPlotWidget;
|
||||||
m_wellAllocationPlotWidget = nullptr;
|
m_wellAllocationPlotWidget = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -183,7 +185,9 @@ void RimWellAllocationPlot::deleteViewWidget()
|
|||||||
{
|
{
|
||||||
if ( m_wellAllocationPlotWidget )
|
if ( m_wellAllocationPlotWidget )
|
||||||
{
|
{
|
||||||
m_wellAllocationPlotWidget->deleteLater();
|
m_wellAllocationPlotWidget->hide();
|
||||||
|
m_wellAllocationPlotWidget->setParent( nullptr );
|
||||||
|
delete m_wellAllocationPlotWidget;
|
||||||
m_wellAllocationPlotWidget = nullptr;
|
m_wellAllocationPlotWidget = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1122,7 +1122,8 @@ void RimGridCrossPlot::cleanupBeforeClose()
|
|||||||
|
|
||||||
if ( m_plotWidget )
|
if ( m_plotWidget )
|
||||||
{
|
{
|
||||||
m_plotWidget->deleteLater();
|
m_plotWidget->setParent( nullptr );
|
||||||
|
delete m_plotWidget;
|
||||||
m_plotWidget = nullptr;
|
m_plotWidget = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -617,7 +617,8 @@ void RimGridPlotWindow::cleanupBeforeClose()
|
|||||||
|
|
||||||
if ( m_viewer )
|
if ( m_viewer )
|
||||||
{
|
{
|
||||||
m_viewer->deleteLater();
|
m_viewer->setParent( nullptr );
|
||||||
|
delete m_viewer;
|
||||||
m_viewer = nullptr;
|
m_viewer = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1519,7 +1519,8 @@ void RimSummaryPlot::cleanupBeforeClose()
|
|||||||
|
|
||||||
if ( m_plotWidget )
|
if ( m_plotWidget )
|
||||||
{
|
{
|
||||||
m_plotWidget->deleteLater();
|
m_plotWidget->setParent( nullptr );
|
||||||
|
delete m_plotWidget;
|
||||||
m_plotWidget = nullptr;
|
m_plotWidget = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -160,7 +160,8 @@ void RiuGridCrossQwtPlot::removeDataSetLegend( RimGridCrossPlotDataSet* dataSetT
|
|||||||
if ( it->second != nullptr )
|
if ( it->second != nullptr )
|
||||||
{
|
{
|
||||||
it->second->hide();
|
it->second->hide();
|
||||||
it->second->deleteLater();
|
it->second->setParent( nullptr );
|
||||||
|
delete it->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_legendWidgets.erase( it );
|
m_legendWidgets.erase( it );
|
||||||
@@ -181,7 +182,8 @@ void RiuGridCrossQwtPlot::removeDanglingDataSetLegends()
|
|||||||
if ( it->second != nullptr )
|
if ( it->second != nullptr )
|
||||||
{
|
{
|
||||||
it->second->hide();
|
it->second->hide();
|
||||||
it->second->deleteLater();
|
it->second->setParent( nullptr );
|
||||||
|
delete it->second;
|
||||||
}
|
}
|
||||||
m_legendWidgets.erase( it++ );
|
m_legendWidgets.erase( it++ );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,9 +78,10 @@ RiuQwtPlotWidget::RiuQwtPlotWidget( RimPlotInterface* plotTrackDefinition, QWidg
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
RiuQwtPlotWidget::~RiuQwtPlotWidget()
|
RiuQwtPlotWidget::~RiuQwtPlotWidget()
|
||||||
{
|
{
|
||||||
// The destructor may be called later when deleting with QWidget::deleteLater()
|
if ( plotDefinition() )
|
||||||
// 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.
|
plotDefinition()->detachAllCurves();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@@ -543,10 +544,6 @@ bool RiuQwtPlotWidget::eventFilter( QObject* watched, QEvent* event )
|
|||||||
void RiuQwtPlotWidget::hideEvent( QHideEvent* event )
|
void RiuQwtPlotWidget::hideEvent( QHideEvent* event )
|
||||||
{
|
{
|
||||||
resetCurveHighlighting();
|
resetCurveHighlighting();
|
||||||
if ( plotDefinition() )
|
|
||||||
{
|
|
||||||
plotDefinition()->detachAllCurves();
|
|
||||||
}
|
|
||||||
QwtPlot::hideEvent( event );
|
QwtPlot::hideEvent( event );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -561,10 +558,6 @@ void RiuQwtPlotWidget::showEvent( QShowEvent* event )
|
|||||||
m_canvasStyleSheet = createCanvasStyleSheet();
|
m_canvasStyleSheet = createCanvasStyleSheet();
|
||||||
m_canvasStyleSheet.applyToWidget( canvas() );
|
m_canvasStyleSheet.applyToWidget( canvas() );
|
||||||
|
|
||||||
if ( plotDefinition() )
|
|
||||||
{
|
|
||||||
plotDefinition()->reattachAllCurves();
|
|
||||||
}
|
|
||||||
QwtPlot::showEvent( event );
|
QwtPlot::showEvent( event );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -189,7 +189,12 @@ void RiuSummaryQwtPlot::removeEnsembleCurveSetLegend( RimEnsembleCurveSet* curve
|
|||||||
auto it = m_ensembleLegendWidgets.find( curveSetToShowLegendFor );
|
auto it = m_ensembleLegendWidgets.find( curveSetToShowLegendFor );
|
||||||
if ( it != m_ensembleLegendWidgets.end() )
|
if ( it != m_ensembleLegendWidgets.end() )
|
||||||
{
|
{
|
||||||
if ( it->second != nullptr ) it->second->deleteLater();
|
if ( it->second != nullptr )
|
||||||
|
{
|
||||||
|
it->second->hide();
|
||||||
|
it->second->setParent( nullptr );
|
||||||
|
delete it->second;
|
||||||
|
}
|
||||||
|
|
||||||
m_ensembleLegendWidgets.erase( it );
|
m_ensembleLegendWidgets.erase( it );
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user