Properly filter the map search results when switching sort types

This commit is contained in:
Marcus Huderle 2020-06-25 18:34:46 -05:00
parent dd91e29e85
commit b58ec89854
2 changed files with 9 additions and 2 deletions

View file

@ -295,6 +295,7 @@ private:
void initMapSortOrder();
void setProjectSpecificUIVisibility();
void loadUserSettings();
void applyMapListFilter(QString filterText);
void restoreWindowState();
void setTheme(QString);
bool openRecentProject();

View file

@ -240,14 +240,20 @@ void MainWindow::mapSortOrder_changed(QAction *action)
if (isProjectOpen())
{
sortMapList();
applyMapListFilter(ui->lineEdit_filterBox->text());
}
}
}
void MainWindow::on_lineEdit_filterBox_textChanged(const QString &arg1)
{
mapListProxyModel->setFilterRegExp(QRegExp(arg1, Qt::CaseInsensitive, QRegExp::FixedString));
if (arg1.isEmpty()) {
this->applyMapListFilter(arg1);
}
void MainWindow::applyMapListFilter(QString filterText)
{
mapListProxyModel->setFilterRegExp(QRegExp(filterText, Qt::CaseInsensitive, QRegExp::FixedString));
if (filterText.isEmpty()) {
ui->mapList->collapseAll();
} else {
ui->mapList->expandToDepth(0);