From 2b33bcffbda5a834836ddc9e4f789a911ab4f41e Mon Sep 17 00:00:00 2001 From: Ekaterina Sukhareva Date: Thu, 1 Feb 2024 17:08:54 +0000 Subject: [PATCH] [CEA] Automatically expand tree in Object Browser --- src/LightApp/LightApp_Application.cxx | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/LightApp/LightApp_Application.cxx b/src/LightApp/LightApp_Application.cxx index b1cb7e3bb..d72e414f5 100644 --- a/src/LightApp/LightApp_Application.cxx +++ b/src/LightApp/LightApp_Application.cxx @@ -599,6 +599,25 @@ bool LightApp_Application::activateModule( const QString& modName ) if ( objectBrowser()->root() != activeStudy()->root() ) objectBrowser()->setRoot( activeStudy()->root() ); updateObjectBrowser( true ); + + // expand SHAPERSTUDY data after leaving Shaper module + // bos #40645 [CEA] Automatically expand tree in Object Browser + if (actName == "Shaper") { + SUIT_AbstractModel* aModel = dynamic_cast(objectBrowser()->model()); + LightApp_Study* aStudy = dynamic_cast( activeStudy() ); + if (aModel && aStudy) { + DataObjectList aComps; + aStudy->root()->children(aComps); + for(auto aCompSUIT : aComps){ + LightApp_DataObject* aComp = dynamic_cast( aCompSUIT ); + if ( aComp && aComp->componentDataType() == "SHAPERSTUDY") { + QModelIndex anIndex = aModel->index(aComp); + objectBrowser()->treeView()->expand(anIndex); + break; + } + } + } + } } if ( activeModule() ) activeModule()->updateModuleVisibilityState(); -- 2.39.2