PDA

View Full Version : How to get http reply to var, for example: to ui->textBrowser?



lapdx
6th November 2012, 17:32
QNetworkRequest request;
networkManager = new QNetworkAccessManager(this);
request.setUrl(QUrl("http://qt.nokia.com"));
request.setRawHeader("User-Agent", "MyOwnBrowser 1.0");
networkManager->get(request);
How to get reply to var, for example: to ui->textBrowser?

ChrisW67
6th November 2012, 20:52
Well, you start by not discarding the QNetworkReply returned by QNetworkAccessManager::get(), connect something to its signals, and get on with life while you wait for the response to come back. When you get the response, check it is not an error, extract the content by reading the QIODevice, and put it in your widget. There is more than one example in the docs and this forum.