The scene's coordinate system

Any item can be moved in the scene using the setPos() function. Try to call textItem->setPos(50, 50) and verify that the text was moved in the scene. Technically, this operation changes the transformation between the item's coordinate system and the scene's coordinate system. A convenience function called moveBy() allows you to shift the position by specified amounts.

An item can also be rotated with setRotation() and scaled with setScale(). Try calling textItem->setRotation(20) to see this in action. If you need a more advanced transformation, such as shearing, or you want to perform multiple translations in a particular order, you can create a QTransform object, apply the required transformations, and use the ...

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.