summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaloyan Chehlarski <kaloyan.chehlarski@qt.io>2026-04-20 13:46:55 +0200
committerKaloyan Chehlarski <kaloyan.chehlarski@qt.io>2026-04-21 07:44:52 +0000
commitdfdbede201d08ab9fcbdb267ab66ce83a4a7a090 (patch)
treec5687a9f1e4d2b749a475bdd382a789e0f77d42c
parent06439de258fcf87e9c4f4bd0bf73c756afe225df (diff)
Android, Darwin: Actually emit urlChanged signals
Seems this got lost during the 6.11 refactoring, and tests were only checking for loadingChanged() signals. Also add a check to tst_qwebview. Fixes: QTBUG-145858 Pick-to: 6.11 Change-Id: I7f6615e8850f4b498cde916dc3bb00d4be911616 Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io> Reviewed-by: Michal Klocek <michal.klocek@qt.io>
-rw-r--r--src/plugins/android/qandroidwebview.cpp4
-rw-r--r--src/plugins/darwin/qdarwinwebview.mm4
-rw-r--r--tests/auto/webview/qwebview/tst_qwebview.cpp2
3 files changed, 8 insertions, 2 deletions
diff --git a/src/plugins/android/qandroidwebview.cpp b/src/plugins/android/qandroidwebview.cpp
index 97fcfe5..f7ee3af 100644
--- a/src/plugins/android/qandroidwebview.cpp
+++ b/src/plugins/android/qandroidwebview.cpp
@@ -372,10 +372,12 @@ static void c_onPageStarted(JNIEnv *env,
if (!g_webViews->contains(wc))
return;
+ QUrl qurl(QJniObject(url).toString());
QWebViewLoadingInfo loadingInfo(QWebViewFactory::LoadingInfo::create(
- QUrl(QJniObject(url).toString()),
+ qurl,
QWebViewLoadingInfo::LoadStatus::Started,
QString()));
+ emit wc->q_ptr->urlChanged(qurl);
emit wc->q_ptr->loadingChanged(loadingInfo);
// if (!icon)
diff --git a/src/plugins/darwin/qdarwinwebview.mm b/src/plugins/darwin/qdarwinwebview.mm
index 79e432e..042fd7d 100644
--- a/src/plugins/darwin/qdarwinwebview.mm
+++ b/src/plugins/darwin/qdarwinwebview.mm
@@ -92,8 +92,10 @@ typedef NSView UIView;
else
return;
+ QUrl url = qDarwinWebViewPrivate->url();
+ emit qDarwinWebViewPrivate->q_ptr->urlChanged(url);
emit qDarwinWebViewPrivate->q_ptr->loadingChanged(
- QWebViewFactory::LoadingInfo::create(qDarwinWebViewPrivate->url(),
+ QWebViewFactory::LoadingInfo::create(url,
QWebViewLoadingInfo::LoadStatus::Started, QString()));
emit qDarwinWebViewPrivate->q_ptr->loadProgressChanged(qDarwinWebViewPrivate->loadProgress());
}
diff --git a/tests/auto/webview/qwebview/tst_qwebview.cpp b/tests/auto/webview/qwebview/tst_qwebview.cpp
index d078d85..a347757 100644
--- a/tests/auto/webview/qwebview/tst_qwebview.cpp
+++ b/tests/auto/webview/qwebview/tst_qwebview.cpp
@@ -25,6 +25,7 @@
class TestWebView : public QWebView {
public:
TestWebView() : QWebView() { settings()->setAttribute(QWebViewSettings::WebAttribute::AllowFileAccess, true); };
+ QSignalSpy urlSpy = QSignalSpy(this, SIGNAL(urlChanged(QUrl)));
QSignalSpy loadingSpy = QSignalSpy(this, SIGNAL(loadingChanged(QWebViewLoadingInfo)));
QSignalSpy titleSpy = QSignalSpy(this, SIGNAL(titleChanged(QString)));
};
@@ -81,6 +82,7 @@ void tst_QWebView::load()
webView.setUrl(makeTestFileUrl("basic_page.html"));
QTRY_COMPARE(webView.loadingSpy.size(), 2);
+ QCOMPARE(webView.urlSpy.size(), 1);
QCOMPARE(webView.loadProgress(), 100);
QCOMPARE(webView.loadingSpy[0][0].value<QWebViewLoadingInfo>().status(), QWebViewLoadingInfo::LoadStatus::Started);
QCOMPARE(webView.loadingSpy[1][0].value<QWebViewLoadingInfo>().status(), QWebViewLoadingInfo::LoadStatus::Succeeded);