From a19bfaa489507827dea1449991f1f5398a28beb1 Mon Sep 17 00:00:00 2001 From: Mikaƫl Capelle Date: Mon, 18 Jan 2021 19:44:29 +0100 Subject: Better handling of layoutChanged in by-priority proxy to avoid resetting. --- src/modlistviewactions.cpp | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'src/modlistviewactions.cpp') diff --git a/src/modlistviewactions.cpp b/src/modlistviewactions.cpp index 5af79b3b..123fbf75 100644 --- a/src/modlistviewactions.cpp +++ b/src/modlistviewactions.cpp @@ -530,21 +530,14 @@ void ModListViewActions::displayModInformation(ModInfo::Ptr modInfo, unsigned in } } -void ModListViewActions::setModsPriority(const QModelIndexList& indexes, int priority) const -{ - auto [current, selected] = m_view->selected(); - m_core.modList()->changeModsPriority(indexes, priority); - m_view->setSelected(current, selected); -} - void ModListViewActions::sendModsToTop(const QModelIndexList& indexes) const { - setModsPriority(indexes, 0); + m_core.modList()->changeModsPriority(indexes, 0); } void ModListViewActions::sendModsToBottom(const QModelIndexList& indexes) const { - setModsPriority(indexes, std::numeric_limits::max()); + m_core.modList()->changeModsPriority(indexes, std::numeric_limits::max()); } void ModListViewActions::sendModsToPriority(const QModelIndexList& indexes) const @@ -555,7 +548,7 @@ void ModListViewActions::sendModsToPriority(const QModelIndexList& indexes) cons 0, 0, std::numeric_limits::max(), 1, &ok); if (!ok) return; - setModsPriority(indexes, priority); + m_core.modList()->changeModsPriority(indexes, priority); } void ModListViewActions::sendModsToSeparator(const QModelIndexList& indexes) const @@ -599,7 +592,7 @@ void ModListViewActions::sendModsToSeparator(const QModelIndexList& indexes) con --newPriority; } - setModsPriority(indexes, newPriority); + m_core.modList()->changeModsPriority(indexes, newPriority); } } } @@ -622,7 +615,7 @@ void ModListViewActions::sendModsToFirstConflict(const QModelIndexList& indexes) }); if (!priorities.empty()) { - setModsPriority(indexes, *priorities.begin()); + m_core.modList()->changeModsPriority(indexes, *priorities.begin()); } } @@ -644,7 +637,7 @@ void ModListViewActions::sendModsToLastConflict(const QModelIndexList& indexes) }); if (!priorities.empty()) { - setModsPriority(indexes, *priorities.rbegin()); + m_core.modList()->changeModsPriority(indexes, *priorities.rbegin()); } } -- cgit v1.3.1