Use LESS or similar to generate a Qt Stylesheet
-
wrote on 10 Aug 2015, 20:15 last edited by
I'm creating a stylesheet for my Qt application to customize the look and feel. I'd love to take advantage of a CSS generator like LESS or Compass, so I can at least use variables for color and perhaps take advantage of some of the other cool features they offer.
Is this even possible? Are Less and Compass able to generate valid Qt stylesheets?
-
I'm creating a stylesheet for my Qt application to customize the look and feel. I'd love to take advantage of a CSS generator like LESS or Compass, so I can at least use variables for color and perhaps take advantage of some of the other cool features they offer.
Is this even possible? Are Less and Compass able to generate valid Qt stylesheets?
Lifetime Qt Championwrote on 10 Aug 2015, 22:24 last edited by mrjj 8 Oct 2015, 22:25Hi and welcome
Since the parser of QSS knows nothing of CSS from LESS / Compass, it can not be used directly.
http://doc.qt.io/qt-4.8/stylesheet-syntax.htmlAs far as I can see both uses css/extended css and knows nothing of Qt.
So I guess its a no. sadly.
But you can somewhat easy use "variables" for colors if you hax it a bit you self
http://stackoverflow.com/questions/10898399/using-variables-in-qt-stylesheets
by writing some code to do some string replacements.
https://forum.qt.io/topic/17318/solved-using-variables-in-style-sheets-qss/2
2/2