From: akl Date: Thu, 29 May 2014 13:44:36 +0000 (+0400) Subject: Automatic update of Dependency tree after object renaming. X-Git-Tag: V7_5_0a1~50^2~31 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f084f3e3cd2846d1a606ae1fe29b94fcbf6f10c9;p=modules%2Fgeom.git Automatic update of Dependency tree after object renaming. --- diff --git a/src/DependencyTree/DependencyTree_View.cxx b/src/DependencyTree/DependencyTree_View.cxx index 5d1323278..8841b0474 100644 --- a/src/DependencyTree/DependencyTree_View.cxx +++ b/src/DependencyTree/DependencyTree_View.cxx @@ -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( selectedObject() ) ) { + aDepObject->updateName(); + res = true; + } + } + return res; +} + DependencyTree_ComputeDlg_QThread::DependencyTree_ComputeDlg_QThread( DependencyTree_View* theView ) { myView = theView; diff --git a/src/DependencyTree/DependencyTree_View.h b/src/DependencyTree/DependencyTree_View.h index e9b52f357..accc5e624 100644 --- a/src/DependencyTree/DependencyTree_View.h +++ b/src/DependencyTree/DependencyTree_View.h @@ -94,6 +94,7 @@ public: void setIsCompute( bool ); bool getIsCompute(); + bool updateObjectName( const std::string &theEntry ); QMutex myMutex; diff --git a/src/GEOMGUI/GeometryGUI.cxx b/src/GEOMGUI/GeometryGUI.cxx index 3e9a1c2c8..c93a28241 100644 --- a/src/GEOMGUI/GeometryGUI.cxx +++ b/src/GEOMGUI/GeometryGUI.cxx @@ -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( svm->getViewModel() ) ) + if ( DependencyTree_View* view = dynamic_cast( viewModel->getActiveViewPort() ) ) + view->updateObjectName( anObj->GetEntry() ); } result = true; }