Make sure project tree is updated when view is deleted

This commit is contained in:
Magne Sjaastad 2024-04-16 15:07:31 +02:00
parent 2d688b1c8b
commit 85136fb343
2 changed files with 16 additions and 0 deletions

View File

@ -24,6 +24,7 @@
#include "RigCaseCellResultsData.h" #include "RigCaseCellResultsData.h"
#include "Rim3dView.h" #include "Rim3dView.h"
#include "RimCase.h"
#include "RimCellEdgeColors.h" #include "RimCellEdgeColors.h"
#include "RimEclipseCellColors.h" #include "RimEclipseCellColors.h"
#include "RimEclipseView.h" #include "RimEclipseView.h"
@ -61,6 +62,18 @@ std::vector<RimEclipseView*> RimEclipseViewCollection::views() const
return m_views.childrenByType(); 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();
}
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -44,6 +44,9 @@ public:
std::vector<RimEclipseView*> views() const; std::vector<RimEclipseView*> views() const;
private:
void onChildDeleted( caf::PdmChildArrayFieldHandle* childArray, std::vector<caf::PdmObjectHandle*>& referringObjects ) override;
private: private:
caf::PdmChildArrayField<RimEclipseView*> m_views; caf::PdmChildArrayField<RimEclipseView*> m_views;
}; };