]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
0052615: Inactive "save" function after renaming any object
authorimn <imn@opencascade.com>
Fri, 27 Feb 2015 13:43:09 +0000 (16:43 +0300)
committerimn <imn@opencascade.com>
Fri, 27 Feb 2015 13:43:09 +0000 (16:43 +0300)
src/LightApp/LightApp_Application.cxx
src/LightApp/LightApp_Application.h
src/SUIT/SUIT_TreeModel.cxx
src/SUIT/SUIT_TreeModel.h

index a2b966ba32dfb5d9b871ac7d5ef6d8da554f64f9..ac3f54a64350dbbb59c322cc84609c8d45df242c 100644 (file)
@@ -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<SUIT_DataObject*>& 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*>&, SUIT_DataObject*, int, Qt::DropAction ) ),
                this,       SLOT( onDropped( const QList<SUIT_DataObject*>&, SUIT_DataObject*, int, Qt::DropAction ) ) );
+      connect( proxyModel, SIGNAL( renamed( SUIT_DataObject* ) ),
+               this,       SLOT( onRenamed( ) ) );
+
     }
 
     // temporary commented
index d9230f4297b970447409b15a08f82bd7a37f6004..392fc791fa7699e3c3c62924895d77d2254f4722 100644 (file)
@@ -274,6 +274,7 @@ private slots:
   void                                onCloseWindow();
   void                                onCloseAllWindow();
   void                                onGroupAllWindow();
+  void                                onRenamed();
 
 protected:
   void                                updateWindows();
index e2ead71cbde88653f7d919bcfedc90279760ca0f..d2a8a655b1f9cc02c312404baf7b4581b1348634 100755 (executable)
@@ -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*>&, SUIT_DataObject*, int, Qt::DropAction ) ),
            this,  SIGNAL( dropped( const QList<SUIT_DataObject*>&, 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*>&, SUIT_DataObject*, int, Qt::DropAction ) ),
            this,  SIGNAL( dropped( const QList<SUIT_DataObject*>&, 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*>&, SUIT_DataObject*, int, Qt::DropAction ) ),
            this,   SIGNAL( dropped( const QList<SUIT_DataObject*>&, SUIT_DataObject*, int, Qt::DropAction ) ) );
+  connect( *model, SIGNAL( renamed( SUIT_DataObject* ) ), this, SIGNAL( rename( SUIT_DataObject* ) ) );
   setSourceModel( *model );
   setDynamicSortFilter( true );
 }
index 6494b7bb97ff7d1a1f73960cc76da27bf35e873c..6e7e24dbe31c962375ed96720f95ff484934b35d 100755 (executable)
@@ -194,6 +194,7 @@ signals:
   void modelUpdated();
   void clicked( SUIT_DataObject*, int );
   void dropped( const QList<SUIT_DataObject*>&, 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*>&, SUIT_DataObject*, int, Qt::DropAction );
+  void renamed( SUIT_DataObject* );
 
 protected:
   SUIT_AbstractModel*    treeModel() const;