Changeset 91002 in vbox for trunk/src/VBox
- Timestamp:
- Aug 30, 2021 3:07:42 PM (3 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserHandlerKeyboard.cpp
r90909 r91002 307 307 /* Start lookup only for non-empty and alphanumerical strings: */ 308 308 const QString strText = pEvent->text(); 309 if (! strText.isEmpty() && !strText.contains(QRegExp("[^A-Za-z0-9]", Qt::CaseInsensitive)))309 if (!checkKey(pEvent->key()) && !strText.isEmpty()) 310 310 model()->lookFor(strText); 311 311 break; … … 393 393 model()->saveGroups(); 394 394 } 395 396 bool UIChooserHandlerKeyboard::checkKey(int iKey) const 397 { 398 if (iKey == Qt::Key_Tab || 399 iKey == Qt::Key_Backtab || 400 iKey == Qt::Key_Backspace || 401 iKey == Qt::Key_Pause || 402 iKey == Qt::Key_Print || 403 iKey == Qt::Key_SysReq || 404 iKey == Qt::Key_Home || 405 iKey == Qt::Key_End || 406 iKey == Qt::Key_Left || 407 iKey == Qt::Key_Up || 408 iKey == Qt::Key_Right || 409 iKey == Qt::Key_Down || 410 iKey == Qt::Key_PageUp || 411 iKey == Qt::Key_PageDown || 412 iKey == Qt::Key_Shift || 413 iKey == Qt::Key_Alt || 414 iKey == Qt::Key_AltGr || 415 iKey == Qt::Key_CapsLock || 416 iKey == Qt::Key_NumLock || 417 iKey == Qt::Key_ScrollLock || 418 iKey == Qt::Key_Control) 419 return true; 420 421 if ((Qt::Key)iKey >= Qt::Key_F1 && 422 (Qt::Key)iKey <= Qt::Key_F35) 423 return true; 424 425 return false; 426 } -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserHandlerKeyboard.h
r82968 r91002 30 30 class QKeyEvent; 31 31 32 /* Keyboard event type:*/32 /** Keyboard event type. */ 33 33 enum UIKeyboardEventType 34 34 { … … 37 37 }; 38 38 39 /* Item shift direction:*/39 /** Item shift direction. */ 40 40 enum UIItemShiftDirection 41 41 { … … 51 51 }; 52 52 53 /* Keyboard handler for graphics selector:*/53 /** Keyboard handler for graphics selector. */ 54 54 class UIChooserHandlerKeyboard : public QObject 55 55 { … … 58 58 public: 59 59 60 /* Constructor:*/60 /** Constructor. */ 61 61 UIChooserHandlerKeyboard(UIChooserModel *pParent); 62 62 63 /* API: Model keyboard-event handler delegate:*/63 /** API: Model keyboard-event handler delegate. */ 64 64 bool handle(QKeyEvent *pEvent, UIKeyboardEventType type) const; 65 65 66 66 private: 67 67 68 /* API: Model wrapper:*/68 /** API: Model wrapper. */ 69 69 UIChooserModel* model() const; 70 70 71 /* Helpers: Model keyboard-event handler delegates:*/71 /** Helpers: Model keyboard-event handler delegates. */ 72 72 bool handleKeyPress(QKeyEvent *pEvent) const; 73 73 bool handleKeyRelease(QKeyEvent *pEvent) const; 74 74 75 /* Helper: Item shift delegate:*/75 /** Helper: Item shift delegate. */ 76 76 void shift(UIItemShiftDirection enmDirection, UIItemShiftType enmShiftType) const; 77 77 78 /* Variables: */ 78 /** Checks the iKey against a set of special keys and returns true if it is one of them. 79 * Depending of this return value we either show the vm search widget or ignore the key event. 80 * @param iKey Qt::key type we get from QKeyEvent::key(). */ 81 bool checkKey(int iKey) const; 82 83 /** Variables. */ 79 84 UIChooserModel *m_pModel; 80 85 QMap<int, UIItemShiftType> m_shiftMap; … … 82 87 83 88 #endif /* !FEQT_INCLUDED_SRC_manager_chooser_UIChooserHandlerKeyboard_h */ 84
Note:
See TracChangeset
for help on using the changeset viewer.