summaryrefslogtreecommitdiffstats
path: root/src/webview/qquickwebview.cpp
diff options
context:
space:
mode:
authorArmin Felder <armin.felder@osalliance.com>2019-03-03 16:52:20 +0100
committerArmin Felder <armin.felder@osalliance.com>2019-05-15 11:55:54 +0000
commit0a8a69d51042b95649dbdf471acb3c96228f372e (patch)
tree53223857ac193b3d55b798981e1d766e7ee62bb2 /src/webview/qquickwebview.cpp
parentfac66332c76e2fc9c29aa2508a41cd9392825d25 (diff)
Add QtWebView::WebView::httpUserAgent property
The httpUserAgent property allows to get and set the User Agent. Task-number: QTBUG-68746 Change-Id: I12fb5da00b14ecba53e71c532f2c8401f8f2a009 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Christian Strømme <christian.stromme@qt.io>
Diffstat (limited to 'src/webview/qquickwebview.cpp')
-rw-r--r--src/webview/qquickwebview.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/webview/qquickwebview.cpp b/src/webview/qquickwebview.cpp
index 898154e..4441df4 100644
--- a/src/webview/qquickwebview.cpp
+++ b/src/webview/qquickwebview.cpp
@@ -101,6 +101,7 @@ QQuickWebView::QQuickWebView(QQuickItem *parent)
connect(m_webView, &QWebView::loadingChanged, this, &QQuickWebView::onLoadingChanged);
connect(m_webView, &QWebView::requestFocus, this, &QQuickWebView::onFocusRequest);
connect(m_webView, &QWebView::javaScriptResult, this, &QQuickWebView::onRunJavaScriptResult);
+ connect(m_webView, &QWebView::httpUserAgentChanged, this, &QQuickWebView::httpUserAgentChanged);
}
QQuickWebView::~QQuickWebView()
@@ -108,6 +109,24 @@ QQuickWebView::~QQuickWebView()
}
/*!
+ \qmlproperty url QtWebView::WebView::httpUserAgent
+ \since QtWebView 1.14
+ The user agent in use.
+
+ \note on WinRT, this property affects all WebViews of the application.
+*/
+
+void QQuickWebView::setHttpUserAgent(const QString &userAgent)
+{
+ m_webView->setHttpUserAgent(userAgent);
+}
+
+QString QQuickWebView::httpUserAgent() const
+{
+ return m_webView->httpUserAgent();
+}
+
+/*!
\qmlproperty url QtWebView::WebView::url
The URL of currently loaded web page. Changing this will trigger