summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTannin <devnull@localhost>2015-03-31 17:48:07 +0200
committerTannin <devnull@localhost>2015-03-31 17:48:07 +0200
commit38eb03c306bc1317ac09195656ea10e413157c4e (patch)
tree1b490e22d6585249772c933235e6c0f7f8c6b4c0 /src
parent6ff201385cccbfb0aec481ca52c1d200a89b4014 (diff)
bugfix: modlist automatically scrolled to the top after closing context menu
Diffstat (limited to 'src')
-rw-r--r--src/mainwindow.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 49bfe117..34bc6dc2 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -2014,7 +2014,6 @@ void MainWindow::addCategoryFilters(QTreeWidgetItem *root, const std::set<int> &
}
}
-
void MainWindow::refreshFilters()
{
QItemSelection currentSelection = ui->modList->selectionModel()->selection();
@@ -2038,11 +2037,10 @@ void MainWindow::refreshFilters()
addFilterItem(nullptr, tr("<Not Endorsed>"), CategoryFactory::CATEGORY_SPECIAL_NOTENDORSED, ModListSortProxy::TYPE_SPECIAL);
addContentFilters();
-
std::set<int> categoriesUsed;
for (unsigned int modIdx = 0; modIdx < ModInfo::getNumMods(); ++modIdx) {
ModInfo::Ptr modInfo = ModInfo::getByIndex(modIdx);
- BOOST_FOREACH (int categoryID, modInfo->getCategories()) {
+ for (int categoryID : modInfo->getCategories()) {
int currentID = categoryID;
// also add parents so they show up in the tree
while (currentID != 0) {
@@ -2061,7 +2059,11 @@ void MainWindow::refreshFilters()
}
}
ui->modList->selectionModel()->select(currentSelection, QItemSelectionModel::Select);
- QModelIndexList matchList = ui->modList->model()->match(ui->modList->model()->index(0, 0), Qt::DisplayRole, currentIndexName);
+ QModelIndexList matchList;
+ if (currentIndexName.isValid()) {
+ matchList = ui->modList->model()->match(ui->modList->model()->index(0, 0), Qt::DisplayRole, currentIndexName);
+ }
+
if (matchList.size() > 0) {
ui->modList->setCurrentIndex(matchList.at(0));
}