summaryrefslogtreecommitdiffstats
path: root/src/webenginewidgets/api/qwebenginepage.cpp
diff options
context:
space:
mode:
authorPeter Varga <pvarga@inf.u-szeged.hu>2016-03-03 17:28:52 +0100
committerPeter Varga <pvarga@inf.u-szeged.hu>2016-03-31 07:40:15 +0000
commit0a4b9df53f0ede439435b0408558e1038c619a67 (patch)
tree0c285ad9a68f90257d013e2df7996ac45b1b4bae /src/webenginewidgets/api/qwebenginepage.cpp
parent76c61aa1400ef2def204c3732e30e08e40631e8d (diff)
Add icon property and iconChanged signal to QWebEnginePage
The new API makes possible to access downloaded icons via QWebEnginePage. Thus the QNAM usage for downloading favicons and the corresponding workaround due to authentication are removed from the demobrowser. Change-Id: I9fdcc7ee7673f7caa239d932f20a51c74b24763f Task-number: QTBUG-51179 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@theqtcompany.com> Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com>
Diffstat (limited to 'src/webenginewidgets/api/qwebenginepage.cpp')
-rw-r--r--src/webenginewidgets/api/qwebenginepage.cpp48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp
index 184b17095..326f1b08d 100644
--- a/src/webenginewidgets/api/qwebenginepage.cpp
+++ b/src/webenginewidgets/api/qwebenginepage.cpp
@@ -44,6 +44,7 @@
#include "browser_context_adapter.h"
#include "certificate_error_controller.h"
#include "color_chooser_controller.h"
+#include "favicon_manager.h"
#include "file_picker_controller.h"
#include "javascript_dialog_controller.h"
#include "qwebenginefullscreenrequest.h"
@@ -150,6 +151,7 @@ void QWebEnginePagePrivate::iconChanged(const QUrl &url)
return;
iconUrl = url;
Q_EMIT q->iconUrlChanged(iconUrl);
+ Q_EMIT q->iconChanged(adapter->faviconManager()->getIcon(iconUrl));
}
void QWebEnginePagePrivate::loadProgressChanged(int progress)
@@ -576,6 +578,25 @@ QWebEnginePage::QWebEnginePage(QObject* parent)
*/
/*!
+ \fn void QWebEnginePage::iconUrlChanged(const QUrl &url)
+
+ This signal is emitted when the URL of the icon ("favicon") associated with the
+ page is changed. The new URL is specified by \a url.
+
+ \sa iconUrl(), icon(), iconChanged()
+*/
+
+/*!
+ \fn void QWebEnginePage::iconChanged(const QIcon &icon)
+ \since 5.7
+
+ This signal is emitted when the icon ("favicon") associated with the
+ page is changed. The new icon is specified by \a icon.
+
+ \sa icon(), iconUrl(), iconUrlChanged()
+*/
+
+/*!
Constructs an empty web engine page in the web engine profile \a profile with the parent
\a parent.
@@ -1480,12 +1501,39 @@ QUrl QWebEnginePage::requestedUrl() const
return d->adapter->requestedUrl();
}
+/*!
+ \property QWebEnginePage::iconUrl
+ \brief the URL of the icon associated with the page currently viewed
+
+ By default, this property contains an empty URL.
+
+ \sa iconUrlChanged(), icon(), iconChanged()
+*/
QUrl QWebEnginePage::iconUrl() const
{
Q_D(const QWebEnginePage);
return d->iconUrl;
}
+/*!
+ \property QWebEnginePage::icon
+ \brief the icon associated with the page currently viewed
+ \since 5.7
+
+ By default, this property contains a null icon.
+
+ \sa iconChanged(), iconUrl(), iconUrlChanged()
+*/
+QIcon QWebEnginePage::icon() const
+{
+ Q_D(const QWebEnginePage);
+
+ if (d->iconUrl.isEmpty())
+ return QIcon();
+
+ return d->adapter->faviconManager()->getIcon(d->iconUrl);
+}
+
qreal QWebEnginePage::zoomFactor() const
{
Q_D(const QWebEnginePage);