[Interest] pre-processing for Qt widget stylesheet

Hamish Moffatt hamish at risingsoftware.com
Tue Aug 11 04:45:59 CEST 2015


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?


Thanks
Hamish



More information about the Interest mailing list