Change API for PdmObjectHandle and PdmFieldHandle

* Refactor interface to PdmObjectHandle and PdmFieldHandle
Return objects instead of passing in structures as parameters

* Add nodiscard to several functions
* Remove redundant this->
* Rename to ptrReferencedObjectsByType
This commit is contained in:
Magne Sjaastad
2023-05-12 21:41:34 +02:00
committed by GitHub
parent 37e29a0f68
commit 0c90f67dcc
510 changed files with 1651 additions and 3111 deletions

View File

@@ -830,8 +830,7 @@ void RiuPlotMainWindow::slotSubWindowActivated( QMdiSubWindow* subWindow )
caf::PdmObject* pdmObject = dynamic_cast<caf::PdmObject*>( uiItem );
if ( pdmObject )
{
std::vector<RimViewWindow*> ancestralViews;
pdmObject->allAncestorsOrThisOfType( ancestralViews );
std::vector<RimViewWindow*> ancestralViews = pdmObject->allAncestorsOrThisOfType<RimViewWindow>();
for ( auto ancestralView : ancestralViews )
{
if ( ancestralView == activatedView )
@@ -909,7 +908,7 @@ void RiuPlotMainWindow::selectedObjectsChanged()
RimViewWindow* selectedWindow = dynamic_cast<RimViewWindow*>( firstSelectedObject );
if ( !selectedWindow )
{
firstSelectedObject->firstAncestorOrThisOfType( selectedWindow );
selectedWindow = firstSelectedObject->firstAncestorOrThisOfType<RimViewWindow>();
}
// If we cant find the view window as an MDI sub window, we search higher in the
@@ -918,7 +917,7 @@ void RiuPlotMainWindow::selectedObjectsChanged()
{
if ( selectedWindow->parentField() && selectedWindow->parentField()->ownerObject() )
{
selectedWindow->parentField()->ownerObject()->firstAncestorOrThisOfType( selectedWindow );
selectedWindow = selectedWindow->parentField()->ownerObject()->firstAncestorOrThisOfType<RimViewWindow>();
}
}
@@ -935,14 +934,12 @@ void RiuPlotMainWindow::selectedObjectsChanged()
if ( firstSelectedObject )
{
RimSummaryMultiPlot* multiSummaryPlot = nullptr;
firstSelectedObject->firstAncestorOrThisOfType( multiSummaryPlot );
auto multiSummaryPlot = firstSelectedObject->firstAncestorOrThisOfType<RimSummaryMultiPlot>();
if ( multiSummaryPlot )
{
updateMultiPlotToolBar();
RimSummaryPlot* summaryPlot = nullptr;
firstSelectedObject->firstAncestorOrThisOfType( summaryPlot );
auto summaryPlot = firstSelectedObject->firstAncestorOrThisOfType<RimSummaryPlot>();
if ( summaryPlot )
{
multiSummaryPlot->makeSureIsVisible( summaryPlot );