[Interest] Fallback (hicolor) theme in resource (.qrc) on Mac not working

Elvis Stansvik elvstone at gmail.com
Thu Jun 1 16:58:44 CEST 2017


So, in short:

I have application resources like

:/icons/breeze/actions/24/document-open.svg
..
:/icons/breeze/index.theme
:/icons/hicolor/scalable/actions/myapp-action.svg
...
:/icons/hicolor/index.theme

and I call QIcon::setThemeName("breeze") and one of the actions in an
.ui file has

   <property name="icon">
    <iconset theme="myapp-action"/>
   </property>

and this seems to work on Linux (it falls back to hicolor and finds
the myapp-action.svg icon), but not on macOS. There it will find e.g.
"document-open", but not "myapp-action".

I would have thought that since Qt allows embedding of a theme
following the icon theme specification in the resources on
Mac/Windows, that it would also implement the fallback behavior (to
hicolor) in the spec, among the resource-embedded themes.

Elvis


2017-06-01 16:44 GMT+02:00 Elvis Stansvik <elvstone at gmail.com>:
> On Mac and Windows, I'm bundling parts of the Breeze icon theme in the
> application resources.
>
> E.g. I have resources like
>
> :/icons/breeze/actions/24/document-open.svg
> :/icons/breeze/actions/24/help-about.svg
> :/icons/breeze/actions/24/document-close.svg
> ...
> :/icons/breeze/index.theme
>
> and I'm calling QIcon::setThemeName("breeze") on Windows/Mac. This was
> working fine.
>
> I kept application specific icons directly in :/icons. For example:
>
> :/icons/myapp-some-action.svg
> :/icons/myapp-some-other-action.svg
> ...
>
> Recently though, I went ahead and moved my application-specific icons
> into the hicolor theme, e.g:
>
> :/icons/hicolor/myapp-some-action.svg
> :/icons/hicolor/myapp-some-other-action.svg
> ...
> :/icons/hicolor/index.theme
>
> And started referring to them by their theme name instead. E.g.
> "myapp-some-action" instead of using the QRC file paths.
>
> I expected this would work, since hicolor is the fallback theme
> (according to Freedesktop Icon Specification).
>
> It works on Linux. It's not working on Mac though :/ The embedded
> Breeze icon theme works fine, but it seems it's not falling back to my
> embedded hicolor theme, so my application specific icons are not
> shown. I haven't tested on Windows yet.
>
> Anyone using a setup like this on Windows/Mac? Where you bundle both
>
>  1. some general theme (e.g. Breeze), and
>  2. a hicolor fallback theme with your application icons
>
> both inside the application resources (.qrc).
>
> Thanks in advance for any help.
>
> Elvis



More information about the Interest mailing list