diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2020-05-14 21:03:39 +0200 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2020-07-31 18:02:02 +0200 |
commit | e5aae7da3352931d286e18c4a4d3e69237479860 (patch) | |
tree | 5f54a883e798512e76639b0edcb0fba98cecdcb1 | |
parent | ac4ccd1b5631470f3ffaca3647a8307190832f30 (diff) | |
parent | 18ba3e960eb6e4188ec576ff5d1da08d2d3f4c6e (diff) |
Merge "Merge remote-tracking branch 'origin/5.15' into dev"
-rw-r--r-- | dist/changes-5.14.0 | 22 | ||||
-rw-r--r-- | dist/changes-5.14.1 | 20 | ||||
-rw-r--r-- | dist/changes-5.14.2 | 20 | ||||
-rw-r--r-- | dist/changes-5.15.0 | 26 | ||||
-rw-r--r-- | examples/webview/minibrowser/doc/src/minibrowser.qdoc | 2 | ||||
-rw-r--r-- | examples/webview/minibrowser/main.cpp | 2 | ||||
-rw-r--r-- | src/imports/imports.pro | 8 | ||||
-rw-r--r-- | src/plugins/android/qandroidwebview.cpp | 4 | ||||
-rw-r--r-- | src/plugins/webengine/qwebenginewebview.cpp | 14 | ||||
-rw-r--r-- | src/webview/doc/src/qtwebview-overview.qdoc | 4 | ||||
-rw-r--r-- | src/webview/doc/src/qtwebview-qmltypes.qdoc | 2 | ||||
-rw-r--r-- | src/webview/qquickviewcontroller.cpp | 36 | ||||
-rw-r--r-- | tests/auto/qml/qquickwebview/tst_qquickwebview.cpp | 18 |
13 files changed, 155 insertions, 23 deletions
diff --git a/dist/changes-5.14.0 b/dist/changes-5.14.0 new file mode 100644 index 0000000..6f33a6e --- /dev/null +++ b/dist/changes-5.14.0 @@ -0,0 +1,22 @@ +Qt 5.14 introduces many new features and improvements as well as bugfixes +over the 5.13.x series. For more details, refer to the online documentation +included in this distribution. The documentation is also available online: + +https://doc.qt.io/qt-5/index.html + +The Qt version 5.14 series is binary compatible with the 5.13.x series. +Applications compiled for 5.13 will continue to run with 5.14. + +Some of the changes listed in this file include issue tracking numbers +corresponding to tasks in the Qt Bug Tracker: + +https://bugreports.qt.io/ + +Each of these identifiers can be entered in the bug tracker to obtain more +information about a particular change. + +**************************************************************************** +* Qt 5.14.0 Changes * +**************************************************************************** + +- [QTBUG-68746] Added property for getting/setting the httpUserAgent diff --git a/dist/changes-5.14.1 b/dist/changes-5.14.1 new file mode 100644 index 0000000..d008638 --- /dev/null +++ b/dist/changes-5.14.1 @@ -0,0 +1,20 @@ +Qt 5.14.1 is a bug-fix release. It maintains both forward and backward +compatibility (source and binary) with Qt 5.14.0. + +For more details, refer to the online documentation included in this +distribution. The documentation is also available online: + +https://doc.qt.io/qt-5/index.html + +The Qt version 5.14 series is binary compatible with the 5.13.x series. +Applications compiled for 5.13 will continue to run with 5.14. + +Some of the changes listed in this file include issue tracking numbers +corresponding to tasks in the Qt Bug Tracker: + +https://bugreports.qt.io/ + +Each of these identifiers can be entered in the bug tracker to obtain more +information about a particular change. + + - This release contains only minor code improvements. diff --git a/dist/changes-5.14.2 b/dist/changes-5.14.2 new file mode 100644 index 0000000..68a0051 --- /dev/null +++ b/dist/changes-5.14.2 @@ -0,0 +1,20 @@ +Qt 5.14.2 is a bug-fix release. It maintains both forward and backward +compatibility (source and binary) with Qt 5.14.0 through 5.14.1. + +For more details, refer to the online documentation included in this +distribution. The documentation is also available online: + +https://doc.qt.io/qt-5/index.html + +The Qt version 5.14 series is binary compatible with the 5.13.x series. +Applications compiled for 5.13 will continue to run with 5.14. + +Some of the changes listed in this file include issue tracking numbers +corresponding to tasks in the Qt Bug Tracker: + +https://bugreports.qt.io/ + +Each of these identifiers can be entered in the bug tracker to obtain more +information about a particular change. + + - This release contains only minor code improvements. diff --git a/dist/changes-5.15.0 b/dist/changes-5.15.0 new file mode 100644 index 0000000..f3d429c --- /dev/null +++ b/dist/changes-5.15.0 @@ -0,0 +1,26 @@ +Qt 5.15 introduces many new features and improvements as well as bugfixes +over the 5.14.x series. For more details, refer to the online documentation +included in this distribution. The documentation is also available online: + +https://doc.qt.io/qt-5/index.html + +The Qt version 5.15 series is binary compatible with the 5.14.x series. +Applications compiled for 5.14 will continue to run with 5.15. + +Some of the changes listed in this file include issue tracking numbers +corresponding to tasks in the Qt Bug Tracker: + +https://bugreports.qt.io/ + +Each of these identifiers can be entered in the bug tracker to obtain more +information about a particular change. + +**************************************************************************** +* Qt 5.15.0 Changes * +**************************************************************************** + + - [QTBUG-79213] Fixed visibility updates when the WebView is placed inside + a QQuickWidget. + - [QTBUG-82778] The initial httpUserAgent property will now be correctly set. + - [QTBUG-80912] Fixed the initialize() documentation and usage + to be consistent with QtWebEngine. diff --git a/examples/webview/minibrowser/doc/src/minibrowser.qdoc b/examples/webview/minibrowser/doc/src/minibrowser.qdoc index 3532861..20f03b0 100644 --- a/examples/webview/minibrowser/doc/src/minibrowser.qdoc +++ b/examples/webview/minibrowser/doc/src/minibrowser.qdoc @@ -37,7 +37,7 @@ couple of controls to navigate through the browsing history. \note When using the Qt WebView module it is necessary to call QtWebView::initialize() - right after creating the QGuiApplication instance. Calling QtWebView::initialize() will + before creating the QGuiApplication instance. Calling QtWebView::initialize() will ensure that the necessary pre-setup steps are run. \snippet minibrowser/main.cpp 0 diff --git a/examples/webview/minibrowser/main.cpp b/examples/webview/minibrowser/main.cpp index 8f56731..8b4718f 100644 --- a/examples/webview/minibrowser/main.cpp +++ b/examples/webview/minibrowser/main.cpp @@ -79,8 +79,8 @@ QUrl Utils::fromUserInput(const QString& userInput) int main(int argc, char *argv[]) { //! [0] - QGuiApplication app(argc, argv); QtWebView::initialize(); + QGuiApplication app(argc, argv); //! [0] QGuiApplication::setApplicationDisplayName(QCoreApplication::translate("main", "QtWebView Example")); diff --git a/src/imports/imports.pro b/src/imports/imports.pro index feeb9f1..aab25ed 100644 --- a/src/imports/imports.pro +++ b/src/imports/imports.pro @@ -14,5 +14,13 @@ DYNAMIC_QMLDIR = \ "classname QWebViewModule" qtHaveModule(webengine):DYNAMIC_QMLDIR += "depends QtWebEngine 1.0" load(qml_plugin) +webview_qrc = \ + "<!DOCTYPE RCC><RCC version=\"1.0\">" \ + "<qresource prefix=\"/qt-project.org/imports/QtWebView\">" \ + "<file alias=\"qmldir\">$$OUT_PWD/qmldir</file>" \ + "</qresource>" \ + "</RCC>" +write_file($$OUT_PWD/qmake_QtWebView.qrc, webview_qrc)|error() +RESOURCES = $$OUT_PWD/qmake_QtWebView.qrc OTHER_FILES += qmldir diff --git a/src/plugins/android/qandroidwebview.cpp b/src/plugins/android/qandroidwebview.cpp index 3d2b98d..91122bd 100644 --- a/src/plugins/android/qandroidwebview.cpp +++ b/src/plugins/android/qandroidwebview.cpp @@ -422,7 +422,7 @@ JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* /*reserved*/) UnionJNIEnvToVoid uenv; uenv.venv = NULL; - if (vm->GetEnv(&uenv.venv, JNI_VERSION_1_4) != JNI_OK) + if (vm->GetEnv(&uenv.venv, JNI_VERSION_1_6) != JNI_OK) return JNI_ERR; JNIEnv *env = uenv.nativeEnvironment; @@ -446,5 +446,5 @@ JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* /*reserved*/) if (env->RegisterNatives(clazz, methods, nMethods) != JNI_OK) return JNI_ERR; - return JNI_VERSION_1_4; + return JNI_VERSION_1_6; } diff --git a/src/plugins/webengine/qwebenginewebview.cpp b/src/plugins/webengine/qwebenginewebview.cpp index f16371d..7870b3a 100644 --- a/src/plugins/webengine/qwebenginewebview.cpp +++ b/src/plugins/webengine/qwebenginewebview.cpp @@ -81,8 +81,11 @@ QString QWebEngineWebViewPrivate::httpUserAgent() const void QWebEngineWebViewPrivate::setHttpUserAgent(const QString &userAgent) { - m_profile->setHttpUserAgent(userAgent); - Q_EMIT httpUserAgentChanged(userAgent); + m_httpUserAgent = userAgent; + if (m_profile) { + m_profile->setHttpUserAgent(userAgent); + Q_EMIT httpUserAgentChanged(userAgent); + } } QUrl QWebEngineWebViewPrivate::url() const @@ -255,7 +258,12 @@ void QWebEngineWebViewPrivate::QQuickWebEngineViewPtr::init() const Q_ASSERT(webEngineView); QQuickWebEngineProfile *profile = webEngineView->profile(); m_parent->m_profile = profile; - m_parent->m_httpUserAgent = profile->httpUserAgent(); + // When the httpUserAgent is set as a property then it will be set before + // init() is called + if (m_parent->m_httpUserAgent.isEmpty()) + m_parent->m_httpUserAgent = profile->httpUserAgent(); + else + profile->setHttpUserAgent(m_parent->m_httpUserAgent); QObject::connect(webEngineView, &QQuickWebEngineView::urlChanged, m_parent, &QWebEngineWebViewPrivate::q_urlChanged); QObject::connect(webEngineView, &QQuickWebEngineView::loadProgressChanged, m_parent, &QWebEngineWebViewPrivate::q_loadProgressChanged); QObject::connect(webEngineView, &QQuickWebEngineView::loadingChanged, m_parent, &QWebEngineWebViewPrivate::q_loadingChanged); diff --git a/src/webview/doc/src/qtwebview-overview.qdoc b/src/webview/doc/src/qtwebview-overview.qdoc index 8ccadd9..0c2330b 100644 --- a/src/webview/doc/src/qtwebview-overview.qdoc +++ b/src/webview/doc/src/qtwebview-overview.qdoc @@ -46,8 +46,8 @@ \section1 Prerequisites To make the Qt \WebView module function correctly across all platforms, it's necessary - to call \l {qtwebview-initialize}{QtWebView::initialize}() right after creating the - QGuiApplication instance. + to call \l {qtwebview-initialize}{QtWebView::initialize}() before creating the + QGuiApplication instance and before window's QPlatformOpenGLContext is created. \section1 QML Types diff --git a/src/webview/doc/src/qtwebview-qmltypes.qdoc b/src/webview/doc/src/qtwebview-qmltypes.qdoc index b5da115..40a3763 100644 --- a/src/webview/doc/src/qtwebview-qmltypes.qdoc +++ b/src/webview/doc/src/qtwebview-qmltypes.qdoc @@ -38,11 +38,9 @@ The QML type can be imported into your application using the following import statement: - \badcode \qml \QtMinorVersion import QtWebView 1.\1 \endqml - \endcode \section1 QML Types */ diff --git a/src/webview/qquickviewcontroller.cpp b/src/webview/qquickviewcontroller.cpp index f5991a4..5986d23 100644 --- a/src/webview/qquickviewcontroller.cpp +++ b/src/webview/qquickviewcontroller.cpp @@ -233,22 +233,36 @@ void QQuickViewController::geometryChange(const QRectF &newGeometry, const QRect void QQuickViewController::onWindowChanged(QQuickWindow* window) { QQuickWindow *oldParent = qobject_cast<QQuickWindow *>(m_view->parentView()); - if (oldParent != 0) + if (oldParent) oldParent->disconnect(this); - if (window != 0) { - connect(window, &QQuickWindow::widthChanged, this, &QQuickViewController::scheduleUpdatePolish); - connect(window, &QQuickWindow::heightChanged, this, &QQuickViewController::scheduleUpdatePolish); - connect(window, &QQuickWindow::xChanged, this, &QQuickViewController::scheduleUpdatePolish); - connect(window, &QQuickWindow::yChanged, this, &QQuickViewController::scheduleUpdatePolish); - connect(window, &QQuickWindow::sceneGraphInitialized, this, &QQuickViewController::scheduleUpdatePolish); - connect(window, &QQuickWindow::sceneGraphInvalidated, this, &QQuickViewController::onSceneGraphInvalidated); - connect(window, &QQuickWindow::visibleChanged, this, [this](bool visible) { m_view->setVisible(visible); }); + if (!window) { + m_view->setParentView(nullptr); + return; } - // Check if there's an actual window available. + // Check if there's an actual native window available. QWindow *rw = QQuickRenderControl::renderWindowFor(window); - m_view->setParentView(rw ? rw : window); + + if (rw) { + connect(rw, &QWindow::widthChanged, this, &QQuickViewController::scheduleUpdatePolish); + connect(rw, &QWindow::heightChanged, this, &QQuickViewController::scheduleUpdatePolish); + connect(rw, &QWindow::xChanged, this, &QQuickViewController::scheduleUpdatePolish); + connect(rw, &QWindow::yChanged, this, &QQuickViewController::scheduleUpdatePolish); + connect(rw, &QWindow::visibleChanged, this, [this](bool visible) { m_view->setVisible(visible); }); + connect(window, &QQuickWindow::sceneGraphInitialized, this, &QQuickViewController::scheduleUpdatePolish); + connect(window, &QQuickWindow::sceneGraphInvalidated, this, &QQuickViewController::onSceneGraphInvalidated); + m_view->setParentView(rw); + } else { + connect(window, &QWindow::widthChanged, this, &QQuickViewController::scheduleUpdatePolish); + connect(window, &QWindow::heightChanged, this, &QQuickViewController::scheduleUpdatePolish); + connect(window, &QWindow::xChanged, this, &QQuickViewController::scheduleUpdatePolish); + connect(window, &QWindow::yChanged, this, &QQuickViewController::scheduleUpdatePolish); + connect(window, &QQuickWindow::sceneGraphInitialized, this, &QQuickViewController::scheduleUpdatePolish); + connect(window, &QQuickWindow::sceneGraphInvalidated, this, &QQuickViewController::onSceneGraphInvalidated); + connect(window, &QWindow::visibleChanged, this, [this](bool visible) { m_view->setVisible(visible); }); + m_view->setParentView(window); + } } void QQuickViewController::onVisibleChanged() diff --git a/tests/auto/qml/qquickwebview/tst_qquickwebview.cpp b/tests/auto/qml/qquickwebview/tst_qquickwebview.cpp index e3162bc..b1a1364 100644 --- a/tests/auto/qml/qquickwebview/tst_qquickwebview.cpp +++ b/tests/auto/qml/qquickwebview/tst_qquickwebview.cpp @@ -68,6 +68,7 @@ private Q_SLOTS: void multipleWebViewWindows(); void multipleWebViews(); void titleUpdate(); + void changeUserAgent(); private: inline QQuickWebView *newWebView(); @@ -75,11 +76,12 @@ private: void runJavaScript(const QString &script); QScopedPointer<TestWindow> m_window; QScopedPointer<QQmlComponent> m_component; + QQmlEngine *engine = nullptr; }; tst_QQuickWebView::tst_QQuickWebView() { - static QQmlEngine *engine = new QQmlEngine(this); + engine = new QQmlEngine(this); m_component.reset(new QQmlComponent(engine, this)); m_component->setData(QByteArrayLiteral("import QtQuick 2.0\n" "import QtWebView 1.1\n" @@ -332,5 +334,19 @@ void tst_QQuickWebView::titleUpdate() } +void tst_QQuickWebView::changeUserAgent() +{ + QQmlComponent userAgentWebView(engine, this); + userAgentWebView.setData(QByteArrayLiteral("import QtQuick 2.0\n" + "import QtWebView 1.14\n" + "WebView {\n" + "httpUserAgent: \"dummy\"\n" + "}"), + QUrl()); + QObject *viewInstance = userAgentWebView.create(); + QQuickWebView *webView = qobject_cast<QQuickWebView *>(viewInstance); + QCOMPARE(webView->httpUserAgent(), "dummy"); +} + QTEST_MAIN(tst_QQuickWebView) #include "tst_qquickwebview.moc" |