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

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  ...

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