From d73d9307035ce751da442484cd6e23c8167393b7 Mon Sep 17 00:00:00 2001 From: Mikaƫl Capelle Date: Sat, 16 Jan 2021 16:21:59 +0100 Subject: Maintain selection when changing priority manually. --- src/modlistview.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/modlistview.cpp') 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() -- cgit v1.3.1