15 namespace swift::misc::input
27 if (m_keyCode == Key_Unknown)
return QString();
30 { Key_ShiftLeft, QStringLiteral(
"ShiftLeft") }, { Key_ShiftRight, QStringLiteral(
"ShiftRight") },
31 { Key_ControlLeft, QStringLiteral(
"CtrlLeft") }, { Key_ControlRight, QStringLiteral(
"CtrlRight") },
32 { Key_AltLeft, QStringLiteral(
"AltLeft") }, { Key_AltRight, QStringLiteral(
"AltRight") }
35 if (
isModifier()) {
return keyStrings.value(m_keyCode); }
39 case Key_Multiply:
return QStringLiteral(
"NumMultiply");
40 case Key_Divide:
return QStringLiteral(
"NumDivide");
41 case Key_Numpad0:
return QStringLiteral(
"Num0");
42 case Key_Numpad1:
return QStringLiteral(
"Num1");
43 case Key_Numpad2:
return QStringLiteral(
"Num2");
44 case Key_Numpad3:
return QStringLiteral(
"Num3");
45 case Key_Numpad4:
return QStringLiteral(
"Num4");
46 case Key_Numpad5:
return QStringLiteral(
"Num5");
47 case Key_Numpad6:
return QStringLiteral(
"Num6");
48 case Key_Numpad7:
return QStringLiteral(
"Num7");
49 case Key_Numpad8:
return QStringLiteral(
"Num8");
50 case Key_Numpad9:
return QStringLiteral(
"Num9");
51 case Key_NumpadEqual:
return QStringLiteral(
"Num=");
52 case Key_NumpadMinus:
return QStringLiteral(
"Num-");
53 case Key_NumpadPlus:
return QStringLiteral(
"Num+");
54 case Key_NumpadDelete:
return QStringLiteral(
"Num.");
55 case Key_Esc:
return QStringLiteral(
"Esc");
56 case Key_Space:
return QStringLiteral(
"Space");
57 case Key_Tab:
return QStringLiteral(
"Tab");
58 case Key_Back:
return QStringLiteral(
"Bksp");
59 case Key_Insert:
return QStringLiteral(
"Ins");
60 case Key_Delete:
return QStringLiteral(
"Del");
61 case Key_Home:
return QStringLiteral(
"Home");
62 case Key_End:
return QStringLiteral(
"End");
63 case Key_PageUp:
return QStringLiteral(
"PgUp");
64 case Key_PageDown:
return QStringLiteral(
"PgDn");
65 case Key_CapsLock:
return QStringLiteral(
"CapsLock");
66 case Key_Enter:
return QStringLiteral(
"Enter");
67 case Key_OEM1:
return QStringLiteral(
"OEM1");
68 case Key_OEM2:
return QStringLiteral(
"OEM2");
69 case Key_OEM3:
return QStringLiteral(
"OEM3");
70 case Key_OEM4:
return QStringLiteral(
"OEM4");
71 case Key_OEM5:
return QStringLiteral(
"OEM5");
72 case Key_OEM6:
return QStringLiteral(
"OEM6");
73 case Key_OEM7:
return QStringLiteral(
"OEM7");
74 case Key_OEM8:
return QStringLiteral(
"OEM8");
75 case Key_OEM102:
return QStringLiteral(
"OEM102");
76 case Key_DeadGrave:
return QStringLiteral(
"DeadGrave");
77 case Key_Function1:
return QStringLiteral(
"F1");
78 case Key_Function2:
return QStringLiteral(
"F2");
79 case Key_Function3:
return QStringLiteral(
"F3");
80 case Key_Function4:
return QStringLiteral(
"F4");
81 case Key_Function5:
return QStringLiteral(
"F5");
82 case Key_Function6:
return QStringLiteral(
"F6");
83 case Key_Function7:
return QStringLiteral(
"F7");
84 case Key_Function8:
return QStringLiteral(
"F8");
85 case Key_Function9:
return QStringLiteral(
"F9");
86 case Key_Function10:
return QStringLiteral(
"F10");
87 case Key_Function11:
return QStringLiteral(
"F11");
88 case Key_Function12:
return QStringLiteral(
"F12");
89 case Key_Function13:
return QStringLiteral(
"F13");
90 case Key_Function14:
return QStringLiteral(
"F14");
91 case Key_Function15:
return QStringLiteral(
"F15");
92 case Key_Function16:
return QStringLiteral(
"F16");
93 case Key_Function17:
return QStringLiteral(
"F17");
94 case Key_Function18:
return QStringLiteral(
"F18");
95 case Key_Function19:
return QStringLiteral(
"F19");
96 case Key_Function20:
return QStringLiteral(
"F20");
97 case Key_Function21:
return QStringLiteral(
"F21");
98 case Key_Function22:
return QStringLiteral(
"F22");
99 case Key_Function23:
return QStringLiteral(
"F23");
100 case Key_Function24:
return QStringLiteral(
"F24");
101 default:
return QChar::fromLatin1(
static_cast<char>(m_keyCode));
105 const QList<KeyCode> &CKeyboardKey::allModifiers()
107 static const QList<KeyCode> allModifiers = {
108 Key_ShiftLeft, Key_ShiftRight, Key_ControlLeft, Key_ControlRight, Key_AltLeft, Key_AltRight,
115 if (index.
isMyself()) {
return QVariant::fromValue(*
this); }
119 case IndexKey:
return QVariant::fromValue(m_keyCode);
120 case IndexKeyAsString:
return QVariant::fromValue(
getKeyAsString());
124 Q_ASSERT_X(
false,
"CKeyboardKey",
"index unknown");
125 QString m = QString(
"no property, index ").append(index.
toQString());
126 return QVariant::fromValue(m);
140 case IndexKeyAsString: qFatal(
"Not implemented");
break;
142 default: Q_ASSERT_X(
false,
"CKeyboardKey",
"index unknown (setter)");
break;
Non-owning reference to a CPropertyIndex with a subset of its features.
QString toQString(bool i18n=false) const
Cast as QString.
CastType frontCasted() const
First element casted to given type, usually the PropertIndex enum.
bool isMyself() const
Myself index, used with nesting.
KeyCode
Key code http://www.kbdlayout.info/.
#define SWIFT_DEFINE_VALUEOBJECT_MIXINS(Namespace, Class)
Explicit template definition of mixins for a CValueObject subclass.