summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2009-11-09 06:50:31 (GMT)
committerMartin Jones <martin.jones@nokia.com>2009-11-09 06:50:31 (GMT)
commitcdbae41f10e13720ff8de6b94491c9cad07a2533 (patch)
treeda06f4ed35e63471324805245cd75b4c26c48858 /tests/auto/declarative
parent94338f0afffa507d95b5f71cfa360a0cded1b949 (diff)
downloadQt-cdbae41f10e13720ff8de6b94491c9cad07a2533.zip
Qt-cdbae41f10e13720ff8de6b94491c9cad07a2533.tar.gz
Qt-cdbae41f10e13720ff8de6b94491c9cad07a2533.tar.bz2
Visual test for ListView.
Diffstat (limited to 'tests/auto/declarative')
-rw-r--r--tests/auto/declarative/visual/ListView/listview.qml81
1 files changed, 81 insertions, 0 deletions
diff --git a/tests/auto/declarative/visual/ListView/listview.qml b/tests/auto/declarative/visual/ListView/listview.qml
new file mode 100644
index 0000000..fb9eecd
--- /dev/null
+++ b/tests/auto/declarative/visual/ListView/listview.qml
@@ -0,0 +1,81 @@
+import Qt 4.6
+
+Rectangle {
+ width: 600; height: 300; color: "white"
+
+ ListModel {
+ id: myModel
+ ListElement {
+ itemColor: "red"
+ }
+ ListElement {
+ itemColor: "green"
+ }
+ ListElement {
+ itemColor: "blue"
+ }
+ ListElement {
+ itemColor: "orange"
+ }
+ ListElement {
+ itemColor: "brown"
+ }
+ ListElement {
+ itemColor: "yellow"
+ }
+ ListElement {
+ itemColor: "purple"
+ }
+ ListElement {
+ itemColor: "darkred"
+ }
+ ListElement {
+ itemColor: "darkblue"
+ }
+ }
+
+ Component {
+ id: myDelegate
+ Item {
+ width: 200; height: 50
+ Rectangle {
+ x: 5; y : 5
+ width: 190; height: 40
+ opacity: 0.5
+ color: itemColor
+ }
+ }
+ }
+
+ Component {
+ id: myHighlight
+ Rectangle { color: "black" }
+ }
+
+ ListView {
+ id: list1
+ width: 200; height: parent.height
+ model: myModel; delegate: myDelegate
+ highlight: myHighlight; currentIndex: list3.currentIndex
+ focus: true
+ }
+ ListView {
+ id: list2
+ x: 200; width: 200; height: parent.height
+ model: myModel; delegate: myDelegate; highlight: myHighlight
+ preferredHighlightBegin: 80
+ preferredHighlightEnd: 220
+ highlightRangeMode: "ApplyRange"
+ currentIndex: list1.currentIndex
+ }
+ ListView {
+ id: list3
+ x: 400; width: 200; height: parent.height
+ model: myModel; delegate: myDelegate; highlight: myHighlight
+ currentIndex: list1.currentIndex
+ preferredHighlightBegin: 125
+ preferredHighlightEnd: 125
+ highlightRangeMode: "StrictlyEnforceRange"
+ flickDeceleration: 1000
+ }
+}