标签:
void MyWidget::SendRequest(QString strUser) { network_manager = new QNetworkAccessManager(); connect(network_manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(ReadXML(QNetworkReply*))); QEventLoop loop; connect(network_manager, SIGNAL(finished(QNetworkReply*)), &loop, SLOT(quit())); // 发送请求 network_manager->post(network_request, post_data); // 启动事件循环 loop.exec(QEventLoop::ExcludeUserInputEvents); network_manager->deleteLater(); }
QEventLoop等待另外一个事件的停止,非常实用 good
标签:
原文地址:http://www.cnblogs.com/findumars/p/5277892.html