[Interest] QIcon::fromTheme on OS X

René J.V. Bertin rjvbertin at gmail.com
Thu Dec 24 15:26:13 CET 2015


On Thursday December 24 2015 15:24:46 Diego Iastrubni wrote:
> yes, this works out of the box only in Linux. On Windows/Mac, you need to
> do a little more work. I will give parts of the solution in this email, if
> this is not completely clear do tell, and I will elaborate.
...
> Hope this helps

Yes it does, but I should apologise for not having reported back my findings after posting my initial question.

It turns out, ahem, that I had not completely understood the exact nature of the hicolor theme I was trying to use. I still don't fully understand it's point if it doesn't have icons for standard dialog buttons, but that is exactly what I was seeing. Once I hardcoded a different XDG-compatible icon theme from the ones I have installed, I started getting icons.

So yes, 

QIcon::setThemeSearchPath("/opt/local/share/icons");
QIcon::setThemeName("oxygen");

is indeed enough if KDE's Oxygen theme is installed in /opt/local/share/icons.

And that's exactly the use case I'm aiming for: not embedding a theme in app-specific resources, but making them available via a central repository.

Re: memory and icon sizes: It appears that QIcon supports scalable icons on OS X so probably on MS Windows too. That should help keeping the resource size down (SVG usually compresses well too).

Regards,
René



More information about the Interest mailing list