Creating Qt Style Sheets and custom themes
In the last section, we created our custom widget, but the widget still has a native look. Qt provides several ways to customize the look and feel of the UI. A Qt Style Sheet is one of the simplest ways to change the look and feel of widgets without doing much complex coding. Qt Style Sheet syntax is identical to HyperText Markup Language/Cascading Style Sheets (HTML/CSS) syntax. Style Sheets comprise a sequence of style rules. A style rule consists of a selector and a declaration. The selector specifies widgets that will be affected by the style rule, and the declaration specifies the properties of the widget. The declaration portion of a style rule is a list of properties as key-value pairs, enclosed inside {}
and separated by semicolons.
Let's have look at the simple QPushButton
Style Sheet syntax, as follows:
QPushButton { color: green; background-color: rgb (193, 255, 216);}
You can also change the look and feel of widgets...