equal
deleted
inserted
replaced
|
1 import Qt 4.7 |
|
2 |
|
3 Rectangle { |
|
4 color: "white" |
|
5 width: 800 |
|
6 height: 600 |
|
7 |
|
8 ListModel { |
|
9 id: model |
|
10 ListElement { name: "1" } |
|
11 ListElement { name: "2" } |
|
12 ListElement { name: "3" } |
|
13 ListElement { name: "4" } |
|
14 ListElement { name: "5" } |
|
15 ListElement { name: "6" } |
|
16 ListElement { name: "6" } |
|
17 ListElement { name: "8" } |
|
18 ListElement { name: "9" } |
|
19 } |
|
20 |
|
21 Component { |
|
22 id: verticalDelegate |
|
23 FocusScope { |
|
24 id: root |
|
25 width: 50; height: 50; |
|
26 Keys.onDigit9Pressed: console.log("Error - " + name) |
|
27 Rectangle { |
|
28 focus: true |
|
29 Keys.onDigit9Pressed: console.log(name) |
|
30 width: 50; height: 50; |
|
31 color: root.ListView.isCurrentItem?"red":"green" |
|
32 Text { text: name; anchors.centerIn: parent } |
|
33 } |
|
34 } |
|
35 } |
|
36 |
|
37 ListView { |
|
38 width: 800; height: 50; orientation: "Horizontal" |
|
39 focus: true |
|
40 model: model |
|
41 delegate: verticalDelegate |
|
42 preferredHighlightBegin: 100 |
|
43 preferredHighlightEnd: 100 |
|
44 highlightRangeMode: "StrictlyEnforceRange" |
|
45 } |
|
46 |
|
47 |
|
48 Text { |
|
49 y: 100; x: 50 |
|
50 text: "Currently selected element should be red\nPressing \"9\" should print the number of the currently selected item\nBe sure to scroll all the way to the right, pause, and then all the way to the left." |
|
51 } |
|
52 } |