Reputation: 287
At the option of creating new files, I do not have this extension.
How can I add this type of file to my project?
Upvotes: 1
Views: 7998
Reputation: 9208
In Qt Creator:
style.qss
(you may also choose the directory);Upvotes: 7
Reputation: 17946
Yeah, Qt Creator (I'm assuming that is what you are using) is a little lacking in this area. Just create the folder and file on your file system. Then, in Qt Creator, right click on the project and select Add Existing Files...
Upvotes: 0
Reputation: 12321
Just create it with a text editor like a notepad and save it with the .qss
extension. 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);
}
Upvotes: 5