Changeset 27235 in vbox for trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineViewFullscreen.cpp
- Timestamp:
- Mar 9, 2010 10:06:02 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 58617
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineViewFullscreen.cpp
r27227 r27235 239 239 bool UIMachineViewFullscreen::eventFilter(QObject *pWatched, QEvent *pEvent) 240 240 { 241 /* Who are we watching? */ 241 242 QIMainDialog *pMainDialog = machineWindowWrapper() && machineWindowWrapper()->machineWindow() ? 242 qobject_cast<QIMainDialog*>(machineWindowWrapper()->machineWindow()) : 0; 243 qobject_cast<QIMainDialog*>(machineWindowWrapper()->machineWindow()) : 0; 244 243 245 if (pWatched != 0 && pWatched == pMainDialog) 244 246 { … … 263 265 } 264 266 } 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 294 268 return UIMachineView::eventFilter(pWatched, pEvent); 295 269 }
Note:
See TracChangeset
for help on using the changeset viewer.