From 5e671a4b0b4fcc832b04a1199546a6a3869ccfa5 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Fri, 11 Oct 2019 21:07:18 +0800 Subject: [PATCH] Allow to select multiple entries in "banned IP" dialog --- src/gui/banlistoptionsdialog.cpp | 8 ++++++-- src/gui/banlistoptionsdialog.ui | 3 +++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/gui/banlistoptionsdialog.cpp b/src/gui/banlistoptionsdialog.cpp index 171612055..040cbc1df 100644 --- a/src/gui/banlistoptionsdialog.cpp +++ b/src/gui/banlistoptionsdialog.cpp @@ -107,8 +107,12 @@ void BanListOptionsDialog::on_buttonBanIP_clicked() void BanListOptionsDialog::on_buttonDeleteIP_clicked() { - const QModelIndexList selection = m_ui->bannedIPList->selectionModel()->selectedIndexes(); - for (const auto &i : selection) + QModelIndexList selection = m_ui->bannedIPList->selectionModel()->selectedIndexes(); + std::sort(selection.begin(), selection.end(), [](const QModelIndex &left, const QModelIndex &right) + { + return (left.row() > right.row()); + }); + for (const QModelIndex &i : selection) m_sortFilter->removeRow(i.row()); m_modified = true; diff --git a/src/gui/banlistoptionsdialog.ui b/src/gui/banlistoptionsdialog.ui index 04293f3fb..e218b2141 100644 --- a/src/gui/banlistoptionsdialog.ui +++ b/src/gui/banlistoptionsdialog.ui @@ -49,6 +49,9 @@ 0 + + QAbstractItemView::ExtendedSelection + false