user628298
user628298

Reputation: 287

How do I create a QSS file in my project folder?

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

Answers (3)

elcuco
elcuco

Reputation: 9208

In Qt Creator:

  1. Ctrl+N;
  2. -> General;
  3. -> Choose;
  4. In name, write style.qss (you may also choose the directory);
  5. Add to project, or SVN.

Upvotes: 7

Dave Mateer
Dave Mateer

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

pnezis
pnezis

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

Related Questions