mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-26 07:00:17 -05:00
#14345 Refresh the owning object when data filters are added or removed
The data filter collection node is hidden in the project tree while the collection is empty, and the owner must be refreshed to re-run its tree ordering when the first filter appears. The refresh targeted the source case, which for a grid ensemble collection is the main case of the ensemble, not the ensemble owning the tree node. Newly created ensemble data filters were therefore not visible in the tree. Refresh the PDM parent object instead, which is the case or the grid ensemble. Also refresh from the programmatic removeFilter path.
This commit is contained in:
1 parent
ab43e67f0f
commit
7ae3543e76
2 files changed
+20
-4
No files matched your search
@@ -84,6 +84,7 @@ void RimDataFilterCollection::removeFilter( RimCellFilter* f )
|
||||
if ( !f ) return;
|
||||
deleteItem( f );
|
||||
filtersChanged.send();
|
||||
updateOwnerEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -161,9 +162,9 @@ void RimDataFilterCollection::onItemsChanged()
|
||||
}
|
||||
filtersChanged.send();
|
||||
|
||||
// The collection node is hidden from the case tree while empty, so refresh the owner case to
|
||||
// The collection node is hidden from the owner's tree while empty, so refresh the owner to
|
||||
// re-run its defineUiTreeOrdering and add the node once the first filter appears.
|
||||
if ( auto* c = ownerCase() ) c->updateConnectedEditors();
|
||||
updateOwnerEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -175,8 +176,22 @@ void RimDataFilterCollection::onChildDeleted( caf::PdmChildArrayFieldHandle* chi
|
||||
updateConnectedEditors();
|
||||
filtersChanged.send();
|
||||
|
||||
// Refresh the owner case so its defineUiTreeOrdering re-runs and drops the node once empty.
|
||||
if ( auto* c = ownerCase() ) c->updateConnectedEditors();
|
||||
// Refresh the owner so its defineUiTreeOrdering re-runs and drops the node once empty.
|
||||
updateOwnerEditors();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Refresh the object owning this collection in the project tree. Note that the owner is not
|
||||
/// necessarily the source case: for a collection in a grid ensemble, the source case is the main
|
||||
/// case of the ensemble, while the tree node is owned by the ensemble.
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimDataFilterCollection::updateOwnerEditors()
|
||||
{
|
||||
caf::PdmObjectHandle* owner = parentField() ? parentField()->ownerObject() : nullptr;
|
||||
if ( owner && owner->uiCapability() )
|
||||
{
|
||||
owner->uiCapability()->updateConnectedEditors();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -72,6 +72,7 @@ protected:
|
||||
private:
|
||||
void connectChildSignal( RimCellFilter* child );
|
||||
void onChildFilterChanged( const caf::SignalEmitter* emitter );
|
||||
void updateOwnerEditors();
|
||||
|
||||
caf::PdmPtrField<RimCase*> m_srcCase;
|
||||
};
|
||||
Reference in new issue
Block a user