Qt 多线程简单应用
声明:
QThread* thread;
初始化:
thread = new QThread();
thread->start();
将对象放到线程中去:
moveToThread(thread);
readTimer.moveToThread(thread);
readTimer.setSingleShot(true);
连接消亡信号:
connect(thread, SIGNAL(finished()), this, SLOT(thread_done()));
注销:
thread->quit();
thread->wait();
thread->deleteLater();