[QGIS-Developer] Transition from QtWebKit to QtWebEngine in qgis2web (QGIS plugin)

Julien Moura (Oslandia) julien.moura at oslandia.com
Thu Aug 1 05:17:14 PDT 2024


Hi Andrea,

We're currently working on this question on QTribu 
(https://github.com/geotribu/qtribu/pull/186).

> What is the correct way to have users install the qtwebengine dependency?
On Debian and derived: |sudo apt install python3-pyqt5.qtwebengine|

On Windows, it seems that it's already included in the MSI package and 
standard QGIS installation with OSGeo4W.|
|

Hope it helps,
Julien

Le 30/07/2024 à 11:29, Info O.GIS via QGIS-Developer a écrit :
> Good morning developers,
> I managed to get qtwebengine working in qgis2web.
> For some reason qtwebkit didn't need to set a window width while 
> qtwebengine did, so with this code I solved it
>
>     self.preview.setMinimumWidth(650)
>
> *Request:*
> What is the correct way to have users install the qtwebengine dependency?
> I wrote this code and it works fine but I only tested it on 
> windows. Is this the correct way?
>
>     try:
>             if system == 'Windows':
>                 pip_exec = os.path.join(sysconfig.get_path("scripts"),
>     "pip3")
>                 env = os.environ.copy()
>                 if full_proxy_url:
>                     env['http_proxy'] = full_proxy_url
>                     env['https_proxy'] = full_proxy_url
>                 subprocess.check_call([pip_exec, "install",
>     "--upgrade", "PyQtWebEngine==5.15.6"], env=env)
>             elif system == 'Linux':
>                 subprocess.check_call(["sudo", "apt-get", "install",
>     "python3-pyqt5.qtwebengine"])
>             elif system == 'Darwin':  # macOS
>                 subprocess.check_call(["brew", "install", "pyqt5"])
>
>
>
> Many thanks
>
> *Andrea Ordonselli*
> *O.GIS - **opengis.it*
>
>
> Dainfo at opengis.it
> Ajan at dalheimer.de
> Ccqgis-developer at lists.osgeo.org
> DataTue, 9 Jul 2024 17:46:39 +0200
> OggettoRe: [QGIS-Developer] Transition from QtWebKit to QtWebEngine in 
> qgis2web (QGIS plugin)
>
> Thanks Jan Dalheimer
> Thanks Jean-Baptiste Peter
>
> From your answers I understood many things.
>
> I tried both to use QGIS 3.38.0 installed in win10 via .msi and the 
> version via OSGeo4W setup; In the first case I added qtwebengine via 
> "pip install qtwebengine", in the second case I installed the 
> "python3-pyqtwebengine" package via OsGeo4w setup
>
> In both installations I get the same result: QtWebEngine it does not 
> work well
>
> I also tried to create a new test plugin and I get the same result, I 
> can't even view a web page. Is there an example of a basic plugin that 
> I can see? Or can someone create it?
>
> *The clue:*
> If I use qt designer to insert a QtWebEngineView into the plugin 
> graphics it works well, even when setting a static web page.
> But if I open QGIS that plugin won't work, why does this happen? I 
> would therefore think that it is just a question of dependency .
>
> For now I noticed this:
>
> 1) From QGIS version 3.38.0 I can use "from 
> qgis.PyQt.QtWebEngineWidgets import *" instead of "from 
> PyQt5.QtWebEngineWidgets import *"
>
>
> 2) with qgis 3.38.0 .msi installation this dependency is missing:
>
>
>     qt5-devel (5.15.13-1)
>     Qt5 headers and libraries (Development)
>     Required by: python3-pyqtwebengine
>
>
>
> 3) with OSGeo4W setup these dependencies are required:
>
>     python3-core (3.12.4-1)
>     Python core interpreter and runtime
>     Required by: python3-pyqtwebengine, python3-pyqt5, python3-pyqt5-sip
>
>
>     python3-pyqt5 (5.15.10-1)
>     Python bindings for the Qt cross platform application toolkit
>     Required by: python3-pyqtwebengine
>
>
>     python3-pyqt5-sip (12.13.0-1)
>     The sip module support for PyQt5
>     Required by: python3-pyqtwebengine, python3-pyqt5
>
>
>     qt5-devel (5.15.13-1)
>     Qt5 headers and libraries (Development)
>     Required by: python3-pyqtwebengine
>
>
>     qt5-libs (5.15.13-1)
>     Qt5 runtime libraries
>     Required by: python3-pyqtwebengine, python3-pyqt5, qt5-devel,
>     qtwebkit-libs
>
>
> Thank you all
>
> *Andrea Ordonselli*
> *OpenGIS.it*
>
> _______________________________________________
> 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
-- 
Oslandia 
<https://geotribu.fr/?utm_source=email&utm_campaign=signature_oslandia&utm_medium=email>- 
Geotribu 
<https://geotribu.fr/?utm_source=email&utm_campaign=signature_oslandia&utm_medium=email>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20240801/15f965a1/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_0x5375CD81333F311E.asc
Type: application/pgp-keys
Size: 3154 bytes
Desc: OpenPGP public key
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20240801/15f965a1/attachment-0001.key>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: julien_moura.vcf
Type: text/vcard
Size: 273 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20240801/15f965a1/attachment-0001.vcf>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20240801/15f965a1/attachment-0001.sig>


More information about the QGIS-Developer mailing list