[QGIS-Developer] Recommended method to display a webpage in a plugin

Jean-Baptiste Peter jbpeter at outlook.com
Fri Apr 1 22:42:46 PDT 2022


Hi,

Following up on my previous post, I managed to get qwebengine to work within a plugin on windows 10.

I had to do the following changes :

- On QGIS side, I had to change a line in the main.cpp from core to set "Qt::AA_ShareOpenGLContexts". I already posted a PR for this :
https://github.com/qgis/QGIS/pull/47873

- I had to upgrade manually one of the dependency (python3-pyqt5-sip) to avoid the following error : “RuntimeError: the sip module implements API v12.0 to v12.8 but the PyQt5.QtCore module requires API v12.9”

- Finally, on Pyqt side it was necessary to add an additional check during initialization to detect if "Qt::AA_ShareOpenGLContexts" has been set; I already reported the issue and this should be addressed in the next release.

After doing these modifications, it works as expected in my environment. Would it be possible to apply these fixes in master?

Best,

Jean-Baptiste Peter


----Original Message-----
From: Nyall Dawson <nyall.dawson at gmail.com>
Sent: Wednesday, February 16, 2022 1:57 AM
To: Jean-Baptiste Peter <jbpeter at outlook.com>
Cc: qgis-developer at lists.osgeo.org
Subject: Re: [QGIS-Developer] Recommended method to display a webpage in a plugin

On Wed, 16 Feb 2022 at 06:46, Jean-Baptiste Peter <jbpeter at outlook.com> wrote:
>
> Hello,
>
> I am trying to figure what is the right way to display a webpage within a QGIS plugin and I have a few questions :
>
> Is it currently possible to use QWebEngineView class with QGIS python console? When I try to import it in QGIS python console, I get the following error :
>
>
>
> ModuleNotFoundError: No module named 'PyQt5.QtWebEngineWidgets'
>
>
>
>
>
> 2. If it is not currently possible to use QWebEngineView, does it involve major work or is there a chance it will be supported in the near future?

It's a very messy, horrible situation with no good ways forward. Right now you'll need to use QtWebKit, and there's no plans on the horizon to change this.

Nyall

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20220402/f899ccf2/attachment.html>


More information about the QGIS-Developer mailing list