[webkit-qt] Image capture of the contents of a QML WebView

Jocelyn Turcotte jocelyn.turcotte at digia.com
Thu May 23 00:45:50 PDT 2013


Hello,

if you want a QImage you should have a look at QQuickWindow::grabWindow().
It only works on the whole scene, so currently you would have to cut the part that interests you out of the QImage.

Cheers,
Jocelyn


On Thu, May 23, 2013 at 09:20:18AM +0200, Martin Leutelt wrote:
> Hi Olivier, 
>  
> I guess that what you want to do could be achieved in several ways, depending on
> which version of Qt/QML you're using.
> Assuming you're using QtQuick1:
> - write a QML-Plugin in which you create a custom painter that writes to an
> image, then pass that custom painter to
> the paint method of the item you want to take the screenshot of
> - use a ShaderEffectSource item in QML and set the target without doing live
> updates
> If you're using QtQuick2:
> - also use ShaderEffectSource
> - write a QML-plugin again, grab the whole screen of your application an cut out
> the area of the item you're interested in by using the coordinates that you
> passed to the plugin
>  
> I think that the solution using shaders would fit your purpose fine, unless you
> really need to have the 'screenshots' as real files. Hope that helps.
>  
> Regards,
> Martin
>  
> 
> On May 22, 2013 at 7:29 PM Olivier Tilloy <olivier at tilloy.net> wrote:
> 
> > I’m interested in capturing an image of the contents rendered into a QML
> > WebView. Ideally, from QML itself. If not directly possible, writing
> > some C++ to do that is an option. My question is: how would I go about
> > doing this?
> >
> > My use case is caching and displaying thumbnails of pages previously
> > visited (browser history), and currently open tabs.
> >
> > Help appreciated. Thanks!
> >
> >   Olivier
> > _______________________________________________
> > webkit-qt mailing list
> > webkit-qt at lists.webkit.org
> > https://lists.webkit.org/mailman/listinfo/webkit-qt
> --
> Martin Leutelt
> Software Engineer
> 
> basysKom GmbH
> Robert-Bosch-Str. 7 | 64293 Darmstadt | Germany
> Tel: +49 6151 870 589 -0 | Fax: -199
> martin.leutelt at basyskom.com  |www.basyskom.com
> 
> Handelsregister: Darmstadt HRB 9352
> Geschaeftsfuehrung: Dr.-Ing. Eva Brucherseifer, Heike Ziegler

> _______________________________________________
> webkit-qt mailing list
> webkit-qt at lists.webkit.org
> https://lists.webkit.org/mailman/listinfo/webkit-qt



More information about the webkit-qt mailing list