From 32222fd9e0b0617143a37a208901d24cdb334030 Mon Sep 17 00:00:00 2001 From: Cameron White Date: Thu, 18 Jun 2020 08:00:21 -0400 Subject: [PATCH] Enable changing the selected filter using the arrow keys #295 --- source/dialogs/viewfilterdialog.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/source/dialogs/viewfilterdialog.cpp b/source/dialogs/viewfilterdialog.cpp index 62222c1c0..fe3e50234 100644 --- a/source/dialogs/viewfilterdialog.cpp +++ b/source/dialogs/viewfilterdialog.cpp @@ -43,8 +43,11 @@ void ViewFilterDialog::setPresenter(ViewFilterPresenter *presenter) connect(ui->removeFilterButton, &QToolButton::clicked, [&]() { myPresenter->removeSelectedFilter(); }); - connect(ui->filterList, &QListWidget::itemClicked, [&](QListWidgetItem *) { - myPresenter->selectFilter(ui->filterList->currentRow()); + connect(ui->filterList, &QListWidget::currentRowChanged, [&](int row) { + // Don't send selection events when the filter list is cleared during + // update(). + if (row >= 0) + myPresenter->selectFilter(row); }); connect(ui->nameLineEdit, &QLineEdit::textEdited, [&](const QString &s) {