[Interest] a question about QNetworkAccessManager

Mårten Nordheim marten.nordheim at qt.io
Wed Mar 20 11:36:25 CET 2019


One QNetworkAccessManager (QNAM for short) will be enough in your case as well. The signals on QNAM all pass a pointer to the QNetworkReply so you can know which it relates to.
Although perhaps more fitting for your usecase may be to use the signals on QNetworkReply instead of QNAM https://doc.qt.io/qt-5/qnetworkreply.html#finished?

Regards,
Mårten

From: Matej Košík<mailto:misc at matej-kosik.net>
Sent: onsdag 20. mars 2019 10:47
To: interest at qt-project.org<mailto:interest at qt-project.org>
Subject: [Interest] a question about QNetworkAccessManager

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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20190320/0e33f30d/attachment.html>


More information about the Interest mailing list