Commit 5e33c08b authored by Christian Strømme's avatar Christian Strømme Committed by Christian Stromme
Browse files

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: default avatarCaroline Chao <caroline.chao@theqtcompany.com>
Showing with 12 additions and 0 deletions
......@@ -47,6 +47,10 @@
#include <QQmlApplicationEngine>
#include <QtQml/QQmlContext>
#ifdef QT_WEBVIEW_WEBENGINE_BACKEND
#include <QtWebEngine>
#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");
......
......@@ -2,6 +2,11 @@ TEMPLATE = app
QT += qml quick
qtHaveModule(webengine) {
QT += webengine
DEFINES += QT_WEBVIEW_WEBENGINE_BACKEND
}
SOURCES += main.cpp
RESOURCES += qml.qrc
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment