From: asl Date: Thu, 9 Aug 2007 13:31:20 +0000 (+0000) Subject: new virtual method update() of SUIT_DataObject is called instead of work with Updater... X-Git-Tag: qt4_porting_delivery_220807~37 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=15b63b632e70b932de5c966b4a5fc5fbdc86a3ad;p=modules%2Fgui.git new virtual method update() of SUIT_DataObject is called instead of work with Updater class that has been removed --- diff --git a/src/SUIT/SUIT_TreeModel.cxx b/src/SUIT/SUIT_TreeModel.cxx index 665bb6cc1..72e78e36a 100755 --- a/src/SUIT/SUIT_TreeModel.cxx +++ b/src/SUIT/SUIT_TreeModel.cxx @@ -282,8 +282,8 @@ SUIT_TreeModel::ItemPtr SUIT_TreeModel::TreeSync::createItem( const ObjPtr& obj ItemPtr item = myModel ? myModel->createItem( obj, parent, after ) : 0; // Additional actions that can't be performed by the model, e.g. expanded state - if( item && myModel->updater() ) - myModel->updater()->update( obj ); + if( item ) + obj->update(); return item; } @@ -295,13 +295,10 @@ SUIT_TreeModel::ItemPtr SUIT_TreeModel::TreeSync::createItem( const ObjPtr& obj */ void SUIT_TreeModel::TreeSync::updateItem( const ObjPtr& obj, const ItemPtr& item ) const { + if( obj ) + obj->update(); if ( item && needUpdate( item ) ) myModel->updateItem( item ); - - // SUIT_TreeUpdater class performs additional update of a tree view, - // since the view is not available from inside a model - if( obj && myModel->updater() ) - myModel->updater()->update( obj ); } /*! @@ -417,8 +414,7 @@ SUIT_TreeModel::SUIT_TreeModel( QObject* parent ) myRoot( 0 ), myRootItem( 0 ), myAutoDeleteTree( false ), - myAutoUpdate( true ), - myUpdater( 0 ) + myAutoUpdate( true ) { initialize(); } @@ -433,8 +429,7 @@ SUIT_TreeModel::SUIT_TreeModel( SUIT_DataObject* root, QObject* parent ) myRoot( root ), myRootItem( 0 ), myAutoDeleteTree( false ), - myAutoUpdate( true ), - myUpdater( 0 ) + myAutoUpdate( true ) { initialize(); } @@ -452,7 +447,6 @@ SUIT_TreeModel::~SUIT_TreeModel() delete myRoot; } - delete myUpdater; delete myRootItem; } @@ -847,28 +841,6 @@ void SUIT_TreeModel::setAutoUpdate( const bool on ) } } -/*! - \brief Get tree updater. - \return current tree updater or 0 if it is not set -*/ -SUIT_TreeUpdater* SUIT_TreeModel::updater() const -{ - return myUpdater; -} - -/*! - \brief Set tree updater. - \param upd new tree updater -*/ -void SUIT_TreeModel::setUpdater( SUIT_TreeUpdater* upd ) -{ - if ( myUpdater ) - delete myUpdater; - - myUpdater = upd; - - updateTree(); -} /*! \brief Check if the specified column supports custom sorting. @@ -1092,17 +1064,16 @@ void SUIT_TreeModel::removeItem( SUIT_TreeModel::TreeItem* item ) int row = item->position(); beginRemoveRows( parentIdx, row, row ); - myItems.remove( obj ); - endRemoveRows(); - if ( obj == root() ) setRoot( 0 ); else if ( item->parent() ) item->parent()->removeChild( item ); delete item; + + endRemoveRows(); } /*! @@ -1271,25 +1242,6 @@ void SUIT_ProxyModel::setAutoUpdate( const bool on ) treeModel()->setAutoUpdate( on ); } -/*! - \brief Get tree updater. - \return current tree updater or 0 if it is not set -*/ -SUIT_TreeUpdater* SUIT_ProxyModel::updater() const -{ - return treeModel() ? treeModel()->updater() : 0; -} - -/*! - \brief Set tree updater. - \param upd new tree updater -*/ -void SUIT_ProxyModel::setUpdater( SUIT_TreeUpdater* upd ) -{ - if ( treeModel() ) - treeModel()->setUpdater( upd ); -} - /*! \brief Check if sorting is enabled. \return \c true if sorting is enabled diff --git a/src/SUIT/SUIT_TreeModel.h b/src/SUIT/SUIT_TreeModel.h index c0e40c5e3..89ca777e2 100755 --- a/src/SUIT/SUIT_TreeModel.h +++ b/src/SUIT/SUIT_TreeModel.h @@ -40,14 +40,6 @@ class SUIT_DataObject; class SUIT_TreeModel; -class SUIT_EXPORT SUIT_TreeUpdater -{ -public: - SUIT_TreeUpdater( SUIT_TreeModel* ) {}; - virtual ~SUIT_TreeUpdater() {}; - virtual void update( SUIT_DataObject* theObj ) = 0; -}; - class SUIT_EXPORT SUIT_TreeModel : public QAbstractItemModel { Q_OBJECT @@ -107,9 +99,6 @@ public: bool autoUpdate() const; void setAutoUpdate( const bool ); - SUIT_TreeUpdater* updater() const; - void setUpdater( SUIT_TreeUpdater* ); - virtual bool customSorting( const int ) const; virtual bool lessThan( const QModelIndex& left, const QModelIndex& right ) const; @@ -145,7 +134,6 @@ private: ItemMap myItems; bool myAutoDeleteTree; bool myAutoUpdate; - SUIT_TreeUpdater* myUpdater; friend class SUIT_TreeModel::TreeSync; }; @@ -171,10 +159,7 @@ public: bool autoUpdate() const; void setAutoUpdate( const bool ); - - SUIT_TreeUpdater* updater() const; - void setUpdater( SUIT_TreeUpdater* ); - + bool isSortingEnabled() const; QAbstractItemDelegate* delegate() const;