Game Programming using Qt 5 Beginner's Guide - Second Edition
by Pavel Strakhov, Witold Wysota, Lorenz Haas
The item's coordinate system
Each item has its own coordinate system. In our example of Post-it notes, the content of each note is defined relative to the top-left corner of the note. No matter how you move or rotate the item, these coordinates remain the same. The coordinates of a drawn object can usually be passed to the constructor of the class, like we did in our demo project, or to a special setter function (for example, rectItem->setRect(0, 10, 20, 25)). These are coordinates in the item's coordinate system.
Some classes, such as QGraphicsSimpleTextItem, do not provide the ability to change the coordinates of the content, so they're always positioned at the origin of the item's coordinate system. This is not a problem at all; as we'll ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access