]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
0021536: signal layoutChanged() should not be called for each updated item
authorasl <asl@opencascade.com>
Tue, 10 Apr 2012 07:55:35 +0000 (07:55 +0000)
committerasl <asl@opencascade.com>
Tue, 10 Apr 2012 07:55:35 +0000 (07:55 +0000)
src/SUIT/SUIT_TreeModel.cxx
src/SUIT/SUIT_TreeModel.h

index 595b42f5140fc05ef7b4cce72be23f9162fdf597..a9453254a65203251a37cb2bceecc4e7ec33d690 100755 (executable)
@@ -334,7 +334,7 @@ void SUIT_TreeModel::TreeSync::updateItem( const ObjPtr& obj, const ItemPtr& ite
   if( obj )
     obj->update();
   if ( item && needUpdate( item ) ) 
-    myModel->updateItem( item );
+    myModel->updateItem( item, false );
 }
 
 /*!
@@ -1357,7 +1357,7 @@ void SUIT_TreeModel::updateTreeModel(SUIT_DataObject* obj,TreeItem* item)
         {
           //obj and item are synchronised : go to next ones
           updateTreeModel(sobj,sitem);
-          if(sobj->modified()) updateItem(sitem);
+          if(sobj->modified()) updateItem(sitem, true);
           if( sobj ) sobj->update();
           kobj++;
           kitem++;
@@ -1581,8 +1581,9 @@ SUIT_TreeModel::TreeItem* SUIT_TreeModel::createItemAtPos( SUIT_DataObject* obj,
 /*!
   \brief Update tree item.
   \param item tree item to be updated
+  \param emitLayoutChanged if signal about changed layout should be emitted
 */
-void SUIT_TreeModel::updateItem( SUIT_TreeModel::TreeItem* item )
+void SUIT_TreeModel::updateItem( SUIT_TreeModel::TreeItem* item, bool emitLayoutChanged )
 {
   if ( !item )
     return;
@@ -1597,7 +1598,8 @@ void SUIT_TreeModel::updateItem( SUIT_TreeModel::TreeItem* item )
   QModelIndex lastIdx  = index( obj, columnCount() - 1 );
   emit dataChanged( firstIdx, lastIdx );
   obj->setModified(false);
-  emit layoutChanged();
+  if( emitLayoutChanged )
+    emit layoutChanged();
 }
 
 /*!
index 9aa6973cc730bddcd0ccf14f0d594ae7bb6b15c4..79cda9d3741f1fdfab9e9ba9470f160f62e2b75a 100755 (executable)
@@ -205,7 +205,7 @@ private:
 
   TreeItem*              createItem( SUIT_DataObject*, TreeItem* = 0, TreeItem* = 0 );
   TreeItem*              createItemAtPos( SUIT_DataObject*, TreeItem* = 0, int pos=0 );
-  void                   updateItem( TreeItem* );
+  void                   updateItem( TreeItem*, bool emitLayoutChanged );
   void                   removeItem( TreeItem* );
 
 private slots: