NOISSUE do not lose selection on mod enable/disable toggle

This commit is contained in:
Petr Mrázek
2019-08-05 00:44:56 +02:00
parent dfb30d9139
commit c291946d2a
7 changed files with 99 additions and 60 deletions

View File

@ -147,12 +147,13 @@ ModFolderPage::ModFolderPage(
connect(m_inst, &BaseInstance::runningStatusChanged, this, &ModFolderPage::on_RunningState_changed);
}
void ModFolderPage::modItemActivated(const QModelIndex& index)
void ModFolderPage::modItemActivated(const QModelIndex&)
{
auto modsModelIndex = m_filterModel->mapToSource(index);
if(modsModelIndex.isValid()) {
m_mods->toggleEnabled(modsModelIndex);
if(!m_controlsEnabled) {
return;
}
auto selection = m_filterModel->mapSelectionToSource(ui->modTreeView->selectionModel()->selection());
m_mods->setModStatus(selection.indexes(), ModFolderModel::Toggle);
}
QMenu * ModFolderPage::createPopupMenu()
@ -297,7 +298,7 @@ void ModFolderPage::on_actionEnable_triggered()
return;
}
auto selection = m_filterModel->mapSelectionToSource(ui->modTreeView->selectionModel()->selection());
m_mods->enableMods(selection.indexes(), true);
m_mods->setModStatus(selection.indexes(), ModFolderModel::Enable);
}
void ModFolderPage::on_actionDisable_triggered()
@ -306,7 +307,7 @@ void ModFolderPage::on_actionDisable_triggered()
return;
}
auto selection = m_filterModel->mapSelectionToSource(ui->modTreeView->selectionModel()->selection());
m_mods->enableMods(selection.indexes(), false);
m_mods->setModStatus(selection.indexes(), ModFolderModel::Disable);
}
void ModFolderPage::on_actionRemove_triggered()