[PyQt] PyQt5 support for QtWebEngine (for QML WebEngineView)?

Russell Warren russ at perspexis.com
Mon Sep 12 22:32:45 BST 2016


> Adding the call to setAttribute() works fine for me.

Works as in you can actual load a WebEngineView in QML?  When I set that
attribute I'm still left with the qml import error:

QQmlApplicationEngine failed to load component
file:///home/russ/pcode/qedms/examples/WEV.qml:3 module "QtWebEngine" is
not installed

Although I now see what you were talking about with
QtWebEngine.initialize() not being specifically required, looking at the
attribute it affects (AA_ShareOpenGLContexts) I can see that it isn't the
problem here.  It still seems like QtWebEngine itself is required, and it
doesn't seem to be present.

In short: I guess I don't need the specific QtWebEngine.initialize method,
but it sure seems like I need QtWebEngine itself in order to use
WebEngineView in QML.

Russ


On Mon, Sep 12, 2016 at 4:49 PM, Phil Thompson <phil at riverbankcomputing.com>
wrote:

> On 12 Sep 2016, at 9:38 pm, Russell Warren <russ at perspexis.com> wrote:
> >
> > What do you actually want to use which is missing?
> >
> > All I'm trying to do is get a WebEngineView to render in QML, per their
> tiny example here (to start with):
> >
> > http://doc.qt.io/qt-5/qml-qtwebengine-webengineview.
> html#initializing-web-engine
> >
> > (Given that, according to the docs, you don't need to call
> QtWebEngine.initialize()).
> >
> > Where does it say that? The docs I see [1] say that "for the web engine
> view to be rendered, the web engine must be initialized by using
> QtWebEngine::initialize in the application main source file".
>
> http://doc.qt.io/qt-5/qtwebengine.html#initialize
>
> > When I convert the small C launcher in the example to python and load
> the qml, I get:
> >
> > QQmlApplicationEngine failed to load component
> > file:///home/russ/code/qml/examples/WEV.qml:3 module "QtWebEngine" is
> not installed
> >
> > Here is my python file (a direct translation from the cited docs, minus
> the unavailable QtWebEngine.initialize()):
> >
> > #!/usr/bin/env python
> > import sys
> > from PyQt5 import QtGui, QtQml
> > from OpenGL import GL  #Linux workaround.  See: http://goo.gl/s0SkFl
> >
> > app = QtGui.QGuiApplication(sys.argv)
> > engine = QtQml.QQmlApplicationEngine()
> > engine.load("WEV.qml")
> > app.exec_()
> >
> > And the QML file...
> >
> > import QtQuick 2.0
> > import QtQuick.Window 2.0
> > import QtWebEngine 1.0
> >
> > Window {
> >     width: 1024
> >     height: 750
> >     visible: true
> >     WebEngineView {
> >         anchors.fill: parent
> >         url: "http://www.qt.io"
> >     }
> > }
> >
> > I have tried other python launchers (eg: with QQuickView) and I still
> run into issues on that qml import of QtWebEngine.
>
> Adding the call to setAttribute() works fine for me.
>
> Phil




-- 
Russell Warren
Perspexis Technologies Inc.

This information is confidential and intended solely for the use of the
individual or entity to whom it is addressed.
If you have received this email in error, please notify the sender
immediately.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20160912/b6c3b169/attachment.html>


More information about the PyQt mailing list