|
1 import Qt 4.7 |
|
2 |
|
3 Item { |
|
4 width: 800; height: 600 |
|
5 Component { |
|
6 id: photoDelegate |
|
7 Package { |
|
8 Item { id: pathItem; objectName: "pathItem"; Package.name: 'path'; width: 85; height: 85; scale: pathItem.PathView.scale } |
|
9 Item { id: linearItem; Package.name: 'linear'; width: 85; height: 85 } |
|
10 Rectangle { |
|
11 id: wrapper |
|
12 width: 85; height: 85; color: lColor |
|
13 |
|
14 transform: Rotation { |
|
15 id: itemRotation; origin.x: wrapper.width/2; origin.y: wrapper.height/2 |
|
16 axis.y: 1; axis.z: 0 |
|
17 } |
|
18 state: 'path' |
|
19 states: [ |
|
20 State { |
|
21 name: 'path' |
|
22 ParentChange { target: wrapper; parent: pathItem; x: 0; y: 0 } |
|
23 PropertyChanges { target: wrapper; opacity: pathItem.PathView.onPath ? 1.0 : 0 } |
|
24 } |
|
25 ] |
|
26 } |
|
27 } |
|
28 } |
|
29 ListModel { |
|
30 id: rssModel |
|
31 ListElement { lColor: "red" } |
|
32 ListElement { lColor: "green" } |
|
33 ListElement { lColor: "yellow" } |
|
34 ListElement { lColor: "blue" } |
|
35 ListElement { lColor: "purple" } |
|
36 ListElement { lColor: "gray" } |
|
37 ListElement { lColor: "brown" } |
|
38 ListElement { lColor: "thistle" } |
|
39 } |
|
40 VisualDataModel { id: visualModel; model: rssModel; delegate: photoDelegate } |
|
41 |
|
42 PathView { |
|
43 id: photoPathView |
|
44 objectName: "photoPathView" |
|
45 width: 800; height: 330; pathItemCount: 4; offset: 1 |
|
46 dragMargin: 24 |
|
47 preferredHighlightBegin: 0.50 |
|
48 preferredHighlightEnd: 0.50 |
|
49 |
|
50 path: Path { |
|
51 startX: -50; startY: 40; |
|
52 |
|
53 PathAttribute { name: "scale"; value: 0.5 } |
|
54 PathAttribute { name: "angle"; value: -45 } |
|
55 |
|
56 PathCubic { |
|
57 x: 400; y: 220 |
|
58 control1X: 140; control1Y: 40 |
|
59 control2X: 210; control2Y: 220 |
|
60 } |
|
61 |
|
62 PathAttribute { name: "scale"; value: 1.2 } |
|
63 PathAttribute { name: "angle"; value: 0 } |
|
64 |
|
65 PathCubic { |
|
66 x: 850; y: 40 |
|
67 control2X: 660; control2Y: 40 |
|
68 control1X: 590; control1Y: 220 |
|
69 } |
|
70 |
|
71 PathAttribute { name: "scale"; value: 0.5 } |
|
72 PathAttribute { name: "angle"; value: 45 } |
|
73 } |
|
74 |
|
75 model: visualModel.parts.path |
|
76 } |
|
77 |
|
78 PathView { |
|
79 y: 400; width: 800; height: 330; pathItemCount: 8 |
|
80 |
|
81 path: Path { |
|
82 startX: 0; startY: 40; |
|
83 PathLine { x: 800; y: 40 } |
|
84 } |
|
85 |
|
86 model: visualModel.parts.linear |
|
87 } |
|
88 } |