diff options
author | Petr Mrázek <peterix@gmail.com> | 2019-08-04 21:13:50 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2019-08-04 21:13:50 +0200 |
commit | 4ed67413ac33f0814b76ffc76ad8c1dae734febf (patch) | |
tree | 2ef6033e7835a10c740d5492b474bd6979d7c864 /application | |
parent | d31184f9a4d96644e8cef249045d511b1960096f (diff) | |
download | MultiMC-4ed67413ac33f0814b76ffc76ad8c1dae734febf.tar MultiMC-4ed67413ac33f0814b76ffc76ad8c1dae734febf.tar.gz MultiMC-4ed67413ac33f0814b76ffc76ad8c1dae734febf.tar.lz MultiMC-4ed67413ac33f0814b76ffc76ad8c1dae734febf.tar.xz MultiMC-4ed67413ac33f0814b76ffc76ad8c1dae734febf.zip |
GH-988 add ability to toggle mods with keyboard
Diffstat (limited to 'application')
-rw-r--r-- | application/pages/instance/ModFolderPage.cpp | 9 | ||||
-rw-r--r-- | application/pages/instance/ModFolderPage.h | 1 |
2 files changed, 10 insertions, 0 deletions
diff --git a/application/pages/instance/ModFolderPage.cpp b/application/pages/instance/ModFolderPage.cpp index 97002824..9e987e95 100644 --- a/application/pages/instance/ModFolderPage.cpp +++ b/application/pages/instance/ModFolderPage.cpp @@ -139,6 +139,7 @@ ModFolderPage::ModFolderPage( ui->modTreeView->sortByColumn(1, Qt::AscendingOrder); ui->modTreeView->setContextMenuPolicy(Qt::CustomContextMenu); connect(ui->modTreeView, &ModListView::customContextMenuRequested, this, &ModFolderPage::ShowContextMenu); + connect(ui->modTreeView, &ModListView::activated, this, &ModFolderPage::modItemActivated); auto smodel = ui->modTreeView->selectionModel(); connect(smodel, &QItemSelectionModel::currentChanged, this, &ModFolderPage::modCurrent); @@ -146,6 +147,14 @@ ModFolderPage::ModFolderPage( connect(m_inst, &BaseInstance::runningStatusChanged, this, &ModFolderPage::on_RunningState_changed); } +void ModFolderPage::modItemActivated(const QModelIndex& index) +{ + auto modsModelIndex = m_filterModel->mapToSource(index); + if(modsModelIndex.isValid()) { + m_mods->toggleEnabled(modsModelIndex); + } +} + QMenu * ModFolderPage::createPopupMenu() { QMenu* filteredMenu = QMainWindow::createPopupMenu(); diff --git a/application/pages/instance/ModFolderPage.h b/application/pages/instance/ModFolderPage.h index a99ab161..d49d25c3 100644 --- a/application/pages/instance/ModFolderPage.h +++ b/application/pages/instance/ModFolderPage.h @@ -94,6 +94,7 @@ slots: private slots: + void modItemActivated(const QModelIndex &index); void on_filterTextChanged(const QString & newContents); void on_RunningState_changed(bool running); void on_actionAdd_triggered(); |