summaryrefslogtreecommitdiff
path: root/src
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
parent54f7df9fbd8946626b974ed212b5f12dd5c28e93 (diff)
Maintain selection when changing priority manually.
Diffstat (limited to 'src')
-rw-r--r--src/modlistview.cpp13
-rw-r--r--src/modlistview.h2
2 files changed, 15 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()
diff --git a/src/modlistview.h b/src/modlistview.h
index 122bf2f1..39099cf7 100644
--- a/src/modlistview.h
+++ b/src/modlistview.h
@@ -182,6 +182,8 @@ protected slots:
void onFiltersCriteria(const std::vector<ModListSortProxy::Criteria>& filters);
void onProfileChanged(Profile* oldProfile, Profile* newProfile);
+ void commitData(QWidget* editor) override;
+
private:
friend class ModConflictIconDelegate;