Qt: Fix invalid names for modifier keys (fixes #525)

This commit is contained in:
Vicki Pfau 2020-02-14 20:38:56 -08:00
parent a5fc8429eb
commit f0ff8d5f82
2 changed files with 31 additions and 1 deletions

View File

@ -40,6 +40,7 @@ Other fixes:
- 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:

View File

@ -9,6 +9,7 @@
#include "GamepadButtonEvent.h"
#include "ShortcutController.h"
#include <QCoreApplication>
#include <QFontMetrics>
#include <QKeyEvent>
@ -32,7 +33,35 @@ void KeyEditor::setValue(int key) {
if (key < 0) {
setText(tr("---"));
} else {
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);