[Interest] pre-processing for Qt widget stylesheet

Konstantin Tokarev annulen at yandex.ru
Tue Aug 11 11:25:09 CEST 2015



11.08.2015, 05:47, "Hamish Moffatt" <hamish at risingsoftware.com>:
>  Does anyone have any experience with preprocessing to generate the Qt
>  stylesheet?
>
>  I'd like to be able to refer to constants (eg colours), and also perhaps
>  to define functions (eg to perform dpi scaling).
>
>  I have looked at incorporating libsass (http://libsass.org/) into my
>  application. The first problem I've found is that its parser is strict
>  and Qt's stylesheet is not true CSS. Two examples:
>  1. rgba function's a parameter behaves differently - CSS requires a real
>  number (0-1), Qt requires a % or an integer 0-255.
>  2. QTabBar::tab:!selected isn't a valid selector in CSS (!selected is
>  invalid), but Qt allows it and we require it.
>
>  Anyone else have experience doing this?


I've implemented custom SCSS-like markup using Text:Sass [1], it is not very strict
about (S)CSS conformance and one can relatively easy write custom (non-CSS) generator
(e.g., my code produces XML)

[1] http://search.cpan.org/~rpettett/Text-Sass-0.97/lib/Text/Sass.pm

-- 
Regards,
Konstantin



More information about the Interest mailing list