PDA

View Full Version : When should i use QThread and QTimer



NathiyaAmose
5th August 2013, 08:17
Can anyone please tell me,when shoud i use choose QTimer or QThread in my qt application with small example scenario.
Thankyou.

ChrisW67
5th August 2013, 09:51
QThread: Rarely. Very little in the average application requires threads in Qt.
QTimer: Quite often. Useful for repeating tasks or delayed execution of single tasks.

The two are not related.

NathiyaAmose
5th August 2013, 10:03
Thankyou
But in my application i have to read data from piece of hardware and plotting this into qwtplot widget,so if i choose QTimer for updating plot it is very slow compared to QThread.

wysota
5th August 2013, 10:08
Thankyou
But in my application i have to read data from piece of hardware and plotting this into qwtplot widget,so if i choose QTimer for updating plot it is very slow compared to QThread.

It's not about choosing the right technique that matters, it is about proper usage of the one you choose.

NathiyaAmose
5th August 2013, 11:02
Yes you are right.
Thankyou