From: imn Date: Fri, 27 Feb 2015 13:43:09 +0000 (+0300) Subject: 0052615: Inactive "save" function after renaming any object X-Git-Tag: V7_6_0a1~15 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=57812a608a7a7e30ee5911ca2f5845d87ea8721d;p=modules%2Fgui.git 0052615: Inactive "save" function after renaming any object --- diff --git a/src/LightApp/LightApp_Application.cxx b/src/LightApp/LightApp_Application.cxx index a2b966ba3..ac3f54a64 100644 --- a/src/LightApp/LightApp_Application.cxx +++ b/src/LightApp/LightApp_Application.cxx @@ -1784,6 +1784,13 @@ void LightApp_Application::onRefresh() updateObjectBrowser( true ); } +/*!Private SLOT. Update actions after rename object.*/ +void LightApp_Application::onRenamed() +{ + activeStudy()->Modified(); + updateActions(); +} + /*!Private SLOT. Support drag-and-drop operation.*/ void LightApp_Application::onDropped( const QList& objects, SUIT_DataObject* parent, int row, Qt::DropAction action ) { @@ -1914,6 +1921,9 @@ QWidget* LightApp_Application::createWindow( const int flag ) if ( proxyModel ) { connect( proxyModel, SIGNAL( dropped( const QList&, SUIT_DataObject*, int, Qt::DropAction ) ), this, SLOT( onDropped( const QList&, SUIT_DataObject*, int, Qt::DropAction ) ) ); + connect( proxyModel, SIGNAL( renamed( SUIT_DataObject* ) ), + this, SLOT( onRenamed( ) ) ); + } // temporary commented diff --git a/src/LightApp/LightApp_Application.h b/src/LightApp/LightApp_Application.h index d9230f429..392fc791f 100644 --- a/src/LightApp/LightApp_Application.h +++ b/src/LightApp/LightApp_Application.h @@ -274,6 +274,7 @@ private slots: void onCloseWindow(); void onCloseAllWindow(); void onGroupAllWindow(); + void onRenamed(); protected: void updateWindows(); diff --git a/src/SUIT/SUIT_TreeModel.cxx b/src/SUIT/SUIT_TreeModel.cxx index e2ead71cb..d2a8a655b 100755 --- a/src/SUIT/SUIT_TreeModel.cxx +++ b/src/SUIT/SUIT_TreeModel.cxx @@ -941,12 +941,15 @@ bool SUIT_TreeModel::setData( const QModelIndex& index, } break; case EditRole: { - QString val = value.toString(); + QString val = value.toString(); + bool mod = obj->name() != val; if ( !val.isEmpty() && obj->setName(val) ) { emit( dataChanged( index, index ) ); - return true; - } - return false; + if (mod) + emit ( renamed(obj) ); + return true; + } + return false; break; } default: @@ -1787,6 +1790,7 @@ SUIT_ProxyModel::SUIT_ProxyModel( QObject* parent ) connect( model, SIGNAL( clicked( SUIT_DataObject*, int ) ), this, SIGNAL(clicked( SUIT_DataObject*, int ) ) ); connect( model, SIGNAL( dropped( const QList&, SUIT_DataObject*, int, Qt::DropAction ) ), this, SIGNAL( dropped( const QList&, SUIT_DataObject*, int, Qt::DropAction ) ) ); + connect( model, SIGNAL( renamed( SUIT_DataObject* ) ), this, SIGNAL( renamed( SUIT_DataObject* ) ) ); setSourceModel( model ); setDynamicSortFilter( true ); } @@ -1805,6 +1809,7 @@ SUIT_ProxyModel::SUIT_ProxyModel( SUIT_DataObject* root, QObject* parent ) connect( model, SIGNAL( clicked( SUIT_DataObject*, int ) ), this, SIGNAL( clicked( SUIT_DataObject*, int ) ) ); connect( model, SIGNAL( dropped( const QList&, SUIT_DataObject*, int, Qt::DropAction ) ), this, SIGNAL( dropped( const QList&, SUIT_DataObject*, int, Qt::DropAction ) ) ); + connect( model, SIGNAL( renamed( SUIT_DataObject* ) ), this, SIGNAL( renamed( SUIT_DataObject* ) ) ); setSourceModel( model ); setDynamicSortFilter( true ); } @@ -1822,6 +1827,7 @@ SUIT_ProxyModel::SUIT_ProxyModel( SUIT_AbstractModel* model, QObject* parent ) connect( *model, SIGNAL( clicked( SUIT_DataObject*, int ) ), this, SIGNAL( clicked( SUIT_DataObject*, int ) ) ); connect( *model, SIGNAL( dropped( const QList&, SUIT_DataObject*, int, Qt::DropAction ) ), this, SIGNAL( dropped( const QList&, SUIT_DataObject*, int, Qt::DropAction ) ) ); + connect( *model, SIGNAL( renamed( SUIT_DataObject* ) ), this, SIGNAL( rename( SUIT_DataObject* ) ) ); setSourceModel( *model ); setDynamicSortFilter( true ); } diff --git a/src/SUIT/SUIT_TreeModel.h b/src/SUIT/SUIT_TreeModel.h index 6494b7bb9..6e7e24dbe 100755 --- a/src/SUIT/SUIT_TreeModel.h +++ b/src/SUIT/SUIT_TreeModel.h @@ -194,6 +194,7 @@ signals: void modelUpdated(); void clicked( SUIT_DataObject*, int ); void dropped( const QList&, SUIT_DataObject*, int, Qt::DropAction ); + void renamed( SUIT_DataObject* ); private: void initialize(); @@ -297,6 +298,7 @@ signals: void modelUpdated(); void clicked( SUIT_DataObject*, int ); void dropped( const QList&, SUIT_DataObject*, int, Qt::DropAction ); + void renamed( SUIT_DataObject* ); protected: SUIT_AbstractModel* treeModel() const;