7
일부 외부 기능에서 Loader
의 sourceComponent
속성 중 일부를 읽거나 쓸 필요가 있습니다.로더의 sourceComponent에서 QML 객체에 액세스하는 방법은 무엇입니까?
내부의 객체 x
에 액세스하는 방법은 무엇입니까? Loader
?
import QtQuick 2.0
Item {
width: 200; height: 200
Loader {
anchors.fill: parent
sourceComponent: rect
}
Component {
id: rect
Rectangle
{
width: 50
height: 50
color: "red"
property int x
}
}
}
어떻게하면 'x'에 액세스하는 데 도움이됩니까? – vsz
@vsz'loaderItem.x'를 통해이 파일에 접근 할 수 있습니다. – GrecKo
외부 파일의 경우'loader.source : "something.qml"'과 함께 작동하지 않습니다. 몇 가지 실험을하고 필요한 경우 새로운 질문을 올립니다. – vsz