mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-31 17:17:50 -05:00
#13894 PolygonInView: Refresh owning picker editors when toggling picking
After migrating m_enablePicking from a PdmField<bool> to a PdmUiButton callback, the RimPolygonFilter parent was no longer notified via childFieldChangedByUi, so its 3D editor did not register or unregister the pick event handler and the button label did not refresh. Route the toggle through a helper that also calls updateEditorsAndVisualization on the owning RimPolylinePickerInterface.
This commit is contained in:
1 parent
f881899815
commit
c66d29e6ea
2 files changed
+23
-14
No files matched your search
@@ -252,6 +252,26 @@ void RimPolygonInView::updatePolygonFromTargets()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolygonInView::togglePicking()
|
||||
{
|
||||
m_enablePicking = !m_enablePicking;
|
||||
|
||||
updateConnectedEditors();
|
||||
|
||||
// When embedded in a RimPolygonFilter, the property panel and 3D editor are bound to the filter,
|
||||
// not to this polygon-in-view. Ask the owning picker interface to refresh its editors so the
|
||||
// button label updates and the pick event handler is (un)registered.
|
||||
if ( auto owner = firstAncestorOfType<RimPolylinePickerInterface>() )
|
||||
{
|
||||
owner->updateEditorsAndVisualization();
|
||||
}
|
||||
|
||||
updateVisualization();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -297,13 +317,7 @@ void RimPolygonInView::defineUiOrdering( QString uiConfigName, caf::PdmUiOrderin
|
||||
|
||||
if ( enableEdit )
|
||||
{
|
||||
uiOrdering.addNewButton( m_enablePicking ? "Stop Picking Points" : "Start Picking Points",
|
||||
[this]()
|
||||
{
|
||||
m_enablePicking = !m_enablePicking;
|
||||
updateConnectedEditors();
|
||||
updateVisualization();
|
||||
} );
|
||||
uiOrdering.addNewButton( m_enablePicking ? "Stop Picking Points" : "Start Picking Points", [this]() { togglePicking(); } );
|
||||
uiOrdering.add( &m_targets );
|
||||
uiOrdering.add( &m_handleScalingFactor );
|
||||
}
|
||||
@@ -378,13 +392,7 @@ void RimPolygonInView::defineObjectEditorAttribute( QString uiConfigName, caf::P
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPolygonInView::uiOrderingForLocalPolygon( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
uiOrdering.addNewButton( m_enablePicking ? "Stop Picking Points" : "Start Picking Points",
|
||||
[this]()
|
||||
{
|
||||
m_enablePicking = !m_enablePicking;
|
||||
updateConnectedEditors();
|
||||
updateVisualization();
|
||||
} );
|
||||
uiOrdering.addNewButton( m_enablePicking ? "Stop Picking Points" : "Start Picking Points", [this]() { togglePicking(); } );
|
||||
uiOrdering.add( &m_targets );
|
||||
uiOrdering.add( &m_handleScalingFactor );
|
||||
}
|
||||
|
||||
@@ -93,6 +93,7 @@ private:
|
||||
|
||||
void updatePolygonFromTargets();
|
||||
void connectSignals();
|
||||
void togglePicking();
|
||||
|
||||
private:
|
||||
caf::PdmPtrField<RimPolygon*> m_polygon;
|
||||
|
||||
Reference in new issue
Block a user