aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickpincharea/data/pinchAreaInPathView.qml
blob: dc909c2c7c629e706fcbea3b86de98029d128531 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import QtQuick

PathView {
    width: 600
    height: 200

    model: 3
    delegate: Rectangle {
        width: 200
        height: 200
        color: "salmon"
        opacity: PathView.isCurrentItem ? 1 : 0.5

        property alias pinchArea: pinchArea

        Text {
            text: "Test"
            font.pixelSize: 100
            anchors.fill: parent
            fontSizeMode: Text.Fit
            horizontalAlignment: Text.AlignHCenter
            verticalAlignment: Text.AlignVCenter
        }

        PinchArea {
            id: pinchArea
            anchors.fill: parent
            pinch.target: parent
            pinch.dragAxis: Pinch.XAndYAxis
            pinch.minimumScale: 1.0
            pinch.maximumScale: 5.0

            onPinchFinished: (pinch) => {
                parent.scale = 1
                parent.x = 0
                parent.y = 0
            }
        }
    }
    path: Path {
        startX: 100
        startY: 100
        PathLine {
            x: 700
            y: 100
        }
    }
}