[Interest] Qt5 CSS StyleSheet Variables

Tony Rietwyk tony at rightsoft.com.au
Mon May 21 17:43:46 CEST 2018


Hi Mike,

QStyleSheets are pretty limited, so we:

- load a sass file from Qt resources,

- inject some calculated variables at the start relating to the specific 
app and client screen size,

- process the sass to css

- set the output into QApplication.

This occurs at startup, and whenever the screen changes.

Hope that helps, Tony


On 22/05/2018 1:17 AM, Christian Ehrlicher wrote:
> Am 21.05.2018 um 15:47 schrieb Michael Jackson:
>> Just to confirm, but does Qt accept CSS variables as describe here: 
>> <https://www.w3schools.com/css/css3_variables.asp> ?
>>
>> I tried and I get the error that the style sheet could not be parsed. 
>> I have a style sheet with a LOT of color settings and having to do a 
>> bunch of search/replace to change the colors is error prone at best.
>>
> http://doc.qt.io/qt-5/stylesheet-reference.html should be your reference.
>
> Christian




More information about the Interest mailing list