From b40623cbaf7b262b17c246c7760fffd3cc6b2c90 Mon Sep 17 00:00:00 2001 From: stv Date: Tue, 29 Aug 2006 11:10:46 +0000 Subject: [PATCH] Default value of "autoOpen" flag was changed on "false" in method updateTree(). Method openLevels() was added. --- src/ObjBrowser/OB_Browser.cxx | 35 ++++++++++++++++++++--------------- src/ObjBrowser/OB_Browser.h | 3 ++- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/src/ObjBrowser/OB_Browser.cxx b/src/ObjBrowser/OB_Browser.cxx index c0343a2ca..2456e168c 100755 --- a/src/ObjBrowser/OB_Browser.cxx +++ b/src/ObjBrowser/OB_Browser.cxx @@ -366,8 +366,25 @@ void OB_Browser::setAutoOpenLevel( const int level ) return; myAutoOpenLevel = level; +} - autoOpenBranches(); +/*! + Opens branches from 1 to \alevels. If parameter value negative then autoOpenLevel() value will be used. + \sa autoOpenLevel() +*/ +void OB_Browser::openLevels( const int levels ) +{ + int level = levels < 0 ? autoOpenLevel() : levels; + QListView* lv = listView(); + if ( !lv || level < 1 ) + return; + + QListViewItem* item = lv->firstChild(); + while ( item ) + { + openBranch( item, level ); + item = item->nextSibling(); + } } /*! @@ -892,7 +909,7 @@ void OB_Browser::updateTree( SUIT_DataObject* obj, const bool autoOpen ) restoreState( selObjs, openObjs, curObj, selKeys, openKeys, curKey ); - if( autoOpen ) + if ( autoOpen ) autoOpenBranches(); setModified(); @@ -939,8 +956,6 @@ void OB_Browser::replaceTree( SUIT_DataObject* src, SUIT_DataObject* trg ) restoreState( selObjs, openObjs, curObj, selKeys, openKeys, curKey ); - autoOpenBranches(); - setModified(); if ( selNum != numberOfSelected() ) @@ -1574,17 +1589,7 @@ void OB_Browser::removeObject( SUIT_DataObject* obj, const bool autoUpd ) */ void OB_Browser::autoOpenBranches() { - int level = autoOpenLevel(); - QListView* lv = listView(); - if ( !lv || level < 1 ) - return; - - QListViewItem* item = lv->firstChild(); - while ( item ) - { - openBranch( item, level ); - item = item->nextSibling(); - } + openLevels(); } /*! diff --git a/src/ObjBrowser/OB_Browser.h b/src/ObjBrowser/OB_Browser.h index 6299afd2d..5dfb52b29 100755 --- a/src/ObjBrowser/OB_Browser.h +++ b/src/ObjBrowser/OB_Browser.h @@ -77,7 +77,7 @@ public: bool isAutoDeleteObjects() const; virtual void setAutoDeleteObjects( const bool ); - virtual void updateTree( SUIT_DataObject* = 0, const bool autoOpen = true ); + virtual void updateTree( SUIT_DataObject* = 0, const bool = false ); virtual void replaceTree( SUIT_DataObject*, SUIT_DataObject* ); bool isShowToolTips(); @@ -95,6 +95,7 @@ public: int autoOpenLevel() const; void setAutoOpenLevel( const int ); + void openLevels( const int = -1 ); virtual int addColumn( const QString&, const int id = -1, const int width = -1 ); virtual int addColumn( const QIconSet&, const QString&, const int id = -1, const int width = -1 ); -- 2.39.2