Use “Less” or something similar to generate a Qt Stylesheets

女生的网名这么多〃 提交于 2019-12-25 04:36:20

问题


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.

My concern is that Qt does not use the W3C standard for stylesheet, they utilize a subset of the syntax with a few extra options.

Is this even possible? Are Less and Compass able to generate valid Qt stylesheets?


回答1:


Qt's CSS has a few specificities that prevent the direct use of a classic LESS or SASS compiler ("!" in selectors, gradient functions...). I had the same need, so I came up with this tool: https://github.com/yann-lty/qtsass.

It's a lightweight utility that turns a W3C-valid SASS file into a valid Qt stylesheet by handling the variations between the two specifications (documented in the README file). Note that it is currently under development and might not cover everything; but I've been using it in production and it's a good starting point.



来源:https://stackoverflow.com/questions/31928253/use-less-or-something-similar-to-generate-a-qt-stylesheets

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!