[Qt-interest] Timer Events Execute in Wrong Thread

Sean Harmer sean.harmer at maps-technology.com
Mon Jul 19 15:47:58 CEST 2010


On Monday 19 July 2010 14:39:47 Andreas Pakulat wrote:
> So you have two options:
> 
> a) Move the TestThread object to itself using moveToThread, in which
> case a direct-connection will be done
> b) explicitly use Qt::DirectConnection and make sure that the tick-slot
> is threadsafe.

Or option:

 c) Create a QObject based helper object that has affinity with your worker 
thread and put your slot in that class. This will also use a direct connection 
but it makes it more obvious that the slot runs in the context of the worker 
thread.

Sean



More information about the Qt-interest-old mailing list