ObjectRegistryRef QML Type
This type is used to access an object 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
- ObjectRegistryRef is part of Qt Qml Design Support QML Types.
Properties
- object : QtObject
Detailed Description
Example usage:
// Register object in a QML file
MouseArea {
ObjectRegistry.key: "MyMouseArea"
}
// In another QML file, refer to the registered object
ObjectRegistryRef {
id: mouseAreaRef
key: "MyMouseArea"
Connections {
target: mouseAreaRef.object
function onClicked(mouse) {
console.log("Mouse clicked")
}
}
}
See also ObjectRegistry and AbstractObjectRegistryRef::key.
Property Documentation
object : QtObject [read-only]
This property specifies the object referenced by this instance.
If multiple objects are registered with the same key, this instance references an unspecified object from that group. In this case, use QMultiObjectRegistryRef.
See also ObjectRegistry and AbstractObjectRegistryRef::key.