summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativepathview/data/pathview_package.qml
blob: 082da13ad6748cc4b2860544dbe706e33aa7f278 (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
import Qt 4.7

Item {
    width: 800; height: 600
    Component {
        id: photoDelegate
        Package {
            Item { id: pathItem; objectName: "pathItem"; Package.name: 'path'; width: 85; height: 85; scale: pathItem.PathView.scale }
            Item { id: linearItem; Package.name: 'linear'; width: 85; height: 85 }
            Rectangle {
                id: wrapper
                width: 85; height: 85; color: lColor

                transform: Rotation {
                    id: itemRotation; origin.x: wrapper.width/2; origin.y: wrapper.height/2
                    axis.y: 1; axis.z: 0
                }
                state: 'path'
                states: [
                    State {
                        name: 'path'
                        ParentChange { target: wrapper; parent: pathItem; x: 0; y: 0 }
                        PropertyChanges { target: wrapper; opacity: pathItem.PathView.onPath ? 1.0 : 0 }
                    }
                ]
            }
        }
    }
    ListModel {
        id: rssModel
        ListElement { lColor: "red" }
        ListElement { lColor: "green" }
        ListElement { lColor: "yellow" }
        ListElement { lColor: "blue" }
        ListElement { lColor: "purple" }
        ListElement { lColor: "gray" }
        ListElement { lColor: "brown" }
        ListElement { lColor: "thistle" }
    }
    VisualDataModel { id: visualModel; model: rssModel; delegate: photoDelegate }

    PathView {
        id: photoPathView
        objectName: "photoPathView"
        width: 800; height: 330; pathItemCount: 4; offset: 1
        dragMargin: 24
        preferredHighlightBegin: 0.50
        preferredHighlightEnd: 0.50

        path: Path {
            startX: -50; startY: 40;

            PathAttribute { name: "scale"; value: 0.5 }
            PathAttribute { name: "angle"; value: -45 }

            PathCubic {
                x: 400; y: 220
                control1X: 140; control1Y: 40
                control2X: 210; control2Y: 220
            }

            PathAttribute { name: "scale"; value: 1.2  }
            PathAttribute { name: "angle"; value: 0 }

            PathCubic {
                x: 850; y: 40
                control2X: 660; control2Y: 40
                control1X: 590; control1Y: 220
            }

            PathAttribute { name: "scale"; value: 0.5 }
            PathAttribute { name: "angle"; value: 45 }
        }

        model: visualModel.parts.path
    }

    PathView {
        y: 400; width: 800; height: 330; pathItemCount: 8

        path: Path {
            startX: 0; startY: 40;
            PathLine { x: 800; y: 40 }
        }

        model: visualModel.parts.linear
    }
}