From 8fafcce33f1d5633cf1cb1acbb067fd485869bbf Mon Sep 17 00:00:00 2001 From: Mikaël Capelle Date: Sat, 16 Jan 2021 13:22:20 +0100 Subject: Add send to last conflict action for modlist. --- src/modlistview.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/modlistview.h') diff --git a/src/modlistview.h b/src/modlistview.h index 13f868c6..122bf2f1 100644 --- a/src/modlistview.h +++ b/src/modlistview.h @@ -89,6 +89,7 @@ public: // focus the view, select the given index and scroll to it // void scrollToAndSelect(const QModelIndex& index); + void scrollToAndSelect(const QModelIndexList& indexes, const QModelIndex& current = QModelIndex()); // refresh the view (to call when settings have been changed) // -- cgit v1.3.1 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 +++++++++++++ src/modlistview.h | 2 ++ 2 files changed, 15 insertions(+) (limited to 'src/modlistview.h') 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& filters); void onProfileChanged(Profile* oldProfile, Profile* newProfile); + void commitData(QWidget* editor) override; + private: friend class ModConflictIconDelegate; -- cgit v1.3.1