Questions tagged [qnetworkreply]

The QNetworkReply class contains the data and headers for a request sent with QNetworkAccessManager.

The QNetworkReply class contains the data and meta data related to a request posted with QNetworkAccessManager. Like QNetworkRequest, it contains a URL and headers (both in parsed and raw form), some information about the reply's state and the contents of the reply itself.

Official documentation can be found here.

114 questions
7
votes
1 answer

How do I read the data from QNetworkReply?

How do I read the data from a QNetworkReply response from a specific URL before QWebPage does? but when the finished() signal is emited the reply is read already by QWebPage, so connect readyRead() or call reply->readAll() return nothing. I tried…
Jack
  • 16,276
  • 55
  • 159
  • 284
7
votes
1 answer

How can I read content (http response body) from a QNetworkReply

I'm using qt5.3 and I googled a lot before I post. I want to read data from QNetworkReply. I have a QWebView and I also need the http response to be read by QWebView to display the webpage. What I need is just to log the web content or whatever…
K--
  • 659
  • 1
  • 7
  • 18
6
votes
4 answers

Qt - Getting source (HTML code) of a web page hosted on the internet

I want to get the source (HTML) of a webpage, for example the homepage of StackOverflow. This is what I've coded so far: QNetworkAccessManager manager; QNetworkReply *response = manager.get(QNetworkRequest(QUrl(url))); QString html =…
Alaa Salah
  • 1,047
  • 3
  • 12
  • 28
5
votes
1 answer

Does QNetworkReply always emit finished()?

I read the document of signal finished() , it does not say the finished() is always emitted. And I read the error() signal: void QNetworkReply::error(QNetworkReply::NetworkError code) This signal is emitted when the reply detects an error in…
zzy
  • 1,771
  • 1
  • 13
  • 48
4
votes
1 answer

What's the meaning of QNetworkReply::ProtocolUnknownError?

I use a object of QNetworkAccessManager to post json data to a website. when handle the reply which is a pointer of QNetworkReply class in the slot function, the value of reply->error() is 301 and the value of reply->errorString() is Error…
stamaimer
  • 6,227
  • 5
  • 34
  • 55
3
votes
1 answer

QT reports "QNetworkReplyHttpImplPrivate::_q_startOperation was called more than once" when requesting a http URL

I'm doing a very small and simple implementation of a protocol where my program will send a specific URL to a target machine and the target will reply with a JSON file. I have read many examples of how to do this in QT but still I face a log message…
3
votes
1 answer

Qt get external IP address using QNetworkReply

Good day Intro: My application requires getting the external IP address and matching it with an internally acquired address, thus allowing the application to proceed. For this, I am using a QNetworkAccessManager and QNetworkReply for this…
CybeX
  • 2,060
  • 3
  • 48
  • 115
3
votes
1 answer

How to add a token when I use the GET method in Qt?

I would like to add a token in my GET request in C++/Qt. This is my GET / download method : QNetworkReply* DownloadManager::doDownload(const QUrl &url) { QNetworkRequest request(url); QNetworkReply *reply = m_manager.get(request); //…
3
votes
1 answer

Read from QNetworkReply write to file

Assume that I have executed a QNetworkRequest and got the appropriated QNetworkReply. If it be a large file (say 1 GB) how can I create a say 4k byte array buffer and read data 4k by 4k into that array and write it at same time into an open file…
epsi1on
  • 561
  • 5
  • 16
3
votes
1 answer

Qt5 QNetworkAccessManager finished signal never emits

I have a very confusing problem. I had a simple project that was downloading files from some ftp servers. It worked very good. Then, I tried implementing that same code into a larger project (first one was a Console App, and the second one is GUI,…
3
votes
1 answer

Qt: connect a signal after a request is sent in QNetworkAccessManager

I was checking some simple examples of using QNetworkAccessManager and I found this (Assuming that manager is a QNetworkAccessManager: QNetworkRequest request; request.setUrl(QUrl("http://www.someserver.com")); QNetworkReply *reply =…
3
votes
2 answers

Slot not called for signal finished of QNetworkAccessManager

I want to send a post request to a server and I do something like this: function makePost(){ QNetworkAccessManager *networkManager = new QNetworkAccessManager(); qDebug()<<"1"; bool ret = connect(networkManager,…
Ispas Claudiu
  • 1,890
  • 2
  • 28
  • 54
3
votes
2 answers

Mac - Detecting Network Disconnect using Qt

I'm writing an application to download a file using Qt. The code snippet is QNetworkAccessManager nam = new QNetworkAccessManager(); QNetworkRequest request; request.setUrl(kUrl); QNetworkReply reply; //connect error(), finished(),…
3
votes
1 answer

QNetworkAccessManager - finished signal never triggers the slot

I'm trying to use QNetworkAcessManager to get the source of a url .. But it seems that there's a problem with the signal-slot complex! my onFinished(QNetworkReply*) is never triggered! Why? void Worker::start(QString url) { …
Alaa Salah
  • 1,047
  • 3
  • 12
  • 28
3
votes
0 answers

How to download resources of a webpage using QWebPage?

When QWebPage loads a page, it sends requests for all the objects in the page (images, js, css). I want to save these objects to separate files and not just to show them on QWebView. As mentioned in How to read data from QNetworkReply being used by…
1
2 3 4 5 6 7 8