it can't run under pyqt5? #1

Open
opened 2015-02-02 08:43:43 +00:00 by dragondjf · 8 comments
dragondjf commented 2015-02-02 08:43:43 +00:00 (Migrated from github.com)

this wrapper work under Qt not for PyQt5, because PyQt5 don't support QtWebEngine , PyQt only support QtWebEngineWidgets. How to fix this?

this wrapper work under Qt not for PyQt5, because PyQt5 don't support QtWebEngine , PyQt only support QtWebEngineWidgets. How to fix this?
mdkcore0 commented 2015-02-02 11:43:32 +00:00 (Migrated from github.com)

Hi @dragondjf. I wrote this wrapper to allow the use of WebEngineView inside QML at a time where pyqt5 just didn't support it. I saw something related to it recently on their changelog, but had no time to check. Will try to check it later, probably they are supporting it right now.

When I wrote this, I was using PyQt 5.4-snapshot-837edec02d98 and Qt 5.4 beta, it worked at the time (I was doing some tests with maps on QML). You can take a look on the example on this repository too.

What is your specific problem? It just doesn't work? Do you have any error message? Can you provide a small piece of code with the problem, and describe what you've done to build it?

Hope to get it solved for you, see ya ;)

Hi @dragondjf. I wrote this wrapper to allow the use of WebEngineView inside QML at a time where pyqt5 just didn't support it. I saw something related to it recently on their changelog, but had no time to check. Will try to check it later, probably they are supporting it right now. When I wrote this, I was using PyQt 5.4-snapshot-837edec02d98 and Qt 5.4 beta, it worked at the time (I was doing some tests with maps on QML). You can take a look on the example on this repository too. What is your specific problem? It just doesn't work? Do you have any error message? Can you provide a small piece of code with the problem, and describe what you've done to build it? Hope to get it solved for you, see ya ;)
dragondjf commented 2015-02-13 09:55:37 +00:00 (Migrated from github.com)

it work well, we must run initialize() before we can use WebEngineView, to fix this, I wrote DQuickView like this, so it work nice. or you can use Loader to cotroll WebEngineWrapper initialize fininshed before use WebEngineView.

#!/usr/bin/python

import sys
import os
from PyQt5 import QtCore
from PyQt5 import QtGui
from PyQt5 import QtQuick
from PyQt5 import QtQml

class DQuickView(QtQuick.QQuickView):

"""The DQuickView init webengine in PyQt5"""

def __init__(self):
    super(DQuickView, self).__init__()
    self.initWebengine()

def initWebengine(self):
    component = QtQml.QQmlComponent(self.engine())
    component.setData('''
        import QtQuick 2.4
        import WebEngineWrapper 1.0
        WebEngineWrapper {
            Component.onCompleted: {
                initialize()
            }
        }
    ''', QtCore.QUrl(''));
    item = component.create()
    item.setParentItem(self.rootObject())
it work well, we must run initialize() before we can use WebEngineView, to fix this, I wrote DQuickView like this, so it work nice. or you can use Loader to cotroll WebEngineWrapper initialize fininshed before use WebEngineView. #!/usr/bin/python import sys import os from PyQt5 import QtCore from PyQt5 import QtGui from PyQt5 import QtQuick from PyQt5 import QtQml class DQuickView(QtQuick.QQuickView): ``` """The DQuickView init webengine in PyQt5""" def __init__(self): super(DQuickView, self).__init__() self.initWebengine() def initWebengine(self): component = QtQml.QQmlComponent(self.engine()) component.setData(''' import QtQuick 2.4 import WebEngineWrapper 1.0 WebEngineWrapper { Component.onCompleted: { initialize() } } ''', QtCore.QUrl('')); item = component.create() item.setParentItem(self.rootObject()) ```
mdkcore0 commented 2015-02-13 11:50:35 +00:00 (Migrated from github.com)

Oh, I see. Pretty cool man!

As I just needed WebEngineView on the QML side, I had no worries on trying to initialize it direct on python. But your way works, nice!

