diff options
| author | Tannin <devnull@localhost> | 2013-05-19 11:37:03 +0200 |
|---|---|---|
| committer | Tannin <devnull@localhost> | 2013-05-19 11:37:03 +0200 |
| commit | cdea0c9da56b20bce0213310ba29fbf6df045443 (patch) | |
| tree | 6275e3cf77a569493324df9cdfc63aa4e6631c43 /src/mainwindow.cpp | |
| parent | 45f6cd21a2c730b9dea322b0dba30120cdc40521 (diff) | |
| parent | 0beb88760b4c258b89daf5791069dc885c0c27aa (diff) | |
Merge
Diffstat (limited to 'src/mainwindow.cpp')
| -rw-r--r-- | src/mainwindow.cpp | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 89dc9904..bbc336a7 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -2383,8 +2383,15 @@ void MainWindow::refreshFilters() ui->modList->setCurrentIndex(QModelIndex()); // save previous filter text so we can restore it later, in case the filter still exists then - QTreeWidgetItem *currentItem = ui->categoriesList->currentItem(); - QString previousFilter = currentItem != NULL ? currentItem->text(0) : tr("<All>"); +// QTreeWidgetItem *currentItem = ui->categoriesList->currentItem(); +// QString previousFilter = currentItem != NULL ? currentItem->text(0) : tr("<All>"); + + + QStringList selectedItems; + foreach (QTreeWidgetItem *item, ui->categoriesList->selectedItems()) { + selectedItems.append(item->text(0)); + } + ui->categoriesList->clear(); addFilterItem(NULL, tr("<Checked>"), CategoryFactory::CATEGORY_SPECIAL_CHECKED); @@ -2408,13 +2415,10 @@ void MainWindow::refreshFilters() addCategoryFilters(NULL, categoriesUsed, 0); - QList<QTreeWidgetItem*> matches = ui->categoriesList->findItems(previousFilter, Qt::MatchFixedString | Qt::MatchRecursive); - if (matches.size() > 0) { - QTreeWidgetItem *currentItem = matches.at(0); - ui->categoriesList->setCurrentItem(currentItem); - while (currentItem != NULL) { - currentItem->setExpanded(true); - currentItem = currentItem->parent(); + foreach (const QString &item, selectedItems) { + QList<QTreeWidgetItem*> matches = ui->categoriesList->findItems(item, Qt::MatchFixedString | Qt::MatchRecursive); + if (matches.size() > 0) { + matches.at(0)->setSelected(true); } } |
