summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativepathview/data/propertychanges.qml
blob: c0cc8555e72407b21a4e4f6609e28d66d71afe6c (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
116
import QtQuick 1.0

Rectangle {
    width: 350; height: 220; color: "white"
    Component {
        id: myDelegate
        Item {
            id: wrapper
            width: 180; height: 40; 
            opacity: PathView.opacity
            Column {
                x: 5; y: 5
                Text { text: '<b>Name:</b> ' + name }
                Text { text: '<b>Number:</b> ' + number }
            }
        }
    }

    PathView {
        preferredHighlightBegin: 0.1
        preferredHighlightEnd: 0.1
        dragMargin: 5.0
        id: pathView
        objectName: "pathView"
        anchors.fill: parent
        model: listModel
        delegate: myDelegate
        focus: true
        path: Path {
            id: myPath
            objectName: "path"
            startX: 220; startY: 200
            PathAttribute { name: "opacity"; value: 1.0; objectName: "pathAttribute"; }
            PathQuad { x: 220; y: 25; controlX: 260; controlY: 75 }
            PathAttribute { name: "opacity"; value: 0.3 }
            PathQuad { x: 220; y: 200; controlX: -20; controlY: 75 }
        }
        Timer {
            interval: 2000; running: true; repeat: true
            onTriggered: {
                if (pathView.path == alternatePath)
                    pathView.path = myPath;
                else
                    pathView.path = alternatePath;
            }
        }
    }

    data:[  
    ListModel {
        id: listModel
        ListElement {
            name: "Bill Smith"
            number: "555 3264"
        }
        ListElement {
            name: "John Brown"
            number: "555 8426"
        }
        ListElement {
            name: "Sam Wise"
            number: "555 0473"
        }
        ListElement {
            name: "Bill Smith"
            number: "555 3264"
        }
        ListElement {
            name: "John Brown"
            number: "555 8426"
        }
        ListElement {
            name: "Sam Wise"
            number: "555 0473"
        }
        ListElement {
            name: "Bill Smith"
            number: "555 3264"
        }
        ListElement {
            name: "John Brown"
            number: "555 8426"
        }
        ListElement {
            name: "Sam Wise"
            number: "555 0473"
        }
    },
    ListModel {
        objectName: "alternateModel"
        ListElement {
            name: "Jack"
            number: "555 8426"
        }
        ListElement {
            name: "Mary"
            number: "555 3264"
        }
    },
    Path {
        id: alternatePath
        objectName: "alternatePath"
        startX: 100; startY: 40
        PathAttribute { name: "opacity"; value: 0.0 }
        PathLine { x: 100; y: 160 }
        PathAttribute { name: "opacity"; value: 0.2 }
        PathLine { x: 300; y: 160 }
        PathAttribute { name: "opacity"; value: 0.0 }
        PathLine { x: 300; y: 40 }
        PathAttribute { name: "opacity"; value: 0.2 }
        PathLine { x: 100; y: 40 }
    }
    ]
}