From 0ea4c0d17450d1da3e52ef6259f3e54e5406c9c5 Mon Sep 17 00:00:00 2001 From: Jan Wester Date: Fri, 9 Jul 2021 23:38:39 +0200 Subject: [PATCH] Share OpenGL contexts to make Qt WebEngine happy This takes care of the following warning in our log file: Qt WebEngine seems to be initialized from a plugin. Please set Qt::AA_ShareOpenGLContexts using QCoreApplication::setAttribute before constructing QGuiApplication --- manuskript/main.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/manuskript/main.py b/manuskript/main.py index 5fc094d3..c0e09583 100644 --- a/manuskript/main.py +++ b/manuskript/main.py @@ -20,6 +20,10 @@ import logging LOGGER = logging.getLogger(__name__) def prepare(arguments, tests=False): + # Qt WebEngine demands this attribute be set _before_ we create our QApplication object. + QApplication.setAttribute(Qt.AA_ShareOpenGLContexts, True) + + # Create the foundation that provides our Qt application with its event loop. app = QApplication(sys.argv) app.setOrganizationName("manuskript" + ("_tests" if tests else "")) app.setOrganizationDomain("www.theologeek.ch") @@ -160,7 +164,7 @@ def prepare(arguments, tests=False): QIcon.setThemeSearchPaths(QIcon.themeSearchPaths() + [appPath("icons")]) QIcon.setThemeName("NumixMsk") - # Font siue + # Font size if settings.contains("appFontSize"): f = qApp.font() f.setPointSize(settings.value("appFontSize", type=int))