RCC for icons - update: Re: Icons installed by apps

Kåre Särs kare.sars at iki.fi
Thu Feb 18 17:25:17 GMT 2016


On Thursday, February 18, 2016 02:51:58 PM René J.V. Bertin wrote:
> On Thursday February 18 2016 13:55:18 Jaroslaw Staniek wrote:
> >>> > since QIcon::fromTheme() apaprently isn't able to find app icons.
> 
> Care to explain? QIcon::fromTheme() doesn't find anything "out of the box"
> on OS X (and I presume on MS Windows), but that is only because no theme
> search path is set on those platforms. When you add the standard XDG icon
> repository to the icon search path on OS X, even "pure" Qt5 application
> will start showing icons all over if you have an icon theme installed --
> including in widgets that should not have icons according to the HIG. Also
> on OS X, fromTheme() will only return the application icon (as in the icon
> shown in the Finder) if the current theme defines that same icon for the
> calling application, and the theme search path is set of course. In all
> other cases it will not, because the application icon is not defined
> through a theme on OS X (nor is it on MS Windows, I presume).
> >> I think the solution with a packaged breeze icons resource working
> >> out-of-the box could be a good (lightweight) addition for non-Plasma
> >> (non-Linux?) users of KF5, to popularize KF5. They grab the icons package
> 
> Popularise, with Breeze "art"work? O:-)
> Anyway,  I don't think "grabbing an icon package" will work on OS X, not if
> you want to create standalone app bundles which by definition contain
> everything they need.
> >> and icons just work without thousands of files, caching, etc. 'One in a
> >> million' would of these users would be interested in theming.
> 
> I'd up that estimate if we're still talking about Breeze icons here O:-)
> 
> >> PS2: I have been beaten by situations such as KToolBar setting 0-size
> >> icons by default.
> 
> Partly this is because almost no KF5 code uses the fallback argument of
> QIcon::fromTheme() explicitly, which means that the function returns an
> empty icon if the search fails. In particular, statements like
> 
> app->setWindowIcon(QIcon::fromTheme(programName))
> 
> should read
> 
> app->setWindowIcon(QIcon::fromTheme(programName, app->windowIcon()))
> 
> >> This is in a Windows env where no themes are (properly) installed. If the
> >> rcc-based solution is in use I would imagine that ideally all the KF5
> >> code
> >> detects this somehow and would not look for xdg standard themes through
> >> the
> >> classic KIconLoader but silently adapt so the rcc resource works great.
> >> Just a dream.
> 
> If your rcc resource corresponds to the resource mentioned in the
> QIcon::fromTheme() documentation (I think that talks about "qrc") and if I
> interpret that documentation correctly then yes, code using that function
> will find icons from the rcc/qrc "builtin" resource over those in xdg
> themes (if the XDG icon repository is even in the icon theme search path).
> >>> What I don't know however is whether artists consider that these icons
> >>> should be themeable...
> 
> I think icon artists will consider that you should touch their icons (for
> theming or anything else). They will probably also consider that their
> icons are the "best" but they really should also consider it a right for
> anyone to use other icons ;)
> 

The breeze.rcc file way is actually how Christoph solved it in Kate for 
Windows and OSX. We create an .rcc file from the breeze icons and at start-up 
we search for the file in QStandardPaths::DataLocation and if the file is 
found we load it with  registerResource() and add ":/icons" to the 
themeSearchPaths. (kate.git/icons.h)

Christoph also added ":/icons" to the search path in kicontheme so that xmlgui 
toolbars and friends also get the icons from the .rcc file.

We get all the same icons as on Linux neatly in one file :)

breesze's symlinks was a problem on windows, but I created a small application 
to replace the symlinked files with an alias pointing to the target file -> 
smaller .rcc file :)

/Kåre





More information about the calligra-devel mailing list