Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qqnxkeytranslator.h
Go to the documentation of this file.
1// Copyright (C) 2011 - 2012 Research In Motion
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QQNXKEYTRANSLATOR_H
5#define QQNXKEYTRANSLATOR_H
6
7#include <sys/keycodes.h>
8
10
12{
13 switch (key) {
14 case KEYCODE_PAUSE: return Qt::Key_Pause;
15 case KEYCODE_SCROLL_LOCK: return Qt::Key_ScrollLock;
16 case KEYCODE_PRINT: return Qt::Key_Print;
17 case KEYCODE_SYSREQ: return Qt::Key_SysReq;
18// case KEYCODE_BREAK:
19 case KEYCODE_ESCAPE: return Qt::Key_Escape;
20 case KEYCODE_BACKSPACE: return Qt::Key_Backspace;
21 case KEYCODE_TAB: return Qt::Key_Tab;
22 case KEYCODE_BACK_TAB: return Qt::Key_Backtab;
23 case KEYCODE_RETURN: return Qt::Key_Return;
24 case KEYCODE_CAPS_LOCK: return Qt::Key_CapsLock;
25 case KEYCODE_LEFT_SHIFT: return Qt::Key_Shift;
26 case KEYCODE_RIGHT_SHIFT: return Qt::Key_Shift;
27 case KEYCODE_LEFT_CTRL: return Qt::Key_Control;
28 case KEYCODE_RIGHT_CTRL: return Qt::Key_Control;
29 case KEYCODE_LEFT_ALT: return Qt::Key_Alt;
30 case KEYCODE_RIGHT_ALT: return Qt::Key_Alt;
31 case KEYCODE_MENU: return Qt::Key_Menu;
32 case KEYCODE_LEFT_HYPER: return Qt::Key_Hyper_L;
33 case KEYCODE_RIGHT_HYPER: return Qt::Key_Hyper_R;
34 case KEYCODE_INSERT: return Qt::Key_Insert;
35 case KEYCODE_HOME: return Qt::Key_Home;
36 case KEYCODE_PG_UP: return Qt::Key_PageUp;
37 case KEYCODE_DELETE: return Qt::Key_Delete;
38 case KEYCODE_END: return Qt::Key_End;
39 case KEYCODE_PG_DOWN: return Qt::Key_PageDown;
40 case KEYCODE_LEFT: return Qt::Key_Left;
41 case KEYCODE_RIGHT: return Qt::Key_Right;
42 case KEYCODE_UP: return Qt::Key_Up;
43 case KEYCODE_DOWN: return Qt::Key_Down;
44 case KEYCODE_NUM_LOCK: return Qt::Key_NumLock;
45 case KEYCODE_KP_PLUS: return Qt::Key_Plus;
46 case KEYCODE_KP_MINUS: return Qt::Key_Minus;
47 case KEYCODE_KP_MULTIPLY: return Qt::Key_Asterisk;
48 case KEYCODE_KP_DIVIDE: return Qt::Key_Slash;
49 case KEYCODE_KP_ENTER: return Qt::Key_Enter;
50 case KEYCODE_KP_HOME: return Qt::Key_Home;
51 case KEYCODE_KP_UP: return Qt::Key_Up;
52 case KEYCODE_KP_PG_UP: return Qt::Key_PageUp;
53 case KEYCODE_KP_LEFT: return Qt::Key_Left;
54 case KEYCODE_KP_FIVE: return Qt::Key_Clear;
55 case KEYCODE_KP_RIGHT: return Qt::Key_Right;
56 case KEYCODE_KP_END: return Qt::Key_End;
57 case KEYCODE_KP_DOWN: return Qt::Key_Down;
58 case KEYCODE_KP_PG_DOWN: return Qt::Key_PageDown;
59 case KEYCODE_KP_INSERT: return Qt::Key_Insert;
60 case KEYCODE_KP_DELETE: return Qt::Key_Delete;
61 case KEYCODE_F1: return Qt::Key_F1;
62 case KEYCODE_F2: return Qt::Key_F2;
63 case KEYCODE_F3: return Qt::Key_F3;
64 case KEYCODE_F4: return Qt::Key_F4;
65 case KEYCODE_F5: return Qt::Key_F5;
66 case KEYCODE_F6: return Qt::Key_F6;
67 case KEYCODE_F7: return Qt::Key_F7;
68 case KEYCODE_F8: return Qt::Key_F8;
69 case KEYCODE_F9: return Qt::Key_F9;
70 case KEYCODE_F10: return Qt::Key_F10;
71 case KEYCODE_F11: return Qt::Key_F11;
72 case KEYCODE_F12: return Qt::Key_F12;
73
74 // See keycodes.h for more, but these are all the basics. And printables are already included.
75
76 default:
77#if defined(QQNXEVENTTHREAD_DEBUG)
78 qDebug("QQNX: unknown key for translation: %d", key);
79#endif
80 break;
81 }
82
83 return Qt::Key_unknown;
84}
85
87{
88 switch (key) {
89 case KEYCODE_ESCAPE: return QStringLiteral("\x1B");
90 case KEYCODE_BACKSPACE: return QStringLiteral("\b");
91 case KEYCODE_TAB: return QStringLiteral("\t");
92 case KEYCODE_RETURN: return QStringLiteral("\r");
93 case KEYCODE_DELETE: return QStringLiteral("\x7F");
94 case KEYCODE_KP_ENTER: return QStringLiteral("\r");
95 }
96
97 return QString();
98}
99
100bool isKeypadKey( int key )
101{
102 switch (key)
103 {
104 case KEYCODE_KP_PLUS:
105 case KEYCODE_KP_MINUS:
106 case KEYCODE_KP_MULTIPLY:
107 case KEYCODE_KP_DIVIDE:
108 case KEYCODE_KP_ENTER:
109 case KEYCODE_KP_HOME:
110 case KEYCODE_KP_UP:
111 case KEYCODE_KP_PG_UP:
112 case KEYCODE_KP_LEFT:
113 case KEYCODE_KP_FIVE:
114 case KEYCODE_KP_RIGHT:
115 case KEYCODE_KP_END:
116 case KEYCODE_KP_DOWN:
117 case KEYCODE_KP_PG_DOWN:
118 case KEYCODE_KP_INSERT:
119 case KEYCODE_KP_DELETE:
120 return true;
121 default:
122 break;
123 }
124
125 return false;
126}
127
128QT_END_NAMESPACE
129
130#endif // QQNXKEYTRANSLATOR_H
static QQnxIntegration * instance()
void removeDisplay(QQnxScreen *screen)
void removeScreenEventFilter(QQnxScreenEventFilter *filter)
void setScreenEventThread(QQnxScreenEventThread *eventThread)
void timerEvent(QTimerEvent *event) override
This event handler can be reimplemented in a subclass to receive timer events for the object.
bool handleEvent(screen_event_t event)
static void injectKeyboardEvent(int flags, int sym, int mod, int scan, int cap)
void addScreenEventFilter(QQnxScreenEventFilter *filter)
bool handleEvent(screen_event_t event, int qnxType)
bool isPrimaryScreen() const
Definition qqnxscreen.h:61
The QQnxWindow is the base class of the various classes used as instances of QPlatformWindow in the Q...
Definition qqnxwindow.h:31
void handleActivationEvent()
Q_LOGGING_CATEGORY(lcEventDispatcher, "qt.eventdispatcher")
#define Q_SCREEN_CHECKERROR(x, message)
Definition qqnxglobal.h:13
QString keyStringForPrivateUseQnxKey(int key)
bool isKeypadKey(int key)
QT_BEGIN_NAMESPACE int qtKeyForPrivateUseQnxKey(int key)
#define _SCREEN_VERSION
Definition qqnxscreen.h:18
const int SCREEN_PROPERTY_FOCUS
Definition qqnxscreen.h:25
#define _SCREEN_MAKE_VERSION(major, minor, patch)
Definition qqnxscreen.h:17
Q_DECLARE_LOGGING_CATEGORY(lcQpaScreenEvents)
static int qtKey(int virtualKey, QChar::Category category)
static QString keyString(int sym, QChar::Category category)
static void finishCloseEvent(screen_event_t event)
static QString capKeyString(int cap, int modifiers, int key)
static void finishCloseEvent(screen_event_t event)