[webkit-qt] Javascript inside pixeldata of QImage

Jocelyn Turcotte jocelyn.turcotte at digia.com
Tue Mar 19 06:41:07 PDT 2013

On Tue, Mar 19, 2013 at 10:39:05AM +0100, Youri Westerman wrote:
> Hi All,
> Basically I do the same thing as the example here:
> http://qt-project.org/doc/qt-4.8/qwebpage.html#details
> But instead of saving the image to disk I'm planning on doing other
> things with the data. Anycase when I retrieve the pixeldata from the
> QImage object by calling bits() on it and then inspect that data, I
> found that there is javascript code in there. So it seems to me that
> there is something going with the render method of the QWebPage class
> or something.
> Anyone out there that can shine their light on this? I tried doing the
> same thing with qt5, but unfortunately the javascript code inside the
> webpage does not even get executed there.

loadFinished means that all static resources have been fetched from the network and doesn't directly wait for script execution.
Also for more complex pages like gmail, there is no easy way AFAIK to guess from the outside when the page passed from an "initializing" state to a "displaying contents and processing user input" state.

I would suggest you to try using QWebFrame::initialLayoutCompleted (which should only be emitted after the body's onload event), or to start an additional timer following it if that still doesn't work.


More information about the webkit-qt mailing list