Have a go hero – Rotating and scaling with a mouse

Of course, you don't have to use PinchArea to rotate or scale an item. Properties controlling those aspects are regular properties that you can read and write at any time. Try replacing PinchArea with MouseArea to obtain a result similar to what we just did by modifying the scale and rotation properties as a result of receiving mouse events—when the user drags the mouse while pressing the left button, the image is scaled and when the user does the same while pressing the right button, the image is rotated.

If you manage to do the task, try replacing MouseArea with PinchArea again, but then, instead of using the pinch property, handle events manually to obtain the same effect (the event object ...

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.