To use the standard sleep function add the following in your .cpp file:
#include <unistd.h>
As of Qt version 4.8, the following sleep functions are available:
void QThread::msleep(unsigned long msecs)
void QThread::sleep(unsigned long secs)
void QThread::usleep(unsigned long usecs)
To use them, simply add the following in your .cpp file:
#include <QThread>
Reference: QThread (via Qt documentation): http://doc.qt.io/qt-4.8/qthread.html
Otherwise, perform these steps...
Modify the project file as follows:
CONFIG += qtestlib
Note that in newer versions of Qt you will get the following error:
Project WARNING: CONFIG+=qtestlib is deprecated. Use QT+=testlib instead.
... so, instead modify the project file as follows:
QT += testlib
Then, in your .cpp file, be sure to add the following:
#include <QtTest>
And then use one of the sleep functions like so:
usleep(100);