PDA

View Full Version : Detecting finished download of HTML content for QWebView



TropicalPenguin
18th December 2010, 17:24
Hello,

Is there any clean way to detect when the HTML content loaded within a QWebView has finished downloading?

The loadFinished() signal doesn't seem quite what I want; to test this I compared the contents of page()->mainFrame()->toHtml() between signals of loadProgress(). On one site the HTML content had changed at progress points of 10, 26 and 27, but beyond that I guess all the progress was due to downloading externally referenced data and perhaps rendering. I'm only curious about the downloading of the HTML content internal to a page.

This assumes that loadFinished isn't emitted until loadProgress() reaches 100, of course, but I'm sure this is reasonable.

Thanks!

wysota
18th December 2010, 18:20
loadFinished() fires when a complete page is ready to be displayed (so when all references are downloaded as well). In your case it's probably best to set your own network access manager using QWebPage::setNetworkAccessManager(), subclass the NAM and reimplement createRequest() where you will connect to the finished() signal of QNetworkReply that gets returned by createRequest if the request is for the url you are interested in.

TropicalPenguin
18th December 2010, 18:50
Oh, wonderful.

Thank you.

Red5_StandingBy
21st June 2011, 20:44
For internal details of frame loading:
http://old.nabble.com/FrameLoaderClient-notifications-td16025970.html