summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-11-05 00:16:45 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-11-05 00:16:45 (GMT)
commit260404b731ef1407267f5f5a325ab4fe66fdfd36 (patch)
treeb3785bf82d53c74fa72ccddc2865e810ed9ab934 /examples
parentc715f4108186c919773a612d9442ec55bc218ea1 (diff)
parentc454cbf083d9851107e958e6c2626f61065fee8b (diff)
downloadQt-260404b731ef1407267f5f5a325ab4fe66fdfd36.zip
Qt-260404b731ef1407267f5f5a325ab4fe66fdfd36.tar.gz
Qt-260404b731ef1407267f5f5a325ab4fe66fdfd36.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: 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 Largely rewrite the Using QML in C++ Applications documentation. It Document list type operations Fix regression in 648eb76c and update visual tests. Don't emit xChanged()/yChanged() twice. Add testcase for QTBUG-13719. Doc fix highlightranges.qml example and visual test contained binding loop. Combining ListView.StrictlyEnforceRange and resizing currentItem stalls. Regression: QDeclarativeText does not update when text turns empty Qml Debugging: Only enable if explicitly requested Regression: Text element breaks when using \n for separating lines Removing a binding while it is being applied caused a crash.
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
}