summaryrefslogtreecommitdiffstats
path: root/doc/codesnippets/doc/src/snippets/code/src_network_access_qnetworkaccessmanager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'doc/codesnippets/doc/src/snippets/code/src_network_access_qnetworkaccessmanager.cpp')
-rw-r--r--doc/codesnippets/doc/src/snippets/code/src_network_access_qnetworkaccessmanager.cpp35
1 files changed, 25 insertions, 10 deletions
diff --git a/doc/codesnippets/doc/src/snippets/code/src_network_access_qnetworkaccessmanager.cpp b/doc/codesnippets/doc/src/snippets/code/src_network_access_qnetworkaccessmanager.cpp
index 73b58c1..9d0ed1c 100644
--- a/doc/codesnippets/doc/src/snippets/code/src_network_access_qnetworkaccessmanager.cpp
+++ b/doc/codesnippets/doc/src/snippets/code/src_network_access_qnetworkaccessmanager.cpp
@@ -1,21 +1,36 @@
//! [0]
manager = QNetworkAccessManager(self)
-connect(manager, SIGNAL(finished("QNetworkReply*")),
- self, SLOT(replyFinished("QNetworkReply*")))
+manager.finished[QNetworkReply].connect(self.replyFinished)
-manager.get(QNetworkRequest(QUrl("http://qtsoftware.com")))
+manager.get(QNetworkRequest(QUrl("http://qt.nokia.com")))
//! [0]
//! [1]
-QNetworkRequest request
-request.setUrl(QUrl("http://qtsoftware.com"))
+request = QNetworkRequest()
+request.setUrl(QUrl("http://qt.nokia.com"))
request.setRawHeader("User-Agent", "MyOwnBrowser 1.0")
reply = manager.get(request)
-connect(reply, SIGNAL("readyRead()"), self, SLOT("slotReadyRead()"))
-connect(reply, SIGNAL(error("QNetworkReply.NetworkError")),
- self, SLOT(slotError("QNetworkReply.NetworkError")))
-connect(reply, SIGNAL(sslErrors("QList<QSslError>")),
- self, SLOT(slotSslErrors("QList<QSslError>")))
+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]
+