开发者

How to view HTML data associated with a QWebPage

I wrote a program that uses a QWebPage to retrieve websites. Is there a way to get the data associated with the web page, like HTML, CSS, and Javascript? Similar to view-source in firefox.

There seem to be a couple options. One way is to make a QNetworkReply proxy and try copying the data, but this seems prone to bugs. Another way is to interact with the cache, but this seems unpredictable. Any other ways possi开发者_运维技巧ble?


Probably over the mainFrame() member function to get a QWebFrame and then maybe over the html() function. I've never done this before, but seems to be the way to go. If you need the DOM of the document there is a QWebElement documentElement () const that gets you most of the needed attributes.


I've settled on using a QNetworkReply Proxy.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