#7128 VFP Plot: fix delete functionality.

This commit is contained in:
Kristian Bendiksen 2020-12-21 19:43:36 +01:00
parent 4414b61efd
commit ba372f7fbe
3 changed files with 37 additions and 5 deletions

View File

@ -135,6 +135,8 @@ RimVfpPlot::RimVfpPlot()
//--------------------------------------------------------------------------------------------------
RimVfpPlot::~RimVfpPlot()
{
removeMdiWindowFromMdiArea();
deleteViewWidget();
}
//--------------------------------------------------------------------------------------------------

View File

@ -60,7 +60,15 @@ void RimVfpPlotCollection::addPlot( RimVfpPlot* newPlot )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimVfpPlot*> RimVfpPlotCollection::plots()
void RimVfpPlotCollection::insertPlot( RimVfpPlot* vfpPlot, size_t index )
{
m_vfpPlots.insert( index, vfpPlot );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::vector<RimVfpPlot*> RimVfpPlotCollection::plots() const
{
return m_vfpPlots.childObjects();
}
@ -72,3 +80,20 @@ void RimVfpPlotCollection::deleteAllChildObjects()
{
m_vfpPlots.deleteAllChildObjects();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
size_t RimVfpPlotCollection::plotCount() const
{
return m_vfpPlots.size();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimVfpPlotCollection::removePlot( RimVfpPlot* vfpPlot )
{
m_vfpPlots.removeChildObject( vfpPlot );
updateAllRequiredEditors();
}

View File

@ -17,16 +17,17 @@
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RimAbstractPlotCollection.h"
#include "RimVfpPlot.h"
#include "cafPdmChildArrayField.h"
#include "cafPdmObject.h"
class RimVfpPlot;
//==================================================================================================
///
///
//==================================================================================================
class RimVfpPlotCollection : public caf::PdmObject
class RimVfpPlotCollection : public caf::PdmObject, public RimTypedPlotCollection<RimVfpPlot>
{
CAF_PDM_HEADER_INIT;
@ -35,9 +36,13 @@ public:
~RimVfpPlotCollection() override;
void addPlot( RimVfpPlot* newPlot );
std::vector<RimVfpPlot*> plots();
std::vector<RimVfpPlot*> plots() const;
void deleteAllChildObjects();
size_t plotCount() const final;
void insertPlot( RimVfpPlot* vfpPlot, size_t index ) final;
void removePlot( RimVfpPlot* vfpPlot ) final;
private:
caf::PdmChildArrayField<RimVfpPlot*> m_vfpPlots;
};