Repeater3D QML Type▲
-
Import Statement: import QtQuick3D
-
Inherited By:: InstanceRepeater
-
Inherits:: Node
Detailed Description▲
The Repeater3D type is used to create a large number of similar items. Like other view types, a Repeater3D 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's model can be any of the supported data models. Additionally, like delegates for other views, a Repeater delegate can access its index within the repeater, as well as the model data relevant to the delegate. See the delegate property documentation for details.
A Repeater3D item owns all items it instantiates. Removing or dynamically destroying an item created by a Repeater3D results in unpredictable behavior.
Repeater3D is Node-based, and can only repeat Node-derived objects.
Property Documentation▲
[read-only] count : int▲
This property holds the number of items in the model.
The number of items in the model as reported by count may differ from the number of created delegates if the Repeater3D is in the process of instantiating delegates or is incorrectly set up.
[default] delegate : Component▲
The delegate provides a template defining each object instantiated by the repeater.
Delegates are exposed to a read-only index property that indicates the index of the delegate within the repeater.
If the model is a model object (such as a ListModel) the delegate can access all model roles as named properties, in the same way that delegates do for view classes like ListView.
See Also▲
See also QML Data Models
model : any▲
The model providing data for the repeater.
This property can be set to any of the supported data models:
-
A number that indicates the number of delegates to be created by the repeater
-
A model (e.g. a ListModel item, or a QAbstractItemModel subclass)
-
A string list
-
An object list
The type of model affects the properties that are exposed to the delegate.
See Also▲
See also Data Models
Signal Documentation▲
objectAdded(int index, Object3D object)▲
This signal is emitted when an object is added to the repeater. The index parameter holds the index at which object has been inserted within the repeater, and the object parameter holds the Object3D that has been added.
The corresponding handler is onObjectAdded.
The corresponding handler is onObjectAdded.
objectRemoved(int index, Object3D object)▲
This signal is emitted when an object is removed from the repeater. The index parameter holds the index at which the item was removed from the repeater, and the object parameter holds the Object3D that was removed.
Do not keep a reference to object if it was created by this repeater, as in these cases it will be deleted shortly after the signal is handled.
The corresponding handler is onObjectRemoved.
The corresponding handler is onObjectRemoved.