|
1 import Qt 4.7 |
|
2 |
|
3 Rectangle { |
|
4 width: 300; height: 400; color: "black" |
|
5 |
|
6 ListModel { |
|
7 id: appModel |
|
8 ListElement { lColor: "red" } |
|
9 ListElement { lColor: "yellow" } |
|
10 ListElement { lColor: "green" } |
|
11 ListElement { lColor: "blue" } |
|
12 ListElement { lColor: "purple" } |
|
13 ListElement { lColor: "orange" } |
|
14 ListElement { lColor: "pink" } |
|
15 ListElement { lColor: "brown" } |
|
16 ListElement { lColor: "gray" } |
|
17 ListElement { lColor: "red" } |
|
18 ListElement { lColor: "yellow" } |
|
19 ListElement { lColor: "green" } |
|
20 ListElement { lColor: "blue" } |
|
21 ListElement { lColor: "purple" } |
|
22 ListElement { lColor: "orange" } |
|
23 ListElement { lColor: "pink" } |
|
24 ListElement { lColor: "brown" } |
|
25 ListElement { lColor: "gray" } |
|
26 ListElement { lColor: "red" } |
|
27 ListElement { lColor: "yellow" } |
|
28 ListElement { lColor: "green" } |
|
29 } |
|
30 |
|
31 Component { |
|
32 id: appDelegate |
|
33 Item { |
|
34 width: 100; height: 100 |
|
35 Rectangle { |
|
36 color: lColor; x: 4; y: 4 |
|
37 width: 92; height: 92 |
|
38 } |
|
39 } |
|
40 } |
|
41 |
|
42 GridView { |
|
43 id: gridView; anchors.fill: parent |
|
44 cellWidth: 100; cellHeight: 100; cacheBuffer: 200 |
|
45 model: appModel; delegate: appDelegate; focus: true |
|
46 keyNavigationWraps: true |
|
47 |
|
48 flickableData: [ |
|
49 Rectangle { |
|
50 color: "transparent"; border.color: "white"; border.width: 8; z: 3000 |
|
51 height: 100; width: 100 |
|
52 x: gridView.currentItem.x |
|
53 y: gridView.currentItem.y |
|
54 |
|
55 Behavior on x { SmoothedAnimation { velocity: 500 } } |
|
56 Behavior on y { SmoothedAnimation { velocity: 500 } } |
|
57 } |
|
58 ] |
|
59 } |
|
60 |
|
61 } |