application icon on OS X, MS Windows and other non-X11 platforms

René J.V. Bertin rjvbertin at gmail.com
Sat Dec 19 21:59:16 UTC 2015


Hello,

I'm not sure if this is the most appropriate ML for this kind of question, but here goes:

With KDE4, many applications obtained a runtime application icon (visible in app switcher, dock, Finder, Explorer, on windows etc) through some equivalent of QApplication::setWindowIcon(). This worked without any need to set env. variables like KDE_SESSION_VERSION or use a KDE-specific theme, even if the application itself had not received an icon during the build process.

This no longer works; one must set KDE_SESSION_VERSION to an appropriate value, *and* use the KDE platform theme in order for icon lookup-from-theme to work. Worse, calling setWindowIcon() now *overrides* the icon set in/on the application (i.e. the one visible in the Finder/Explorer).

There is a relatively easy workaround for this: use QApplication::windowIcon() to provide the fallback icon in the call to QIcon::fromTheme(). Caching the result from QIcon::fromTheme() and only using the result if not isNull() might be more efficient, certainly be less readable but could possibly provide better protection against "optimising developers" :).

Thoughts?

René


More information about the Kde-frameworks-devel mailing list