[Qt-interest] Load QWidget in background "thread"

Berry Octave octave at octavious.servegame.org
Sat Jan 9 23:38:11 CET 2010


> Hi there
>
> I know that it is not possible to load a QWidget in a real QThread, but
> is there another way to load some QWidget in the background. One of our
> classes with OSG is quite big and it would be nice to load this at
> startup in background.
>
> Thanks a lot and regards
> Dominic
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest


Hi Dominic.

One thing you can do is to delay the widget's heavy initialization later in 
your code, and trigger it using a QTimer::singleShot(0, myobject, 
SLOT(initialize()));

This way, your window will be displayed with some empty contents quite early, 
then be populated once the initialize() method returns (which will allow the 
event loop to run).

Regards





More information about the Qt-interest-old mailing list