Variables and math inside Qt's QSS, interested?


Anyone here ever wanted to use variables and math operations inside Qt’s QSS style sheets?

margin-left: calc($menuLabelMargin + 1px)

I have a small module that adds that and I’m thinking to release it as open source, but I’m not sure if it’s something people will find useful. Are you guys mostly just use the Qt Designer and do not manually edit the style sheets?



My library is inspired by SCSS and CSS3, but I guess people might prefer to just go on with full SCSS, or just use the Qt Designer, so it may not be worth it to release it.

I have often struggled with the lack of variables in qss and have it on my long term list of things to do - if you wanted to open source your current code, that would be awesome!

1 Like

Cool! I’ll release it then. Is a small module and it has tests.