Compare commits

...

3 Commits

Author SHA1 Message Date
Joe Wagner acd7610525
Merge f8f8049fd3 into 0a0f99dd1b 2024-09-18 09:50:53 -07:00
Joe Wagner f8f8049fd3
fix for formatting 2024-09-18 09:25:33 -07:00
Joe Wagner 0d37ea42f9
Update QtKeyCodes.cpp
This addresses an issue present in EQOA where SHIFT only worked on alpha characters. SHIFT now is detected and works to produce symbols as well.
2024-09-18 08:44:59 -07:00
1 changed files with 55 additions and 0 deletions

View File

@ -13,6 +13,53 @@
#include <QtGui/QKeyEvent>
uint8_t map_text_to_keycode(const QString& text)
{
if (text == "!")
return Qt::Key_1;
if (text == "@")
return Qt::Key_2;
if (text == "#")
return Qt::Key_3;
if (text == "$")
return Qt::Key_4;
if (text == "%")
return Qt::Key_5;
if (text == "^")
return Qt::Key_6;
if (text == "&")
return Qt::Key_7;
if (text == "*")
return Qt::Key_8;
if (text == "(")
return Qt::Key_9;
if (text == ")")
return Qt::Key_0;
if (text == "_")
return Qt::Key_Minus;
if (text == "+")
return Qt::Key_Equal;
if (text == "?")
return Qt::Key_Slash;
if (text == ":")
return Qt::Key_Semicolon;
if (text == "\"")
return Qt::Key_Apostrophe;
if (text == "~")
return Qt::Key_QuoteLeft;
if (text == "<")
return Qt::Key_Comma;
if (text == ">")
return Qt::Key_Period;
if (text == "|")
return Qt::Key_Backslash;
if (text == "{")
return Qt::Key_BracketLeft;
if (text == "}")
return Qt::Key_BracketRight;
return 0; // No remapping
}
struct KeyCodeName
{
int code;
@ -519,7 +566,15 @@ const char* InputManager::ConvertHostKeyboardCodeToIcon(u32 code)
u32 QtUtils::KeyEventToCode(const QKeyEvent* ev)
{
QString text = ev->text();
uint8_t keycode = map_text_to_keycode(text); // Map special text symbols to keycodes
int key = ev->key();
if (keycode != 0)
{
key = keycode; // Override key if mapped
}
Qt::KeyboardModifiers modifiers = ev->modifiers();
#ifdef __APPLE__