Changeset 10934 for trunk/qt/details.cc


Ignore:
Timestamp:
Jul 3, 2010, 3:46:14 AM (12 years ago)
Author:
Longinus00
Message:

(qt) delete multiple trackers at once

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/qt/details.cc

    r10933 r10934  
    11621162Details :: onRemoveTrackerPushed( )
    11631163{
    1164     const QTreeWidgetItem * item = myTrackerTree->selectedItems().first();
    1165     const bool isTier = item->data( 0, TRACKERID ).toInt() == -1;
    1166     if( isTier )
    1167     {
    1168         for( int i = 0; i < item->childCount(); ++i )
    1169             removeTracker( item->child( i ) );
    1170     }
    1171     else
    1172         removeTracker( item );
     1164    const QList<QTreeWidgetItem*> items = myTrackerTree->selectedItems();
     1165    QSet<int> removedTiers;
     1166    foreach( const QTreeWidgetItem * item, items ) {
     1167        const bool isTier = item->data( 0, TRACKERID ).toInt() == -1;
     1168        const int curTier = item->data( 0, TRACKERTIER ).toInt();
     1169        if( isTier )
     1170        {
     1171            removedTiers << curTier;
     1172            for( int i = 0; i < item->childCount(); ++i )
     1173                removeTracker( item->child( i ) );
     1174        }
     1175        else if( !removedTiers.contains( curTier ) ) // skip trackers removed by clearing a tier
     1176            removeTracker( item );
     1177    }
    11731178}
    11741179
     
    12891294    myTrackerTree = new QTreeWidget;
    12901295    myTrackerTree->setHeaderLabels( headers );
    1291     myTrackerTree->setSelectionMode( QTreeWidget::SingleSelection );
     1296    myTrackerTree->setSelectionMode( QTreeWidget::ExtendedSelection );
    12921297    myTrackerTree->setRootIsDecorated( false );
    12931298    myTrackerTree->setIndentation( 2 );
Note: See TracChangeset for help on using the changeset viewer.