Painter paths

If you want to create a graphics item that consists of multiple geometric primitives, creating multiple QGraphicsItem objects seems to be tedious. Fortunately, Qt provides a QGraphicsPathItem class that allows you to specify a number of primitives in a QPainterPath object. QPainterPath allows you to "record" multiple painting instructions (including filling, outlining, and clipping), and then efficiently reuse them multiple times.

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.