ObjectRegistry QML Type
この型は、キー文字列に基づいて、後でアクセスできるようにオブジェクトを登録するために使用されます。詳細...
| Import Statement: | import QtQml.DesignSupport |
| Since: | Qt 6.12 |
- 継承されたメンバーを含む、すべてのメンバーの一覧
- ObjectRegistryは、Qt Qml デザインサポートQMLタイプの一部です。
プロパティ
詳細な説明
オブジェクトレジストリは、QMLエンジン全体にわたるオブジェクトの参照を提供します。各オブジェクトは文字列キーで登録され、後で以下の参照型のいずれか(ObjectRegistryRef およびMultiObjectRegistryRef )を使用して、そのオブジェクトを取得することができます。登録されたオブジェクトにアクセスするためのC++クラスも用意されています:QObjectRegistryRef およびQMultiObjectRegistryRef 。
同じキーを使用して、複数のオブジェクトを登録することができます。この典型的な使用例としては、リストやリピーターのデリゲートを登録する場合が挙げられます。
登録されたオブジェクトは、オブジェクトの破棄時、または ObjectRegistry インスタンスの破棄時に、レジストリから自動的に削除されます。ターゲットオブジェクトやキーを変更すると、レジストリから古い組み合わせが削除されます。
同じオブジェクトとキーの組み合わせを複数回登録しないでください。組み合わせごとに1つの登録のみが保存されます。
登録は、登録対象オブジェクトの添付プロパティを使用するか、ターゲットとキーを指定した個別の ObjectRegistry オブジェクトを使用して行うことができます:
// Registering with attached property
Item {
id: itemToRegister
ObjectRegistry.key: "MyItem"
}
// Registering with separate ObjectRegistry object
Item {
id: itemToRegister
ObjectRegistry {
target: itemToRegister
key: "MyItem"
}
}関連項目: ObjectRegistryRef 、MultiObjectRegistryRef 、QObjectRegistryRef 、およびQMultiObjectRegistryRef 。
プロパティのドキュメント
key : string
このプロパティは、登録されたオブジェクトのキーを指定します。
target : QtObject
このプロパティは、登録する対象オブジェクトを指定します。
ターゲットオブジェクトが破棄された場合、このプロパティは null にリセットされます。
© 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.