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:

AbstractObjectRegistryRef

Properties

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.