[Qt-interest] QThread Question

Andre Somers andre at familiesomers.nl
Thu Aug 6 13:24:17 CEST 2009


Hi,

Donal O'Connor wrote:
> Hi Sean,
>
> Ok I see but actually looking at the code, there are some instance's 
> where it is just a regular method and not a slot. Does this mean, when 
> the method is called, that it is run in the calling thread?
Yes, normal methods called from another thread are executed in that 
calling thread's context.
>
> Plus, no where have specified the connection type to be Queued, I'm 
> assuming direct connection is the default and this results in the slot 
> being called in the calling thread?
Don't assume, read the documentation instead. The default mode is Auto. 
That means that if the two objects are in the same thread, the 
connection will be direct, and if they are in different threads, it will 
be queued.

But... if you want to know if that code runs in another thread, then why 
don't just test it? You can see in your process monitor what threads are 
created, or you can simply send the QObject::thread value to the debug 
output and compare it to the GUI's thread value, or...

André




More information about the Qt-interest-old mailing list