summaryrefslogtreecommitdiffstats
path: root/examples/declarative
diff options
context:
space:
mode:
Diffstat (limited to 'examples/declarative')
-rw-r--r--examples/declarative/focusscope/test3.qml4
-rw-r--r--examples/declarative/listview/itemlist.qml4
-rw-r--r--examples/declarative/listview/listview.qml43
-rw-r--r--examples/declarative/xmldata/yahoonews.qml1
4 files changed, 26 insertions, 26 deletions
diff --git a/examples/declarative/focusscope/test3.qml b/examples/declarative/focusscope/test3.qml
index 51fa35a..8a53c3a 100644
--- a/examples/declarative/focusscope/test3.qml
+++ b/examples/declarative/focusscope/test3.qml
@@ -39,7 +39,9 @@ Rectangle {
focus: true
model: Model
delegate: VerticalDelegate
- currentItemPositioning: "SnapAuto"
+ preferredHighlightBegin: 100
+ preferredHighlightEnd: 101
+ strictlyEnforceHighlightRange: true
}
diff --git a/examples/declarative/listview/itemlist.qml b/examples/declarative/listview/itemlist.qml
index 061fab3..01781ec 100644
--- a/examples/declarative/listview/itemlist.qml
+++ b/examples/declarative/listview/itemlist.qml
@@ -29,7 +29,9 @@ Rectangle {
anchors.fill: parent
anchors.bottomMargin: 30
model: ItemModel
- currentItemPositioning: "SnapAuto"
+ preferredHighlightBegin: 0
+ preferredHighlightEnd: 1
+ strictlyEnforceHighlightRange: true
orientation: "Horizontal"
}
diff --git a/examples/declarative/listview/listview.qml b/examples/declarative/listview/listview.qml
index 1cca5ad..ac1cef1 100644
--- a/examples/declarative/listview/listview.qml
+++ b/examples/declarative/listview/listview.qml
@@ -29,21 +29,24 @@ Rectangle {
Rectangle { color: "#FFFF88" }
}
- // Show the model in three lists, with different currentItemPositioning.
- // currentItemPositioning determines how the list behaves when the
- // current item changes. Note that the second and third ListView
+ // Show the model in three lists, with different highlight ranges.
+ // preferredHighlightBegin and preferredHighlightEnd set the
+ // range in which to attempt to maintain the highlight.
+ // Note that the second and third ListView
// set their currentIndex to be the same as the first, and that
// the first ListView is given keyboard focus.
- // The default mode, Free, allows the currentItem to move freely
+ // The default mode allows the currentItem to move freely
// within the visible area. If it would move outside the visible
// area, the view is scrolled to keep it visible.
- // Snap currentItemPositioning attempts to keep the current item
- // aligned with the snapPosition by scrolling the view, however the
- // items will not scroll beyond the beginning or end of the view.
- // SnapAuto currentItemPositioning always keeps the current item on
- // the snapPosition by scrolling the view. It also automatically
- // sets the current item as is scrolled with the mouse. Note
- // that the first ListView sets its currentIndex to be equal to
+ // The second list sets a highlight range which attempts to keep the
+ // current item within the the bounds of the range, however
+ // items will not scroll beyond the beginning or end of the view,
+ // forcing the highlight to move outside the range at the ends.
+ // The third list sets strictlyEnforceHighlightRange to true
+ // and sets a range smaller than the height of an item. This
+ // forces the current item to change when the view is flicked,
+ // since the highlight is unable to move.
+ // Note that the first ListView sets its currentIndex to be equal to
// the third ListView's currentIndex. By flicking List3 with
// the mouse, the current index of List1 will be changed.
ListView {
@@ -57,23 +60,17 @@ Rectangle {
id: List2
x: 200; width: 200; height: parent.height
model: MyPetsModel; delegate: PetDelegate; highlight: PetHighlight
- currentItemPositioning: "Snap"; snapPosition: 125
+ preferredHighlightBegin: 80
+ preferredHighlightEnd: 220
currentIndex: List1.currentIndex
}
ListView {
id: List3
x: 400; width: 200; height: parent.height
- model: MyPetsModel; delegate: PetDelegate
- currentItemPositioning: "SnapAuto"; snapPosition: 125
+ model: MyPetsModel; delegate: PetDelegate; highlight: PetHighlight
currentIndex: List1.currentIndex
-
- // Position a static highlight rather than a normal highlight so that
- // when the view is flicked, the highlight does not move.
- // By positioning the highlight at the same position as the snapPosition
- // the item under the highlight will always be the current item.
- Rectangle {
- y: 125; width: 200; height: 50
- color: "#FFFF88"; z: -1
- }
+ preferredHighlightBegin: 125
+ preferredHighlightEnd: 126
+ strictlyEnforceHighlightRange: true
}
}
diff --git a/examples/declarative/xmldata/yahoonews.qml b/examples/declarative/xmldata/yahoonews.qml
index 6395284..7ebc2b2 100644
--- a/examples/declarative/xmldata/yahoonews.qml
+++ b/examples/declarative/xmldata/yahoonews.qml
@@ -101,6 +101,5 @@ Rectangle {
clip: true
model: feedModel
delegate: feedDelegate
- currentItemPositioning: "Snap"
}
}