這是代碼:發現QT HTTP GET,有什麼問題?
QEventLoop eventLoop;
QNetworkAccessManager mgr();
QObject::connect(mgr, SIGNAL(finished(QNetworkReply*)), &eventLoop, SLOT(quit()));
QUrl url(site);
QNetworkRequest req(url);
QNetworkReply *reply = mgr.get(req);
eventLoop.exec();
if (reply->error() == QNetworkReply::NoError) {
cout << "Success" endl;
delete reply;
}
else {
cout << "Failure" endl;
delete reply;
}
錯誤:
.. \ request.cpp(17):錯誤C2665: '的QObject :: 連接':無3過載可以轉換各種主題
和
的.. \ request.cp P(20):錯誤C2228:該元素添加到 左「獲得」必須是