GNU Octave  6.2.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
KeyMap.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 2011-2021 The Octave Project Developers
4 //
5 // See the file COPYRIGHT.md in the top-level directory of this
6 // distribution or <https://octave.org/copyright/>.
7 //
8 // This file is part of Octave.
9 //
10 // Octave is free software: you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // Octave is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with Octave; see the file COPYING. If not, see
22 // <https://www.gnu.org/licenses/>.
23 //
24 ////////////////////////////////////////////////////////////////////////
25 
26 #if defined (HAVE_CONFIG_H)
27 # include "config.h"
28 #endif
29 
30 #include <QMap>
31 #include <Qt>
32 
33 #include "KeyMap.h"
34 
35 namespace QtHandles
36 {
37  namespace KeyMap
38  {
40  {
41  QMap<int, std::string> keyMapper;
42 
43  keyMapper[Qt::Key_Escape] = "escape";
44  keyMapper[Qt::Key_Tab] = "tab";
45  keyMapper[Qt::Key_Backtab] = "backtab";
46  keyMapper[Qt::Key_Backspace] = "backspace";
47  keyMapper[Qt::Key_Return] = "return";
48  keyMapper[Qt::Key_Enter] = "enter";
49  keyMapper[Qt::Key_Insert] = "insert";
50  keyMapper[Qt::Key_Delete] = "delete";
51  keyMapper[Qt::Key_Pause] = "pause";
52  keyMapper[Qt::Key_Print] = "print";
53  keyMapper[Qt::Key_SysReq] = "sysreq";
54  keyMapper[Qt::Key_Clear] = "clear";
55  keyMapper[Qt::Key_Home] = "home";
56  keyMapper[Qt::Key_End] = "end";
57  keyMapper[Qt::Key_Left] = "left";
58  keyMapper[Qt::Key_Up] = "up";
59  keyMapper[Qt::Key_Right] = "right";
60  keyMapper[Qt::Key_Down] = "down";
61  keyMapper[Qt::Key_PageUp] = "pageup";
62  keyMapper[Qt::Key_PageDown] = "pagedown";
63  keyMapper[Qt::Key_Shift] = "shift";
64  keyMapper[Qt::Key_Control] = "control";
65  keyMapper[Qt::Key_Meta] = "meta";
66  keyMapper[Qt::Key_Alt] = "alt";
67  keyMapper[Qt::Key_CapsLock] = "capslock";
68  keyMapper[Qt::Key_NumLock] = "numlock";
69  keyMapper[Qt::Key_ScrollLock] = "scrolllock";
70  keyMapper[Qt::Key_F1] = "f1";
71  keyMapper[Qt::Key_F2] = "f2";
72  keyMapper[Qt::Key_F3] = "f3";
73  keyMapper[Qt::Key_F4] = "f4";
74  keyMapper[Qt::Key_F5] = "f5";
75  keyMapper[Qt::Key_F6] = "f6";
76  keyMapper[Qt::Key_F7] = "f7";
77  keyMapper[Qt::Key_F8] = "f8";
78  keyMapper[Qt::Key_F9] = "f9";
79  keyMapper[Qt::Key_F10] = "f10";
80  keyMapper[Qt::Key_F11] = "f11";
81  keyMapper[Qt::Key_F12] = "f12";
82  keyMapper[Qt::Key_F13] = "f13";
83  keyMapper[Qt::Key_F14] = "f14";
84  keyMapper[Qt::Key_F15] = "f15";
85  keyMapper[Qt::Key_F16] = "f16";
86  keyMapper[Qt::Key_F17] = "f17";
87  keyMapper[Qt::Key_F18] = "f18";
88  keyMapper[Qt::Key_F19] = "f19";
89  keyMapper[Qt::Key_F20] = "f20";
90  keyMapper[Qt::Key_F21] = "f21";
91  keyMapper[Qt::Key_F22] = "f22";
92  keyMapper[Qt::Key_F23] = "f23";
93  keyMapper[Qt::Key_F24] = "f24";
94  keyMapper[Qt::Key_F25] = "f25";
95  keyMapper[Qt::Key_F26] = "f26";
96  keyMapper[Qt::Key_F27] = "f27";
97  keyMapper[Qt::Key_F28] = "f28";
98  keyMapper[Qt::Key_F29] = "f29";
99  keyMapper[Qt::Key_F30] = "f30";
100  keyMapper[Qt::Key_F31] = "f31";
101  keyMapper[Qt::Key_F32] = "f32";
102  keyMapper[Qt::Key_F33] = "f33";
103  keyMapper[Qt::Key_F34] = "f34";
104  keyMapper[Qt::Key_F35] = "f35";
105  keyMapper[Qt::Key_Super_L] = "super_l";
106  keyMapper[Qt::Key_Super_R] = "super_r";
107  keyMapper[Qt::Key_Menu] = "menu";
108  keyMapper[Qt::Key_Hyper_L] = "hyper_l";
109  keyMapper[Qt::Key_Hyper_R] = "hyper_r";
110  keyMapper[Qt::Key_Help] = "help";
111  keyMapper[Qt::Key_Direction_L] = "direction_l";
112  keyMapper[Qt::Key_Direction_R] = "direction_r";
113  keyMapper[Qt::Key_Space] = "space";
114  keyMapper[Qt::Key_Exclam] = "exclam";
115  keyMapper[Qt::Key_QuoteDbl] = "quotedbl";
116  keyMapper[Qt::Key_NumberSign] = "numbersign";
117  keyMapper[Qt::Key_Dollar] = "dollar";
118  keyMapper[Qt::Key_Percent] = "percent";
119  keyMapper[Qt::Key_Ampersand] = "ampersand";
120  keyMapper[Qt::Key_Apostrophe] = "apostrophe";
121  keyMapper[Qt::Key_ParenLeft] = "parenleft";
122  keyMapper[Qt::Key_ParenRight] = "parenright";
123  keyMapper[Qt::Key_Asterisk] = "asterisk";
124  keyMapper[Qt::Key_Plus] = "plus";
125  keyMapper[Qt::Key_Comma] = "comma";
126  keyMapper[Qt::Key_Minus] = "minus";
127  keyMapper[Qt::Key_Period] = "period";
128  keyMapper[Qt::Key_Slash] = "slash";
129  keyMapper[Qt::Key_0] = "0";
130  keyMapper[Qt::Key_1] = "1";
131  keyMapper[Qt::Key_2] = "2";
132  keyMapper[Qt::Key_3] = "3";
133  keyMapper[Qt::Key_4] = "4";
134  keyMapper[Qt::Key_5] = "5";
135  keyMapper[Qt::Key_6] = "6";
136  keyMapper[Qt::Key_7] = "7";
137  keyMapper[Qt::Key_8] = "8";
138  keyMapper[Qt::Key_9] = "9";
139  keyMapper[Qt::Key_Colon] = "colon";
140  keyMapper[Qt::Key_Semicolon] = "semicolon";
141  keyMapper[Qt::Key_Less] = "less";
142  keyMapper[Qt::Key_Equal] = "equal";
143  keyMapper[Qt::Key_Greater] = "greater";
144  keyMapper[Qt::Key_Question] = "question";
145  keyMapper[Qt::Key_At] = "at";
146  keyMapper[Qt::Key_A] = "a";
147  keyMapper[Qt::Key_B] = "b";
148  keyMapper[Qt::Key_C] = "c";
149  keyMapper[Qt::Key_D] = "d";
150  keyMapper[Qt::Key_E] = "e";
151  keyMapper[Qt::Key_F] = "f";
152  keyMapper[Qt::Key_G] = "g";
153  keyMapper[Qt::Key_H] = "h";
154  keyMapper[Qt::Key_I] = "i";
155  keyMapper[Qt::Key_J] = "j";
156  keyMapper[Qt::Key_K] = "k";
157  keyMapper[Qt::Key_L] = "l";
158  keyMapper[Qt::Key_M] = "m";
159  keyMapper[Qt::Key_N] = "n";
160  keyMapper[Qt::Key_O] = "o";
161  keyMapper[Qt::Key_P] = "p";
162  keyMapper[Qt::Key_Q] = "q";
163  keyMapper[Qt::Key_R] = "r";
164  keyMapper[Qt::Key_S] = "s";
165  keyMapper[Qt::Key_T] = "t";
166  keyMapper[Qt::Key_U] = "u";
167  keyMapper[Qt::Key_V] = "v";
168  keyMapper[Qt::Key_W] = "w";
169  keyMapper[Qt::Key_X] = "x";
170  keyMapper[Qt::Key_Y] = "y";
171  keyMapper[Qt::Key_Z] = "z";
172  keyMapper[Qt::Key_BracketLeft] = "bracketleft";
173  keyMapper[Qt::Key_Backslash] = "backslash";
174  keyMapper[Qt::Key_BracketRight] = "bracketright";
175  keyMapper[Qt::Key_AsciiCircum] = "asciicircum";
176  keyMapper[Qt::Key_Underscore] = "underscore";
177  keyMapper[Qt::Key_QuoteLeft] = "quoteleft";
178  keyMapper[Qt::Key_BraceLeft] = "braceleft";
179  keyMapper[Qt::Key_Bar] = "bar";
180  keyMapper[Qt::Key_BraceRight] = "braceright";
181  keyMapper[Qt::Key_AsciiTilde] = "asciitilde";
182 
183  keyMapper[Qt::Key_nobreakspace] = "nobreakspace";
184  keyMapper[Qt::Key_exclamdown] = "exclamdown";
185  keyMapper[Qt::Key_cent] = "cent";
186  keyMapper[Qt::Key_sterling] = "sterling";
187  keyMapper[Qt::Key_currency] = "currency";
188  keyMapper[Qt::Key_yen] = "yen";
189  keyMapper[Qt::Key_brokenbar] = "brokenbar";
190  keyMapper[Qt::Key_section] = "section";
191  keyMapper[Qt::Key_diaeresis] = "diaeresis";
192  keyMapper[Qt::Key_copyright] = "copyright";
193  keyMapper[Qt::Key_ordfeminine] = "ordfeminine";
194  keyMapper[Qt::Key_guillemotleft] = "guillemotleft";
195  keyMapper[Qt::Key_notsign] = "notsign";
196  keyMapper[Qt::Key_hyphen] = "hyphen";
197  keyMapper[Qt::Key_registered] = "registered";
198  keyMapper[Qt::Key_macron] = "macron";
199  keyMapper[Qt::Key_degree] = "degree";
200  keyMapper[Qt::Key_plusminus] = "plusminus";
201  keyMapper[Qt::Key_twosuperior] = "twosuperior";
202  keyMapper[Qt::Key_threesuperior] = "threesuperior";
203  keyMapper[Qt::Key_acute] = "acute";
204  keyMapper[Qt::Key_mu] = "mu";
205  keyMapper[Qt::Key_paragraph] = "paragraph";
206  keyMapper[Qt::Key_periodcentered] = "periodcentered";
207  keyMapper[Qt::Key_cedilla] = "cedilla";
208  keyMapper[Qt::Key_onesuperior] = "onesuperior";
209  keyMapper[Qt::Key_masculine] = "masculine";
210  keyMapper[Qt::Key_guillemotright] = "guillemotright";
211  keyMapper[Qt::Key_onequarter] = "onequarter";
212  keyMapper[Qt::Key_onehalf] = "onehalf";
213  keyMapper[Qt::Key_threequarters] = "threequarters";
214  keyMapper[Qt::Key_questiondown] = "questiondown";
215  keyMapper[Qt::Key_Agrave] = "agrave";
216  keyMapper[Qt::Key_Aacute] = "aacute";
217  keyMapper[Qt::Key_Acircumflex] = "acircumflex";
218  keyMapper[Qt::Key_Atilde] = "atilde";
219  keyMapper[Qt::Key_Adiaeresis] = "adiaeresis";
220  keyMapper[Qt::Key_Aring] = "aring";
221  keyMapper[Qt::Key_AE] = "ae";
222  keyMapper[Qt::Key_Ccedilla] = "ccedilla";
223  keyMapper[Qt::Key_Egrave] = "egrave";
224  keyMapper[Qt::Key_Eacute] = "eacute";
225  keyMapper[Qt::Key_Ecircumflex] = "ecircumflex";
226  keyMapper[Qt::Key_Ediaeresis] = "ediaeresis";
227  keyMapper[Qt::Key_Igrave] = "igrave";
228  keyMapper[Qt::Key_Iacute] = "iacute";
229  keyMapper[Qt::Key_Icircumflex] = "icircumflex";
230  keyMapper[Qt::Key_Idiaeresis] = "idiaeresis";
231  keyMapper[Qt::Key_ETH] = "eth";
232  keyMapper[Qt::Key_Ntilde] = "ntilde";
233  keyMapper[Qt::Key_Ograve] = "ograve";
234  keyMapper[Qt::Key_Oacute] = "oacute";
235  keyMapper[Qt::Key_Ocircumflex] = "ocircumflex";
236  keyMapper[Qt::Key_Otilde] = "otilde";
237  keyMapper[Qt::Key_Odiaeresis] = "odiaeresis";
238  keyMapper[Qt::Key_multiply] = "multiply";
239  keyMapper[Qt::Key_Ooblique] = "ooblique";
240  keyMapper[Qt::Key_Ugrave] = "ugrave";
241  keyMapper[Qt::Key_Uacute] = "uacute";
242  keyMapper[Qt::Key_Ucircumflex] = "ucircumflex";
243  keyMapper[Qt::Key_Udiaeresis] = "udiaeresis";
244  keyMapper[Qt::Key_Yacute] = "yacute";
245  keyMapper[Qt::Key_THORN] = "thorn";
246  keyMapper[Qt::Key_ssharp] = "ssharp";
247  keyMapper[Qt::Key_division] = "division";
248  keyMapper[Qt::Key_ydiaeresis] = "ydiaeresis";
249 
250  return keyMapper;
251  }
252 
253  std::string qKeyToKeyString (int key)
254  {
255  static const QMap<int, std::string> keyMapper = makeKeyMapper ();
256 
257  return keyMapper.value (key, "<unknown key>");
258  }
259  }
260 }
QMap< int, std::string > makeKeyMapper(void)
Definition: KeyMap.cc:39
std::string qKeyToKeyString(int key)
Definition: KeyMap.cc:253