O'Reilly logo

Game Programming using Qt 5 Beginner's Guide - Second Edition by Lorenz Haas, Witold Wysota, Pavel Strakhov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Drawing operations

Once you have the painter properly set, you can start issuing painting operations. QPainter has a rich set of operations for drawing different kinds of primitives. All of these operations have the draw prefix in their names, followed by the name of the primitive that is to be drawn. Thus, operations such as drawLine, drawRoundedRect, and drawText are available with a number of overloads that usually allow us to express coordinates using different data types. These may be pure values (either integer or real), Qt's classes, such as QPoint and QRect, or their floating point equivalents—QPointF and QRectF. Each operation is performed using current painter settings (font, pen, and brush).

Refer to the documentation of the 

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required