이 페이지에서

MultiObjectRegistryRef QML Type

이 타입은 ` ObjectRegistry ` 타입으로 등록된 객체에 접근하는 데 사용됩니다. 더 보기...

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

AbstractObjectRegistryRef

속성

신호

상세 설명

동일한 키로 등록된 여러 객체에 이 참조를 통해 접근할 수 있습니다.

사용 예시:

// 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.