-
Book Overview & Buying
-
Table Of Contents
Qt5 C++ GUI Programming Cookbook
By :
In this section, we will learn how to develop a touch-driven application that runs on mobile devices using Qt Quick.
First of all, create a new Qt Quick application project.
In Qt Creator, right-click on qml.qrc and select Open in Editor. Then, click Add | Add Files and add tux.png to the project:

Next, open up MainForm.ui.qml. Drag an image widget from the Library window to the canvas. Then, set the source of the image to tux.png and set its fillmode to PreserveAspectFit. After that, set its width to 200 and its height to 220.
Make sure both the mouse area widget and the image widget are exported as alias properties of the root item by clicking on the small icon besides their respective widget name.
After that, switch over to the Script Editor by clicking on the Edit button on the side bar located at the left side of the editor. We need to change the mouse area widget to a multi-point touch area widget, like so:
MultiPointTouchArea {
id: touchArea
anchors.fill: parent...