- virtual bool eventFilter(QObject *theObject, QEvent *theEvent)
- {
- bool isAccepted = false;
-
- if (myIsActive) {
- // Do not process keys for modal dialogues: all keys has to be processed within the dialog
- // There is only one exception: ModuleBase_EditorDialog
- QWindow* aWnd = qApp->modalWindow();
- QString aName = "NoModal";
- if (aWnd) {
- if (!aWnd->objectName().startsWith("ModuleBase_EditorDialog"))
- aName = aWnd->objectName();
- }
- if (aName == "NoModal") {
- if (theEvent->type() == QEvent::KeyRelease) {
- QKeyEvent* aKeyEvent = dynamic_cast<QKeyEvent*>(theEvent);
- if (aKeyEvent) {
- myOperationMgr->setSHIFTPressed(aKeyEvent->modifiers() & Qt::ShiftModifier);
- switch (aKeyEvent->key()) {
- case Qt::Key_Delete:
- isAccepted = myOperationMgr->onProcessDelete(theObject);
- break;
- default:
- isAccepted = myOperationMgr->onKeyReleased(theObject, aKeyEvent);
- break;
- }
+ virtual bool eventFilter(QObject *theObject, QEvent *theEvent);
+
+private:
+ XGUI_OperationMgr* myOperationMgr; /// processor for key event
+ bool myIsActive; /// boolean state whether the event filter perform own signal processing
+};
+
+bool XGUI_ShortCutListener::eventFilter(QObject *theObject, QEvent *theEvent)
+{
+ bool isAccepted = false;
+
+ if (myIsActive) {
+ // Do not process keys for modal dialogues: all keys has to be processed within the dialog
+ // There is only one exception: ModuleBase_EditorDialog
+ QWindow* aWnd = qApp->modalWindow();
+ QString aName = "NoModal";
+ if (aWnd) {
+ if (!aWnd->objectName().startsWith("ModuleBase_EditorDialog"))
+ aName = aWnd->objectName();
+ }
+ if (aName == "NoModal") {
+ if (theEvent->type() == QEvent::KeyRelease) {
+ QKeyEvent* aKeyEvent = dynamic_cast<QKeyEvent*>(theEvent);
+ if (aKeyEvent) {
+ myOperationMgr->setSHIFTPressed(aKeyEvent->modifiers() & Qt::ShiftModifier);
+ switch (aKeyEvent->key()) {
+ case Qt::Key_Delete:
+ isAccepted = myOperationMgr->onProcessDelete(theObject);
+ break;
+ case Qt::Key_F2:
+ myOperationMgr->xworkshop()->objectBrowser()->onEditItem();
+ break;
+ default:
+ isAccepted = myOperationMgr->onKeyReleased(theObject, aKeyEvent);
+ break;