/* \internal Returns TRUE if the accel is in the current subwindow, else FALSE. */ bool QAccelManager::correctSubWindow( QWidget* w, QAccelPrivate* d ) { #if !defined ( Q_OS_MACX ) if ( !d->watch || !d->watch->isVisible() || !d->watch->isEnabled() ) #else if ( !d->watch || (!d->watch->isVisible() && !d->watch->inherits( "QMenuBar" )) || !d->watch->isEnabled() ) #endif return FALSE; QWidget* tlw = w->topLevelWidget(); QWidget* wtlw = d->watch->topLevelWidget(); /* if we live in a floating dock window, keep our parent's * accelerators working */ #ifndef QT_NO_MAINWINDOW if ( tlw->isDialog() && tlw->parentWidget() && ::qt_cast<QDockWindow*>(tlw) ) return tlw->parentWidget()->topLevelWidget() == wtlw; if ( wtlw != tlw ) return FALSE; #endif /* if we live in a MDI subwindow, ignore the event if we are not the active document window */ QWidget* sw = d->watch; while ( sw && !sw->testWFlags( WSubWindow ) ) sw = sw->parentWidget( TRUE ); if ( sw ) { // we are in a subwindow indeed QWidget* fw = w; while ( fw && fw != sw ) fw = fw->parentWidget( TRUE ); if ( fw != sw ) // focus widget not in our subwindow return FALSE; } return TRUE; }