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();
posted @ 2023-08-21 23:13  愿得入睡  阅读(5)  评论(0编辑  收藏  举报