Changeset 60744 in webkit
- Timestamp:
- Jun 5, 2010, 3:00:02 AM (15 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 2 edited
-
ChangeLog (modified) (1 diff)
-
platform/qt/PlatformKeyboardEventQt.cpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r60743 r60744 1 2010-06-05 Anders Bakken <agbakken@gmail.com> 2 3 Reviewed by Eric Seidel. 4 5 [Qt] PlatformKeyboardEventQt.cpp has coding-style errors 6 https://bugs.webkit.org/show_bug.cgi?id=39770 7 8 * platform/qt/PlatformKeyboardEventQt.cpp: 9 (WebCore::keyIdentifierForQtKeyCode): 10 (WebCore::windowsKeyCodeForKeyEvent): 11 (WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent): 12 1 13 2010-06-05 Anders Bakken <agbakken@gmail.com> 2 14 -
trunk/WebCore/platform/qt/PlatformKeyboardEventQt.cpp
r56704 r60744 32 32 #include "WindowsKeyboardCodes.h" 33 33 34 #include <QKeyEvent> 34 35 #include <ctype.h> 35 36 #include <QKeyEvent>37 36 38 37 namespace WebCore { … … 41 40 { 42 41 switch (keyCode) { 43 case Qt::Key_Menu:44 case Qt::Key_Alt:45 return "Alt";46 case Qt::Key_Clear:47 return "Clear";48 case Qt::Key_Down:49 return "Down";50 case Qt::Key_End:51 return "End";52 case Qt::Key_Return:53 case Qt::Key_Enter:54 return "Enter";55 case Qt::Key_Execute:56 return "Execute";57 case Qt::Key_F1:58 return "F1";59 case Qt::Key_F2:60 return "F2";61 case Qt::Key_F3:62 return "F3";63 case Qt::Key_F4:64 return "F4";65 case Qt::Key_F5:66 return "F5";67 case Qt::Key_F6:68 return "F6";69 case Qt::Key_F7:70 return "F7";71 case Qt::Key_F8:72 return "F8";73 case Qt::Key_F9:74 return "F9";75 case Qt::Key_F10:76 return "F10";77 case Qt::Key_F11:78 return "F11";79 case Qt::Key_F12:80 return "F12";81 case Qt::Key_F13:82 return "F13";83 case Qt::Key_F14:84 return "F14";85 case Qt::Key_F15:86 return "F15";87 case Qt::Key_F16:88 return "F16";89 case Qt::Key_F17:90 return "F17";91 case Qt::Key_F18:92 return "F18";93 case Qt::Key_F19:94 return "F19";95 case Qt::Key_F20:96 return "F20";97 case Qt::Key_F21:98 return "F21";99 case Qt::Key_F22:100 return "F22";101 case Qt::Key_F23:102 return "F23";103 case Qt::Key_F24:104 return "F24";105 case Qt::Key_Help:106 return "Help";107 case Qt::Key_Home:108 return "Home";109 case Qt::Key_Insert:110 return "Insert";111 case Qt::Key_Left:112 return "Left";113 case Qt::Key_PageDown:114 return "PageDown";115 case Qt::Key_PageUp:116 return "PageUp";117 case Qt::Key_Pause:118 return "Pause";119 case Qt::Key_Print:120 return "PrintScreen";121 case Qt::Key_Right:122 return "Right";123 case Qt::Key_Select:124 return "Select";125 case Qt::Key_Up:126 return "Up";127 // Standard says that DEL becomes U+007F.128 case Qt::Key_Delete:129 return "U+007F";130 case Qt::Key_Backspace:131 return "U+0008";132 case Qt::Key_Tab:133 return "U+0009";134 case Qt::Key_Backtab:135 return "U+0009";136 default:137 return String::format("U+%04X", toupper(keyCode));42 case Qt::Key_Menu: 43 case Qt::Key_Alt: 44 return "Alt"; 45 case Qt::Key_Clear: 46 return "Clear"; 47 case Qt::Key_Down: 48 return "Down"; 49 case Qt::Key_End: 50 return "End"; 51 case Qt::Key_Return: 52 case Qt::Key_Enter: 53 return "Enter"; 54 case Qt::Key_Execute: 55 return "Execute"; 56 case Qt::Key_F1: 57 return "F1"; 58 case Qt::Key_F2: 59 return "F2"; 60 case Qt::Key_F3: 61 return "F3"; 62 case Qt::Key_F4: 63 return "F4"; 64 case Qt::Key_F5: 65 return "F5"; 66 case Qt::Key_F6: 67 return "F6"; 68 case Qt::Key_F7: 69 return "F7"; 70 case Qt::Key_F8: 71 return "F8"; 72 case Qt::Key_F9: 73 return "F9"; 74 case Qt::Key_F10: 75 return "F10"; 76 case Qt::Key_F11: 77 return "F11"; 78 case Qt::Key_F12: 79 return "F12"; 80 case Qt::Key_F13: 81 return "F13"; 82 case Qt::Key_F14: 83 return "F14"; 84 case Qt::Key_F15: 85 return "F15"; 86 case Qt::Key_F16: 87 return "F16"; 88 case Qt::Key_F17: 89 return "F17"; 90 case Qt::Key_F18: 91 return "F18"; 92 case Qt::Key_F19: 93 return "F19"; 94 case Qt::Key_F20: 95 return "F20"; 96 case Qt::Key_F21: 97 return "F21"; 98 case Qt::Key_F22: 99 return "F22"; 100 case Qt::Key_F23: 101 return "F23"; 102 case Qt::Key_F24: 103 return "F24"; 104 case Qt::Key_Help: 105 return "Help"; 106 case Qt::Key_Home: 107 return "Home"; 108 case Qt::Key_Insert: 109 return "Insert"; 110 case Qt::Key_Left: 111 return "Left"; 112 case Qt::Key_PageDown: 113 return "PageDown"; 114 case Qt::Key_PageUp: 115 return "PageUp"; 116 case Qt::Key_Pause: 117 return "Pause"; 118 case Qt::Key_Print: 119 return "PrintScreen"; 120 case Qt::Key_Right: 121 return "Right"; 122 case Qt::Key_Select: 123 return "Select"; 124 case Qt::Key_Up: 125 return "Up"; 126 // Standard says that DEL becomes U+007F. 127 case Qt::Key_Delete: 128 return "U+007F"; 129 case Qt::Key_Backspace: 130 return "U+0008"; 131 case Qt::Key_Tab: 132 return "U+0009"; 133 case Qt::Key_Backtab: 134 return "U+0009"; 135 default: 136 return String::format("U+%04X", toupper(keyCode)); 138 137 } 139 138 } … … 145 144 switch (keycode) { 146 145 case Qt::Key_0: 147 return VK_NUMPAD0; // (60) Numeric keypad 0 key146 return VK_NUMPAD0; // (60) Numeric keypad 0 key 148 147 case Qt::Key_1: 149 return VK_NUMPAD1; // (61) Numeric keypad 1 key148 return VK_NUMPAD1; // (61) Numeric keypad 1 key 150 149 case Qt::Key_2: 151 150 return VK_NUMPAD2; // (62) Numeric keypad 2 key 152 151 case Qt::Key_3: 153 return VK_NUMPAD3; // (63) Numeric keypad 3 key152 return VK_NUMPAD3; // (63) Numeric keypad 3 key 154 153 case Qt::Key_4: 155 return VK_NUMPAD4; // (64) Numeric keypad 4 key154 return VK_NUMPAD4; // (64) Numeric keypad 4 key 156 155 case Qt::Key_5: 157 return VK_NUMPAD5; // (65) Numeric keypad 5 key156 return VK_NUMPAD5; // (65) Numeric keypad 5 key 158 157 case Qt::Key_6: 159 return VK_NUMPAD6; // (66) Numeric keypad 6 key158 return VK_NUMPAD6; // (66) Numeric keypad 6 key 160 159 case Qt::Key_7: 161 return VK_NUMPAD7; // (67) Numeric keypad 7 key160 return VK_NUMPAD7; // (67) Numeric keypad 7 key 162 161 case Qt::Key_8: 163 return VK_NUMPAD8; // (68) Numeric keypad 8 key162 return VK_NUMPAD8; // (68) Numeric keypad 8 key 164 163 case Qt::Key_9: 165 return VK_NUMPAD9; // (69) Numeric keypad 9 key164 return VK_NUMPAD9; // (69) Numeric keypad 9 key 166 165 case Qt::Key_Asterisk: 167 166 return VK_MULTIPLY; // (6A) Multiply key 168 167 case Qt::Key_Plus: 169 return VK_ADD; // (6B) Add key168 return VK_ADD; // (6B) Add key 170 169 case Qt::Key_Minus: 171 170 return VK_SUBTRACT; // (6D) Subtract key 172 171 case Qt::Key_Period: 173 return VK_DECIMAL; // (6E) Decimal key172 return VK_DECIMAL; // (6E) Decimal key 174 173 case Qt::Key_Slash: 175 return VK_DIVIDE; // (6F) Divide key174 return VK_DIVIDE; // (6F) Divide key 176 175 case Qt::Key_PageUp: 177 176 return VK_PRIOR; // (21) PAGE UP key … … 197 196 198 197 switch (keycode) { 199 case Qt::Key_Backspace:200 return VK_BACK; // (08) BACKSPACE key201 case Qt::Key_Backtab:202 case Qt::Key_Tab:203 return VK_TAB; // (09) TAB key204 case Qt::Key_Clear:205 return VK_CLEAR; // (0C) CLEAR key206 case Qt::Key_Enter:207 case Qt::Key_Return:208 return VK_RETURN; //(0D) Return key209 case Qt::Key_Shift:210 return VK_SHIFT; // (10) SHIFT key211 case Qt::Key_Control:212 return VK_CONTROL; // (11) CTRL key213 case Qt::Key_Menu:214 case Qt::Key_Alt:215 return VK_MENU; // (12) ALT key216 217 case Qt::Key_F1:218 return VK_F1;219 case Qt::Key_F2:220 return VK_F2;221 case Qt::Key_F3:222 return VK_F3;223 case Qt::Key_F4:224 return VK_F4;225 case Qt::Key_F5:226 return VK_F5;227 case Qt::Key_F6:228 return VK_F6;229 case Qt::Key_F7:230 return VK_F7;231 case Qt::Key_F8:232 return VK_F8;233 case Qt::Key_F9:234 return VK_F9;235 case Qt::Key_F10:236 return VK_F10;237 case Qt::Key_F11:238 return VK_F11;239 case Qt::Key_F12:240 return VK_F12;241 case Qt::Key_F13:242 return VK_F13;243 case Qt::Key_F14:244 return VK_F14;245 case Qt::Key_F15:246 return VK_F15;247 case Qt::Key_F16:248 return VK_F16;249 case Qt::Key_F17:250 return VK_F17;251 case Qt::Key_F18:252 return VK_F18;253 case Qt::Key_F19:254 return VK_F19;255 case Qt::Key_F20:256 return VK_F20;257 case Qt::Key_F21:258 return VK_F21;259 case Qt::Key_F22:260 return VK_F22;261 case Qt::Key_F23:262 return VK_F23;263 case Qt::Key_F24:264 return VK_F24;265 266 case Qt::Key_Pause:267 return VK_PAUSE; // (13) PAUSE key268 case Qt::Key_CapsLock:269 return VK_CAPITAL; // (14) CAPS LOCK key270 case Qt::Key_Kana_Lock:271 case Qt::Key_Kana_Shift:272 return VK_KANA; // (15) Input Method Editor (IME) Kana mode273 case Qt::Key_Hangul:274 return VK_HANGUL; // VK_HANGUL (15) IME Hangul mode275 // VK_JUNJA (17) IME Junja mode276 // VK_FINAL (18) IME final mode277 case Qt::Key_Hangul_Hanja:278 return VK_HANJA; // (19) IME Hanja mode279 case Qt::Key_Kanji:280 return VK_KANJI; // (19) IME Kanji mode281 case Qt::Key_Escape:282 return VK_ESCAPE; // (1B) ESC key283 // VK_CONVERT (1C) IME convert284 // VK_NONCONVERT (1D) IME nonconvert285 // VK_ACCEPT (1E) IME accept286 // VK_MODECHANGE (1F) IME mode change request287 case Qt::Key_Space:288 return VK_SPACE; // (20) SPACEBAR289 case Qt::Key_PageUp:290 return VK_PRIOR; // (21) PAGE UP key291 case Qt::Key_PageDown:292 return VK_NEXT; // (22) PAGE DOWN key293 case Qt::Key_End:294 return VK_END; // (23) END key295 case Qt::Key_Home:296 return VK_HOME; // (24) HOME key297 case Qt::Key_Left:298 return VK_LEFT; // (25) LEFT ARROW key299 case Qt::Key_Up:300 return VK_UP; // (26) UP ARROW key301 case Qt::Key_Right:302 return VK_RIGHT; // (27) RIGHT ARROW key303 case Qt::Key_Down:304 return VK_DOWN; // (28) DOWN ARROW key305 case Qt::Key_Select:306 return VK_SELECT; // (29) SELECT key307 case Qt::Key_Print:308 return VK_PRINT; // (2A) PRINT key309 case Qt::Key_Execute:310 return VK_EXECUTE;// (2B) EXECUTE key311 //dunno on this312 //case Qt::Key_PrintScreen:313 //return VK_SNAPSHOT; // (2C) PRINT SCREEN key314 case Qt::Key_Insert:315 return VK_INSERT; // (2D) INS key316 case Qt::Key_Delete:317 return VK_DELETE; // (2E) DEL key318 case Qt::Key_Help:319 return VK_HELP; // (2F) HELP key320 case Qt::Key_0:321 case Qt::Key_ParenLeft:322 return VK_0; //(30) 0) key323 case Qt::Key_1:324 return VK_1; //(31) 1 ! key325 case Qt::Key_2:326 case Qt::Key_At:327 return VK_2; //(32) 2 & key328 case Qt::Key_3:329 case Qt::Key_NumberSign:330 return VK_3; //case '3': case '#';331 case Qt::Key_4:332 case Qt::Key_Dollar: //(34) 4 key '$';333 return VK_4;334 case Qt::Key_5:335 case Qt::Key_Percent:336 return VK_5; //(35) 5 key '%'337 case Qt::Key_6:338 case Qt::Key_AsciiCircum:339 return VK_6; //(36) 6 key '^'340 case Qt::Key_7:341 case Qt::Key_Ampersand:342 return VK_7; //(37) 7 key case '&'343 case Qt::Key_8:344 case Qt::Key_Asterisk:345 return VK_8; //(38) 8 key '*'346 case Qt::Key_9:347 case Qt::Key_ParenRight:348 return VK_9; //(39) 9 key '('349 case Qt::Key_A:350 return VK_A; //(41) A key case 'a': case 'A': return 0x41;351 case Qt::Key_B:352 return VK_B; //(42) B key case 'b': case 'B': return 0x42;353 case Qt::Key_C:354 return VK_C; //(43) C key case 'c': case 'C': return 0x43;355 case Qt::Key_D:356 return VK_D; //(44) D key case 'd': case 'D': return 0x44;357 case Qt::Key_E:358 return VK_E; //(45) E key case 'e': case 'E': return 0x45;359 case Qt::Key_F:360 return VK_F; //(46) F key case 'f': case 'F': return 0x46;361 case Qt::Key_G:362 return VK_G; //(47) G key case 'g': case 'G': return 0x47;363 case Qt::Key_H:364 return VK_H; //(48) H key case 'h': case 'H': return 0x48;365 case Qt::Key_I:366 return VK_I; //(49) I key case 'i': case 'I': return 0x49;367 case Qt::Key_J:368 return VK_J; //(4A) J key case 'j': case 'J': return 0x4A;369 case Qt::Key_K:370 return VK_K; //(4B) K key case 'k': case 'K': return 0x4B;371 case Qt::Key_L:372 return VK_L; //(4C) L key case 'l': case 'L': return 0x4C;373 case Qt::Key_M:374 return VK_M; //(4D) M key case 'm': case 'M': return 0x4D;375 case Qt::Key_N:376 return VK_N; //(4E) N key case 'n': case 'N': return 0x4E;377 case Qt::Key_O:378 return VK_O; //(4F) O key case 'o': case 'O': return 0x4F;379 case Qt::Key_P:380 return VK_P; //(50) P key case 'p': case 'P': return 0x50;381 case Qt::Key_Q:382 return VK_Q; //(51) Q key case 'q': case 'Q': return 0x51;383 case Qt::Key_R:384 return VK_R; //(52) R key case 'r': case 'R': return 0x52;385 case Qt::Key_S:386 return VK_S; //(53) S key case 's': case 'S': return 0x53;387 case Qt::Key_T:388 return VK_T; //(54) T key case 't': case 'T': return 0x54;389 case Qt::Key_U:390 return VK_U; //(55) U key case 'u': case 'U': return 0x55;391 case Qt::Key_V:392 return VK_V; //(56) V key case 'v': case 'V': return 0x56;393 case Qt::Key_W:394 return VK_W; //(57) W key case 'w': case 'W': return 0x57;395 case Qt::Key_X:396 return VK_X; //(58) X key case 'x': case 'X': return 0x58;397 case Qt::Key_Y:398 return VK_Y; //(59) Y key case 'y': case 'Y': return 0x59;399 case Qt::Key_Z:400 return VK_Z; //(5A) Z key case 'z': case 'Z': return 0x5A;401 case Qt::Key_Meta:402 return VK_LWIN; // (5B) Left Windows key (Microsoft Natural keyboard)403 // case Qt::Key_Meta_R: FIXME: What to do here?198 case Qt::Key_Backspace: 199 return VK_BACK; // (08) BACKSPACE key 200 case Qt::Key_Backtab: 201 case Qt::Key_Tab: 202 return VK_TAB; // (09) TAB key 203 case Qt::Key_Clear: 204 return VK_CLEAR; // (0C) CLEAR key 205 case Qt::Key_Enter: 206 case Qt::Key_Return: 207 return VK_RETURN; // (0D) Return key 208 case Qt::Key_Shift: 209 return VK_SHIFT; // (10) SHIFT key 210 case Qt::Key_Control: 211 return VK_CONTROL; // (11) CTRL key 212 case Qt::Key_Menu: 213 case Qt::Key_Alt: 214 return VK_MENU; // (12) ALT key 215 216 case Qt::Key_F1: 217 return VK_F1; 218 case Qt::Key_F2: 219 return VK_F2; 220 case Qt::Key_F3: 221 return VK_F3; 222 case Qt::Key_F4: 223 return VK_F4; 224 case Qt::Key_F5: 225 return VK_F5; 226 case Qt::Key_F6: 227 return VK_F6; 228 case Qt::Key_F7: 229 return VK_F7; 230 case Qt::Key_F8: 231 return VK_F8; 232 case Qt::Key_F9: 233 return VK_F9; 234 case Qt::Key_F10: 235 return VK_F10; 236 case Qt::Key_F11: 237 return VK_F11; 238 case Qt::Key_F12: 239 return VK_F12; 240 case Qt::Key_F13: 241 return VK_F13; 242 case Qt::Key_F14: 243 return VK_F14; 244 case Qt::Key_F15: 245 return VK_F15; 246 case Qt::Key_F16: 247 return VK_F16; 248 case Qt::Key_F17: 249 return VK_F17; 250 case Qt::Key_F18: 251 return VK_F18; 252 case Qt::Key_F19: 253 return VK_F19; 254 case Qt::Key_F20: 255 return VK_F20; 256 case Qt::Key_F21: 257 return VK_F21; 258 case Qt::Key_F22: 259 return VK_F22; 260 case Qt::Key_F23: 261 return VK_F23; 262 case Qt::Key_F24: 263 return VK_F24; 264 265 case Qt::Key_Pause: 266 return VK_PAUSE; // (13) PAUSE key 267 case Qt::Key_CapsLock: 268 return VK_CAPITAL; // (14) CAPS LOCK key 269 case Qt::Key_Kana_Lock: 270 case Qt::Key_Kana_Shift: 271 return VK_KANA; // (15) Input Method Editor (IME) Kana mode 272 case Qt::Key_Hangul: 273 return VK_HANGUL; // VK_HANGUL (15) IME Hangul mode 274 // VK_JUNJA (17) IME Junja mode 275 // VK_FINAL (18) IME final mode 276 case Qt::Key_Hangul_Hanja: 277 return VK_HANJA; // (19) IME Hanja mode 278 case Qt::Key_Kanji: 279 return VK_KANJI; // (19) IME Kanji mode 280 case Qt::Key_Escape: 281 return VK_ESCAPE; // (1B) ESC key 282 // VK_CONVERT (1C) IME convert 283 // VK_NONCONVERT (1D) IME nonconvert 284 // VK_ACCEPT (1E) IME accept 285 // VK_MODECHANGE (1F) IME mode change request 286 case Qt::Key_Space: 287 return VK_SPACE; // (20) SPACEBAR 288 case Qt::Key_PageUp: 289 return VK_PRIOR; // (21) PAGE UP key 290 case Qt::Key_PageDown: 291 return VK_NEXT; // (22) PAGE DOWN key 292 case Qt::Key_End: 293 return VK_END; // (23) END key 294 case Qt::Key_Home: 295 return VK_HOME; // (24) HOME key 296 case Qt::Key_Left: 297 return VK_LEFT; // (25) LEFT ARROW key 298 case Qt::Key_Up: 299 return VK_UP; // (26) UP ARROW key 300 case Qt::Key_Right: 301 return VK_RIGHT; // (27) RIGHT ARROW key 302 case Qt::Key_Down: 303 return VK_DOWN; // (28) DOWN ARROW key 304 case Qt::Key_Select: 305 return VK_SELECT; // (29) SELECT key 306 case Qt::Key_Print: 307 return VK_PRINT; // (2A) PRINT key 308 case Qt::Key_Execute: 309 return VK_EXECUTE; // (2B) EXECUTE key 310 // dunno on this 311 // case Qt::Key_PrintScreen: 312 // return VK_SNAPSHOT; // (2C) PRINT SCREEN key 313 case Qt::Key_Insert: 314 return VK_INSERT; // (2D) INS key 315 case Qt::Key_Delete: 316 return VK_DELETE; // (2E) DEL key 317 case Qt::Key_Help: 318 return VK_HELP; // (2F) HELP key 319 case Qt::Key_0: 320 case Qt::Key_ParenLeft: 321 return VK_0; // (30) 0) key 322 case Qt::Key_1: 323 return VK_1; // (31) 1 ! key 324 case Qt::Key_2: 325 case Qt::Key_At: 326 return VK_2; // (32) 2 & key 327 case Qt::Key_3: 328 case Qt::Key_NumberSign: 329 return VK_3; // case '3': case '#'; 330 case Qt::Key_4: 331 case Qt::Key_Dollar: // (34) 4 key '$'; 332 return VK_4; 333 case Qt::Key_5: 334 case Qt::Key_Percent: 335 return VK_5; // (35) 5 key '%' 336 case Qt::Key_6: 337 case Qt::Key_AsciiCircum: 338 return VK_6; // (36) 6 key '^' 339 case Qt::Key_7: 340 case Qt::Key_Ampersand: 341 return VK_7; // (37) 7 key case '&' 342 case Qt::Key_8: 343 case Qt::Key_Asterisk: 344 return VK_8; // (38) 8 key '*' 345 case Qt::Key_9: 346 case Qt::Key_ParenRight: 347 return VK_9; // (39) 9 key '(' 348 case Qt::Key_A: 349 return VK_A; // (41) A key case 'a': case 'A': return 0x41; 350 case Qt::Key_B: 351 return VK_B; // (42) B key case 'b': case 'B': return 0x42; 352 case Qt::Key_C: 353 return VK_C; // (43) C key case 'c': case 'C': return 0x43; 354 case Qt::Key_D: 355 return VK_D; // (44) D key case 'd': case 'D': return 0x44; 356 case Qt::Key_E: 357 return VK_E; // (45) E key case 'e': case 'E': return 0x45; 358 case Qt::Key_F: 359 return VK_F; // (46) F key case 'f': case 'F': return 0x46; 360 case Qt::Key_G: 361 return VK_G; // (47) G key case 'g': case 'G': return 0x47; 362 case Qt::Key_H: 363 return VK_H; // (48) H key case 'h': case 'H': return 0x48; 364 case Qt::Key_I: 365 return VK_I; // (49) I key case 'i': case 'I': return 0x49; 366 case Qt::Key_J: 367 return VK_J; // (4A) J key case 'j': case 'J': return 0x4A; 368 case Qt::Key_K: 369 return VK_K; // (4B) K key case 'k': case 'K': return 0x4B; 370 case Qt::Key_L: 371 return VK_L; // (4C) L key case 'l': case 'L': return 0x4C; 372 case Qt::Key_M: 373 return VK_M; // (4D) M key case 'm': case 'M': return 0x4D; 374 case Qt::Key_N: 375 return VK_N; // (4E) N key case 'n': case 'N': return 0x4E; 376 case Qt::Key_O: 377 return VK_O; // (4F) O key case 'o': case 'O': return 0x4F; 378 case Qt::Key_P: 379 return VK_P; // (50) P key case 'p': case 'P': return 0x50; 380 case Qt::Key_Q: 381 return VK_Q; // (51) Q key case 'q': case 'Q': return 0x51; 382 case Qt::Key_R: 383 return VK_R; // (52) R key case 'r': case 'R': return 0x52; 384 case Qt::Key_S: 385 return VK_S; // (53) S key case 's': case 'S': return 0x53; 386 case Qt::Key_T: 387 return VK_T; // (54) T key case 't': case 'T': return 0x54; 388 case Qt::Key_U: 389 return VK_U; // (55) U key case 'u': case 'U': return 0x55; 390 case Qt::Key_V: 391 return VK_V; // (56) V key case 'v': case 'V': return 0x56; 392 case Qt::Key_W: 393 return VK_W; // (57) W key case 'w': case 'W': return 0x57; 394 case Qt::Key_X: 395 return VK_X; // (58) X key case 'x': case 'X': return 0x58; 396 case Qt::Key_Y: 397 return VK_Y; // (59) Y key case 'y': case 'Y': return 0x59; 398 case Qt::Key_Z: 399 return VK_Z; // (5A) Z key case 'z': case 'Z': return 0x5A; 400 case Qt::Key_Meta: 401 return VK_LWIN; // (5B) Left Windows key (Microsoft Natural keyboard) 402 // case Qt::Key_Meta_R: FIXME: What to do here? 404 403 // return VK_RWIN; // (5C) Right Windows key (Natural keyboard) 405 // VK_APPS (5D) Applications key (Natural keyboard)406 // VK_SLEEP (5F) Computer Sleep key407 // VK_SEPARATOR (6C) Separator key408 // VK_SUBTRACT (6D) Subtract key409 // VK_DECIMAL (6E) Decimal key410 // VK_DIVIDE (6F) Divide key411 // handled by key code above412 413 case Qt::Key_NumLock:414 return VK_NUMLOCK; // (90) NUM LOCK key415 416 case Qt::Key_ScrollLock:417 return VK_SCROLL; // (91) SCROLL LOCK key418 419 // VK_LSHIFT (A0) Left SHIFT key420 // VK_RSHIFT (A1) Right SHIFT key421 // VK_LCONTROL (A2) Left CONTROL key422 // VK_RCONTROL (A3) Right CONTROL key423 // VK_LMENU (A4) Left MENU key424 // VK_RMENU (A5) Right MENU key425 // VK_BROWSER_BACK (A6) Windows 2000/XP: Browser Back key426 // VK_BROWSER_FORWARD (A7) Windows 2000/XP: Browser Forward key427 // VK_BROWSER_REFRESH (A8) Windows 2000/XP: Browser Refresh key428 // VK_BROWSER_STOP (A9) Windows 2000/XP: Browser Stop key429 // VK_BROWSER_SEARCH (AA) Windows 2000/XP: Browser Search key430 // VK_BROWSER_FAVORITES (AB) Windows 2000/XP: Browser Favorites key431 // VK_BROWSER_HOME (AC) Windows 2000/XP: Browser Start and Home key432 // VK_VOLUME_MUTE (AD) Windows 2000/XP: Volume Mute key433 // VK_VOLUME_DOWN (AE) Windows 2000/XP: Volume Down key434 // VK_VOLUME_UP (AF) Windows 2000/XP: Volume Up key435 // VK_MEDIA_NEXT_TRACK (B0) Windows 2000/XP: Next Track key436 // VK_MEDIA_PREV_TRACK (B1) Windows 2000/XP: Previous Track key437 // VK_MEDIA_STOP (B2) Windows 2000/XP: Stop Media key438 // VK_MEDIA_PLAY_PAUSE (B3) Windows 2000/XP: Play/Pause Media key439 // VK_LAUNCH_MAIL (B4) Windows 2000/XP: Start Mail key440 // VK_LAUNCH_MEDIA_SELECT (B5) Windows 2000/XP: Select Media key441 // VK_LAUNCH_APP1 (B6) Windows 2000/XP: Start Application 1 key442 // VK_LAUNCH_APP2 (B7) Windows 2000/XP: Start Application 2 key443 444 // VK_OEM_1 (BA) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the ';:' key445 case Qt::Key_Semicolon:446 case Qt::Key_Colon:447 return VK_OEM_1; //case ';': case ':': return 0xBA;448 // VK_OEM_PLUS (BB) Windows 2000/XP: For any country/region, the '+' key449 case Qt::Key_Plus:450 case Qt::Key_Equal:451 return VK_OEM_PLUS; //case '=': case '+': return 0xBB;452 // VK_OEM_COMMA (BC) Windows 2000/XP: For any country/region, the ',' key453 case Qt::Key_Comma:454 case Qt::Key_Less:455 return VK_OEM_COMMA; //case ',': case '<': return 0xBC;456 // VK_OEM_MINUS (BD) Windows 2000/XP: For any country/region, the '-' key457 case Qt::Key_Minus:458 case Qt::Key_Underscore:459 return VK_OEM_MINUS; //case '-': case '_': return 0xBD;460 // VK_OEM_PERIOD (BE) Windows 2000/XP: For any country/region, the '.' key461 case Qt::Key_Period:462 case Qt::Key_Greater:463 return VK_OEM_PERIOD; //case '.': case '>': return 0xBE;464 // VK_OEM_2 (BF) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '/?' key465 case Qt::Key_Slash:466 case Qt::Key_Question:467 return VK_OEM_2; //case '/': case '?': return 0xBF;468 // VK_OEM_3 (C0) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '`~' key469 case Qt::Key_AsciiTilde:470 case Qt::Key_QuoteLeft:471 return VK_OEM_3; //case '`': case '~': return 0xC0;472 // VK_OEM_4 (DB) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '[{' key473 case Qt::Key_BracketLeft:474 case Qt::Key_BraceLeft:475 return VK_OEM_4; //case '[': case '{': return 0xDB;476 // VK_OEM_5 (DC) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '\|' key477 case Qt::Key_Backslash:478 case Qt::Key_Bar:479 return VK_OEM_5; //case '\\': case '|': return 0xDC;480 // VK_OEM_6 (DD) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the ']}' key481 case Qt::Key_BracketRight:482 case Qt::Key_BraceRight:483 return VK_OEM_6; // case ']': case '}': return 0xDD;484 // VK_OEM_7 (DE) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the 'single-quote/double-quote' key485 case Qt::Key_QuoteDbl:486 return VK_OEM_7; // case '\'': case '"': return 0xDE;487 // VK_OEM_8 (DF) Used for miscellaneous characters; it can vary by keyboard.488 // VK_OEM_102 (E2) Windows 2000/XP: Either the angle bracket key or the backslash key on the RT 102-key keyboard489 // VK_PROCESSKEY (E5) Windows 95/98/Me, Windows NT 4.0, Windows 2000/XP: IME PROCESS key490 // VK_PACKET (E7) Windows 2000/XP: Used to pass Unicode characters as if they were keystrokes. The VK_PACKET key is the low word of a 32-bit Virtual Key value used for non-keyboard input methods. For more information, see Remark in KEYBDINPUT,SendInput, WM_KEYDOWN, and WM_KEYUP491 // VK_ATTN (F6) Attn key492 // VK_CRSEL (F7) CrSel key493 // VK_EXSEL (F8) ExSel key494 // VK_EREOF (F9) Erase EOF key495 // VK_PLAY (FA) Play key496 // VK_ZOOM (FB) Zoom key497 // VK_NONAME (FC) Reserved for future use498 // VK_PA1 (FD) PA1 key499 // VK_OEM_CLEAR (FE) Clear key500 default:501 return 0;404 // VK_APPS (5D) Applications key (Natural keyboard) 405 // VK_SLEEP (5F) Computer Sleep key 406 // VK_SEPARATOR (6C) Separator key 407 // VK_SUBTRACT (6D) Subtract key 408 // VK_DECIMAL (6E) Decimal key 409 // VK_DIVIDE (6F) Divide key 410 // handled by key code above 411 412 case Qt::Key_NumLock: 413 return VK_NUMLOCK; // (90) NUM LOCK key 414 415 case Qt::Key_ScrollLock: 416 return VK_SCROLL; // (91) SCROLL LOCK key 417 418 // VK_LSHIFT (A0) Left SHIFT key 419 // VK_RSHIFT (A1) Right SHIFT key 420 // VK_LCONTROL (A2) Left CONTROL key 421 // VK_RCONTROL (A3) Right CONTROL key 422 // VK_LMENU (A4) Left MENU key 423 // VK_RMENU (A5) Right MENU key 424 // VK_BROWSER_BACK (A6) Windows 2000/XP: Browser Back key 425 // VK_BROWSER_FORWARD (A7) Windows 2000/XP: Browser Forward key 426 // VK_BROWSER_REFRESH (A8) Windows 2000/XP: Browser Refresh key 427 // VK_BROWSER_STOP (A9) Windows 2000/XP: Browser Stop key 428 // VK_BROWSER_SEARCH (AA) Windows 2000/XP: Browser Search key 429 // VK_BROWSER_FAVORITES (AB) Windows 2000/XP: Browser Favorites key 430 // VK_BROWSER_HOME (AC) Windows 2000/XP: Browser Start and Home key 431 // VK_VOLUME_MUTE (AD) Windows 2000/XP: Volume Mute key 432 // VK_VOLUME_DOWN (AE) Windows 2000/XP: Volume Down key 433 // VK_VOLUME_UP (AF) Windows 2000/XP: Volume Up key 434 // VK_MEDIA_NEXT_TRACK (B0) Windows 2000/XP: Next Track key 435 // VK_MEDIA_PREV_TRACK (B1) Windows 2000/XP: Previous Track key 436 // VK_MEDIA_STOP (B2) Windows 2000/XP: Stop Media key 437 // VK_MEDIA_PLAY_PAUSE (B3) Windows 2000/XP: Play/Pause Media key 438 // VK_LAUNCH_MAIL (B4) Windows 2000/XP: Start Mail key 439 // VK_LAUNCH_MEDIA_SELECT (B5) Windows 2000/XP: Select Media key 440 // VK_LAUNCH_APP1 (B6) Windows 2000/XP: Start Application 1 key 441 // VK_LAUNCH_APP2 (B7) Windows 2000/XP: Start Application 2 key 442 443 // VK_OEM_1 (BA) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the ';:' key 444 case Qt::Key_Semicolon: 445 case Qt::Key_Colon: 446 return VK_OEM_1; // case ';': case ':': return 0xBA; 447 // VK_OEM_PLUS (BB) Windows 2000/XP: For any country/region, the '+' key 448 case Qt::Key_Plus: 449 case Qt::Key_Equal: 450 return VK_OEM_PLUS; // case '=': case '+': return 0xBB; 451 // VK_OEM_COMMA (BC) Windows 2000/XP: For any country/region, the ',' key 452 case Qt::Key_Comma: 453 case Qt::Key_Less: 454 return VK_OEM_COMMA; // case ',': case '<': return 0xBC; 455 // VK_OEM_MINUS (BD) Windows 2000/XP: For any country/region, the '-' key 456 case Qt::Key_Minus: 457 case Qt::Key_Underscore: 458 return VK_OEM_MINUS; // case '-': case '_': return 0xBD; 459 // VK_OEM_PERIOD (BE) Windows 2000/XP: For any country/region, the '.' key 460 case Qt::Key_Period: 461 case Qt::Key_Greater: 462 return VK_OEM_PERIOD; // case '.': case '>': return 0xBE; 463 // VK_OEM_2 (BF) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '/?' key 464 case Qt::Key_Slash: 465 case Qt::Key_Question: 466 return VK_OEM_2; // case '/': case '?': return 0xBF; 467 // VK_OEM_3 (C0) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '`~' key 468 case Qt::Key_AsciiTilde: 469 case Qt::Key_QuoteLeft: 470 return VK_OEM_3; // case '`': case '~': return 0xC0; 471 // VK_OEM_4 (DB) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '[{' key 472 case Qt::Key_BracketLeft: 473 case Qt::Key_BraceLeft: 474 return VK_OEM_4; // case '[': case '{': return 0xDB; 475 // VK_OEM_5 (DC) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '\|' key 476 case Qt::Key_Backslash: 477 case Qt::Key_Bar: 478 return VK_OEM_5; // case '\\': case '|': return 0xDC; 479 // VK_OEM_6 (DD) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the ']}' key 480 case Qt::Key_BracketRight: 481 case Qt::Key_BraceRight: 482 return VK_OEM_6; // case ']': case '}': return 0xDD; 483 // VK_OEM_7 (DE) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the 'single-quote/double-quote' key 484 case Qt::Key_QuoteDbl: 485 return VK_OEM_7; // case '\'': case '"': return 0xDE; 486 // VK_OEM_8 (DF) Used for miscellaneous characters; it can vary by keyboard. 487 // VK_OEM_102 (E2) Windows 2000/XP: Either the angle bracket key or the backslash key on the RT 102-key keyboard 488 // VK_PROCESSKEY (E5) Windows 95/98/Me, Windows NT 4.0, Windows 2000/XP: IME PROCESS key 489 // VK_PACKET (E7) Windows 2000/XP: Used to pass Unicode characters as if they were keystrokes. The VK_PACKET key is the low word of a 32-bit Virtual Key value used for non-keyboard input methods. For more information, see Remark in KEYBDINPUT,SendInput, WM_KEYDOWN, and WM_KEYUP 490 // VK_ATTN (F6) Attn key 491 // VK_CRSEL (F7) CrSel key 492 // VK_EXSEL (F8) ExSel key 493 // VK_EREOF (F9) Erase EOF key 494 // VK_PLAY (FA) Play key 495 // VK_ZOOM (FB) Zoom key 496 // VK_NONAME (FC) Reserved for future use 497 // VK_PA1 (FD) PA1 key 498 // VK_OEM_CLEAR (FE) Clear key 499 default: 500 return 0; 502 501 } 503 504 502 } 505 503 … … 512 510 m_keyIdentifier = keyIdentifierForQtKeyCode(event->key()); 513 511 m_autoRepeat = event->isAutoRepeat(); 514 m_ctrlKey = (state & Qt::ControlModifier) != 0;515 m_altKey = (state & Qt::AltModifier) != 0;516 m_metaKey = (state & Qt::MetaModifier) != 0;517 m_isKeypad = (state & Qt::KeypadModifier) != 0;512 m_ctrlKey = (state & Qt::ControlModifier); 513 m_altKey = (state & Qt::AltModifier); 514 m_metaKey = (state & Qt::MetaModifier); 515 m_isKeypad = (state & Qt::KeypadModifier); 518 516 m_windowsVirtualKeyCode = windowsKeyCodeForKeyEvent(event->key(), m_isKeypad); 519 517 m_nativeVirtualKeyCode = event->nativeVirtualKey(); 520 m_shiftKey = (state & Qt::ShiftModifier) != 0|| event->key() == Qt::Key_Backtab; // Simulate Shift+Tab with Key_Backtab518 m_shiftKey = (state & Qt::ShiftModifier) || event->key() == Qt::Key_Backtab; // Simulate Shift+Tab with Key_Backtab 521 519 m_qtEvent = event; 522 520 }
Note:
See TracChangeset
for help on using the changeset viewer.