VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIKeyboardHandlerScale.cpp@ 35740

Last change on this file since 35740 was 30848, checked in by vboxsync, 14 years ago

export to OSE

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.5 KB
Line 
1/* $Id: UIKeyboardHandlerScale.cpp 30848 2010-07-14 17:06:55Z vboxsync $ */
2/** @file
3 *
4 * VBox frontends: Qt GUI ("VirtualBox"):
5 * UIKeyboardHandlerScale class implementation
6 */
7
8/*
9 * Copyright (C) 2010 Oracle Corporation
10 *
11 * This file is part of VirtualBox Open Source Edition (OSE), as
12 * available from http://www.virtualbox.org. This file is free software;
13 * you can redistribute it and/or modify it under the terms of the GNU
14 * General Public License (GPL) as published by the Free Software
15 * Foundation, in version 2 as it comes in the "COPYING" file of the
16 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
17 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
18 */
19
20/* Global includes */
21#include <QKeyEvent>
22#include <QTimer>
23#include <QWidget>
24
25/* Local includes */
26#include "UIKeyboardHandlerScale.h"
27#include "UIMachineWindow.h"
28
29/* Fullscreen keyboard-handler constructor: */
30UIKeyboardHandlerScale::UIKeyboardHandlerScale(UIMachineLogic* pMachineLogic)
31 : UIKeyboardHandler(pMachineLogic)
32{
33}
34
35/* Fullscreen keyboard-handler destructor: */
36UIKeyboardHandlerScale::~UIKeyboardHandlerScale()
37{
38}
39
40/* Event handler for prepared listener(s): */
41bool UIKeyboardHandlerScale::eventFilter(QObject *pWatchedObject, QEvent *pEvent)
42{
43 /* Check if pWatchedObject object is view: */
44 if (UIMachineView *pWatchedView = isItListenedView(pWatchedObject))
45 {
46 /* Get corresponding screen index: */
47 ulong uScreenId = m_views.key(pWatchedView);
48 NOREF(uScreenId);
49 /* Handle view events: */
50 switch (pEvent->type())
51 {
52#ifndef Q_WS_MAC
53 /* We don't want this on the Mac, cause there the menu bar isn't within the window
54 * and popping up a menu there looks really ugly. */
55 case QEvent::KeyPress:
56 {
57 /* Get key-event: */
58 QKeyEvent *pKeyEvent = static_cast<QKeyEvent*>(pEvent);
59 /* Process Host+Home for menu popup: */
60 if (isHostKeyPressed() && pKeyEvent->key() == Qt::Key_Home)
61 {
62 /* Post request to show popup-menu: */
63 QTimer::singleShot(0, m_windows[uScreenId]->machineWindow(), SLOT(sltPopupMainMenu()));
64 /* Filter-out this event: */
65 return true;
66 }
67 break;
68 }
69#endif /* !Q_WS_MAC */
70 default:
71 break;
72 }
73 }
74
75 /* Else just propagate to base-class: */
76 return UIKeyboardHandler::eventFilter(pWatchedObject, pEvent);
77}
78
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use