[SailfishDevel] Resolution-independent in-app icons

Joona Petrell joona.petrell at jolla.com
Fri Jul 22 07:17:32 UTC 2016


> Thanks. This was very helpful. I assume these z-values are the same as
Theme.pixelRatio?

Yes.

>> Let say I would like to create my custom set of icons for my app. Is there any good approach to figure out (in C++), which icon set is used in the system, which Zx.x?
> dconf /desktop/sailfish/silica/theme_pixel_ratio 

Nowadays Theme class is also exposed in C++ as SilicaTheme:

PKGCONFIG += sailfishsilica
INCLUDEPATH += /usr/include/libsailfishsilica
...
#include <silicatheme.h>
SilicaTheme theme;
qreal pixelRatio = theme.pixelRatio();

It is quite new addition, created pull request to allow it for Store apps:
https://github.com/sailfish-sdk/sdk-harbour-rpmvalidator/pull/78

In theory you could use that to scale application's SVGs on device to target pixel ratio as post-install step, unfortunately it is ran as root and thus cannot be allowed for Store apps. Then you wouldn't need to hardcode the pixel ratios to build time scripts. I'll dig deeper to see what we could do there.

Br,

Joona

________________________________________
From: devel-bounces at lists.sailfishos.org [devel-bounces at lists.sailfishos.org] on behalf of Michal [muki at mkiol.net]
Sent: 22 July 2016 08:25
To: Sailfish OS Developers
Subject: Re: [SailfishDevel] Resolution-independent in-app icons

> dconf /desktop/sailfish/silica/theme_pixel_ratio
> or /desktop/sailfish/silica/theme_icon_subdir

It seems that "/desktop/sailfish/silica/theme_icon_subdir" entry doesn't
exists, but "/desktop/sailfish/silica/theme_pixel_ratio" is ok and I
will stick to it.

Thanks!

br,
Michal
_______________________________________________
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscribe at lists.sailfishos.org


More information about the Devel mailing list