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// Qt-Security score:significant reason:default
4
5#ifndef QQNXKEYTRANSLATOR_H
6#define QQNXKEYTRANSLATOR_H
7
8#include <sys/keycodes.h>
9
11
13{
14 switch (key) {
15 case KEYCODE_PAUSE: return Qt::Key_Pause;
16 case KEYCODE_SCROLL_LOCK: return Qt::Key_ScrollLock;
17 case KEYCODE_PRINT: return Qt::Key_Print;
18 case KEYCODE_SYSREQ: return Qt::Key_SysReq;
19// case KEYCODE_BREAK:
20 case KEYCODE_ESCAPE: return Qt::Key_Escape;
21 case KEYCODE_BACKSPACE: return Qt::Key_Backspace;
22 case KEYCODE_TAB: return Qt::Key_Tab;
23 case KEYCODE_BACK_TAB: return Qt::Key_Backtab;
24 case KEYCODE_RETURN: return Qt::Key_Return;
25 case KEYCODE_CAPS_LOCK: return Qt::Key_CapsLock;
26 case KEYCODE_LEFT_SHIFT: return Qt::Key_Shift;
27 case KEYCODE_RIGHT_SHIFT: return Qt::Key_Shift;
28 case KEYCODE_LEFT_CTRL: return Qt::Key_Control;
29 case KEYCODE_RIGHT_CTRL: return Qt::Key_Control;
30 case KEYCODE_LEFT_ALT: return Qt::Key_Alt;
31 case KEYCODE_RIGHT_ALT: return Qt::Key_Alt;
32 case KEYCODE_MENU: return Qt::Key_Menu;
33 case KEYCODE_LEFT_HYPER: return Qt::Key_Hyper_L;
34 case KEYCODE_RIGHT_HYPER: return Qt::Key_Hyper_R;
35 case KEYCODE_INSERT: return Qt::Key_Insert;
36 case KEYCODE_HOME: return Qt::Key_Home;
37 case KEYCODE_PG_UP: return Qt::Key_PageUp;
38 case KEYCODE_DELETE: return Qt::Key_Delete;
39 case KEYCODE_END: return Qt::Key_End;
40 case KEYCODE_PG_DOWN: return Qt::Key_PageDown;
41 case KEYCODE_LEFT: return Qt::Key_Left;
42 case KEYCODE_RIGHT: return Qt::Key_Right;
43 case KEYCODE_UP: return Qt::Key_Up;
44 case KEYCODE_DOWN: return Qt::Key_Down;
45 case KEYCODE_NUM_LOCK: return Qt::Key_NumLock;
46 case KEYCODE_KP_PLUS: return Qt::Key_Plus;
47 case KEYCODE_KP_MINUS: return Qt::Key_Minus;
48 case KEYCODE_KP_MULTIPLY: return Qt::Key_Asterisk;
49 case KEYCODE_KP_DIVIDE: return Qt::Key_Slash;
50 case KEYCODE_KP_ENTER: return Qt::Key_Enter;
51 case KEYCODE_KP_HOME: return Qt::Key_Home;
52 case KEYCODE_KP_UP: return Qt::Key_Up;
53 case KEYCODE_KP_PG_UP: return Qt::Key_PageUp;
54 case KEYCODE_KP_LEFT: return Qt::Key_Left;
55 case KEYCODE_KP_FIVE: return Qt::Key_Clear;
56 case KEYCODE_KP_RIGHT: return Qt::Key_Right;
57 case KEYCODE_KP_END: return Qt::Key_End;
58 case KEYCODE_KP_DOWN: return Qt::Key_Down;
59 case KEYCODE_KP_PG_DOWN: return Qt::Key_PageDown;
60 case KEYCODE_KP_INSERT: return Qt::Key_Insert;
61 case KEYCODE_KP_DELETE: return Qt::Key_Delete;
62 case KEYCODE_F1: return Qt::Key_F1;
63 case KEYCODE_F2: return Qt::Key_F2;
64 case KEYCODE_F3: return Qt::Key_F3;
65 case KEYCODE_F4: return Qt::Key_F4;
66 case KEYCODE_F5: return Qt::Key_F5;
67 case KEYCODE_F6: return Qt::Key_F6;
68 case KEYCODE_F7: return Qt::Key_F7;
69 case KEYCODE_F8: return Qt::Key_F8;
70 case KEYCODE_F9: return Qt::Key_F9;
71 case KEYCODE_F10: return Qt::Key_F10;
72 case KEYCODE_F11: return Qt::Key_F11;
73 case KEYCODE_F12: return Qt::Key_F12;
74
75 // See keycodes.h for more, but these are all the basics. And printables are already included.
76
77 default:
78#if defined(QQNXEVENTTHREAD_DEBUG)
79 qDebug("QQNX: unknown key for translation: %d", key);
80#endif
81 break;
82 }
83
84 return Qt::Key_unknown;
85}
86
88{
89 switch (key) {
90 case KEYCODE_ESCAPE: return QStringLiteral("\x1B");
91 case KEYCODE_BACKSPACE: return QStringLiteral("\b");
92 case KEYCODE_TAB: return QStringLiteral("\t");
93 case KEYCODE_RETURN: return QStringLiteral("\r");
94 case KEYCODE_DELETE: return QStringLiteral("\x7F");
95 case KEYCODE_KP_ENTER: return QStringLiteral("\r");
96 }
97
98 return QString();
99}
100
101bool isKeypadKey( int key )
102{
103 switch (key)
104 {
105 case KEYCODE_KP_PLUS:
106 case KEYCODE_KP_MINUS:
107 case KEYCODE_KP_MULTIPLY:
108 case KEYCODE_KP_DIVIDE:
109 case KEYCODE_KP_ENTER:
110 case KEYCODE_KP_HOME:
111 case KEYCODE_KP_UP:
112 case KEYCODE_KP_PG_UP:
113 case KEYCODE_KP_LEFT:
114 case KEYCODE_KP_FIVE:
115 case KEYCODE_KP_RIGHT:
116 case KEYCODE_KP_END:
117 case KEYCODE_KP_DOWN:
118 case KEYCODE_KP_PG_DOWN:
119 case KEYCODE_KP_INSERT:
120 case KEYCODE_KP_DELETE:
121 return true;
122 default:
123 break;
124 }
125
126 return false;
127}
128
129QT_END_NAMESPACE
130
131#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:60
The QQnxWindow is the base class of the various classes used as instances of QPlatformWindow in the Q...
Definition qqnxwindow.h:32
void handlePostEvent()
void handleActivationEvent()
Combined button and popup list for selecting options.
Q_LOGGING_CATEGORY(lcEventDispatcher, "qt.eventdispatcher")
#define Q_SCREEN_CHECKERROR(x, message)
Definition qqnxglobal.h:17
QString keyStringForPrivateUseQnxKey(int key)
bool isKeypadKey(int key)
QT_BEGIN_NAMESPACE int qtKeyForPrivateUseQnxKey(int key)
const int SCREEN_PROPERTY_SYM
Definition qqnxscreen.h:29
#define _SCREEN_VERSION
Definition qqnxscreen.h:19
const int SCREEN_PROPERTY_SCAN
Definition qqnxscreen.h:28
const int SCREEN_PROPERTY_FOCUS
Definition qqnxscreen.h:26
const int SCREEN_PROPERTY_MODIFIERS
Definition qqnxscreen.h:27
#define _SCREEN_MAKE_VERSION(major, minor, patch)
Definition qqnxscreen.h:18
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)