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.

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.