From be37a74e7d8cfdb0d8d44ce8ecd85ccde6107f24 Mon Sep 17 00:00:00 2001 From: nds Date: Wed, 17 Sep 2008 06:25:43 +0000 Subject: [PATCH] Appends flag in the method setAutoUpdate() to give an opportunity to put off update tree functionality. --- src/SUIT/SUIT_DataBrowser.cxx | 6 ++++-- src/SUIT/SUIT_DataBrowser.h | 2 +- src/SUIT/SUIT_TreeModel.cxx | 13 +++++++++---- src/SUIT/SUIT_TreeModel.h | 4 ++-- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/SUIT/SUIT_DataBrowser.cxx b/src/SUIT/SUIT_DataBrowser.cxx index 32c92c013..9dd97b1fe 100644 --- a/src/SUIT/SUIT_DataBrowser.cxx +++ b/src/SUIT/SUIT_DataBrowser.cxx @@ -107,13 +107,15 @@ bool SUIT_DataBrowser::autoUpdate() const automatically when data tree is changed. \param on 'auto-update tree' flag value + \param updateImmediately if \c true, the tree is updated immediately; + otherwise the tree must be updated manually \sa autoUpdate(), updateTree() */ -void SUIT_DataBrowser::setAutoUpdate( const bool on ) +void SUIT_DataBrowser::setAutoUpdate( const bool on, const bool updateImmediately ) { SUIT_ProxyModel* m = qobject_cast( model() ); if ( m ) - m->setAutoUpdate( on ); + m->setAutoUpdate( on, updateImmediately ); } /*! diff --git a/src/SUIT/SUIT_DataBrowser.h b/src/SUIT/SUIT_DataBrowser.h index 25794a685..6cb2b00d4 100644 --- a/src/SUIT/SUIT_DataBrowser.h +++ b/src/SUIT/SUIT_DataBrowser.h @@ -45,7 +45,7 @@ public: void setRoot( SUIT_DataObject* ); bool autoUpdate() const; - void setAutoUpdate( const bool ); + void setAutoUpdate( const bool, const bool = true ); void updateTree( SUIT_DataObject* = 0, const bool = true ); diff --git a/src/SUIT/SUIT_TreeModel.cxx b/src/SUIT/SUIT_TreeModel.cxx index 48f486896..b2c1e880a 100755 --- a/src/SUIT/SUIT_TreeModel.cxx +++ b/src/SUIT/SUIT_TreeModel.cxx @@ -819,9 +819,11 @@ bool SUIT_TreeModel::autoUpdate() const automatically when data tree is changed. \param on 'auto-update tree' flag value + \param updateImmediately if \c true, the tree is updated immediately; + otherwise the tree must be updated manually \sa autoUpdate(), updateTree() */ -void SUIT_TreeModel::setAutoUpdate( const bool on ) +void SUIT_TreeModel::setAutoUpdate( const bool on, const bool updateImmediately ) { if ( myAutoUpdate == on ) return; @@ -838,7 +840,8 @@ void SUIT_TreeModel::setAutoUpdate( const bool on ) SUIT_DataObject::connect( SIGNAL( removed( SUIT_DataObject*, SUIT_DataObject* ) ), this, SLOT( onRemoved( SUIT_DataObject*, SUIT_DataObject* ) ) ); - updateTree(); + if ( updateImmediately ) + updateTree(); } } @@ -1235,12 +1238,14 @@ bool SUIT_ProxyModel::autoUpdate() const automatically when data tree is changed. \param on 'auto-update tree' flag value + \param updateImmediately if \c true, the tree is updated immediately; + otherwise the tree must be updated manually \sa autoUpdate(), updateTree() */ -void SUIT_ProxyModel::setAutoUpdate( const bool on ) +void SUIT_ProxyModel::setAutoUpdate( const bool on, const bool updateImmediately ) { if ( treeModel() ) - treeModel()->setAutoUpdate( on ); + treeModel()->setAutoUpdate( on, updateImmediately ); } /*! diff --git a/src/SUIT/SUIT_TreeModel.h b/src/SUIT/SUIT_TreeModel.h index 89ca777e2..e5ad92517 100755 --- a/src/SUIT/SUIT_TreeModel.h +++ b/src/SUIT/SUIT_TreeModel.h @@ -97,7 +97,7 @@ public: void setAutoDeleteTree( const bool ); bool autoUpdate() const; - void setAutoUpdate( const bool ); + void setAutoUpdate( const bool, const bool = true ); virtual bool customSorting( const int ) const; virtual bool lessThan( const QModelIndex& left, const QModelIndex& right ) const; @@ -158,7 +158,7 @@ public: void setAutoDeleteTree( const bool ); bool autoUpdate() const; - void setAutoUpdate( const bool ); + void setAutoUpdate( const bool, const bool = true ); bool isSortingEnabled() const; -- 2.39.2