Nesta página

ObjectRegistryRef QML Type

Esse tipo é usado para acessar um objeto registrado com um tipo d ObjectRegistry. Mais...

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

AbstractObjectRegistryRef

Propriedades

Descrição detalhada

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

Veja também ObjectRegistry e AbstractObjectRegistryRef::key.

Documentação da propriedade

object : QtObject [read-only]

Esta propriedade especifica o objeto ao qual esta instância faz referência.

Se vários objetos estiverem registrados com a mesma chave, esta instância fará referência a um objeto não especificado desse grupo. Nesse caso, utilize QMultiObjectRegistryRef.

Veja também ObjectRegistry e 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.