diff options
author | Peter Varga <pvarga@inf.u-szeged.hu> | 2016-04-12 17:35:19 +0200 |
---|---|---|
committer | Peter Varga <pvarga@inf.u-szeged.hu> | 2016-05-04 12:27:20 +0000 |
commit | 240efee49a8e4402f2048a05c596605b2feadbd3 (patch) | |
tree | 8df93a1a1732bafe78192f70cfdb54bde8b1b3b5 /src/webengine | |
parent | 0bf8a13a4d0391339bae686e199fb922b64a1dcc (diff) |
Combine candidate icons for a page into a single icon
For the Widget API the QIcon returned by QWebEnginePage::icon() function
contains all the candidate icons for the current page.
For the Quick API the QQuickWebEngineFaviconProvider provides the best
quality icon for the requested size from the candidates.
Task-number: QTBUG-51179
Change-Id: I42b8427f957e2f2fc745dd0111bedcc71b577216
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
Diffstat (limited to 'src/webengine')
-rw-r--r-- | src/webengine/api/qquickwebenginefaviconprovider.cpp | 7 | ||||
-rw-r--r-- | src/webengine/doc/src/webengineview.qdoc | 7 |
2 files changed, 11 insertions, 3 deletions
diff --git a/src/webengine/api/qquickwebenginefaviconprovider.cpp b/src/webengine/api/qquickwebenginefaviconprovider.cpp index c41ec5a07..fe8436d6c 100644 --- a/src/webengine/api/qquickwebenginefaviconprovider.cpp +++ b/src/webengine/api/qquickwebenginefaviconprovider.cpp @@ -121,12 +121,13 @@ QPixmap QQuickWebEngineFaviconProvider::requestPixmap(const QString &id, QSize * return QPixmap(); FaviconManager *faviconManager = view->d_ptr->adapter->faviconManager(); - Q_ASSERT(faviconManager); - const QIcon &icon = faviconManager->getIcon(iconUrl); + Q_ASSERT(faviconManager); + const FaviconInfo &faviconInfo = faviconManager->getFaviconInfo(iconUrl); + const QIcon &icon = faviconManager->getIcon(faviconInfo.candidate ? QUrl() : iconUrl); Q_ASSERT(!icon.isNull()); - const QSize &bestSize = faviconManager->getFaviconInfo(iconUrl).size; + const QSize &bestSize = faviconInfo.size; // If source size is not specified, use the best quality if (!requestedSize.isValid()) { diff --git a/src/webengine/doc/src/webengineview.qdoc b/src/webengine/doc/src/webengineview.qdoc index a070140c7..7c7a2283a 100644 --- a/src/webengine/doc/src/webengineview.qdoc +++ b/src/webengine/doc/src/webengineview.qdoc @@ -215,10 +215,17 @@ \qml Image { id: appIcon + sourceSize: Qt.size(32, 32) source: webView.icon != "" ? webView.icon : "fallbackFavicon.png"; // ... } \endqml + + Specifying the \c{sourceSize} property of the \c{Image} element informs + the Qt WebEngine's favicon provider about the requested size. The + favicon provider tries to find the best fit among the web page candidate + icons. If \c{sourceSize} property is not specified, the provider provides + the icon with the largest resolution. */ /*! |