/* Event handler for prepared listener(s): */ bool UIKeyboardHandlerSeamless::eventFilter(QObject *pWatchedObject, QEvent *pEvent) { /* Check if pWatchedObject object is view: */ if (UIMachineView *pWatchedView = isItListenedView(pWatchedObject)) { /* Get corresponding screen index: */ ulong uScreenId = m_views.key(pWatchedView); NOREF(uScreenId); /* Handle view events: */ switch (pEvent->type()) { case QEvent::KeyPress: { /* Get key-event: */ QKeyEvent *pKeyEvent = static_cast<QKeyEvent*>(pEvent); /* Process Host+Home for menu popup: */ if (isHostKeyPressed() && pKeyEvent->key() == gMS->keySequence(UIMachineShortcuts::PopupMenuShortcut)) { /* Post request to show popup-menu: */ QTimer::singleShot(0, m_windows[uScreenId]->machineWindow(), SLOT(sltPopupMainMenu())); /* Filter-out this event: */ return true; } break; } default: break; } } /* Else just propagate to base-class: */ return UIKeyboardHandler::eventFilter(pWatchedObject, pEvent); }
/* Event handler for prepared listener(s): */ bool UIKeyboardHandlerScale::eventFilter(QObject *pWatchedObject, QEvent *pEvent) { /* Check if pWatchedObject object is view: */ if (UIMachineView *pWatchedView = isItListenedView(pWatchedObject)) { /* Get corresponding screen index: */ ulong uScreenId = m_views.key(pWatchedView); NOREF(uScreenId); /* Handle view events: */ switch (pEvent->type()) { #ifndef Q_WS_MAC /* We don't want this on the Mac, cause there the menu bar isn't within the window * and popping up a menu there looks really ugly. */ case QEvent::KeyPress: { /* Get key-event: */ QKeyEvent *pKeyEvent = static_cast<QKeyEvent*>(pEvent); /* Process Host+Home for menu popup: */ if (isHostKeyPressed() && pKeyEvent->key() == gMS->keySequence(UIMachineShortcuts::PopupMenuShortcut)) { /* Post request to show popup-menu: */ QTimer::singleShot(0, m_windows[uScreenId], SLOT(sltPopupMainMenu())); /* Filter-out this event: */ return true; } break; } #endif /* !Q_WS_MAC */ default: break; } } /* Else just propagate to base-class: */ return UIKeyboardHandler::eventFilter(pWatchedObject, pEvent); }