May 2019
Intermediate to advanced
542 pages
13h 37m
English
If we want something fancier than a solid color, then we can use a QBrush object. Brushes are capable of filling colors in patterns, gradients, or textures (that is, image-based patterns).
For example, let's create a brush that paints a white stipple fill:
dotted_brush = qtg.QBrush( qtg.QColor('white'), qtc.Qt.Dense2Pattern)
Dense2Pattern is one of 15 patterns available. (You can refer to https://doc.qt.io/qt-5/qt.html#BrushStyle-enum for the full list.) Most of these are varying degrees of stippling, cross-hatching, or alternating line patterns.
Patterns have their uses, but gradient-based brushes are perhaps more interesting for modern styling. However, creating one is a little more involved, as shown in the ...
Read now
Unlock full access