[Qt-interest] Basic QThread question

Phil phillor at telstra.com
Wed Apr 28 06:21:58 CEST 2010


On Tue, 27 Apr 2010 05:40:33 pm Sean Harmer wrote:
> 
> It is probably best to use a QTimer with a 1s timeout value in your worker
> thread. Then connect the timeout signal to a slot that queries your device
>  and then emits a signal value( int x ) say that you have connected to in
>  the main thread.
> 

Thank you Sean and Andre for your detailed replies. 

It's not immediately clear to me how I might add your methods to my 
present code. Briefly, my main class is sub-classed from QMainWindow and 
is used as a supervisor to get information from other classes each second. 
This timing period is derived from a QTimer. A calculation, based on the data 
returned from another classes is then made. The hardware is then polled 
and it's returned value determines the course of the programme before the 
next one second polling period.

So, how I might use a QTimer in my hardware class and tie that in with my 
present code is a bit of a mystery at the moment. I'll have to give this a lot 
more thought.

-- 
Regards,
Phil



More information about the Qt-interest-old mailing list