Initial import from the monolithic Qt.
[profile/ivi/qtdeclarative.git] / tests / auto / declarative / qmlvisual / qdeclarativepathview / test-pathview.qml
1 import QtQuick 1.0
2
3 Rectangle {
4     width: 580; height: 220
5     
6     ListModel {
7         id: rssModel
8         ListElement { lColor: "red" }
9         ListElement { lColor: "green" }
10         ListElement { lColor: "yellow" }
11         ListElement { lColor: "blue" }
12         ListElement { lColor: "purple" }
13         ListElement { lColor: "gray" }
14         ListElement { lColor: "brown" }
15         ListElement { lColor: "thistle" }
16     }
17
18     Component {
19         id: photoDelegate
20         Rectangle {
21             id: wrapper
22             width: 65; height: 65; color: lColor
23             scale: wrapper.PathView.scale
24
25             MouseArea { anchors.fill: parent }
26             
27             transform: Rotation {
28                 id: itemRotation; origin.x: wrapper.width/2; origin.y: wrapper.height/2
29                 axis.y: 1; axis.z: 0; angle: wrapper.PathView.angle
30             }
31         }
32     }
33
34     PathView {
35         id: photoPathView; model: rssModel; delegate: photoDelegate
36         anchors.fill: parent;  z: 1
37         anchors.topMargin:40
38         highlightMoveDuration: 200
39         flickDeceleration: 200
40         path: Path {
41             startX: -50; startY: 40;
42             
43             PathAttribute { name: "scale"; value: 0.5 }
44             PathAttribute { name: "angle"; value: -45 }
45             
46             PathCubic {
47                 x: 300; y: 140
48                 control1X: 90; control1Y: 30
49                 control2X: 140; control2Y: 150
50             }
51             
52             PathAttribute { name: "scale"; value: 1.2  }
53             PathAttribute { name: "angle"; value: 0 }
54             
55             PathCubic {
56                 x: 600; y: 30
57                 control2X: 440; control2Y: 30
58                 control1X: 420; control1Y: 150
59             }
60             
61             PathAttribute { name: "scale"; value: 0.5 }
62             PathAttribute { name: "angle"; value: 45 }
63         }
64     }
65
66     Column {
67         Rectangle { width: 20; height: 20; color: "red"; opacity: photoPathView.moving ? 1 : 0 }
68         Rectangle { width: 20; height: 20; color: "blue"; opacity: photoPathView.flicking ? 1 : 0 }
69     }
70 }