I\'m playing around with Qt, and I want to create a simple pause between two commands. However it won\'t seem to let me use Sleep(int mili);
, and I can\'t find
Similar to some answers here, but maybe a little more lightweight
void MyClass::sleepFor(qint64 milliseconds){
qint64 timeToExitFunction = QDateTime::currentMSecsSinceEpoch()+milliseconds;
while(timeToExitFunction>QDateTime::currentMSecsSinceEpoch()){
QApplication::processEvents(QEventLoop::AllEvents, 100);
}
}