summaryrefslogtreecommitdiff
path: root/src/datatab.cpp
diff options
context:
space:
mode:
authorJonathan Feenstra <26406078+JonathanFeenstra@users.noreply.github.com>2025-01-02 08:52:38 +0100
committerGitHub <noreply@github.com>2025-01-02 08:52:38 +0100
commitf8340e16201c214eef5327c4e810432e12b23805 (patch)
tree88814d5d1d5d8413adc72e4e83990ed986e6a144 /src/datatab.cpp
parent110014bf5eb1df045790204836e8d0d44fcea1e2 (diff)
Highlight mods that contain selected files in data tab (#2179)
Diffstat (limited to 'src/datatab.cpp')
-rw-r--r--src/datatab.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/datatab.cpp b/src/datatab.cpp
index dc8419cf..e4d0a215 100644
--- a/src/datatab.cpp
+++ b/src/datatab.cpp
@@ -2,6 +2,7 @@
#include "filetree.h"
#include "filetreemodel.h"
#include "messagedialog.h"
+#include "modelutils.h"
#include "organizercore.h"
#include "settings.h"
#include "ui_mainwindow.h"
@@ -57,6 +58,17 @@ DataTab::DataTab(OrganizerCore& core, PluginContainer& pc, QWidget* parent,
onHiddenFiles();
});
+ connect(ui.tree->selectionModel(), &QItemSelectionModel::selectionChanged, [=] {
+ const auto* fileTreeModel = m_filetree->model();
+ const auto& selectedIndexList = MOShared::indexViewToModel(
+ ui.tree->selectionModel()->selectedRows(), fileTreeModel);
+ std::set<QString> mods;
+ for (auto& idx : selectedIndexList) {
+ mods.insert(fileTreeModel->itemFromIndex(idx)->mod());
+ }
+ mwui->modList->setHighlightedMods(mods);
+ });
+
connect(m_filetree.get(), &FileTree::executablesChanged, this,
&DataTab::executablesChanged);
@@ -92,6 +104,8 @@ void DataTab::activated()
if (m_needUpdate) {
updateTree();
}
+ // update highlighted mods
+ ui.tree->selectionModel()->selectionChanged({}, {});
}
bool DataTab::isActive() const