En esta página

ObjectRegistryRef QML Type

Este tipo se utiliza para acceder a un objeto registrado con un tip ObjectRegistry. Más información...

Import Statement: import QtQml.DesignSupport
Since: Qt 6.12
In C++: QObjectRegistryRef
Inherits:

AbstractObjectRegistryRef

Propiedades

Descripción detallada

Ejemplo de uso:

// 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")
        }
    }
}

Véase también ObjectRegistry y AbstractObjectRegistryRef::key.

Documentación de la propiedad

object : QtObject [read-only]

Esta propiedad especifica el objeto al que hace referencia esta instancia.

Si hay varios objetos registrados con la misma clave, esta instancia hace referencia a un objeto no especificado de ese grupo. En este caso, utilice QMultiObjectRegistryRef.

Véase también ObjectRegistry y 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.