From 56999a270de5c243399b7f237007b87559668c6f Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Mon, 25 Nov 2013 02:20:50 -0600 Subject: Wake up the correct event loop when an event is posted to TQApplication This relates to Bug 1703 --- src/kernel/qapplication.cpp | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) (limited to 'src/kernel/qapplication.cpp') diff --git a/src/kernel/qapplication.cpp b/src/kernel/qapplication.cpp index aa2806e..d87d2e5 100644 --- a/src/kernel/qapplication.cpp +++ b/src/kernel/qapplication.cpp @@ -2453,6 +2453,16 @@ void QApplication::aboutQt() \sa postEvent(), notify() */ +bool QApplication::sendEvent( QObject *receiver, QEvent *event ) { + if ( event ) event->spont = FALSE; + return qApp ? qApp->notify( receiver, event ) : FALSE; +} + +bool QApplication::sendSpontaneousEvent( QObject *receiver, QEvent *event ) { + if ( event ) event->spont = TRUE; + return qApp ? qApp->notify( receiver, event ) : FALSE; +} + /*! Sends event \a e to \a receiver: \a {receiver}->event(\a e). Returns the value that is returned from the receiver's event handler. @@ -3452,18 +3462,19 @@ void QApplication::postEvent( QObject *receiver, QEvent *event ) globalPostedEvents->append( pe ); #ifdef QT_THREAD_SUPPORT - if ( event->type() == QEvent::MetaCall ) { - // Wake up the receiver thread event loop - QThread* thread = receiver->contextThreadObject(); - if (thread) { - if (thread->d) { - if (thread->d->eventLoop) { - thread->d->eventLoop->wakeUp(); - } + // Wake up the receiver thread event loop + QThread* thread = receiver->contextThreadObject(); + if (thread) { + if (thread->d) { + if (thread->d->eventLoop) { + thread->d->eventLoop->wakeUp(); + return; } } + } + if ( event->type() == QEvent::MetaCall ) { return; - } + } #endif if (currentEventLoop()) { -- cgit v1.2.3