Repeater QML Type
Instantiates a number of Item-based components using a provided model. More...
|Import Statement:||import QtQuick|
|Since:||Qt Quick Ultralite 1.0|
- var itemAt(int index)
The Repeater type is used to create a large number of similar items. Like other view types, a Repeater has a model and a delegate: for each entry in the model, the delegate is instantiated in a context seeded with data from the model. A Repeater item is usually enclosed in a positioner type such as Row or Column to visually position the multiple delegate items created by the Repeater.
The following Repeater creates three instances of a Text item in a Row:
Items instantiated are inserted, in order, as children of the Repeater's parent. The insertion starts immediately after the repeater's position in its parent stacking list. This allows a Repeater to be used inside a layout. For example, the following Repeater's items are stacked between a red rectangle and a blue rectangle:
Delegates are exposed to a read-only index property that indicates the index of the delegate within the repeater. For example, the following Text delegate displays the index of each repeated item:
The Repeater type creates all of its delegate items when the repeater is first created. This can be inefficient if there are a large number of delegate items and not all of the items are required to be visible at the same time. If this is the case, consider using other view types like ListView (which only creates delegate items when they are scrolled into view) or use the Dynamic Object Creation methods to create items as they are required.
Also, note that Repeater is Item-based, and can only repeat Item-derived objects. For example, it cannot be used to repeat QtObjects:
delegate : Component
The delegate provides a template defining each item instantiated by the repeater.
model : any
The model providing data for the repeater.
See also Models and Views in Qt Quick Ultralite.
Returns the Item that has been created at the given index, or null if no item exists at index.
This method was introduced in Qt Quick Ultralite 1.6.
Available under certain Qt licenses.
Find out more.