From 7e6ef9548432e96deff0c8e525f5db26b301c9ec Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Thu, 15 Oct 2015 14:12:34 +0200 Subject: Document QtWebEngine::initialize() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: If0dd01dadfb65cdf36f996347ef625c082057b56 Reviewed-by: Topi Reiniö --- src/webengine/api/qtwebengineglobal.cpp | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'src/webengine/api/qtwebengineglobal.cpp') diff --git a/src/webengine/api/qtwebengineglobal.cpp b/src/webengine/api/qtwebengineglobal.cpp index 1c67e710e..db9d7552d 100644 --- a/src/webengine/api/qtwebengineglobal.cpp +++ b/src/webengine/api/qtwebengineglobal.cpp @@ -47,6 +47,17 @@ Q_GUI_EXPORT QOpenGLContext *qt_gl_global_share_context(); namespace QtWebEngine { +/*! + \namespace QtWebEngine + \inmodule QtWebEngine + \ingroup qtwebengine-namespaces + \keyword QtWebEngine Namespace + + \brief Helper functions for the Qt WebEngine (Qt Quick) module + + The \l[CPP]{QtWebEngine} namespace is part of the Qt WebEngine module. +*/ + static QOpenGLContext *shareContext; static void deleteShareContext() @@ -59,6 +70,16 @@ static void deleteShareContext() // QtWebEngine::initialize was introduced first and meant to be called // after the QGuiApplication creation, when AA_ShareOpenGLContexts fills // the same need but the flag has to be set earlier. + +/*! + \fn QtWebEngine::initialize() + + Sets up an OpenGL Context that can be shared between processes. This has to be done after + QGuiApplication is created, but before a Qt Quick window is created. + + This has the same effect as passing Qt::AA_ShareOpenGLContexts to the QGuiApplication + constructor. +*/ void initialize() { #ifdef Q_OS_WIN32 @@ -71,11 +92,11 @@ void initialize() QCoreApplication *app = QCoreApplication::instance(); if (!app) { - qFatal("QWebEngine(Widgets)::initialize() must be called after the construction of the application object."); + qFatal("QtWebEngine::initialize() must be called after the construction of the application object."); return; } if (app->thread() != QThread::currentThread()) { - qFatal("QWebEngine(Widgets)::initialize() must be called from the Qt gui thread."); + qFatal("QtWebEngine::initialize() must be called from the Qt gui thread."); return; } -- cgit v1.2.1 From fbfd6b7617a88bf9668f88be5db220d3a3f92071 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Thu, 15 Oct 2015 13:38:17 +0200 Subject: Set Qt::AA_ShareOpenGLContexts in QtWebEngine::initialize() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QtWebEngine::initialize() does the same as passing AA_ShareOpenGLContexts to the QCoreApplication constructor, so it should also behave the same. Other Qt classes (e.g. QOpenGLWidget) actually check for the attribute to adapt. Change-Id: I6068a9a3f5736c708944d69c0df853143c3e9dd1 Reviewed-by: Michael Brüning Reviewed-by: Allan Sandfeld Jensen --- src/webengine/api/qtwebengineglobal.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/webengine/api/qtwebengineglobal.cpp') diff --git a/src/webengine/api/qtwebengineglobal.cpp b/src/webengine/api/qtwebengineglobal.cpp index db9d7552d..07561be6e 100644 --- a/src/webengine/api/qtwebengineglobal.cpp +++ b/src/webengine/api/qtwebengineglobal.cpp @@ -107,6 +107,9 @@ void initialize() shareContext->create(); qAddPostRoutine(deleteShareContext); qt_gl_set_global_share_context(shareContext); + + // Classes like QOpenGLWidget check for the attribute + app->setAttribute(Qt::AA_ShareOpenGLContexts); } } // namespace QtWebEngine -- cgit v1.2.1