【发布时间】:2012-10-18 02:29:50
【问题描述】:
我没有永远循环like this question,但它仍然没有发出finished() 信号,
在类的构造函数中:
connect (&thread, SIGNAL(started()), SLOT(threadFunc()));
connect (&thread, SIGNAL(finished()), SLOT(finished()));
在finished()函数中,
void XX::finished()
{
qDebug() << "Completed";
}
void XX::threadFunc()
{
qDebug() << "Thread finished"; // only single line, finishes immediately
}
但是我从来没有看到finished()被调用,每次在我用thread.start()启动线程之前,我必须手动调用thread.terminate(),我误解了QThread的用法吗?
【问题讨论】:
标签: multithreading qt4