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
@kshark27's answer didn't work for me for some reason (because I use Qt 5.7?) so I ended up doing this:
while (someCondition) {
// do something
QApplication::processEvents();
QThread::sleep(1); // 1 second
};
If this is done in the GUI thread, it obviously introduces a 1 second GUI lag before responding to user events. But if you can live with it, this solution is probably an easiest to implement and even Qt endorses it in their Threading Basics article (see When to Use Alternatives to Threads section).