summaryrefslogtreecommitdiff
path: root/src/modlistview.cpp
diff options
context:
space:
mode:
authorMikaël Capelle <capelle.mikael@gmail.com>2021-01-16 16:21:59 +0100
committerMikaël Capelle <capelle.mikael@gmail.com>2021-01-16 16:21:59 +0100
commitd73d9307035ce751da442484cd6e23c8167393b7 (patch)
treef1b209a12e6d9c580a1570701962b73f0dd16bb9 /src/modlistview.cpp
parent54f7df9fbd8946626b974ed212b5f12dd5c28e93 (diff)
Maintain selection when changing priority manually.
Diffstat (limited to 'src/modlistview.cpp')
-rw-r--r--src/modlistview.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/modlistview.cpp b/src/modlistview.cpp
index c40b4752..243e78a4 100644
--- a/src/modlistview.cpp
+++ b/src/modlistview.cpp
@@ -906,6 +906,19 @@ void ModListView::drawBranches(QPainter* painter, const QRect& rect, const QMode
QTreeView::drawBranches(painter, r, index);
}
+void ModListView::commitData(QWidget* editor)
+{
+ // maintain the selection when changing priority
+ if (currentIndex().column() == ModList::COL_PRIORITY) {
+ auto [current, selected] = this->selected();
+ QTreeView::commitData(editor);
+ setSelected(current, selected);
+ }
+ else {
+ QTreeView::commitData(editor);
+ }
+}
+
QModelIndexList ModListView::selectedIndexes() const
{
// during drag&drop events, we fake the return value of selectedIndexes()