summaryrefslogtreecommitdiffstats
path: root/doc/codesnippets/doc/src/snippets/code/src_network_access_qnetworkaccessmanager.cpp
blob: 9d0ed1ce39da288ed36d4c7c2a18652a163e22f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//! [0]
manager = QNetworkAccessManager(self)
manager.finished[QNetworkReply].connect(self.replyFinished)

manager.get(QNetworkRequest(QUrl("http://qt.nokia.com")))
//! [0]


//! [1]
request = QNetworkRequest()
request.setUrl(QUrl("http://qt.nokia.com"))
request.setRawHeader("User-Agent", "MyOwnBrowser 1.0")

reply = manager.get(request)
reply.readyRead.connect(self.slotReadyRead)
reply.error[QNetworkReply.NetworkError].connect(self..slotError)
reply.sslErrors.connect(self.slotSslErrors)
//! [1]

//! [2]
manager = QNetworkConfigurationManager()
networkAccessManager.setConfiguration(manager.defaultConfiguration())
//! [2]

//! [3]
networkAccessManager.setConfiguration(QNetworkConfiguration())
//! [3]

//! [4]
networkAccessManager.setNetworkAccessible(QNetworkAccessManager.NotAccessible)
//! [4]

//! [5]
networkAccessManager.setNetworkAccessible(QNetworkAccessManager.Accessible)
//! [5]