Author: sh-sh-sh Date: Tue Jul 8 15:43:55 2008 New Revision: 48916 URL: http://svn.opensuse.org/viewcvs/yast?rev=48916&view=rev Log: Fixed massive performance drop when inserting many (3000+) YQSelectionBox items Modified: trunk/qt/VERSION.cmake trunk/qt/package/yast2-qt.changes trunk/qt/src/YQSelectionBox.cc trunk/qt/src/YQSelectionBox.h Modified: trunk/qt/VERSION.cmake URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/VERSION.cmake?rev=48916&r1=48915&r2=48916&view=diff ============================================================================== --- trunk/qt/VERSION.cmake (original) +++ trunk/qt/VERSION.cmake Tue Jul 8 15:43:55 2008 @@ -1,3 +1,3 @@ SET(VERSION_MAJOR "2") SET(VERSION_MINOR "17") -SET(VERSION_PATCH "1") +SET(VERSION_PATCH "2") Modified: trunk/qt/package/yast2-qt.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/package/yast2-qt.changes?rev=48916&r1=48915&r2=48916&view=diff ============================================================================== --- trunk/qt/package/yast2-qt.changes (original) +++ trunk/qt/package/yast2-qt.changes Tue Jul 8 15:43:55 2008 @@ -1,4 +1,11 @@ ------------------------------------------------------------------- +Tue Jul 8 15:42:54 CEST 2008 - sh@suse.de + +- Fixed massive performance drop when inserting many (3000+) + YQSelectionBox items +- V 2.17.2 + +------------------------------------------------------------------- Tue Jun 24 11:55:26 CEST 2008 - tgoettlicher@suse.de - prevent that the user deselects all radiobutton items Modified: trunk/qt/src/YQSelectionBox.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/YQSelectionBox.cc?rev=48916&r1=48915&r2=48916&view=diff ============================================================================== --- trunk/qt/src/YQSelectionBox.cc (original) +++ trunk/qt/src/YQSelectionBox.cc Tue Jul 8 15:43:55 2008 @@ -95,8 +95,35 @@ } +void YQSelectionBox::addItems( const YItemCollection & itemCollection ) +{ + for ( YItemConstIterator it = itemCollection.begin(); + it != itemCollection.end(); + ++it ) + { + addItem( *it, + true ); // batchMode + + // No need to check for (*it)->hasChildren() and iterate recursively + // over the children: Any children of this item simply remain in this + // item's YItemCollection. + } + + + _qt_listWidget->scrollToItem( _qt_listWidget->currentItem(), + QAbstractItemView::EnsureVisible ); +} + + void YQSelectionBox::addItem( YItem * item ) { + addItem( item, + false ); // batchMode +} + + +void YQSelectionBox::addItem( YItem * item, bool batchMode ) +{ YSelectionBox::addItem( item ); QPixmap icon; @@ -127,7 +154,11 @@ _qt_listWidget->setCurrentItem( _qt_listWidget->item( item->index() ) ); } - _qt_listWidget->scrollToItem( _qt_listWidget->currentItem(), QAbstractItemView::EnsureVisible ); + if ( ! batchMode ) + { + _qt_listWidget->scrollToItem( _qt_listWidget->currentItem(), + QAbstractItemView::EnsureVisible ); + } } Modified: trunk/qt/src/YQSelectionBox.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/YQSelectionBox.h?rev=48916&r1=48915&r2=48916&view=diff ============================================================================== --- trunk/qt/src/YQSelectionBox.h (original) +++ trunk/qt/src/YQSelectionBox.h Tue Jul 8 15:43:55 2008 @@ -61,6 +61,13 @@ virtual void addItem( YItem * item ); /** + * Add multiple items. + * + * Reimplemented for efficiency from YSelectionWidget. + **/ + virtual void addItems( const YItemCollection & itemCollection ); + + /** * Select or deselect an item. * * Reimplemented from YSelectionWidget. @@ -157,6 +164,12 @@ **/ void selectItem( int index ); + /** + * Internal addItem() method that will not do expensive operations in batch + * mode. + **/ + void addItem( YItem * item, bool batchMode ); + // // Data members -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org