Networking in Qt is quite feature-rich. Networking in Qt Quick is more behind the scenes than in your face. In Qt Modeling Language (QML), you can download remote components and use them in your application, but any other arbitrary download or network functionality you will have to bake yourself in the C++ backend or use JavaScript.
Even though QNetworkRequest
, QNetworkReply
, and QNetworkAccessManager
are all used to make network requests, let's split them up and see how to use them.
QNetworkRequest
is a part of the access functionality. It constructs a request
, which can be one of the following verbs:
GET
:get(...)
POST
:post(...)
PUT
:put(...)
DELETE
:deleteResource(...)
HEAD
:head(...)
You can also send custom verbs using sendCustomRequest
, which takes the custom verb as a QByteArray
argument.
Headers can be set as known headers using setHeader
and can be one of the following:
ContentDispositionHeader
ContentTypeHeader
ContentLengthHeader
LocationHeader...