Oh, I see. Pretty cool man! As I just needed WebEngineView on the QML side, I had no worries on trying to initialize it direct on python. But your way works, nice!
chirstius commented 2016-10-21 19:49:23 +00:00 (Migrated from github.com)

I need to use WebEngine rendering to an OpenGL surface, tried compiling this, and it doesn't seem to work (Pyhton 3.x Qt 5.7) @dragondjf - can you provide a more complete example of how you get WebEngineView to work under pyqt5 with qml/QuickView? I can't seem to suss out how to do it from your sample - apologies, I am very new to python!

I need to use WebEngine rendering to an OpenGL surface, tried compiling this, and it doesn't seem to work (Pyhton 3.x Qt 5.7) @dragondjf - can you provide a more complete example of how you get WebEngineView to work under pyqt5 with qml/QuickView? I can't seem to suss out how to do it from your sample - apologies, I am very new to python!
chirstius commented 2016-10-21 20:58:49 +00:00 (Migrated from github.com)

Actually, I think I have everything sorted, but any time I try to run the example, I get:
file:///D:/WebEngineWrapper-master/example/main.qml:4:1: plugin cannot be loaded for module "WebEngineWrapper": Cannot load library D:\WebEngineWrapper-master\build\WebEngineWrapper\webenginewrapper.dll: The specified module could not be found.
import WebEngineWrapper 1.0
^

Though, 100% the file IS there. QML2_IMPORT_PATH is set properly (changing it causes other issues so I know its being read) any ideas on why it might not be able to see the wrapper code? This is, obviously, on Windows

Actually, I think I have everything sorted, but any time I try to run the example, I get: file:///D:/WebEngineWrapper-master/example/main.qml:4:1: plugin cannot be loaded for module "WebEngineWrapper": Cannot load library D:\WebEngineWrapper-master\build\WebEngineWrapper\webenginewrapper.dll: The specified module could not be found. import WebEngineWrapper 1.0 ^ Though, 100% the file IS there. QML2_IMPORT_PATH is set properly (changing it causes other issues so I know its being read) any ideas on why it might not be able to see the wrapper code? This is, obviously, on Windows
mdkcore0 commented 2016-10-24 16:42:25 +00:00 (Migrated from github.com)

Hi, I can't test it with Qt 5.7 right now, but it's working on 5.6.2 (python 2.7 and 3.5, on OSX), and PyQt5.6.

Seems there is some problem with PyQt 5.7: https://www.riverbankcomputing.com/pipermail/pyqt/2016-October/038231.html
https://www.riverbankcomputing.com/pipermail/pyqt/2016-September/038092.html

Hi, I can't test it with Qt 5.7 right now, but it's working on 5.6.2 (python 2.7 and 3.5, on OSX), and PyQt5.6. Seems there is some problem with PyQt 5.7: https://www.riverbankcomputing.com/pipermail/pyqt/2016-October/038231.html https://www.riverbankcomputing.com/pipermail/pyqt/2016-September/038092.html
chirstius commented 2016-10-24 17:00:28 +00:00 (Migrated from github.com)

Got some info from the PyQt guys that say WebEngine should be sorted out in the next release of PyQt that's due in a few weeks. I suppose I'll just wait it out and see if that really does correct things. Thanks for the response!

Got some info from the PyQt guys that say WebEngine should be sorted out in the next release of PyQt that's due in a few weeks. I suppose I'll just wait it out and see if that really does correct things. Thanks for the response!
IlyaBizyaev commented 2016-12-30 09:12:52 +00:00 (Migrated from github.com)

Hello!
Loading WebEngine from QML produces segfault. I am using Qt 5.8.
In C++ code, everything works fine; I think the reason is that in C++ there is "QtWebEngine::initialize()".
Is there still no way to use WebEngine with PyQt without wrappers?

Hello! Loading WebEngine from QML produces segfault. I am using Qt 5.8. In C++ code, everything works fine; I think the reason is that in C++ there is "QtWebEngine::initialize()". Is there still no way to use WebEngine with PyQt without wrappers?
Commenting is not possible because the repository is archived.
No labels
No milestone
No project
No assignees
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
mdkcore/WebEngineWrapper#1
No description provided.