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

What just happened?

Our simple application loads an image and centers it in the view. Then, there is a PinchArea item filling the view area that is told to operate on the image object. We define the range of the scaling and rotating of the item. The rest is left to the PinchArea item itself. If you start interacting with the application, you will see the item rotate and scale. What really happens behind the scenes is that PinchArea modifies the values of the two properties each Qt Quick item has—rotation and scale.

PinchArea can also control the dragging of the item with pinch.dragAxis, just like MouseArea does with drag, but for simplicity, we didn't use this part of the API. Feel free to experiment with it in your own code.

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