]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
Automatic update of Dependency tree after object renaming.
authorakl <akl@opencascade.com>
Thu, 29 May 2014 13:44:36 +0000 (17:44 +0400)
committerakl <akl@opencascade.com>
Thu, 29 May 2014 13:44:36 +0000 (17:44 +0400)
src/DependencyTree/DependencyTree_View.cxx
src/DependencyTree/DependencyTree_View.h
src/GEOMGUI/GeometryGUI.cxx

index 5d1323278c0f72763511a94e8249c568aa623c41..8841b047470c48e76c45d23e78d976c5725a8298 100644 (file)
@@ -716,6 +716,18 @@ void DependencyTree_View::changeWidgetState( bool theIsCompute )
   updateButton->setEnabled( !theIsCompute );
 }
 
+bool DependencyTree_View::updateObjectName( const std::string &theEntry )
+{
+  bool res = false;
+  for( initSelected(); moreSelected(); nextSelected() ) {
+    if( DependencyTree_Object* aDepObject = dynamic_cast<DependencyTree_Object*>( selectedObject() ) ) {
+      aDepObject->updateName();
+      res = true;
+    }
+  }
+  return res;
+}
+
 DependencyTree_ComputeDlg_QThread::DependencyTree_ComputeDlg_QThread( DependencyTree_View* theView )
 {
   myView = theView;
index e9b52f35747d5aab8eb7464e264947e95a5a9355..accc5e62408e9b64ed3ce16c72e87ff594b024af 100644 (file)
@@ -94,6 +94,7 @@ public:
   void setIsCompute( bool );
   bool getIsCompute();
 
+  bool updateObjectName( const std::string &theEntry );
 
   QMutex myMutex;
 
index 3e9a1c2c843a7a8451b0a73978fa1bbc09e1d2ae..c93a2824118e0eb76ab6af92bfd377d9d19150bd 100644 (file)
@@ -3343,6 +3343,11 @@ bool GeometryGUI::renameObject( const QString& entry, const QString& name)
       GEOM::GEOM_Object_var anObj = GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(obj));
       if (!CORBA::is_nil(anObj)) {
         anObj->SetName( name.toLatin1().data() );  // Rename the corresponding GEOM_Object
+        // rename the given object in the dependency tree
+        if ( SUIT_ViewManager *svm = app->getViewManager( GraphicsView_Viewer::Type(), false ) )
+          if ( DependencyTree_ViewModel* viewModel = dynamic_cast<DependencyTree_ViewModel*>( svm->getViewModel() ) )
+            if ( DependencyTree_View* view = dynamic_cast<DependencyTree_View*>( viewModel->getActiveViewPort() ) )
+              view->updateObjectName( anObj->GetEntry() );
       }
       result = true;
     }