To achieve its unique look and the ability to switch between different themes Photivo mostly relies on Qt’s styling abilities around QPalette
, QStyle
and QSS stylesheets. On top of that ptTheme
has its own stylsheet format and parser to avoid duplicated stylesheets and define colour variables in one single place instead of putting the actual colour values wherever you need them.
To tweak some aspects of a theme without touching the “official” theming files the best way is to use a custom QSS stylesheet. QSS is Qt’s version of the web world’s CSS stylesheets. Basically it’s CSS with several Qt specific additions.
Assuming you know a bit about CSS, a good place to start is the Qt Stylesheet documentation. For writing a custom stylesheet you’ll want to keep the style sheets reference and examples handy. Also the Photivo.qss file in Photivo’s Themes subfolder is a good reference. There the major part of Photivo’s built-in themes are defined.
Things to keep in mind:
$Colourname$
variables you see in Photivo.qss do not work in custom stylesheets. You must use the actual colour values themselves.
A Photivo theme consists of a .ptheme
file defining variables and one or more .qss
files defining the actual style rules. For example the default Dark grey style is defined in DarkGrey.ptheme, Photivo.qss, Photivo.windows.qss and Photivo.linux.qss.
@Variables
section followed by an @import
command. Both are mandatory.@Variables
or @import
are not allowed.@Variables
section. Do not use comments anywhere else!/*
and ending with */
. They can span multiple lines./
” as path delimiter..ptheme
files must reside in <PhotivoProgramFolder>/Themes
The @Variables
section defines global color values and paths to graphical elements. Access them anywhere in the QSS as $VariableName$
.
#rrggbb
notation compatible with QColor::name()
absolute or relative to the .qss
file’s location.
The @import
specifies the theme’s QSS files.
.ptheme
file’s location..qss
(lower case).@import
rules in the QSS files themselves. You cannot use the variables from the @Variables
section in additionally imported files.