How to call a function periodically in Qt?

advertisements

Is it possible to call a function periodically in C++ with Qt function ?
And how to stop the timed function after it is set to be called periodically ?


If you are using qt, you can you QTimer which by default creates a repetitive timer.

There is an example in the documentation (shown below) and an example (Analog Clock).

QTimer *timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), this, SLOT(update()));
timer->start(1000);