From 384cfb53eda543be197b04b2ec1ac1120ae785a3 Mon Sep 17 00:00:00 2001 From: Dan Paulat Date: Sat, 8 Oct 2022 23:31:29 -0500 Subject: [PATCH] Fix radar site selection when filtering and the selected item changes index --- scwx-qt/source/scwx/qt/ui/radar_site_dialog.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/scwx-qt/source/scwx/qt/ui/radar_site_dialog.cpp b/scwx-qt/source/scwx/qt/ui/radar_site_dialog.cpp index f30ce195..d66587e2 100644 --- a/scwx-qt/source/scwx/qt/ui/radar_site_dialog.cpp +++ b/scwx-qt/source/scwx/qt/ui/radar_site_dialog.cpp @@ -76,9 +76,17 @@ RadarSiteDialog::RadarSiteDialog(QWidget* parent) : connect(ui->radarSiteView->selectionModel(), &QItemSelectionModel::selectionChanged, this, - [=](const QItemSelection& selected, - const QItemSelection& /* deselected */) + [=](const QItemSelection& selected, const QItemSelection& deselected) { + if (selected.size() == 0 && deselected.size() == 0) + { + // Items which stay selected but change their index are not + // included in selected and deselected. Thus, this signal might + // be emitted with both selected and deselected empty, if only + // the indices of selected items change. + return; + } + ui->buttonBox->button(QDialogButtonBox::Ok) ->setEnabled(selected.size() > 0);