]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
[CEA] Automatically expand tree in Object Browser
authorEkaterina Sukhareva <ekaterina.sukhareva@opencascade.com>
Thu, 1 Feb 2024 17:08:54 +0000 (17:08 +0000)
committerNabil Ghodbane <nabil.ghodbane@cea.fr>
Wed, 28 Feb 2024 12:06:25 +0000 (13:06 +0100)
src/LightApp/LightApp_Application.cxx

index b1cb7e3bb7700699c931795ffa780757d9cd333a..d72e414f5a293eca0416426cc5a2a28f8b0bf946 100644 (file)
@@ -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<SUIT_AbstractModel*>(objectBrowser()->model());
+      LightApp_Study* aStudy = dynamic_cast<LightApp_Study*>( activeStudy() );
+      if (aModel && aStudy) {
+        DataObjectList aComps;
+        aStudy->root()->children(aComps);
+        for(auto aCompSUIT : aComps){
+          LightApp_DataObject* aComp = dynamic_cast<LightApp_DataObject*>( aCompSUIT );
+          if ( aComp && aComp->componentDataType() == "SHAPERSTUDY") {
+            QModelIndex anIndex = aModel->index(aComp);
+            objectBrowser()->treeView()->expand(anIndex);
+            break;
+          }
+        }
+      }
+    }
   }
 
   if ( activeModule() ) activeModule()->updateModuleVisibilityState();