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

Time for action – Rotating and scaling a picture by pinching

Start a new Qt Quick Application - Empty project. Add an image file to the resources, just like we previously did in the button project. In the main.qml file, add an image to the window and make it centered in its parent:

Image {
    id: image
    anchors.centerIn: parent
    source: "qrc:/wilanow.jpg"
}

Now, we will add a PinchArea element. This kind of item can be used in two ways—either by manually implementing signal handlers onPinchStarted, onPinchUpdated, and onPinchFinished to have total control over the functionality of the gesture, or using a simplified interface similar to the drag property of MouseArea. Since the simplified interface does exactly what we want, there is no need to ...

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