From 2c57899cf611056a8c5bae1f7f27c9a157df6f41 Mon Sep 17 00:00:00 2001 From: LostDragonist Date: Thu, 1 Nov 2018 17:58:49 -0500 Subject: Fix matching highlights for mod and plugin selections The selectionChanged event used before requires subtractive/additive logic to work correctly. A separate event is fired for each row and each column for each row that is selected or deselected. The previous logic assumed all of the selection was passed in at once. The logic has been changed to recalculate all highlights each time the event is fired. This is poorly optimized in regards to performance but makes the function work. --- src/modlist.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/modlist.cpp') diff --git a/src/modlist.cpp b/src/modlist.cpp index 3f8fa0c0..539ba6fc 100644 --- a/src/modlist.cpp +++ b/src/modlist.cpp @@ -24,6 +24,7 @@ along with Mod Organizer. If not, see . #include "qtgroupingproxy.h" #include "viewmarkingscrollbar.h" #include "modlistsortproxy.h" +#include "pluginlist.h" #include "settings.h" #include "modinforegular.h" #include @@ -768,12 +769,12 @@ int ModList::timeElapsedSinceLastChecked() const return m_LastCheck.elapsed(); } -void ModList::highlightMods(const QItemSelection &selected, const MOShared::DirectoryEntry &directoryEntry) +void ModList::highlightMods(const QItemSelectionModel *selection, const MOShared::DirectoryEntry &directoryEntry) { for (unsigned int i = 0; i < ModInfo::getNumMods(); ++i) { ModInfo::getByIndex(i)->setPluginSelected(false); } - for (QModelIndex idx : selected.indexes()) { + for (QModelIndex idx : selection->selectedRows(PluginList::COL_NAME)) { QString modName = idx.data().toString(); const MOShared::FileEntry::Ptr fileEntry = directoryEntry.findFile(modName.toStdWString()); -- cgit v1.3.1