Sending and receiving HTTP data

Requesting information from an HTTP server is a common task. Again, the Qt folks have prepared some useful classes to make it easy for us. To achieve this, we will rely on three classes, as follows:

  • QNetworkAccessManager: This class allows your application to send requests and receive replies
  • QNetworkRequest: This class holds the request to be sent with all the information (headers, URLs, data, and so on)
  • QNetworkReply: This class contains the result of a QNetworkRequest class, with the headers and the data

The QNetworkAccessManager class is the pivot point of the whole Qt HTTP API. It is built around a single QNetworkAccessManager object that holds the configuration of the client, proxy settings, cache information, ...

Get Mastering Qt 5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.