summaryrefslogtreecommitdiffstats
path: root/src/core/api/qtwebenginecoreglobal.cpp
diff options
context:
space:
mode:
authorAnu Aliyas <anu.aliyas@qt.io>2023-08-30 12:31:14 +0200
committerAnu Aliyas <anu.aliyas@qt.io>2023-09-12 22:12:36 +0200
commitf79f7a3b6d80a29baad5c5cb1bf68bb01045c7c7 (patch)
tree0a5deec19cb9c918d506110438ebcb00a7de142b /src/core/api/qtwebenginecoreglobal.cpp
parente4d73afd5464bd7f34063e08aab55e8f6b16aa22 (diff)
Delay the graphics API setup calls
- The initialization process sets up the graphics API before the main is invoked and hence the qputenv calls have no effect. - Delayed the graphic API setup calls so that it will consider the value set by qputenv calls as well. Fixes: QTBUG-116159 Pick-to: 6.6 Change-Id: I1e9dde7f65c214a7d5963dbba12f41b8feba925f Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
Diffstat (limited to 'src/core/api/qtwebenginecoreglobal.cpp')
-rw-r--r--src/core/api/qtwebenginecoreglobal.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/core/api/qtwebenginecoreglobal.cpp b/src/core/api/qtwebenginecoreglobal.cpp
index 7d547cb51..a379a8dfe 100644
--- a/src/core/api/qtwebenginecoreglobal.cpp
+++ b/src/core/api/qtwebenginecoreglobal.cpp
@@ -48,6 +48,14 @@ Q_WEBENGINECORE_PRIVATE_EXPORT void initialize()
#ifdef Q_OS_WIN32
qputenv("QT_D3DCREATE_MULTITHREADED", "1");
#endif
+ auto api = QQuickWindow::graphicsApi();
+ if (api != QSGRendererInterface::OpenGL
+#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)
+ && api != QSGRendererInterface::Vulkan && api != QSGRendererInterface::Metal
+ && api != QSGRendererInterface::Direct3D11
+#endif
+ )
+ QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGL);
// No need to override the shared context if QApplication already set one (e.g with Qt::AA_ShareOpenGLContexts).
if (!qt_gl_global_share_context()) {
@@ -109,14 +117,6 @@ static void initialize()
#if QT_CONFIG(opengl) && !defined(Q_OS_MACOS)
// QCoreApplication is not yet instantiated, ensuring the call will be deferred
qAddPreRoutine(QtWebEngineCore::initialize);
- auto api = QQuickWindow::graphicsApi();
- if (api != QSGRendererInterface::OpenGL
-#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)
- && api != QSGRendererInterface::Vulkan
- && api != QSGRendererInterface::Metal && api != QSGRendererInterface::Direct3D11
-#endif
- )
- QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGL);
#endif // QT_CONFIG(opengl)
}