Nyaruko
Nyaruko

Reputation: 4499

How to differentiate a QNetworkReply is aborted or not?

I have the following code:

connect(&netMgr, SIGNAL(finished(QNetworkReply*)), this, SLOT(loadFinished(QNetworkReply*)), Qt::UniqueConnection);
reply = netMgr.get(qheader);

How could I tell whether the loadFinished(); slot is triggered by calling reply->abort() or not?

Upvotes: 2

Views: 1578

Answers (1)

Amartel
Amartel

Reputation: 4286

If aborted, QNetworkReply::error() should return QNetworkReply::OperationCanceledError, which means:

the operation was canceled via calls to abort() or close() before it was finished.

Upvotes: 9

Related Questions