Initial import from the monolithic Qt.
[profile/ivi/qtdeclarative.git] / tests / auto / declarative / qmlvisual / qdeclarativepathview / test-pathview-2.qml
1 import QtQuick 1.0
2
3 Rectangle {
4     width: 580; height: 220
5     //Same as test-pathview, but with pathItemCount < model.count
6     
7     ListModel {
8         id: rssModel
9         ListElement { lColor: "red" }
10         ListElement { lColor: "green" }
11         ListElement { lColor: "yellow" }
12         ListElement { lColor: "blue" }
13         ListElement { lColor: "purple" }
14         ListElement { lColor: "gray" }
15         ListElement { lColor: "brown" }
16         ListElement { lColor: "thistle" }
17     }
18
19     Component {
20         id: photoDelegate
21         Rectangle {
22             id: wrapper
23             width: 65; height: 65; color: lColor
24             scale: wrapper.PathView.scale
25
26             MouseArea { anchors.fill: parent }
27             
28             transform: Rotation {
29                 id: itemRotation; origin.x: wrapper.width/2; origin.y: wrapper.height/2
30                 axis.y: 1; axis.z: 0; angle: wrapper.PathView.angle
31             }
32         }
33     }
34
35     PathView {
36         id: photoPathView; model: rssModel; delegate: photoDelegate
37         anchors.fill: parent;  z: 1
38         anchors.topMargin:40
39         pathItemCount: 6
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 }