[Qt-interest] ASSERT: "qApp && qApp->thread() == QThread::currentThread"

Arnold Krille arnold at arnoldarts.de
Tue May 26 22:42:31 CEST 2009


On Tuesday 26 May 2009 15:57:21 Wasilios Goutas wrote:
> It seems to me, that the thread initializd the QApplication instance has
> also to be the thread with owns the instance of the used widgets.
> Is this right?

That is right (and stated often enough both in this lists archives and the 
official documentation of qt).
QApplication initializes the graphics connection with the os/environment. And 
graphics (=widgets and their updates/painting) can only be done in the thread 
that has the graphics connection.
Which means: If you initialize QApplication in your main thread, all the 
widgets have to live in the main thread too (and some other classes using X-
functions too). If you initialize the QApplication in a sub thread, all the 
widgets have to live in that subthread too.

Arnold
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090526/797cda41/attachment.bin 


More information about the Qt-interest-old mailing list