Stop reselecting on activation in plot view if a child is already selected

This commit is contained in:
Gaute Lindkvist 2019-10-18 09:58:13 +02:00
parent 3422f1b609
commit 0fd7f40e46

View File

@ -645,7 +645,26 @@ void RiuPlotMainWindow::slotSubWindowActivated( QMdiSubWindow* subWindow )
if ( !blockSubWindowProjectTreeSelection() )
{
selectAsCurrentItem( activatedView );
std::vector<caf::PdmUiItem*> currentSelection;
m_projectTreeView->selectedUiItems( currentSelection );
bool childSelected = false;
for ( caf::PdmUiItem* uiItem : currentSelection )
{
caf::PdmObject* pdmObject = dynamic_cast<caf::PdmObject*>( uiItem );
if ( pdmObject )
{
RimViewWindow* owningView = nullptr;
pdmObject->firstAncestorOrThisOfType( owningView );
if ( owningView && owningView == activatedView )
{
childSelected = true;
}
}
}
if ( !childSelected )
{
selectAsCurrentItem( activatedView );
}
}
updateWellLogPlotToolBar();