summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-10-27 10:03:35 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-10-27 10:03:35 (GMT)
commit5f9091771eaa26db5ad35e4788c13ac011512b61 (patch)
tree1618f8ee918cf39bfd24172fec2bdad3d8dea550
parenta40db2cd7d5e57e74aa4280e69d99cd252e2d460 (diff)
downloadQt-5f9091771eaa26db5ad35e4788c13ac011512b61.zip
Qt-5f9091771eaa26db5ad35e4788c13ac011512b61.tar.gz
Qt-5f9091771eaa26db5ad35e4788c13ac011512b61.tar.bz2
Doc
-rw-r--r--doc/src/declarative/pics/repeater-index.pngbin0 -> 3024 bytes
-rw-r--r--doc/src/snippets/declarative/repeater-index.qml15
-rw-r--r--src/declarative/fx/qfxrepeater.cpp12
3 files changed, 25 insertions, 2 deletions
diff --git a/doc/src/declarative/pics/repeater-index.png b/doc/src/declarative/pics/repeater-index.png
new file mode 100644
index 0000000..3dbe6d0
--- /dev/null
+++ b/doc/src/declarative/pics/repeater-index.png
Binary files differ
diff --git a/doc/src/snippets/declarative/repeater-index.qml b/doc/src/snippets/declarative/repeater-index.qml
new file mode 100644
index 0000000..9063967
--- /dev/null
+++ b/doc/src/snippets/declarative/repeater-index.qml
@@ -0,0 +1,15 @@
+import Qt 4.6
+
+Rectangle {
+ width: 50; height: childrenRect.height; color: "white"
+
+//! [0]
+ Column {
+ Repeater {
+ model: 10
+ Text { text: "I'm item " + index }
+ }
+ }
+//! [0]
+}
+
diff --git a/src/declarative/fx/qfxrepeater.cpp b/src/declarative/fx/qfxrepeater.cpp
index 182dcc7..94954e7 100644
--- a/src/declarative/fx/qfxrepeater.cpp
+++ b/src/declarative/fx/qfxrepeater.cpp
@@ -72,10 +72,18 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Repeater,QFxRepeater)
The model may be either an object list, a string list, a number or a Qt model.
In each case, the data element and the index is exposed to each instantiated
- component. The index is always exposed as an accessible \c index property.
+ component.
+
+ The index is always exposed as an accessible \c index property.
In the case of an object or string list, the data element (of type string
or object) is available as the \c modelData property. In the case of a Qt model,
- all roles are available as named properties just like in the view classes.
+ all roles are available as named properties just like in the view classes. The
+ following example shows how to use the index property inside the instantiated
+ items.
+
+ \snippet doc/src/snippets/declarative/repeater-index.qml 0
+
+ \image repeater-index.png
Items instantiated by the Repeater are inserted, in order, as
children of the Repeater's parent. The insertion starts immediately after