Repeater3D QML Type

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

import 语句: import QtQuick3D 1.15
继承:

Node

特性

信号

方法

详细描述

The Repeater3D type is used to create a large number of similar items. Like other view types, a Repeater3D has a model 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.

特性文档编制

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.

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 .

另请参阅 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 .

另请参阅 数据模型 .

信号文档编制

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.

相应处理程序是 onObjectAdded .

注意: 相应处理程序是 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.

相应处理程序是 onObjectRemoved .

注意: 相应处理程序是 onObjectRemoved .

方法文档编制

Object3D objectAt ( index )

返回 Object3D that has been created at the given index ,或 null if no item exists at index .