How to give a stop delay for delay processing in loop execution using QTime in qt?
Printable View
How to give a stop delay for delay processing in loop execution using QTime in qt?
Why you want to use QTime. If have decided to do so, write a while/for loop to monitor the time and count the delay you want.
One could use QThread::sleep() also
QTime dieTime= QTime::currentTime().addMSecs(10);
while( QTime::currentTime() < dieTime )
QCoreApplication::processEvents(QEventLoop::AllEve nts, 100);
I used this code for delay processing in my project.but I don't know how to stop this delay processing in loop execution?
And when the time changes from summer to winter you wait an hour. For this type of calculation, use QElapsedTimer which is insensitive to change the clock settings on your computer. A more elegant solution :