Processed QSS

Something you'll come across all the time in this project is PQSS. To understand why it exists, let's start from the beginning. Don't worry, it's not a long story.

In the beginning, there was the file extention. And the file extention was QSS. And it was good, but not good enough. QSS is just Qt's version of CSS, and it's fantastic for styling native desktop applications, but much like vanilla CSS, you're gonna end up repeating yourself a lot. If you want to change one color, you gotta change it everywhere in the QSS file. For an application which boasts theming as one of it's highlights, this would not do.

PQSS is simple. It's just QSS with variables. Simple variables, too; it's just string replacement. That's why PQSS isn't it's own language, really. It's still QSS, but with a processor. PQSS consists of two files: the values file, and the QSS file. As of right now, the values file is imported automatically. Let's take a look at how this works.

As mentioned before, there are two files: the values file, and the theme file. The values file is where the magic happens; let's look there first.

The values file is a file that must be named in a certain fashion. It must be named values.[theme name].pqss, otherwise the current generation of processor just won't pick it up. These files are processed line-by-line. Any line starting with a # is a comment line, anything else is PQSS. PQSS values are just names and values separated by an equals sign. Kebab-case is encouraged, but not necessary.

background-main = #FFFFFF

That's all there is to it. Now comes the next part, the QSS file. This file must be named theme.[theme name].pqss, and [theme name] must be the same as in the values file. Here, you can just write normal QSS but use these names in place of values. All you need to do is prefix the name with a "@"

background-color: @background-main;

That's PQSS. A simple tool for a simple job, but with a notable ease to development. Additionally, you can just use QSS instead, if you don't like PQSS. Just use the .qss file extention instead, and you won't need to make a values file, obviously.