mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-25 14:40:26 -05:00
Sector export: Hide empty Refinement Regions folder in project tree
Add shouldBeVisibleInTree() to RimRefinementRegionCollection (true only when at least one region exists) and consult it from RimEclipseView::defineUiTreeOrdering. Refresh the parent view's connected editors from addNewRegion, removeRegion, and onChildDeleted so the folder appears and disappears as regions are added or removed via the generic delete-item action. The "New Refinement Region" action remains reachable from the Eclipse view's context menu while the folder is hidden.
This commit is contained in:
1 parent
663142be71
commit
88355751a5
3 files changed
+27
-1
No files matched your search
@@ -51,6 +51,14 @@ bool RimRefinementRegionCollection::isActive() const
|
||||
return m_isActive();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimRefinementRegionCollection::shouldBeVisibleInTree() const
|
||||
{
|
||||
return !m_regions.empty();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -86,6 +94,9 @@ RimRefinementRegion* RimRefinementRegionCollection::addNewRegion( RimEclipseCase
|
||||
region->setDefaultsFromCase( eclipseCase );
|
||||
|
||||
updateConnectedEditors();
|
||||
// Visibility of this collection in the parent view's tree depends on m_regions being non-empty,
|
||||
// so refresh the parent so the folder appears when the first region is added.
|
||||
if ( auto* view = firstAncestorOrThisOfType<Rim3dView>() ) view->updateConnectedEditors();
|
||||
return region;
|
||||
}
|
||||
|
||||
@@ -106,6 +117,17 @@ void RimRefinementRegionCollection::removeRegion( RimRefinementRegion* region )
|
||||
m_regions.removeChild( region );
|
||||
delete region;
|
||||
updateConnectedEditors();
|
||||
if ( auto* view = firstAncestorOrThisOfType<Rim3dView>() ) view->updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Refresh the parent view's tree so the collection folder disappears once the last region is
|
||||
/// removed via the generic delete-item action.
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimRefinementRegionCollection::onChildDeleted( caf::PdmChildArrayFieldHandle* childArray,
|
||||
std::vector<caf::PdmObjectHandle*>& referringObjects )
|
||||
{
|
||||
if ( auto* view = firstAncestorOrThisOfType<Rim3dView>() ) view->updateConnectedEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
Reference in new issue
Block a user