Repeater3D QML Type
使用提供的模型实例化若干基于节点的组件。更多
Import Statement: | import QtQuick3D |
Inherits: | |
Inherited By: |
属性
信号
- objectAdded(int index, Object3D object)
- objectRemoved(int index, Object3D object)
方法
- Object3D objectAt(index)
详细说明
Repeater3D 类型用于创建大量类似的项目。与其他视图类型一样,Repeater3D 也有一个model 和一个delegate :对于模型中的每个条目,委托都会在使用模型数据种子的上下文中实例化。
Repeater 的model 可以是任何支持的数据模型。此外,与其他视图的委托一样,中继器委托可以访问其在中继器中的索引以及与委托相关的模型数据。有关详情,请参阅delegate 属性文档。
注: Repeater3D 项目拥有其实例化的所有项目。删除或动态销毁 Repeater3D 创建的项目会导致不可预测的行为。
属性文档
count : int |
此属性表示模型中的项目数。
注: 如果Repeater3D 正在实例化委托或委托设置不正确,则 count 所报告的模型中的项目数可能与创建的委托数不同。
delegate : Component |
model : any |
为中继器提供数据的模型。
该属性可设置为任何支持的数据模型:
- 一个数字,表示中继器要创建的委派数目
- 一个模型(如ListModel 项,或QAbstractItemModel 子类)
- 字符串列表
- 对象列表
模型的类型会影响delegate 所显示的属性。
另请参阅 数据模型。
信号文档
当一个对象被添加到中继器时,就会发出该信号。index 参数包含在中继器中插入对象的索引,object 参数包含已添加的Object3D 。
相应的处理程序是onObjectAdded
。
注: 相应的处理程序是onObjectAdded
。
当一个对象从中继器中移除时,就会发出该信号。index 参数包含项目从中继器中移除时的索引,而object 参数则包含被移除的Object3D 。
如果object 是由该中继器创建的,则不要保留对它的引用,因为在这种情况下,它将在信号处理后不久被删除。
相应的处理程序是onObjectRemoved
。
注: 相应的处理程序是onObjectRemoved
。
方法文档
© 2025 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.