diff options
| author | Mikaël Capelle <capelle.mikael@gmail.com> | 2021-01-16 16:14:46 +0100 |
|---|---|---|
| committer | Mikaël Capelle <capelle.mikael@gmail.com> | 2021-01-16 16:14:46 +0100 |
| commit | 54f7df9fbd8946626b974ed212b5f12dd5c28e93 (patch) | |
| tree | 5a9d092739fb181670cfd1bf1bd6762d4c41848a /src | |
| parent | 89a735d6e11b8339b5b350d15ddd8fbfdf7998f5 (diff) | |
Maintain selection after drag&drop. Fix update of conflicts (visual) after priority change.
Diffstat (limited to 'src')
| -rw-r--r-- | src/modlistview.cpp | 51 |
1 files changed, 25 insertions, 26 deletions
diff --git a/src/modlistview.cpp b/src/modlistview.cpp index 94f55098..c40b4752 100644 --- a/src/modlistview.cpp +++ b/src/modlistview.cpp @@ -451,34 +451,31 @@ void ModListView::onModPrioritiesChanged(const QModelIndexList& indices) m_core->currentProfile()->writeModlist();
m_core->directoryStructure()->getFileRegister()->sortOrigins();
- { // refresh selection
- QModelIndex current = currentIndex();
- if (current.isValid()) {
- ModInfo::Ptr modInfo = ModInfo::getByIndex(current.data(ModList::IndexRole).toInt());
- // clear caches on all mods conflicting with the moved mod
- for (int i : modInfo->getModOverwrite()) {
- ModInfo::getByIndex(i)->clearCaches();
- }
- for (int i : modInfo->getModOverwritten()) {
- ModInfo::getByIndex(i)->clearCaches();
- }
- for (int i : modInfo->getModArchiveOverwrite()) {
- ModInfo::getByIndex(i)->clearCaches();
- }
- for (int i : modInfo->getModArchiveOverwritten()) {
- ModInfo::getByIndex(i)->clearCaches();
- }
- for (int i : modInfo->getModArchiveLooseOverwrite()) {
- ModInfo::getByIndex(i)->clearCaches();
- }
- for (int i : modInfo->getModArchiveLooseOverwritten()) {
- ModInfo::getByIndex(i)->clearCaches();
- }
- // update conflict check on the moved mod
- modInfo->doConflictCheck();
- setOverwriteMarkers(selectionModel()->selectedRows());
+ for (auto& idx : indices) {
+ ModInfo::Ptr modInfo = ModInfo::getByIndex(idx.data(ModList::IndexRole).toInt());
+ // clear caches on all mods conflicting with the moved mod
+ for (int i : modInfo->getModOverwrite()) {
+ ModInfo::getByIndex(i)->clearCaches();
+ }
+ for (int i : modInfo->getModOverwritten()) {
+ ModInfo::getByIndex(i)->clearCaches();
+ }
+ for (int i : modInfo->getModArchiveOverwrite()) {
+ ModInfo::getByIndex(i)->clearCaches();
+ }
+ for (int i : modInfo->getModArchiveOverwritten()) {
+ ModInfo::getByIndex(i)->clearCaches();
+ }
+ for (int i : modInfo->getModArchiveLooseOverwrite()) {
+ ModInfo::getByIndex(i)->clearCaches();
+ }
+ for (int i : modInfo->getModArchiveLooseOverwritten()) {
+ ModInfo::getByIndex(i)->clearCaches();
}
+ // update conflict check on the moved mod
+ modInfo->doConflictCheck();
}
+ setOverwriteMarkers(selectionModel()->selectedRows());
}
void ModListView::onModInstalled(const QString& modName)
@@ -1349,9 +1346,11 @@ void ModListView::dropEvent(QDropEvent* event) emit dropEntered(event->mimeData(), isExpanded(index), static_cast<DropPosition>(dropIndicatorPosition()));
// see selectedIndexes()
+ auto [current, selected] = this->selected();
m_inDragMoveEvent = true;
QTreeView::dropEvent(event);
m_inDragMoveEvent = false;
+ setSelected(current, selected);
}
void ModListView::timerEvent(QTimerEvent* event)
|
