MultiObjectRegistryRef QML Type
この型は、ObjectRegistry 型で登録されたオブジェクトにアクセスするために使用されます。詳細...
| Import Statement: | import QtQml.DesignSupport |
| Since: | Qt 6.12 |
| In C++: | QObjectRegistryRef |
| Inherits: |
- 継承されたメンバーを含む、すべてのメンバーの一覧
- MultiObjectRegistryRefは、Qt Qml Design Support QML Typesの一部です。
プロパティ
- objects : list<QtObject>
信号
- objectAdded(QtObject obj)
- objectRemoved(QtObject obj)
詳細説明
同じキーで登録された複数のオブジェクトに、この参照を介してアクセスできます。
使用例:
// In a QML file, register something that gets created multiple times (e.g. a repeater delegate)
Repeater {
model: 4
Rectangle {
id: qmlRepeaterDelegate
required property int index
x: 50 * index
width: 40
height: 40
MouseArea {
property int repeaterIndex: qmlRepeaterDelegate.index
anchors.fill: parent
ObjectRegistry.key: "RepeatedMouseArea"
}
}
}
// In another QML file, refer to the registered objects
MultiObjectRegistryRef {
id: repeaterRef
key: "RepeatedMouseArea"
onObjectAdded: (object)=> {
// Connect each object's clicked signal as they are added
object.clicked.connect(function (mouse) { clickedHandler(object); })
}
function clickedHandler(object) {
console.log("Index clicked: " + object.repeaterIndex)
}
}ObjectRegistry およびAbstractObjectRegistryRef::keyも参照してください 。
プロパティのドキュメント
objects : list<QtObject>
このプロパティは、このインスタンスが参照するオブジェクトを提供します。このリスト内のオブジェクトの順序が、登録順と一致することは保証されません。
ObjectRegistry およびAbstractObjectRegistryRef::keyも参照してください 。
Signal ドキュメント
objectAdded(QtObject obj)
このシグナルは、新しいオブジェクト(obj )がこの参照のキーに登録されたときに発火します。
注: 対応するハンドラは onObjectAdded です。
objectRemoved(QtObject obj)
このシグナルは、オブジェクト `obj` の登録が、この参照のキーを用いて解除された際に発火します。
注: オブジェクトの削除によって登録の解除がトリガーされた場合 、QML は削除中のオブジェクトを解決できないため、obj パラメータは null になります。
注: 対応するハンドラは onObjectRemoved です。
© 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.