[Interest] Using Qt Webengine to render to an image

Kevin Mcintyre kebin70 at gmail.com
Sat Aug 27 04:56:59 CEST 2016


I do using pyqt.  Sometimes it's necessary to use QWebChannel to set
additional params like clipping properties.

class App(QApplication):

    def initCapture(self):
        self.capture = True
        self.opengl = None

    def toImage(self, location = None):
        png = '/tmp/capture.png'
        if location:
            png = location
        print 'toImage:', location
        if not self.opengl:
            print 'no opengl'
            return
        print 'IMAGE CAPTURE', png, self.opengl
        self.opengl.grabFramebuffer().save(png, 'PNG')


    def notify(self, receiver, event):
        if self.capture and isinstance(receiver, QOpenGLWidget):
            if self.opengl is None or self.opengl != receiver:
                #print '    SET OPENGL:', receiver
                self.opengl = receiver
        return super(App, self).notify(receiver, event)

On Fri, Aug 26, 2016 at 12:38 AM, Boudewijn Rempt <boud at valdyas.org> wrote:

> Hi,
>
> I'm looking into ways to render complex text with opentype features,
> complex scripts and so on. Web engines support that already, so I
> was wondering whether someone has already tried to make qtwebengine(page)
> render to a QImage instead of a widget.
>
> --
> Boudewijn Rempt | http://www.krita.org, http://www.valdyas.org
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20160826/e120443e/attachment.html>


More information about the Interest mailing list