summaryrefslogtreecommitdiffstats
path: root/doc/codesnippets/doc/src/snippets/code/src_network_access_qnetworkaccessmanager.cpp
blob: 73b58c1fdf14e03c99aba743d0b2cae10ee15f7d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//! [0]
manager = QNetworkAccessManager(self)
connect(manager, SIGNAL(finished("QNetworkReply*")),
        self, SLOT(replyFinished("QNetworkReply*")))

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


//! [1]
QNetworkRequest request
request.setUrl(QUrl("http://qtsoftware.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>")))
//! [1]