From: asl Date: Tue, 10 Apr 2012 07:55:35 +0000 (+0000) Subject: 0021536: signal layoutChanged() should not be called for each updated item X-Git-Tag: V6_5_0a1~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a23bf627de8c1c6c566d1320c6469da5c9d6a5db;p=modules%2Fgui.git 0021536: signal layoutChanged() should not be called for each updated item --- diff --git a/src/SUIT/SUIT_TreeModel.cxx b/src/SUIT/SUIT_TreeModel.cxx index 595b42f51..a9453254a 100755 --- a/src/SUIT/SUIT_TreeModel.cxx +++ b/src/SUIT/SUIT_TreeModel.cxx @@ -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(); } /*! diff --git a/src/SUIT/SUIT_TreeModel.h b/src/SUIT/SUIT_TreeModel.h index 9aa6973cc..79cda9d37 100755 --- a/src/SUIT/SUIT_TreeModel.h +++ b/src/SUIT/SUIT_TreeModel.h @@ -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: