From 2a7027f794267effe651b242956ed669c242e9ca Mon Sep 17 00:00:00 2001 From: StapleButter Date: Tue, 19 May 2020 13:46:31 +0200 Subject: add AltGr, weak attempt at blocking garbage key names --- src/frontend/qt_sdl/InputConfigDialog.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/frontend/qt_sdl') diff --git a/src/frontend/qt_sdl/InputConfigDialog.cpp b/src/frontend/qt_sdl/InputConfigDialog.cpp index 3b006fd..54251a1 100644 --- a/src/frontend/qt_sdl/InputConfigDialog.cpp +++ b/src/frontend/qt_sdl/InputConfigDialog.cpp @@ -235,6 +235,7 @@ printf("KEY PRESSED = %08X %08X | %08X %08X %08X | %08X\n", event->key(), event- int key = event->key(); bool ismod = (key == Qt::Key_Control || key == Qt::Key_Alt || + key == Qt::Key_AltGr || key == Qt::Key_Shift || key == Qt::Key_Meta); @@ -284,11 +285,17 @@ QString KeyMapButton::mappingText() case Qt::Key_Control: return "Ctrl"; case Qt::Key_Alt: return "Alt"; + case Qt::Key_AltGr: return "AltGr"; case Qt::Key_Shift: return "Shift"; case Qt::Key_Meta: return "Meta"; } QKeySequence seq(key); QString ret = seq.toString(); + + // weak attempt at detecting garbage key names + if (ret.length() == 2 && ret[0].unicode() > 0xFF) + return QString("[%1]").arg(key, 8, 16); + return ret.replace("&", "&&"); } -- cgit v1.2.3