From 96425960f9d57387c33e3ba50785aaa81255bc98 Mon Sep 17 00:00:00 2001 From: Jocelyn Turcotte Date: Fri, 28 Mar 2014 17:14:30 +0100 Subject: Render the widgets view using the scene graph into a QOpenGLWidget This means that widgets application now need to setup the GL context sharing as well. QWebEngineWidgets::initialize() must be called, which has the same effect as QWebEngine::initialize(). The QtWebEngineWidgets now depends on the QtWebEngine module to make this happen. Since QOpenGLWidget is only available in Qt 5.3, this patch also disables the webenginewidgets module completely when building using Qt 5.2. Change-Id: I0e99a779d1eb080f2ccf5a338ff0763ad64e6eba Reviewed-by: Simon Hausmann --- src/webengine/api/qtwebengineglobal.cpp | 12 +++++++++--- src/webengine/render_widget_host_view_qt_delegate_quick.cpp | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'src/webengine') diff --git a/src/webengine/api/qtwebengineglobal.cpp b/src/webengine/api/qtwebengineglobal.cpp index 4aa72ba6f..7340d32d1 100644 --- a/src/webengine/api/qtwebengineglobal.cpp +++ b/src/webengine/api/qtwebengineglobal.cpp @@ -41,8 +41,10 @@ #include "qtwebengineglobal.h" -#include #include +#include +#include +#include static QOpenGLContext *shareContext; @@ -56,11 +58,11 @@ void QWebEngine::initialize() { QCoreApplication *app = QCoreApplication::instance(); if (!app) { - qFatal("QWebEngine::initialize() must be called after the construction of the application object."); + qFatal("QWebEngine(Widgets)::initialize() must be called after the construction of the application object."); return; } if (app->thread() != QThread::currentThread()) { - qFatal("QWebEngine::initialize() must be called from the Qt gui thread."); + qFatal("QWebEngine(Widgets)::initialize() must be called from the Qt gui thread."); return; } @@ -70,6 +72,10 @@ void QWebEngine::initialize() shareContext = new QOpenGLContext; shareContext->create(); qAddPostRoutine(deleteShareContext); +#if (QT_VERSION < QT_VERSION_CHECK(5, 3, 0)) QSGContext::setSharedOpenGLContext(shareContext); +#else + QOpenGLContextPrivate::setGlobalShareContext(shareContext); +#endif } diff --git a/src/webengine/render_widget_host_view_qt_delegate_quick.cpp b/src/webengine/render_widget_host_view_qt_delegate_quick.cpp index 693b12e07..e2804ef9b 100644 --- a/src/webengine/render_widget_host_view_qt_delegate_quick.cpp +++ b/src/webengine/render_widget_host_view_qt_delegate_quick.cpp @@ -66,7 +66,7 @@ void RenderWidgetHostViewQtDelegateQuick::itemChange(ItemChange change, const It QSGNode *RenderWidgetHostViewQtDelegateQuick::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) { - return m_client->updatePaintNode(oldNode, QQuickItem::window()); + return m_client->updatePaintNode(oldNode, QQuickWindowPrivate::get(QQuickItem::window())->context); } RenderWidgetHostViewQtDelegateQuickPainted::RenderWidgetHostViewQtDelegateQuickPainted(RenderWidgetHostViewQtDelegateClient *client, bool isPopup) -- cgit v1.2.3