diff options
Diffstat (limited to 'src/kernel/qapplication.cpp')
| -rw-r--r-- | src/kernel/qapplication.cpp | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/src/kernel/qapplication.cpp b/src/kernel/qapplication.cpp index 0ec4904..960db1e 100644 --- a/src/kernel/qapplication.cpp +++ b/src/kernel/qapplication.cpp @@ -546,8 +546,9 @@ static QPostEventList *globalPostedEvents = 0; // list of posted events uint qGlobalPostedEventsCount() { - if (!globalPostedEvents) + if (!globalPostedEvents) { return 0; + } return globalPostedEvents->count(); } @@ -2315,8 +2316,9 @@ void QApplication::aboutQt() bool QApplication::notify( QObject *receiver, QEvent *e ) { // no events are delivered after ~QApplication() has started - if ( is_app_closing ) + if ( is_app_closing ) { return FALSE; + } if ( receiver == 0 ) { // serious error #if defined(QT_CHECK_NULL) @@ -2358,8 +2360,9 @@ bool QApplication::notify( QObject *receiver, QEvent *e ) } bool res = FALSE; - if ( !receiver->isWidgetType() ) + if ( !receiver->isWidgetType() ) { res = internalNotify( receiver, e ); + } else switch ( e->type() ) { #ifndef QT_NO_ACCEL case QEvent::Accel: @@ -2367,13 +2370,15 @@ bool QApplication::notify( QObject *receiver, QEvent *e ) QKeyEvent* key = (QKeyEvent*) e; res = internalNotify( receiver, e ); - if ( !res && !key->isAccepted() ) + if ( !res && !key->isAccepted() ) { res = qt_dispatchAccelEvent( (QWidget*)receiver, key ); + } // next lines are for compatibility with Qt <= 3.0.x: old // QAccel was listening on toplevel widgets - if ( !res && !key->isAccepted() && !((QWidget*)receiver)->isTopLevel() ) + if ( !res && !key->isAccepted() && !((QWidget*)receiver)->isTopLevel() ) { res = internalNotify( ((QWidget*)receiver)->topLevelWidget(), e ); + } } break; #endif //QT_NO_ACCEL @@ -3116,8 +3121,9 @@ void QApplication::postEvent( QObject *receiver, QEvent *event ) qapp_cleanup_events.set( &globalPostedEvents ); } - if ( !receiver->postedEvents ) + if ( !receiver->postedEvents ) { receiver->postedEvents = new QPostEventList; + } QPostEventList * l = receiver->postedEvents; // if this is one of the compressible events, do compression @@ -3232,22 +3238,25 @@ void QApplication::sendPostedEvents( QObject *receiver, int event_type ) { // Make sure the object hierarchy is stable before processing events // to avoid endless loops - if ( receiver == 0 && event_type == 0 ) + if ( receiver == 0 && event_type == 0 ) { sendPostedEvents( 0, QEvent::ChildInserted ); - - if ( !globalPostedEvents || ( receiver && !receiver->postedEvents ) ) - return; + } #ifdef QT_THREAD_SUPPORT QMutexLocker locker( postevent_mutex ); #endif + if ( !globalPostedEvents || ( receiver && !receiver->postedEvents ) ) { + return; + } + bool sent = TRUE; while ( sent ) { sent = FALSE; - if ( !globalPostedEvents || ( receiver && !receiver->postedEvents ) ) + if ( !globalPostedEvents || ( receiver && !receiver->postedEvents ) ) { return; + } // if we have a receiver, use the local list. Otherwise, use the // global list @@ -3296,8 +3305,9 @@ void QApplication::sendPostedEvents( QObject *receiver, int event_type ) if ( e->type() == QEvent::Paint && r->isWidgetType() ) { QWidget * w = (QWidget*)r; QPaintEvent * p = (QPaintEvent*)e; - if ( w->isVisible() ) + if ( w->isVisible() ) { w->repaint( p->reg, p->erase ); + } } else { sent = TRUE; QApplication::sendEvent( r, e ); @@ -3318,10 +3328,12 @@ void QApplication::sendPostedEvents( QObject *receiver, int event_type ) if ( l == globalPostedEvents ) { globalPostedEvents->first(); while( (pe=globalPostedEvents->current()) != 0 ) { - if ( pe->event ) + if ( pe->event ) { globalPostedEvents->next(); - else + } + else { globalPostedEvents->remove(); + } } } } |
