Sleep in Qt
Somehow got very distracted from Qt. And then the other day had to come back =) Spent a long time remembering how I used to implement delays, or sleep in Qt (yes, yes, yes, it's bad, etc., but sometimes you really need it, especially if you need to turn in a lab to make others stop bothering you.)
Example of a trivial implementation:
#include "QThread"
...
class Sleeper: public QThread
{
public:
static void msleep(int ms)
{
QThread::msleep(ms);
}
};
Usage:
Sleeper::msleep(100);
Another plus in favor of the above code is its cross-platform nature, unlike Sleep() or something similar from the standard library.