[Interest] a question about QNetworkAccessManager

Reinhardt Behm rbehm at hushmail.com
Wed Mar 20 11:03:50 CET 2019


On Wednesday 20 March 2019 10:45:18 you wrote:
> Hi,
> 
> I am new to Qt.
> Yesterday, I have learned about:
> - QNetworkAccessManager
> - QNetworkRequest
> - QNetworkReply
> (as I wanted to figure out how to make HTTP GET/POST request and process the
> responses).
> 
> Here:
> 
>   https://doc.qt.io/qt-5/qnetworkaccessmanager.html#details
> 
> I read:
> 
>   One QNetworkAccessManager instance should be enough for the whole Qt
> application.
> 
> I do not understand what do I gain by that.
> Our application makes different HTTP requests.
> Each response must be handled differently.
> Why would we want to pipe all "finished" signals (generated by the
> QNetworkAccessManager) to the same set of slots? What sense would that
> make?
> 
> ---
> 
> Curiously,
> Matej

Then simply don't do this. Connect the finished signal from the generated 
QNetworkReply to the corresponding slot.

In this slot you should also delete the QNR (with deleteLater() ) because 
otherwise it will exist forever and eat up memory.

-- 
Best Regards

Reinhardt Behm




More information about the Interest mailing list