From f923de39e071b48bc1437fa4c79c22b3bc9b0583 Mon Sep 17 00:00:00 2001 From: Mikaƫl Capelle Date: Tue, 29 Dec 2020 13:27:29 +0100 Subject: Maintain selection while filtering. --- src/mainwindow.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 7c72f132..69e2d989 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -422,10 +422,6 @@ MainWindow::MainWindow(Settings &settings connect(&m_PluginContainer, SIGNAL(diagnosisUpdate()), this, SLOT(scheduleCheckForProblems())); - connect(m_ModListSortProxy, SIGNAL(filterActive(bool)), this, SLOT(modFilterActive(bool))); - connect(m_ModListSortProxy, SIGNAL(layoutChanged()), this, SLOT(updateModCount())); - connect(ui->modFilterEdit, SIGNAL(textChanged(QString)), m_ModListSortProxy, SLOT(updateFilter(QString))); - connect(ui->espFilterEdit, SIGNAL(textChanged(QString)), m_PluginListSortProxy, SLOT(updateFilter(QString))); connect(ui->espFilterEdit, SIGNAL(textChanged(QString)), this, SLOT(espFilterChanged(QString))); @@ -659,6 +655,15 @@ void MainWindow::setupModList() connect(m_OrganizerCore.modList(), &ModList::downloadArchiveDropped, this, [this](int row, int priority) { m_OrganizerCore.installDownload(row, priority); }); + + connect(m_ModListSortProxy, &ModListSortProxy::filterActive, this, &MainWindow::modFilterActive); + connect(ui->modFilterEdit, &QLineEdit::textChanged, m_ModListSortProxy, &ModListSortProxy::updateFilter); + connect(m_ModListSortProxy, &QAbstractItemModel::layoutChanged, this, &MainWindow::updateModCount); + connect(m_ModListSortProxy, &QAbstractItemModel::layoutChanged, this, [&]() { + if (m_ModListSortProxy->sourceModel() == m_ModListByPriorityProxy) { + m_ModListByPriorityProxy->refreshExpandedItems(); + } + }); } void MainWindow::resetActionIcons() @@ -5835,7 +5840,6 @@ void MainWindow::onFiltersCriteria(const std::vector } ui->currentCategoryLabel->setText(label); - ui->modList->reset(); } void MainWindow::onFiltersOptions( -- cgit v1.3.1