On this page

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.

© 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.