[QGIS-Developer] Transition from QtWebKit to QtWebEngine in qgis2web (QGIS plugin)
Info O.GIS
info at opengis.it
Tue Jul 30 02:29:05 PDT 2024
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
Da info at opengis.it
A jan at dalheimer.de
Cc qgis-developer at lists.osgeo.org
Data Tue, 9 Jul 2024 17:46:39 +0200
Oggetto Re: [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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20240730/6439bb1f/attachment.htm>
More information about the QGIS-Developer
mailing list