mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Fix crashes when dropping analysis plots into Multiplots
This commit is contained in:
committed by
Magne Sjaastad
parent
ab3e43d8fb
commit
93baf776a1
@@ -39,9 +39,9 @@ RimSummaryPlotCollection::RimSummaryPlotCollection()
|
||||
{
|
||||
CAF_PDM_InitScriptableObject( "Summary Plots", ":/SummaryPlotsLight16x16.png", "", "" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &summaryPlots, "SummaryPlots", "Summary Plots", "", "", "" );
|
||||
summaryPlots.uiCapability()->setUiHidden( true );
|
||||
caf::PdmFieldReorderCapability::addToField( &summaryPlots );
|
||||
CAF_PDM_InitFieldNoDefault( &m_summaryPlots, "SummaryPlots", "Summary Plots", "", "", "" );
|
||||
m_summaryPlots.uiCapability()->setUiHidden( true );
|
||||
caf::PdmFieldReorderCapability::addToField( &m_summaryPlots );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -49,7 +49,6 @@ RimSummaryPlotCollection::RimSummaryPlotCollection()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryPlotCollection::~RimSummaryPlotCollection()
|
||||
{
|
||||
summaryPlots.deleteAllChildObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -61,7 +60,8 @@ RimSummaryPlot* RimSummaryPlotCollection::createSummaryPlotWithAutoTitle()
|
||||
plot->setAsPlotMdiWindow();
|
||||
|
||||
plot->enableAutoPlotTitle( true );
|
||||
summaryPlots.push_back( plot );
|
||||
|
||||
addPlot( plot );
|
||||
|
||||
return plot;
|
||||
}
|
||||
@@ -74,7 +74,8 @@ RimSummaryPlot* RimSummaryPlotCollection::createNamedSummaryPlot( const QString&
|
||||
RimSummaryPlot* plot = new RimSummaryPlot();
|
||||
plot->setAsPlotMdiWindow();
|
||||
|
||||
summaryPlots.push_back( plot );
|
||||
addPlot( plot );
|
||||
|
||||
plot->setDescription( name );
|
||||
|
||||
return plot;
|
||||
@@ -85,7 +86,7 @@ RimSummaryPlot* RimSummaryPlotCollection::createNamedSummaryPlot( const QString&
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlotCollection::updateSummaryNameHasChanged()
|
||||
{
|
||||
for ( RimSummaryPlot* plot : summaryPlots )
|
||||
for ( RimSummaryPlot* plot : plots() )
|
||||
{
|
||||
plot->updateCaseNameHasChanged();
|
||||
}
|
||||
@@ -96,21 +97,13 @@ void RimSummaryPlotCollection::updateSummaryNameHasChanged()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlotCollection::summaryPlotItemInfos( QList<caf::PdmOptionItemInfo>* optionInfos ) const
|
||||
{
|
||||
for ( RimSummaryPlot* plot : summaryPlots() )
|
||||
for ( RimSummaryPlot* plot : plots() )
|
||||
{
|
||||
QString displayName = plot->description();
|
||||
optionInfos->push_back( caf::PdmOptionItemInfo( displayName, plot, false, plot->uiCapability()->uiIconProvider() ) );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlotCollection::removeSummaryPlot( RimSummaryPlot* summaryPlot )
|
||||
{
|
||||
summaryPlots.removeChildObject( summaryPlot );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -121,3 +114,35 @@ void RimSummaryPlotCollection::onChildDeleted( caf::PdmChildArrayFieldHandle*
|
||||
RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow();
|
||||
mainPlotWindow->updateSummaryPlotToolBar();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimSummaryPlot*> RimSummaryPlotCollection::plots() const
|
||||
{
|
||||
return m_summaryPlots.childObjects();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
size_t RimSummaryPlotCollection::plotCount() const
|
||||
{
|
||||
return m_summaryPlots.size();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlotCollection::insertPlot( RimSummaryPlot* summaryPlot, size_t index )
|
||||
{
|
||||
m_summaryPlots.insert( index, summaryPlot );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryPlotCollection::removePlot( RimSummaryPlot* summaryPlot )
|
||||
{
|
||||
m_summaryPlots.removeChildObject( summaryPlot );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user