[Qt-interest] Qt 4.6's QWebSettings::iconForUrl() only returns null icons

R. Reucher rene.reucher at batcom-it.net
Wed Dec 2 13:11:31 CET 2009


On Tue December 1 2009 20:52 rene.reucher at batcom-it.net wrote:
> My application uses webkit for some web lookups, and I need to (not only)
> display the web pages' favicons whenever possible (= when a favicon is
> provided). But for some reason, this simple snippet of code always returns
> null icons (whereas with Qt 4.5.3 this works beautifully):
> 
>   ...
>   QIcon pageIcon = QWebSettings::iconForUrl(webView->url());
>   if ( pageIcon.isNull() )
>     // use fallback icon
>     pageIcon = QIcon(QString::fromUtf8(":/data/img/browser.png"));
>   ...
> 
> Unfortunately, there is no current Qt example that uses
> QWebSettings::iconForUrl() (also not in Qt 4.5.3). So I have no simple
> reference to offer.
I've modified the "fancybrowser" example a bit to include a favicon label
(left of the location edit) which allows me to demonstrate the problem with
QWebSettings::iconForUrl() in Qt 4.6. The code is here:

http://qmc2.arcadehits.net/tmp/fancybrowser-modified.tar.bz2

When you build it for Qt 4.5.3, it shows the favicons. However, in case of
Qt 4.6.0, the returned icons are always null icons.

I suppose the likely bug is somehow related to accessing WebpageIcons.db
(which will be created in the current working directory!).

If a Qt developer could look into it, it'd be greatly appreciated.

Thanks, René
-- 
René Reucher
rene.reucher at batcom-it.net
http://www.batcom-it.net/



More information about the Qt-interest-old mailing list