From d73fef560e4b98253a8c769b21c3360d0e188756 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 10 Aug 2022 21:07:29 +0530 Subject: [PATCH] Allow using QtWebEngine in the main calibre application as well --- bypy/init_env.py | 3 +++ src/calibre/gui2/__init__.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/bypy/init_env.py b/bypy/init_env.py index e955728f91..a16e06ab2f 100644 --- a/bypy/init_env.py +++ b/bypy/init_env.py @@ -34,6 +34,7 @@ dlls = [ 'Widgets', # 'Multimedia', 'OpenGL', + 'OpenGLWidgets', 'Quick', 'QuickWidgets', 'Qml', @@ -88,6 +89,8 @@ PYQT_MODULES = ( 'QtSensors', 'QtSvg', 'QtWidgets', + 'QtOpenGL', + 'QtOpenGLWidgets', 'QtWebEngine', 'QtWebEngineCore', 'QtWebEngineWidgets', diff --git a/src/calibre/gui2/__init__.py b/src/calibre/gui2/__init__.py index e201e6d714..946a18e75f 100644 --- a/src/calibre/gui2/__init__.py +++ b/src/calibre/gui2/__init__.py @@ -1077,6 +1077,9 @@ class Application(QApplication): # Allow import of webengine after construction of QApplication on new # enough PyQt QApplication.setAttribute(Qt.ApplicationAttribute.AA_ShareOpenGLContexts) + # this import is needed to have Qt call qt_registerDefaultPlatformBackingStoreOpenGLSupport + from qt.core import QOpenGLWidget + del QOpenGLWidget if iswindows: self.windows_app_uid = None if windows_app_uid: