Add more special key codes to keyboard keys

ref T404
This commit is contained in:
Roland Winklmeier
2018-10-22 12:14:48 +02:00
committed by Klaus Basan
parent 6cb0ed583e
commit 0f140cb155
6 changed files with 80 additions and 9 deletions

View File

@@ -55,8 +55,22 @@ namespace BlackMisc
if (isModifier()) { return keyStrings.value(m_keyCode); }
QChar key = QChar::fromLatin1(static_cast<char>(m_keyCode));
return key;
switch (m_keyCode)
{
case Key_Multiply: return QStringLiteral("×");
case Key_Divide: return QStringLiteral("÷");
case Key_Numpad0: return QStringLiteral("Num0");
case Key_Numpad1: return QStringLiteral("Num1");
case Key_Numpad2: return QStringLiteral("Num2");
case Key_Numpad3: return QStringLiteral("Num3");
case Key_Numpad4: return QStringLiteral("Num4");
case Key_Numpad5: return QStringLiteral("Num5");
case Key_Numpad6: return QStringLiteral("Num6");
case Key_Numpad7: return QStringLiteral("Num7");
case Key_Numpad8: return QStringLiteral("Num8");
case Key_Numpad9: return QStringLiteral("Num9");
default: return QChar::fromLatin1(static_cast<char>(m_keyCode));
}
}
const QList<KeyCode> &CKeyboardKey::allModifiers()

View File

@@ -22,15 +22,18 @@ namespace BlackMisc
enum KeyCode
{
Key_Unknown,
// Modifiers
Key_ShiftLeft,
Key_ShiftRight,
Key_ControlLeft,
Key_ControlRight,
Key_AltLeft,
Key_AltRight,
Key_Plus = 43,
Key_Comma,
Key_Minus,
Key_Period,
// 0 - 9
Key_0 = 0x30,
Key_0 = 48,
Key_1,
Key_2,
Key_3,
@@ -41,7 +44,7 @@ namespace BlackMisc
Key_8,
Key_9,
// A - Z
Key_A = 0x41,
Key_A = 65,
Key_B,
Key_C,
Key_D,
@@ -67,6 +70,19 @@ namespace BlackMisc
Key_X,
Key_Y,
Key_Z,
// Numpad
Key_Multiply,
Key_Divide,
Key_Numpad0,
Key_Numpad1,
Key_Numpad2,
Key_Numpad3,
Key_Numpad4,
Key_Numpad5,
Key_Numpad6,
Key_Numpad7,
Key_Numpad8,
Key_Numpad9,
};
} //namespace