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 response to http posts.
The problem is QNetworkReply
is something that can only be read once.
If I call
readAll()
when I pickreadyRead()
signal, I will get the full data. But it will be cleared soQWebView
displays nothing (it won't get any reply data).Or if I pick
finished()
signal, since the data is already read byQWebView
(orQNetworkAccessManager
), I get nothing if I callreadAll()
here. Is there somewhere thatQNetworkReply
, or manager or any class, stores the data which I can still read?
In #1 I can get part of the data if I call peek()
. This function does not clear the response data. But it won't work if the response body is big. The QNetworkReply
is a sequential thing that I can neither know its data nor read further than buffered.
I have no idea of how to do with this.....
I just want to monitor and log the request and response body of any request made on my QWebView
...
Edit: note that my data to read from response is as large as 1MB so it won't be ok to peek the whole data without further reading.