Make sure project tree is updated when view is deleted

This commit is contained in:
Magne Sjaastad committed 2024-04-16 15:23:53 +02:00
1 parent 2d688b1c8b
commit 85136fb343
2 files changed
+16

No files matched your search

@@ -24,6 +24,7 @@
#include "RigCaseCellResultsData.h"
#include "Rim3dView.h"
#include "RimCase.h"
#include "RimCellEdgeColors.h"
#include "RimEclipseCellColors.h"
#include "RimEclipseView.h"
@@ -61,6 +62,18 @@ std::vector<RimEclipseView*> RimEclipseViewCollection::views() const
return m_views.childrenByType();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimEclipseViewCollection::onChildDeleted( caf::PdmChildArrayFieldHandle* childArray, std::vector<caf::PdmObjectHandle*>& referringObjects )
{
// If a view is child of a case, the view collection object is hidden in the tree view. Find the parent case and update connected editors.
if ( auto parentCase = firstAncestorOrThisOfType<RimCase>() )
{
parentCase->updateConnectedEditors();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -44,6 +44,9 @@ public:
std::vector<RimEclipseView*> views() const;
private:
void onChildDeleted( caf::PdmChildArrayFieldHandle* childArray, std::vector<caf::PdmObjectHandle*>& referringObjects ) override;
private:
caf::PdmChildArrayField<RimEclipseView*> m_views;
};