PDA

View Full Version : QThread::exec and QApplication instantiation



Ray Froehlich
27th July 2010, 22:26
I'm using Qt 4.6.1 with Embedded Linux and am configuring so that the Qt application is automatically launched upon boot. The symptom of the problem I'm dealing with is that the application starts but does nothing; it did not progress to the point where the main window is shown. After looking into it, it *seems* as though the problem is related to a QThread::exec call that is occuring before the QApplication is instantiated. The QThread in question is a static piece of data that starts itself automatically in it's constructor, and in it's run function calls exec(). If this start call (and therefore the call to exec() as well) is made outside this constructor and *after* the QApplication is instantiated, everything seems to work fine. Does anyone know why this might be? Any help would be much appreciated!

-Ray Froehlich

tbscope
28th July 2010, 05:35
From the documentation:


Starting a Thread
Then, create an instance of the thread object and call QThread::start(). Note that you must create the QApplication (or QCoreApplication) object before you can create a QThread.


To put it very simple, QThread makes use of the application.