aboutsummaryrefslogtreecommitdiffstats
path: root/tests/manual/painterpathquickshape/SimpleShape.qml
blob: b5d2226cb44c3aedc3ffc9ace93a39aed6ac9967 (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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

import QtQuick
import QtQuick.Shapes

ControlledShape {
    delegate: [
        // A triangle
        PathPolyline {
            id: ppl
            path: [ Qt.point(150.0, 100.0),
                Qt.point(1250.0, 150.0),
                Qt.point(100.0, 1000.0),
                Qt.point(150, 100)
            ]
        },
        // A very narrow shape with one convex and one concave curve
        PathMove { x: 600; y: 1200},
        PathQuad { x: 800; y: 1200; controlX: 700; controlY: 600 },
        PathQuad { x: 600; y: 1200; controlX: 700; controlY: 700 },

        // A more complex path with editable points
        PathMove { x: p1.cx; y: p1.cy },
        PathQuad { x: p2.cx; y: p2.cy; controlX: c1.cx; controlY: c1.cy },
        PathQuad { x: p3.cx; y: p3.cy; controlX: c2.cx; controlY: c2.cy },
        PathQuad { x: p4.cx; y: p4.cy; controlX: c3.cx; controlY: c3.cy },
        PathLine { x: p5.cx; y: p5.cy },
        PathQuad { x: p6.cx; y: p6.cy; controlX: c5.cx; controlY: c5.cy },
        PathQuad { x: p7.cx; y: p7.cy; controlX: c6.cx; controlY: c6.cy },
        PathQuad { x: p8.cx; y: p8.cy; controlX: c7.cx; controlY: c7.cy }
    ]

    // Control points for the editable part:
    // Curve p1-c1-p2, Curve p2-c2-p3, Curve p3-c3-p4
    // Line p4-p5, Curve p5-c5-p6, Curve p6-c6-p7, Curve p7-c7-p8

    ControlPoint {
        id: p1
        cx: 100
        cy: 1000
    }
    ControlPoint {
        id: c1
        color: "blue"
        cx: 200
        cy: 1500
    }
    ControlPoint {
        id: p2
        cx: 700
        cy: 1500
    }
    ControlPoint {
        id: c2
        color: "blue"
        cx: 1200
        cy: 1500
    }
    ControlPoint {
        id: p3
        cx: 1200
        cy: 1000
    }
    ControlPoint {
        id: c3
        color: "blue"
        cx: 1100
        cy: 700
    }
    ControlPoint {
        id: p4
        cx: 800
        cy: 600
    }
    ControlPoint {
        id: p5
        cx: 800
        cy: 800
    }
    ControlPoint {
        id: c5
        color: "blue"
        cx: 1000
        cy: 600
    }
    ControlPoint {
        id: p6
        cx: 1000
        cy: 1000
    }
    ControlPoint {
        id: c6
        color: "blue"
        cx: 1000
        cy: 1300
    }
    ControlPoint {
        id: p7
        cx: 700
        cy: 1300
    }
    ControlPoint {
        id: c7
        color: "blue"
        cx: 400
        cy: 1300
    }
    ControlPoint {
        id: p8
        cx: 400
        cy: 1000
    }

}