Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
src_network_access_qrestaccessmanager.cpp
Go to the documentation of this file.
1
// Copyright (C) 2023 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
4
//! [0]
5
QNetworkReply
*
reply
= manager->get(request);
6
QObject::connect(reply, &QNetworkReply::finished,
this
, [reply]() {
7
// The reply may be wrapped in the finish handler:
8
QRestReply restReply(reply);
9
if
(restReply.isSuccess())
10
// ...
11
});
12
//! [0]
13
14
15
//! [1]
16
// With lambda
17
manager->get(request,
this
, [
this
](QRestReply &reply) {
18
if
(reply.isSuccess()) {
19
// ...
20
}
21
});
22
// With member function
23
manager->get(request,
this
, &MyClass::handleFinished);
24
//! [1]
25
26
27
//! [2]
28
QJsonDocument
myJson
;
29
// ...
30
manager->post(request, myJson,
this
, [
this
](QRestReply &reply) {
31
if
(!reply.isSuccess()) {
32
// ...
33
}
34
if
(std::optional json = reply.readJson()) {
35
// use *json
36
}
37
});
38
//! [2]
39
40
41
//! [3]
42
manager->get(request,
this
, [
this
](QRestReply &reply) {
43
if
(!reply.isSuccess())
44
// handle error
45
if
(std::optional json = reply.readJson())
46
// use *json
47
});
48
//! [3]
49
50
51
//! [4]
52
manager->get(request, myData,
this
, [
this
](QRestReply &reply) {
53
if
(reply.isSuccess())
54
// ...
55
});
56
//! [4]
57
58
59
//! [5]
60
manager->post(request, myData,
this
, [
this
](QRestReply &reply) {
61
if
(reply.isSuccess())
62
// ...
63
});
64
//! [5]
65
66
67
//! [6]
68
manager->put(request, myData,
this
, [
this
](QRestReply &reply) {
69
if
(reply.isSuccess())
70
// ...
71
});
72
//! [6]
73
74
75
//! [7]
76
manager->head(request,
this
, [
this
](QRestReply &reply) {
77
if
(reply.isSuccess())
78
// ...
79
});
80
//! [7]
81
82
83
//! [8]
84
manager->deleteResource(request,
this
, [
this
](QRestReply &reply) {
85
if
(reply.isSuccess())
86
// ...
87
});
88
//! [8]
89
90
91
//! [9]
92
manager->sendCustomRequest(request,
"MYMETHOD"
, myData,
this
, [
this
](QRestReply &reply) {
93
if
(reply.isSuccess())
94
// ...
95
});
96
//! [9]
97
98
99
//! [10]
100
manager->patch(request, myData,
this
, [
this
](QRestReply &reply) {
101
if
(reply.isSuccess())
102
// ...
103
});
104
//! [10]
reply
QNetworkReply * reply
[0]
Definition
src_network_access_qhttpmultipart.cpp:26
myJson
QJsonDocument myJson
[1]
Definition
src_network_access_qrestaccessmanager.cpp:28
qtbase
src
network
doc
snippets
code
src_network_access_qrestaccessmanager.cpp
Generated on
for Qt by
1.18.0