本文介绍了Qt Creator中的CSS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在此主题上找不到任何内容,是否可以在Qt中使用CSS文件,还是必须在要设置样式的每个元素上使用setStyleSheet?
I can't find anything on this topic, is it possible to use CSS files in Qt or do I have to use setStyleSheet on every element I want to style?
如果必须将所有样式都写在引号中,我不能说它非常易于维护.
I can't say its very maintainable if I have to write all the styles in quotes.
推荐答案
您可以使用 -stylesheet
在命令行上指定样式表.此外,您可以从文件或资源中加载.qss文件,然后调用 setStylesheet .
You can use -stylesheet
to specify a stylesheet on the command line. In addition, you could load your .qss file from a file or a resource and then call setStylesheet on your QApplication instance.
这篇关于Qt Creator中的CSS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!