[Development] Two bugs in the QIcon which broke my life.
David Faure
faure at kde.org
Thu Aug 9 15:39:00 CEST 2012
On Wednesday 08 August 2012 17:00:29 David Faure wrote:
> On Wednesday 08 August 2012 14:32:36 Mark wrote:
> > As for the second bug report
> > (https://bugreports.qt-project.org/browse/QTBUG-12874) shouldn't the
> > standard icon paths be defined in the new class QStandardPaths? Then
> > QIcon can use QStandardPaths to find icons - obviously.
> >
> > Right now i don't see any icon related thing in
> > http://doc-snapshot.qt-project.org/5.0/qstandardpaths.html Since the
> > icon stuff is defined by freedesktop
> > (http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.h
> > tm l#directory_layout) it might as well be added in there.
> >
> > Adding David Faure to the cc since he invented QStandardPaths.
>
> QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, "icons",
> QStandardPaths::LocateDirectory);
>
> will give you all the base icon paths where to look for icon themes.
Sorry, now I read the bug report which also talks about /usr/share/pixmaps.
Interesting :-)
The KDE icon loader code says that locating one icon can be done with:
QStandardPaths::locate(QStandardPaths::GenericDataLocation, searchPath + '/' +
iconName)
where searchPath iterates over a list containing
1) the application-specific directory + "/pics"
2) "icons"
3) "pixmaps", but with a comment that this is historical and mostly for gnome
compatibility. I had no idea that it was actually in the spec :-)
I'll fix that comment.
Now what's interesting is that the spec hardcodes /usr/share/pixmaps, while
the KDE code makes this more generic, i.e. $XDG_DATA_DIRS/pixmaps.
Anyway, to come back to the Qt code, this means:
A) yes, QStandardPaths should be used to find $XDG_DATA_DIRS/icons, but that's
unrelated to QTBUG-12874, which is about
B) yes, Qt icon loading should look into /usr/share/pixmaps, as the spec says.
I don't know qiconloader.cpp so I can't approve the rest of the patch, but the
hardcoded /usr/share/pixmaps looks fine, it's as per the spec.
--
David Faure, faure at kde.org, http://www.davidfaure.fr
Sponsored by Nokia to work on KDE, incl. KDE Frameworks 5
More information about the Development
mailing list