From 5e33c08b025f40cd032daa4c947140bfc41b8ad6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Str=C3=B8mme?= Date: Fri, 21 Nov 2014 12:03:42 +0100 Subject: Fix webview example for use with QtWebEngine. When the QtWebEngine is used as a back-end we need to call QtWebEngine::initialize() or the example will fail as OpenGL context sharing needs to be enabled. Task-number: QTBUG-42745 Change-Id: I27ffc4043f759470f4d40441e62de2ba10728a01 Reviewed-by: Caroline Chao --- examples/webview/webview/main.cpp | 7 +++++++ examples/webview/webview/webview.pro | 5 +++++ 2 files changed, 12 insertions(+) (limited to 'examples') diff --git a/examples/webview/webview/main.cpp b/examples/webview/webview/main.cpp index 7ae5d4f..4598b3f 100644 --- a/examples/webview/webview/main.cpp +++ b/examples/webview/webview/main.cpp @@ -47,6 +47,10 @@ #include #include +#ifdef QT_WEBVIEW_WEBENGINE_BACKEND +#include +#endif // QT_WEBVIEW_WEBENGINE_BACKEND + // Workaround: As of Qt 5.4 QtQuick does not expose QUrl::fromUserInput. class Utils : public QObject { Q_OBJECT @@ -68,6 +72,9 @@ QUrl Utils::fromUserInput(const QString& userInput) int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); +#ifdef QT_WEBVIEW_WEBENGINE_BACKEND + QtWebEngine::initialize(); +#endif // QT_WEBVIEW_WEBENGINE_BACKEND QCommandLineParser parser; QCoreApplication::setApplicationVersion(QT_VERSION_STR); parser.setApplicationDescription("QtWebView Browser Example"); diff --git a/examples/webview/webview/webview.pro b/examples/webview/webview/webview.pro index 77cbe78..e02757c 100644 --- a/examples/webview/webview/webview.pro +++ b/examples/webview/webview/webview.pro @@ -2,6 +2,11 @@ TEMPLATE = app QT += qml quick +qtHaveModule(webengine) { + QT += webengine + DEFINES += QT_WEBVIEW_WEBENGINE_BACKEND +} + SOURCES += main.cpp RESOURCES += qml.qrc -- cgit v1.2.3