VirtualBox

Changeset 27235 in vbox


Ignore:
Timestamp:
Mar 9, 2010 10:06:02 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
58617
Message:

FE/Qt4: New running VM core: some code cleanup.

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

Legend:

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

    r27227 r27235  
    239239bool UIMachineViewFullscreen::eventFilter(QObject *pWatched, QEvent *pEvent)
    240240{
     241    /* Who are we watching? */
    241242    QIMainDialog *pMainDialog = machineWindowWrapper() && machineWindowWrapper()->machineWindow() ?
    242         qobject_cast<QIMainDialog*>(machineWindowWrapper()->machineWindow()) : 0;
     243                                qobject_cast<QIMainDialog*>(machineWindowWrapper()->machineWindow()) : 0;
     244
    243245    if (pWatched != 0 && pWatched == pMainDialog)
    244246    {
     
    263265        }
    264266    }
    265 #ifdef Q_WS_MAC // TODO: Is it really needed?
    266     QMenuBar *pMenuBar = machineWindowWrapper() && machineWindowWrapper()->machineWindow() ?
    267                          qobject_cast<QIMainDialog*>(machineWindowWrapper()->machineWindow())->menuBar() : 0;
    268     if (pWatched != 0 && pWatched == pMenuBar)
    269     {
    270         /* Sometimes when we press ESC in the menu it brings the focus away (Qt bug?)
    271          * causing no widget to have a focus, or holds the focus itself, instead of
    272          * returning the focus to the console window. Here we fix this: */
    273         switch (pEvent->type())
    274         {
    275             case QEvent::FocusOut:
    276             {
    277                 if (qApp->focusWidget() == 0)
    278                     setFocus();
    279                 break;
    280             }
    281             case QEvent::KeyPress:
    282             {
    283                 QKeyEvent *pKeyEvent = static_cast<QKeyEvent*>(pEvent);
    284                 if (pKeyEvent->key() == Qt::Key_Escape && (pKeyEvent->modifiers() == Qt::NoModifier))
    285                     if (pMenuBar->hasFocus())
    286                         setFocus();
    287                 break;
    288             }
    289             default:
    290                 break;
    291         }
    292     }
    293 #endif /* Q_WS_MAC */
     267
    294268    return UIMachineView::eventFilter(pWatched, pEvent);
    295269}
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineViewNormal.cpp

    r27233 r27235  
    264264bool UIMachineViewNormal::eventFilter(QObject *pWatched, QEvent *pEvent)
    265265{
    266     /* Who are we watchin? */
     266    /* Who are we watching? */
    267267    QIMainDialog *pMainDialog = machineWindowWrapper() && machineWindowWrapper()->machineWindow() ?
    268         qobject_cast<QIMainDialog*>(machineWindowWrapper()->machineWindow()) : 0;
    269     QMenuBar *pMenuBar = pMainDialog ? qobject_cast<QIMainDialog*>(pMainDialog)->menuBar() : 0;
     268                                qobject_cast<QIMainDialog*>(machineWindowWrapper()->machineWindow()) : 0;
    270269
    271270    if (pWatched != 0 && pWatched == pMainDialog)
     
    292291                break;
    293292            }
    294 # endif
     293# endif /* defined (VBOX_GUI_USE_DDRAW) */
    295294#endif /* defined (Q_WS_WIN32) */
    296295            default:
     
    298297        }
    299298    }
    300     else if (pWatched != 0 && pWatched == pMenuBar)
    301     {
    302         /* Sometimes when we press ESC in the menu it brings the focus away (Qt bug?)
    303          * causing no widget to have a focus, or holds the focus itself, instead of
    304          * returning the focus to the console window. Here we fix this: */
    305         switch (pEvent->type())
    306         {
    307             case QEvent::FocusOut:
    308             {
    309                 if (qApp->focusWidget() == 0)
    310                     setFocus();
    311                 break;
    312             }
    313             case QEvent::KeyPress:
    314             {
    315                 QKeyEvent *pKeyEvent = static_cast<QKeyEvent*>(pEvent);
    316                 if (pKeyEvent->key() == Qt::Key_Escape && (pKeyEvent->modifiers() == Qt::NoModifier))
    317                     if (pMenuBar->hasFocus())
    318                         setFocus();
    319                 break;
    320             }
    321             default:
    322                 break;
    323         }
    324     }
     299
    325300    return UIMachineView::eventFilter(pWatched, pEvent);
    326301}
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineViewSeamless.cpp

    r27227 r27235  
    246246bool UIMachineViewSeamless::eventFilter(QObject *pWatched, QEvent *pEvent)
    247247{
     248    /* Who are we watching? */
    248249    QIMainDialog *pMainDialog = machineWindowWrapper() && machineWindowWrapper()->machineWindow() ?
    249         qobject_cast<QIMainDialog*>(machineWindowWrapper()->machineWindow()) : 0;
     250                                qobject_cast<QIMainDialog*>(machineWindowWrapper()->machineWindow()) : 0;
     251
    250252    if (pWatched != 0 && pWatched == pMainDialog)
    251253    {
     
    270272        }
    271273    }
    272 #ifdef Q_WS_MAC // TODO: Is it really needed?
    273     QMenuBar *pMenuBar = machineWindowWrapper() && machineWindowWrapper()->machineWindow() ?
    274                          qobject_cast<QIMainDialog*>(machineWindowWrapper()->machineWindow())->menuBar() : 0;
    275     if (pWatched != 0 && pWatched == pMenuBar)
    276     {
    277         /* Sometimes when we press ESC in the menu it brings the focus away (Qt bug?)
    278          * causing no widget to have a focus, or holds the focus itself, instead of
    279          * returning the focus to the console window. Here we fix this: */
    280         switch (pEvent->type())
    281         {
    282             case QEvent::FocusOut:
    283             {
    284                 if (qApp->focusWidget() == 0)
    285                     setFocus();
    286                 break;
    287             }
    288             case QEvent::KeyPress:
    289             {
    290                 QKeyEvent *pKeyEvent = static_cast<QKeyEvent*>(pEvent);
    291                 if (pKeyEvent->key() == Qt::Key_Escape && (pKeyEvent->modifiers() == Qt::NoModifier))
    292                     if (pMenuBar->hasFocus())
    293                         setFocus();
    294                 break;
    295             }
    296             default:
    297                 break;
    298         }
    299     }
    300 #endif /* Q_WS_MAC */
     274
    301275    return UIMachineView::eventFilter(pWatched, pEvent);
    302276}
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