#include class WorkerThread : public QThread { public: void run() { while(true) { /* * this thread won't work if you set the system time * during the thread's running * example: * first run this application * if nowtime is 3:50pm you can set system time to 2:50pm * look the console to determin if thread running */ qDebug() << "HelloWorld"; this->msleep(2000); } } }; int main(int argc, char *argv[]) { WorkerThread *workerThread = new WorkerThread(); workerThread->start(); QCoreApplication a(argc, argv); return a.exec(); }