Repeater3D QML Type

Instantiates a number of Node-based components using a provided model. More...

Import Statement: import QtQuick3D
Inherits:

Node

Inherited By:

InstanceRepeater

Properties

Signals

Methods

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.

Note: A Repeater3D item owns all items it instantiates. Removing or dynamically destroying an item created by a Repeater3D results in unpredictable behavior.

Note: Repeater3D is Node-based, and can only repeat Node-derived objects.

Property Documentation

count : int [read-only]

This property holds the number of items in the model.

Note: 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.


delegate : Component [default]

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 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 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.

Note: 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.

Note: The corresponding handler is onObjectRemoved.


Method Documentation

Object3D objectAt(index)

Returns the Object3D that has been created at the given index, or null if no item exists at index.


© 2024 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.