View Full Version : QTimer or something else

14th December 2011, 20:47
Hi !

I am writing a program with Qt that runs in background and at some specific time it should turn a camera with a unique id on.
We have four cameras so maybe we would have these rules( suppose system current time is 8:00 )

at 12:00 turn on camera 0
at 13:22 turn on camera 2 for 3 mins

Is it good idea to use QTimer with a big interval? Do you have a better idea?

14th December 2011, 21:06
QTimer is a good choice. You can also use QObject::timerEvent() directly if you like. In General I would use a timer with a shorter range and just do nothing if it isn't the time yet. This way you get a more accurate execution time.

15th December 2011, 08:47
I think the best solution is a queue of tasks and QTimer with a period, for example, 1 minute. In the slot, check to see if the queue we have some work to do in a given time and execute them.