1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
#include <QCoreApplication> #include <QDebug> #include <QThread> #include "myobject.h" #include "mythread.h" int main(int argc, char **argv) { QCoreApplication app(argc, argv); qDebug() << "main thread:" << QThread::currentThread(); MyObject a; MyThread t(&a); t.start(); // sleep(1); return app.exec(); }