将你的while(1)循环改成用QTimer控制的事件来处理,自定义一个信号与主线程连接起来。比如
MyThread::run()
{
QTimer::singleShot(0, this, SLOT(myProc());
exec();
}
MyThread::myProc()
{
bool continue;
......
if (bCallOutFunc)
{
emit callOutFunc(data);
}
if (continue)
{
QTimer::singleShot(0, this, SLOT(myProc()));
}
}