Note: The Repeater3D component is released as a tech preview feature in Qt Design Studio 2.2, and its functionality will be improved in future releases.
The Repeater3D component is used to create a large number of similar items. Like other view types, Repeater3D needs a model and a delegate. For each entry in the model, the delegate is instantiated in a context seeded with data from the model.
The model can be any of the supported data models. Additionally, like delegates for other views, a delegate for the Repeater3D can access its index within the repeater, as well as the model data relevant to the delegate.
Add a Repeater3D component to your scene by drag-and-dropping it from Library > Components > Qt Quick 3D > Qt Quick 3D to Scene in Navigator.
Note: Repeater3D owns all items it instantiates. Removing or dynamically destroying an item created by Repeater3D results in unpredictable behavior.
Note: Repeater3D can only repeat objects derived from Nodes.
For more information, see Repeater3D in the Qt Quick 3D documentation.
To define a model providing data for the repeater, select it in Navigator, and then in Properties > Repeater, specify the Model property. Currently, you can only use the Model property in the Properties view to set a numeric model or to bind to QML based models. You can use the Edit mode or Text Editor to define any of the supported data models as the value of the Model property:
- A number that indicates the number of delegates to be created by the repeater.
- A model, such as a ListModel component, or a QAbstractItemModel subclass.
- A string list.
- An object list.
The type of model affects the properties that are exposed to the delegate.
The Delegate property specifies a template defining each object instantiated by the repeater. Currently, the Delegate property needs to be defined in code using the Edit mode or Text Editor. Delegates are exposed to a read-only index property that indicates the index of the delegate within the repeater. For more information, see Delegate in the Qt Quick 3D documentation.
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.
© 2021 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.