Changeset 27235 in vbox
- Timestamp:
- Mar 9, 2010 10:06:02 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 58617
- 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 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 } -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineViewNormal.cpp
r27233 r27235 264 264 bool UIMachineViewNormal::eventFilter(QObject *pWatched, QEvent *pEvent) 265 265 { 266 /* Who are we watchin ? */266 /* Who are we watching? */ 267 267 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; 270 269 271 270 if (pWatched != 0 && pWatched == pMainDialog) … … 292 291 break; 293 292 } 294 # endif 293 # endif /* defined (VBOX_GUI_USE_DDRAW) */ 295 294 #endif /* defined (Q_WS_WIN32) */ 296 295 default: … … 298 297 } 299 298 } 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 325 300 return UIMachineView::eventFilter(pWatched, pEvent); 326 301 } -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineViewSeamless.cpp
r27227 r27235 246 246 bool UIMachineViewSeamless::eventFilter(QObject *pWatched, QEvent *pEvent) 247 247 { 248 /* Who are we watching? */ 248 249 QIMainDialog *pMainDialog = machineWindowWrapper() && machineWindowWrapper()->machineWindow() ? 249 qobject_cast<QIMainDialog*>(machineWindowWrapper()->machineWindow()) : 0; 250 qobject_cast<QIMainDialog*>(machineWindowWrapper()->machineWindow()) : 0; 251 250 252 if (pWatched != 0 && pWatched == pMainDialog) 251 253 { … … 270 272 } 271 273 } 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 301 275 return UIMachineView::eventFilter(pWatched, pEvent); 302 276 }
Note:
See TracChangeset
for help on using the changeset viewer.