Automatic update of Dependency tree after object renaming.

This commit is contained in:
akl 2014-05-29 17:44:36 +04:00
parent 66d16d30f7
commit f084f3e3cd
3 changed files with 18 additions and 0 deletions

View 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;

View File

@ -94,6 +94,7 @@ public:
void setIsCompute( bool );
bool getIsCompute();
bool updateObjectName( const std::string &theEntry );
QMutex myMutex;

View 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;
}