mirror of
https://github.com/PCSX2/pcsx2.git
synced 2024-10-06 23:13:25 +00:00
Qt: Fix keyboard SHIFT for non-alpha characters
Some checks failed
🐧 Linux Builds / AppImage (push) Has been skipped
🐧 Linux Builds / Flatpak (push) Has been skipped
🍎 MacOS Builds / Defaults (push) Has been skipped
🖥️ Windows Builds / CMake (push) Has been skipped
🌎 Update Base Translation / Update Base Translation (push) Failing after 0s
📦 Publish Flathub Release / Check if release is needed (push) Failing after 0s
📦 Publish Flathub Release / Build and publish Flatpak (push) Has been skipped
🖥️ Windows Builds / Lint VS Project Files (push) Has been cancelled
🖥️ Windows Builds / SSE4 (push) Has been cancelled
🖥️ Windows Builds / AVX2 (push) Has been cancelled
Some checks failed
🐧 Linux Builds / AppImage (push) Has been skipped
🐧 Linux Builds / Flatpak (push) Has been skipped
🍎 MacOS Builds / Defaults (push) Has been skipped
🖥️ Windows Builds / CMake (push) Has been skipped
🌎 Update Base Translation / Update Base Translation (push) Failing after 0s
📦 Publish Flathub Release / Check if release is needed (push) Failing after 0s
📦 Publish Flathub Release / Build and publish Flatpak (push) Has been skipped
🖥️ Windows Builds / Lint VS Project Files (push) Has been cancelled
🖥️ Windows Builds / SSE4 (push) Has been cancelled
🖥️ Windows Builds / AVX2 (push) Has been cancelled
This commit is contained in:
parent
217e1c8fae
commit
fc715d58f0
@ -13,6 +13,53 @@
|
||||
|
||||
#include <QtGui/QKeyEvent>
|
||||
|
||||
u8 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)
|
||||
{
|
||||
const QString text = ev->text();
|
||||
const u8 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__
|
||||
|
Loading…
Reference in New Issue
Block a user