summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-11-09 06:39:30 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-11-09 06:39:30 (GMT)
commit83a48659bd8a4b9dc1f0c77189bd60d91b875c4d (patch)
treeac7c03a6407124dfc1591e6f15f6bcddafa2c637 /examples
parent3d2504305fa39903ab680d7199cb4bb5427167e8 (diff)
parent736a73ac2d05bcc811ee8eaeb6aa7a026d6b018a (diff)
downloadQt-83a48659bd8a4b9dc1f0c77189bd60d91b875c4d.zip
Qt-83a48659bd8a4b9dc1f0c77189bd60d91b875c4d.tar.gz
Qt-83a48659bd8a4b9dc1f0c77189bd60d91b875c4d.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml: (32 commits) Fix Text::elide docs. Fix Rectangle painting at small sizes. Fix QML ecmascript autotest. Fix QtQuick import. Export QDeclarativeDebugHelper on Symbian for QTBUG-13762 Don't use stdint.h in our headers since it is a C99 header. Text alignment is broken with multi-line text and implicit size. Update QtOpenVg def files for bug QT-3589 Image bounding rect should always include the area being painted Fix minehunt.pro (minehunt is no longer a plugin) Don't allow flagging of flipped tiles in Minehunt Remove Snake demo from QtDemo Fix samegame text input focus Whitespace fixes Update visual tests for Mac. Run all QML visual tests now. Make qmlvisual tests more stable Add documentation about script evaluation context and allowed types Maintain passing visualtests on X11 Fix errors in example code. Also reverts the example code to the old ...
Diffstat (limited to 'examples')
-rw-r--r--examples/declarative/modelviews/listview/highlightranges.qml20
1 files changed, 11 insertions, 9 deletions
diff --git a/examples/declarative/modelviews/listview/highlightranges.qml b/examples/declarative/modelviews/listview/highlightranges.qml
index 2716ee5..58d37a3 100644
--- a/examples/declarative/modelviews/listview/highlightranges.qml
+++ b/examples/declarative/modelviews/listview/highlightranges.qml
@@ -42,15 +42,14 @@ import QtQuick 1.0
import "content"
Rectangle {
+ id: root
+ property int current: 0
width: 600; height: 300
// This example shows the same model in three different ListView items,
// with different highlight ranges. The highlight ranges are set by the
// preferredHighlightBegin and preferredHighlightEnd properties in ListView.
//
- // The second and third ListViews set their currentIndex to be the
- // same as the first. The first ListView is given keyboard focus.
- //
// The first ListView does not set a highlight range, so its currentItem
// can move freely within the visible area. If it moves outside the
// visible area, the view is automatically scrolled to keep the current
@@ -66,9 +65,10 @@ Rectangle {
// 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 the third ListView with
- // the mouse, the current index of the first ListView will be changed.
+ // All ListViews bind their currentIndex to the root.current property.
+ // The first ListView sets root.current whenever its currentIndex changes
+ // due to keyboard interaction.
+ // Flicking the third ListView with the mouse also changes root.current.
ListView {
id: list1
@@ -77,7 +77,8 @@ Rectangle {
delegate: petDelegate
highlight: Rectangle { color: "lightsteelblue" }
- currentIndex: list3.currentIndex
+ currentIndex: root.current
+ onCurrentIndexChanged: root.current = currentIndex
focus: true
}
@@ -89,7 +90,7 @@ Rectangle {
delegate: petDelegate
highlight: Rectangle { color: "yellow" }
- currentIndex: list1.currentIndex
+ currentIndex: root.current
preferredHighlightBegin: 80; preferredHighlightEnd: 220
highlightRangeMode: ListView.ApplyRange
}
@@ -102,7 +103,8 @@ Rectangle {
delegate: petDelegate
highlight: Rectangle { color: "yellow" }
- currentIndex: list1.currentIndex
+ currentIndex: root.current
+ onCurrentIndexChanged: root.current = currentIndex
preferredHighlightBegin: 125; preferredHighlightEnd: 125
highlightRangeMode: ListView.StrictlyEnforceRange
}