Qt: Fix invalid names for modifier keys (fixes #525)
Vicki Pfau vi@endrift.com
Fri, 14 Feb 2020 20:38:56 -0800
2 files changed,
31 insertions(+),
1 deletions(-)
M
CHANGES
→
CHANGES
@@ -40,6 +40,7 @@ - Qt: Fix window title not updating after shutting down game
- Qt: Fix GIF view not allowing manual filename entry - Qt: Fix non-GB build (fixes mgba.io/i/1664) - Qt: Fix pausing Qt Multimedia audio (fixes mgba.io/i/1643) + - Qt: Fix invalid names for modifier keys (fixes mgba.io/i/525) - Util: Fix crash reading invalid ELFs - VFS: Fix handle leak when double-mapping (fixes mgba.io/i/1659) Misc:
M
src/platform/qt/KeyEditor.cpp
→
src/platform/qt/KeyEditor.cpp
@@ -9,6 +9,7 @@ #include "GamepadAxisEvent.h"
#include "GamepadButtonEvent.h" #include "ShortcutController.h" +#include <QCoreApplication> #include <QFontMetrics> #include <QKeyEvent>@@ -32,7 +33,35 @@ } else {
if (key < 0) { setText(tr("---")); } else { - setText(QKeySequence(key).toString(QKeySequence::NativeText)); + QKeySequence seq(key); + switch (key) { +#ifndef Q_OS_MAC + case Qt::Key_Shift: + setText(QCoreApplication::translate("QShortcut", "Shift")); + break; + case Qt::Key_Control: + setText(QCoreApplication::translate("QShortcut", "Control")); + break; + case Qt::Key_Alt: + setText(QCoreApplication::translate("QShortcut", "Alt")); + break; + case Qt::Key_Meta: + setText(QCoreApplication::translate("QShortcut", "Meta")); + break; +#endif + case Qt::Key_Super_L: + setText(tr("Super (L)")); + break; + case Qt::Key_Super_R: + setText(tr("Super (R)")); + break; + case Qt::Key_Menu: + setText(tr("Menu")); + break; + default: + setText(QKeySequence(key).toString(QKeySequence::NativeText)); + break; + } } } emit valueChanged(key);