Qt: connect a signal after a request is sent in QNetworkAccessManager [duplicate]

馋奶兔 提交于 2019-12-06 10:21:25

Not a problem. The get call is asynchronous: http://doc.qt.io/qt-5/qnetworkaccessmanager.html#details

QNetworkAccessManager queues the requests it receives, and runs 6 asynchronous tasks per time. So there's no much room to an error as you point.

But if you're afraid you can try the first example, connecting the signals of the manager:

QNetworkAccessManager *manager = new QNetworkAccessManager(this);
connect(manager, SIGNAL(finished(QNetworkReply*)),
        this, SLOT(replyFinished(QNetworkReply*)));

manager->get(QNetworkRequest(QUrl("http://qt-project.org")));
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!