diff options
author | Jocelyn Turcotte <jocelyn.turcotte@digia.com> | 2014-03-28 17:14:30 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-04-08 14:00:10 +0200 |
commit | 96425960f9d57387c33e3ba50785aaa81255bc98 (patch) | |
tree | 01799f1235c85ffef420c06c5598ebd4e028339e /src/webengine | |
parent | 84f31c11b77a62212451cb77adae63219e06de96 (diff) |
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 <simon.hausmann@digia.com>
Diffstat (limited to 'src/webengine')
-rw-r--r-- | src/webengine/api/qtwebengineglobal.cpp | 12 | ||||
-rw-r--r-- | src/webengine/render_widget_host_view_qt_delegate_quick.cpp | 2 |
2 files changed, 10 insertions, 4 deletions
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 <private/qsgcontext_p.h> #include <QGuiApplication> +#include <QThread> +#include <private/qopenglcontext_p.h> +#include <private/qsgcontext_p.h> 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) |