VirtualBox

Changeset 27233 in vbox


Ignore:
Timestamp:
Mar 9, 2010 9:40:39 PM (15 years ago)
Author:
vboxsync
Message:

FE/Qt4: New running VM core: bug fix for normal (windowed) mode: handle 'host+home' as menu-bar focus shortcut.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/runtime
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp

    r27227 r27233  
    816816                }
    817817
    818                 if (pKeyEvent->key() == Qt::Key_Home)
    819                 {
    820 #if 0 // TODO: Divide tha code to specific parts of fullscreen & seamless and move it there:
    821                     /* Activate the main menu */
    822                     if (machineWindowWrapper()->isTrueSeamless() || machineWindowWrapper()->isTrueFullscreen())
    823                         machineWindowWrapper()->popupMainMenu (uisession()->isMouseCaptured());
    824 #endif
    825                 }
    826                 else
    827                 {
    828                     /* Process hot keys not processed in keyEvent() (as in case of non-alphanumeric keys): */
    829                     machineWindowWrapper()->machineLogic()->actionsPool()->processHotKey(QKeySequence(pKeyEvent->key()));
    830                 }
     818                /* Process hot keys not processed in keyEvent() (as in case of non-alphanumeric keys): */
     819                machineWindowWrapper()->machineLogic()->actionsPool()->processHotKey(QKeySequence(pKeyEvent->key()));
    831820            }
    832821            else if (!m_bIsHostkeyPressed && pEvent->type() == QEvent::KeyRelease)
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineViewNormal.cpp

    r27227 r27233  
    225225            if (isHostKeyPressed() && pEvent->type() == QEvent::KeyPress)
    226226            {
     227                /* Process Host+Home as menu-bar activator: */
    227228                if (pKeyEvent->key() == Qt::Key_Home)
    228229                {
    229                     /* In Qt4 it is not enough to just set the focus to menu-bar.
    230                      * So to get the menu-bar we have to send Qt::Key_Alt press/release events directly: */
    231                     QKeyEvent e1(QEvent::KeyPress, Qt::Key_Alt, Qt::NoModifier);
    232                     QKeyEvent e2(QEvent::KeyRelease, Qt::Key_Alt, Qt::NoModifier);
     230                    /* Trying to get menu-bar: */
    233231                    QMenuBar *pMenuBar = machineWindowWrapper() && machineWindowWrapper()->machineWindow() ?
    234232                                         qobject_cast<QIMainDialog*>(machineWindowWrapper()->machineWindow())->menuBar() : 0;
    235                     QApplication::sendEvent(pMenuBar, &e1);
    236                     QApplication::sendEvent(pMenuBar, &e2);
     233
     234                    /* If menu-bar is present and have actions: */
     235                    if (pMenuBar && !pMenuBar->actions().isEmpty())
     236                    {
     237                        /* If 'active' action is NOT chosen: */
     238                        if (!pMenuBar->activeAction())
     239                            /* Set first menu-bar action as 'active': */
     240                            pMenuBar->setActiveAction(pMenuBar->actions()[0]);
     241
     242                        /* If 'active' action is chosen: */
     243                        if (pMenuBar->activeAction())
     244                        {
     245                            /* Activate 'active' menu-bar action: */
     246                            pMenuBar->activeAction()->activate(QAction::Trigger);
     247
     248                            /* Accept this event: */
     249                            pEvent->accept();
     250                            return true;
     251                        }
     252                    }
    237253                }
    238254                else
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette