[Qt-interest] QObject::moveToThread: Widgets cannot be moved to a new thread

alexandre.raczynski@technog alexandre.raczynski at technogerma.fr
Fri Jul 31 07:21:55 CEST 2009


Arnold Krille a écrit :
> On Thursday 30 July 2009 16:49:36 alexandre.raczynski at technog wrote:
>> Donal O'Connor wrote :
>>> From my understanding, GUI operations can only be performed in the
>>> main (GUI) thread of the application so it wouldn't make sense to move
>>> QWidget to another thread?
>> You are right but moving them to the main thread makes sense.
> 
> Instantiating QWidgets (and all dereived classes) outside the main-thread 
> _doesnt_ make sense! It will probably lead to nasty errors and shouldn't be 
> done in the first place. So there isn't actually a reason to move a widget to 
> the main thread...
> 
> Have fun,
> 
> Arnold

In my use case it makes sense. It does not lead to nasty errors at least 
on Windows XP (Qt 4.5.2 MinGW). I have commented out the isWidget() 
check in QtCore and it works like a charm.

Alexandre.



More information about the Qt-interest-old mailing list