How to give a stop delay for delay processing in loop execution using QTime in qt?
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
When you know how to do it then you may do it wrong.
When you don't know how to do it then it is not that you may do it wrong but you may not do it right.
QTime dieTime= QTime::currentTime().addMSecs(10);
while( QTime::currentTime() < dieTime )
QCoreApplication:rocessEvents(QEventLoop::AllEvents, 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 :
Bookmarks