diff options
author | Timothy Pearson <[email protected]> | 2012-12-06 16:48:15 -0600 |
---|---|---|
committer | Timothy Pearson <[email protected]> | 2012-12-06 16:48:15 -0600 |
commit | 3f5dc49edf41359f18e7c94c28a345a9600eb44f (patch) | |
tree | 9377a62fd7701d20da0f08cc391035d8d072e8bf /src/kernel/qeventloop.cpp | |
parent | 6955a7ebe3c3a0ae2af416fc57ca1f3e9af0ecc3 (diff) | |
download | tqt3-3f5dc49edf41359f18e7c94c28a345a9600eb44f.tar.gz tqt3-3f5dc49edf41359f18e7c94c28a345a9600eb44f.zip |
Automated update from Qt3
Diffstat (limited to 'src/kernel/qeventloop.cpp')
-rw-r--r-- | src/kernel/qeventloop.cpp | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/src/kernel/qeventloop.cpp b/src/kernel/qeventloop.cpp index 4824f5717..e13a0e92a 100644 --- a/src/kernel/qeventloop.cpp +++ b/src/kernel/qeventloop.cpp @@ -41,6 +41,11 @@ #include "ntqapplication.h" #include "ntqdatetime.h" +#ifdef QT_THREAD_SUPPORT +# include "ntqthread.h" +# include "qthreadinstance_p.h" +#endif + /*! \class TQEventLoop \brief The TQEventLoop class manages the event queue. @@ -100,15 +105,27 @@ TQEventLoop::TQEventLoop( TQObject *parent, const char *name ) : TQObject( parent, name ) { #if defined(QT_CHECK_STATE) - if ( TQApplication::eventloop ) - tqFatal( "TQEventLoop: there must be only one event loop object. \nConstruct it before TQApplication." ); - // for now ;) + if ( TQApplication::currentEventLoop() ) + tqFatal( "TQEventLoop: there must be only one event loop object per thread. \nIf this is supposed to be the main GUI event loop, construct it before TQApplication." ); + if (!TQThread::currentThreadObject()) { + tqFatal( "TQEventLoop: this object can only be used in threads constructed via TQThread." ); + } #endif // QT_CHECK_STATE d = new TQEventLoopPrivate; init(); + +#ifdef QT_THREAD_SUPPORT + TQThread* thread = TQThread::currentThreadObject(); + if (thread) { + if (thread->d) { + thread->d->eventLoop = this; + } + } +#else TQApplication::eventloop = this; +#endif } /*! @@ -118,7 +135,16 @@ TQEventLoop::~TQEventLoop() { cleanup(); delete d; +#ifdef QT_THREAD_SUPPORT + TQThread* thread = TQThread::currentThreadObject(); + if (thread) { + if (thread->d) { + thread->d->eventLoop = 0; + } + } +#else TQApplication::eventloop = 0; +#endif } /*! |