[QGIS-Developer] Qt WebEngine in QGIS 3.36

Enzo Cocca enzo.ccc at gmail.com
Sun May 26 02:17:27 PDT 2024


Hi Enrico, have you tried to import early the qwebengine before the other
modules?

Like that example:

from PyQt5.QtWebEngineWidgets import QWebEngineView, QWebEnginePage
from qgis.PyQt.QtCore import QCoreApplication, QObject
from qgis.PyQt.QtWidgets import QAction
from qgis.core import QgsApplication
from qgis.gui import QgsMapCanvas

class MyPlugin(QObject):
    def __init__(self, iface):
        super().__init__()
        self.iface = iface
        self.web_view = QWebEngineView()
        self.web_view.setPage(QWebEnginePage())
        self.initGui()

I fixed the same problem in this way but I use windows not Linux

Best
E

Il dom 26 mag 2024, 10:42 Enrico Ferreguti via QGIS-Developer <
qgis-developer at lists.osgeo.org> ha scritto:

> Dear QGIS developers, I would need your support to update my plugins.
>
> I read that Qt WebEngine, from QGIS
>
> 3.36.3-Maidenhead, QT 5.15.3, is available for plugins:
> https://changelog.qgis.org/en/entry/2607
>
> But on Ubuntu Jammy LTS 22.04 and a fresh QGIS 3.36.3-Maidenhead with QT
> 5.15.3, when I try to import from QT5:
> from PyQt5.QtWebEngineWidgets import QWebEngineView, QWebEnginePage,
>
> I get an exception:
> ImportError: QtWebEngineWidgets must be imported before a QCoreApplication
> instance is created
>
> and when I do the same from python3 in bash I get no exceptions
>
> Where Am I wrong? Is there something different to do for importing
> QtWebEngineWidgets ?
> Can you point me to a running example?
>
> Thank you very much.
> Enrico Ferreguti
>
>
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20240526/9efb27d8/attachment.htm>


More information about the QGIS-Developer mailing list