PDA

View Full Version : How to use setErrorString() of QNetworkReply?



npatil15
23rd July 2019, 14:54
Hi,

How to access setErrorString() of QNetworkReply Class, as its private member but I want to add my custom message.

Thanks

ChrisW67
24th July 2019, 03:43
How to access setErrorString() of QNetworkReply Class, as its private member but I want to add my custom message.

Subclass QNetworkReply and provide a way to get the relevant data to QNetworkReply::setError() (https://doc.qt.io/qt-5/qnetworkreply.html#setError). Return an instance of your QNetworkReply subclass from your QNetworkAccessManager::createRequest() (https://doc.qt.io/qt-5/qnetworkaccessmanager.html#createRequest) override.

npatil15
24th July 2019, 07:14
Thats the problem here, setError() is private and how I can access it

anda_skoa
25th July 2019, 09:47
Thats the problem here, setError() is private and how I can access it

No, QNetworkReply::setError() is protected, not private.

Cheers,
_