]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
refs #551: incorrect visible status
authorasl <asl@opencascade.com>
Tue, 26 May 2015 07:38:28 +0000 (10:38 +0300)
committerasl <asl@opencascade.com>
Tue, 26 May 2015 07:38:28 +0000 (10:38 +0300)
src/HYDROGUI/HYDROGUI_DataModel.cxx
src/HYDROGUI/HYDROGUI_Module.cxx

index 9b9863dbdf2c77a98fddf5016dbe062a81fa0a5e..44c63cd2fec0f7e55c0e50141ce201553ab420b7 100644 (file)
@@ -705,7 +705,12 @@ LightApp_DataObject* HYDROGUI_DataModel::createObject( SUIT_DataObject*
         treeModel = dynamic_cast<SUIT_AbstractModel*>( app->objectBrowser()->model() );
 
     if ( treeModel )
-      treeModel->setVisibilityState( aResObj->text( aResObj->customData( Qtx::IdType ).toInt() ), Qtx::HiddenState, false );
+    {
+      HYDROGUI_Module* aModule = dynamic_cast<HYDROGUI_Module*>( module() );
+      bool isVisible = aModule->isObjectVisible( -1, theModelObject );
+      Qtx::VisibilityState aVisState = isVisible ? Qtx::ShownState : Qtx::HiddenState;
+      treeModel->setVisibilityState( aResObj->text( aResObj->customData( Qtx::IdType ).toInt() ), aVisState, false );
+    }
   }
 
   if ( theIsBuildTree )
index 283f361e77034b025de0ec4630f6b5fc4f06ba64..95d4a5906ae7c107171efe75d5a97257bf039e5b 100644 (file)
@@ -951,6 +951,17 @@ bool HYDROGUI_Module::isObjectVisible( const int theViewId,
   if( theObject.IsNull() )
     return false;
 
+  if( theViewId < 0 )
+  {
+    //search in all
+    foreach( int aViewId, myObjectStateMap.keys() )
+    {
+      if( isObjectVisible( aViewId, theObject ) )
+        return true;
+    }
+    return false;
+  }
+
   ViewId2Entry2ObjectStateMap::const_iterator anIter1 = myObjectStateMap.find( theViewId );
   if( anIter1 != myObjectStateMap.end() )
   {