[英]Qt4 css - How to create file .QSS?
I have a question. 我有个问题。
How do I create in my project folder with a file. 如何在项目文件夹中创建文件。
.QSS
? .QSS
?
At the option of creating new files do not have this extension! 选择创建新文件时没有此扩展名!
I would be very grateful for the help. 我将非常感谢您的帮助。
Thank you. 谢谢。
Just create it with a text editor like a notepad and save it with the .qss
extension. 只需使用文本编辑器(如记事本)创建它,然后将其保存为
.qss
扩展名即可。 I suggest to add it in your resource file. 我建议将其添加到您的资源文件中。
You can load it using the following sample code 您可以使用以下示例代码加载它
QFile file(":/qss/style.qss");
if(file.open(QFile::ReadOnly)) {
QString StyleSheet = QLatin1String(file.readAll());
qApp->setStyleSheet(StyleSheet);
}
Yeah, Qt Creator (I'm assuming that is what you are using) is a little lacking in this area. 是的,Qt Creator(我假设您正在使用的是)在此领域有点缺乏。 Just create the folder and file on your file system.
只需在文件系统上创建文件夹和文件。 Then, in Qt Creator, right click on the project and select
Add Existing Files...
然后,在Qt Creator中,右键单击该项目,然后选择“
Add Existing Files...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.