Qt线程中exec()之后的代码未实现
我在线程的Qt线程中exec()之后的代码未实现,qt,Qt,我在线程的run()函数的代码体中发现,exec()()后面的代码在退出应用程序之前不会实现。例如: myClass::run() { qDebug()<<"Before exec()"; //do some work, e.g., signal-slot connections based on a QTimer object exec(); qDebug()<<"After exec()"; //this piece of code is
run()
函数的代码体中发现,exec()
()后面的代码在退出应用程序之前不会实现。例如:
myClass::run()
{
qDebug()<<"Before exec()";
//do some work, e.g., signal-slot connections based on a QTimer object
exec();
qDebug()<<"After exec()"; //this piece of code is implemented only after the application is quitted.
}
myClass::run()
{
qDebug()根据Qt doc(),exec()
意味着进入事件循环并等待调用exit()。这可能是退出应用程序后执行exec()
之后的代码的原因