나는 내가 원하는 것을하지 못하게하는 이상한 행동을 발견했습니다.Flickable + 속성 별칭 내용
내가
Comp.qml있는 경우 :
Rectangle {
id: comp;
anchors.fill: parent
default property alias contents: flickable.children;
property int contentHeight: comp.height;
Flickable {
id: flickable;
anchors.fill: parent;
contentHeight: comp.contentHeight;
}
}
및
main.qml을 :
Rectangle {
id: root;
width: 400;
height: 400;
Comp {
contentHeight: 800;
Rectangle {
width: 800;
height: 800;
border.color: "black";
border.width: 5;
Component.onCompleted: console.debug(parent)
}
}
}
flickable 한이 작동하지 않습니다.
main.qml :
Rectangle {
id: root;
width: 400;
height: 400;
Rectangle {
id: comp;
anchors.fill: parent
Flickable {
id: flickable;
anchors.fill: parent;
contentHeight: 800;
Rectangle {
width: 800;
height: 800;
border.color: "black";
border.width: 5;
}
}
}
}
난 실종 뭔가를 예상대로
나는 하나 개의 파일에 모든 것을 넣어하려고하면
, 그것은 작동?콘텐츠가 flickable에있는 외부 구성 요소를 수행하는 방법은 무엇입니까? docs에 명시된 바와 같이
그것은이 초기화되기 전에 flickable 한을 QML 바인드 어린이 항목에 비해 보인다. 'comp'에서'onContentsChanged : {flickable.contentWidth}'를하면 * -1 *을 얻을 것입니다. 그러나이 '사각형'은 800px 너비입니다. 그래서 그것이 크기 문제 wile reparenting일지도 모른다. – folibis