MultiObjectRegistryRef QML Type
This type is used to access objects registered with ObjectRegistry type. More...
| Import Statement: | import QtQml.DesignSupport |
| Since: | Qt 6.12 |
| In C++: | QObjectRegistryRef |
| Inherits: |
- List of all members, including inherited members
- MultiObjectRegistryRef is part of Qt Qml Design Support QML Types.
Properties
- objects : list<QtObject>
Signals
- objectAdded(QtObject obj)
- objectRemoved(QtObject obj)
Detailed Description
Multiple objects registered with the same key can be accessed via this reference.
Example usage:
// In a QML file, register something that gets created multiple times (e.g. a repeater delegate)
Repeater {
model: 4
Rectangle {
id: qmlRepeaterDelegate
required property int index
x: 50 * index
width: 40
height: 40
MouseArea {
property int repeaterIndex: qmlRepeaterDelegate.index
anchors.fill: parent
ObjectRegistry.key: "RepeatedMouseArea"
}
}
}
// In another QML file, refer to the registered objects
MultiObjectRegistryRef {
id: repeaterRef
key: "RepeatedMouseArea"
onObjectAdded: (object)=> {
// Connect each object's clicked signal as they are added
object.clicked.connect(function (mouse) { clickedHandler(object); })
}
function clickedHandler(object) {
console.log("Index clicked: " + object.repeaterIndex)
}
}See also ObjectRegistry and AbstractObjectRegistryRef::key.
Property Documentation
objects : list<QtObject>
This property provides the objects referenced by this instance. The order of the objects in this list is not guaranteed to match the order of their registration.
See also ObjectRegistry and AbstractObjectRegistryRef::key.
Signal Documentation
objectAdded(QtObject obj)
This signal is emitted when a new object, obj, has been registered with the key of this reference.
Note: The corresponding handler is onObjectAdded.
objectRemoved(QtObject obj)
This signal is emitted when an object, obj, registration has been removed with the key of this reference.
Note: If the registration removal was triggered by the object deletion, the obj parameter will be null as QML is not able to resolve an object being deleted.
Note: The corresponding handler is onObjectRemoved.
© 2026 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.