ObjectRegistryRef QML Type
此类型用于访问已注册为ObjectRegistry 类型的对象。更多内容...
| Import Statement: | import QtQml.DesignSupport |
| Since: | Qt 6.12 |
| In C++: | QObjectRegistryRef |
| Inherits: |
- 所有成员列表,包括继承的成员
- ObjectRegistryRef 是Qt Qml 设计支持 QML 类型的一部分。
属性
- object : QtObject
详细说明
使用示例:
// 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")
}
}
}另请参阅 ObjectRegistry 和AbstractObjectRegistryRef::key 。
属性文档
object : QtObject [read-only]
该属性指定了此实例所引用的对象。
如果使用同一键注册了多个对象,则该实例将引用该组中一个未指定的对象。在这种情况下,请使用 `QMultiObjectRegistryRef`。
© 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.