Painter attributes

Let's start with the attributes. The three most important ones are the pen, brush, and font. The pen holds properties of the outline drawn by the painter, and the brush determines how it will fill shapes. We've already described pens and brushes in Chapter 4, Custom 2D Graphics with Graphics View, so you should already understand how to work with them.

The font attribute is an instance of the QFont class. It contains a large number of methods for controlling font parameters such as font family, style (italic or oblique), font weight, and font size (either in points or device-dependent pixels). All the parameters are self-explanatory, so we will not discuss them here in detail. It is important to note that QFont can use ...

Get Game Programming using Qt 5 Beginner's Guide - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.