summaryrefslogtreecommitdiff
path: root/src/webengine/api/qtwebengineglobal.cpp
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2015-10-23 14:20:07 +0200
committerAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2015-10-23 14:20:07 +0200
commitdffe673c3044a6351aa72b69a5bf60429259c08c (patch)
treee0feba0056896b981a287704b2ef7383f9b95266 /src/webengine/api/qtwebengineglobal.cpp
parent9be23eb946580519b2b0600cc854ec8050b90659 (diff)
parent8f32ce028a48ddc6a7333b7af635424c78437ed7 (diff)
downloadqtwebengine-dffe673c3044a6351aa72b69a5bf60429259c08c.tar.gz
Merge remote-tracking branch 'origin/5.6' into dev
Change-Id: I5d0d5f65575256673c35558e0fcbf749a1439793
Diffstat (limited to 'src/webengine/api/qtwebengineglobal.cpp')
-rw-r--r--src/webengine/api/qtwebengineglobal.cpp28
1 files changed, 26 insertions, 2 deletions
diff --git a/src/webengine/api/qtwebengineglobal.cpp b/src/webengine/api/qtwebengineglobal.cpp
index 1c67e710e..07561be6e 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;
}
@@ -86,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