ObjectRegistry QML Type
This type is used to register objects for later access based on a key string. More...
| Import Statement: | import QtQml.DesignSupport |
| Since: | Qt 6.12 |
- List of all members, including inherited members
- ObjectRegistry is part of Qt Qml Design Support QML Types.
Properties
Detailed Description
The object registry provides a QML engine-wide reference for objects. You register each object with a string key, which you can use later to retrieve the object through one of the following reference types: ObjectRegistryRef and MultiObjectRegistryRef. C++ classes are also provided for accessing registered objects: QObjectRegistryRef and QMultiObjectRegistryRef.
The same key can be used to register multiple objects. A typical use case for this is registering a list or repeater delegate.
The registered object is automatically removed from the registry on either object destruction or ObjectRegistry instance destruction. Changing the target object or the key removes the old combination from the registry.
Do not register the same object and key combination more than once. Only one registration per combination is stored.
The registration can be done either with attached property on the registered object or using separate ObjectRegistry object with target and key:
// Registering with attached property
Item {
id: itemToRegister
ObjectRegistry.key: "MyItem"
}
// Registering with separate ObjectRegistry object
Item {
id: itemToRegister
ObjectRegistry {
target: itemToRegister
key: "MyItem"
}
}See also ObjectRegistryRef, MultiObjectRegistryRef, QObjectRegistryRef, and QMultiObjectRegistryRef.
Property Documentation
key : string
This property specifies the key of the registered object.
target : QtObject
This property specifies the target object to register.
© 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.