Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

QNetworkAccessManager how to check whether there is pending request?

Tags:

c++

qt

In qt4.8, where there is still the qhttp class, I could use http->hasPendingRequests() to check whether there is still pending requests. But in qt5, we are forced to use the QNetworkAccessManager class to manage the http link. How could I achieve this checking?

like image 219
Nyaruko Avatar asked Nov 01 '22 08:11

Nyaruko


1 Answers

Better late than never, although I could not find related docs, try something like:

QNetworkAccessManager myManager;

// Some requests here...

QList<QNetworkReply *> list =
    myManager->findChildren<QNetworkReply *>();

Note that above is only tested with Qt4 and Qt5 (but might be true for coming versions),
And actually, this is how Qt itself finds them for destruction.

like image 173
Top-Master Avatar answered Nov 15 '22 03:11

Top-Master