[Qt-interest] Basic QThread question

Eirik Ulvik eiriku at simsurgery.com
Thu May 6 11:32:20 CEST 2010



Den 06.05.2010 11:26, skrev Sean Harmer:
> On Thursday 06 May 2010 10:21:23 Eirik Ulvik wrote:
>>> I do not think this is correct. DevicePoller is not a QThread it is a
>>> QObject so it has no started() signal.
>>>
>>> Cheers,
>>>
>>> Sean
>>
>> Ahh, sorry. It should be in the PollingThread class.
> 
> Why? It is not needed at all. The object that does the work, DevicePoller, was 
> created in the worker thread and so has affinity with the worker thread. 
> Therefore the timer in DevicePoller will use the event loop of the worker 
> thread.
> 
> You would only need to move the Thread to have affinity with itself if it is 
> the thread that is doing the polling. As we have another object doing it for 
> us this is not needed.
>

Yes, but the OP does seem to get the code working but still running in
the GUI thread. Based on my experience on a similar problem and
referring to the previous list entry (see link in my first reply) this
was the solution. Maybe this is not the case here, but it might be...

Eirik

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 551 bytes
Desc: OpenPGP digital signature
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100506/6131f800/attachment.bin 


More information about the Qt-interest-old mailing list