[Qt-interest] how to get the all the text in QWebView

Andre Somers andre at familiesomers.nl
Sun Oct 3 10:47:20 CEST 2010


  Op 2-10-2010 2:34, go canal schreef:
> Hi,
> is there a method to get the whole html content of a QWebView ? Like 
> 'view source' of other browsers.
>
> from QWebPage, we can get mainFrame and currentFrame, then using 
> toHtml() to get the html content of a frame. However, what if the web 
> page has multiple frames ? How do I iterate all the frames ? Better 
> still if there is one single method to get all the content of  the web 
> page.
You were on the right track. There is no meaningful way to return one 
single html source if there are multiple frames. So indeed you need to 
iterate to get the source from all the frames. Lucky for you, QWebFrame 
has a childFrames() method that will return a QList of frames. Simply 
iterate over them recursively and you get all your frames.

André
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20101003/48567cd2/attachment.html 


More information about the Qt-interest-old mailing list