From: apl Date: Thu, 12 Apr 2012 15:46:27 +0000 (+0000) Subject: Fix for model indexing X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=bf330a93f25337efdcc402a891076e3ddee97b1e;p=modules%2Fgui.git Fix for model indexing --- diff --git a/src/SUIT/SUIT_TreeModel.cxx b/src/SUIT/SUIT_TreeModel.cxx index 8893581a2..3bab26044 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 ); } /*! @@ -1396,7 +1396,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++; @@ -1598,8 +1598,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; @@ -1614,7 +1615,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 8a259da3b..d8dd51a52 100755 --- a/src/SUIT/SUIT_TreeModel.h +++ b/src/SUIT/SUIT_TreeModel.h @@ -203,7 +203,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: