I have a Ubuntu , and i'am working with IDE QT
on C++
.
I will to pause and resume the Qtimer , for exampe :
void Ordonnancer_les_taches::on_pushButton_clicked()
{
connect(&dataTimer, SIGNAL(timeout()), this, SLOT(l_odonnancement()));
dataTimer.start(5000);
}
How to Pause
and how Restart
?
give me an exmple
Since there is no dedicated method to achieve this behaviour, you could do something like this (you may move it to a subclass PausableTime or so):
void pause() {
int remaining = dataTimer.remainingTime();
dataTimer.stop();
dataTimer.setInterval(remaining);
}
void resume() {
dataTimer.start();
}
Of course you then need to adjust the interval in your timeout slot again.