QT中如果在QApplication.exec()之前执行QEventLoop.exec(), 简要代码如下:
代码
int main(int argc, char *argv[]){
........
QEventLoop eventLoop;
QTimer timer;
timer.setSingleShot(true);
QObject::connect(&timer, SIGNAL(timeout()), &eventLoop, SLOT(quit()));
QObject::connect(reply, SIGNAL(finished()), &eventLoop, SLOT(quit()));
timer.start(timeout);
eventLoop.exec(QEventLoop::ExcludeUserInputEvents);
.......
QApplication a(argc, argv);
a.exec();
}
为什么程序会阻塞在eventLoop.exec()?