Changeset 44682 in vbox
- Timestamp:
- Feb 14, 2013 9:59:17 AM (12 years ago)
- svn:sync-xref-src-repo-rev:
- 83777
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIHotKeyEditor.cpp
r44653 r44682 271 271 } 272 272 273 bool UIHotKeyEditor::approvedKeyPressed(QKeyEvent *pKeyEvent) 274 { 275 /* Qt by some reason generates text for complex cases like 276 * Backspace or Del but skip other similar things like 277 * F1 - F35, Home, End, Page UP, Page DOWN and so on. 278 * We should declare all the approved keys. */ 279 280 /* Compose the set of the approved keys: */ 281 QSet<int> approvedKeys; 282 283 /* Add Fn keys: */ 284 for (int i = Qt::Key_F1; i <= Qt::Key_F35; ++i) 285 approvedKeys << i; 286 287 /* Add digit keys: */ 288 for (int i = Qt::Key_0; i <= Qt::Key_9; ++i) 289 approvedKeys << i; 290 291 /* We allow to use only English letters in shortcuts. 292 * The reason is by some reason Qt distinguish native language 293 * letters only with no modifiers pressed. 294 * With modifiers pressed Qt thinks the letter is always English. */ 295 for (int i = Qt::Key_A; i <= Qt::Key_Z; ++i) 296 approvedKeys << i; 297 298 /* Add few more special cases: */ 299 approvedKeys << Qt::Key_Space << Qt::Key_Backspace 300 << Qt::Key_Insert << Qt::Key_Delete 301 << Qt::Key_Pause << Qt::Key_Print 302 << Qt::Key_Home << Qt::Key_End 303 << Qt::Key_PageUp << Qt::Key_PageDown 304 << Qt::Key_BracketLeft << Qt::Key_BracketRight << Qt::Key_Backslash 305 << Qt::Key_Semicolon << Qt::Key_Apostrophe 306 << Qt::Key_Comma << Qt::Key_Period << Qt::Key_Slash; 307 308 /* Is this one of the approved keys? */ 309 if (approvedKeys.contains(pKeyEvent->key())) 310 return true; 311 312 /* False by default: */ 313 return false; 314 } 315 273 316 void UIHotKeyEditor::handleKeyPress(QKeyEvent *pKeyEvent) 274 317 { … … 277 320 { 278 321 /* If finalizing key is pressed: */ 279 if ( !pKeyEvent->text().isEmpty())322 if (approvedKeyPressed(pKeyEvent)) 280 323 { 281 324 /* Remember taken key: */
Note:
See TracChangeset
for help on using the changeset viewer.