This is my first experience on threading with Qt, so bear with me.
I have a singleton "system" object which periodically executes a heavy piece of code. I control the system singleton from my UI, but the system is not aware of the UI.
I create a thread in my main, and then move the system to it:
QThread systemThread;
System::instance()->moveToThread(&systemThread);
systemThread.start();
qApp.exec();
The UI hangs until the system's periodical processing cycle is complete.
I have also tried to subclass QThread and calling exec from the run method.
What could be the problem? I'm certainly doing something wrong.
Best regards
See the excellent article about Threads, Events and QObjects in the Qt developer wiki. Something seems to be wrong with the thread affinity, you can check that with QObject::thread().