aboutsummaryrefslogtreecommitdiff
path: root/launcher/ui/pages
diff options
context:
space:
mode:
Diffstat (limited to 'launcher/ui/pages')
-rw-r--r--launcher/ui/pages/modplatform/ModModel.cpp1
-rw-r--r--launcher/ui/pages/modplatform/ModPage.cpp16
2 files changed, 17 insertions, 0 deletions
diff --git a/launcher/ui/pages/modplatform/ModModel.cpp b/launcher/ui/pages/modplatform/ModModel.cpp
index 5861fcc6..84f6f4c4 100644
--- a/launcher/ui/pages/modplatform/ModModel.cpp
+++ b/launcher/ui/pages/modplatform/ModModel.cpp
@@ -2,6 +2,7 @@
#include "BuildConfig.h"
#include "Json.h"
+#include "ModPage.h"
#include "minecraft/MinecraftInstance.h"
#include "minecraft/PackProfile.h"
#include "ui/dialogs/ModDownloadDialog.h"
diff --git a/launcher/ui/pages/modplatform/ModPage.cpp b/launcher/ui/pages/modplatform/ModPage.cpp
index a9a37b4b..c355f069 100644
--- a/launcher/ui/pages/modplatform/ModPage.cpp
+++ b/launcher/ui/pages/modplatform/ModPage.cpp
@@ -76,6 +76,7 @@ ModPage::ModPage(ModDownloadDialog* dialog, BaseInstance* instance, ModAPI* api)
});
ui->packView->setItemDelegate(new ProjectItemDelegate(this));
+ ui->packView->installEventFilter(this);
}
ModPage::~ModPage()
@@ -101,6 +102,18 @@ auto ModPage::eventFilter(QObject* watched, QEvent* event) -> bool
keyEvent->accept();
return true;
}
+ } else if (watched == ui->packView && event->type() == QEvent::KeyPress) {
+ auto* keyEvent = dynamic_cast<QKeyEvent*>(event);
+ if (keyEvent->key() == Qt::Key_Return) {
+ onModSelected();
+
+ // To have the 'select mod' button outlined instead of the 'review and confirm' one
+ ui->modSelectionButton->setFocus(Qt::FocusReason::ShortcutFocusReason);
+ ui->packView->setFocus(Qt::FocusReason::NoFocusReason);
+
+ keyEvent->accept();
+ return true;
+ }
}
return QWidget::eventFilter(watched, event);
}
@@ -172,6 +185,9 @@ void ModPage::onVersionSelectionChanged(QString data)
void ModPage::onModSelected()
{
+ if (selectedVersion < 0)
+ return;
+
auto& version = current.versions[selectedVersion];
if (dialog->isModSelected(current.name, version.fileName)) {
dialog->removeSelectedMod(current.name);