Thanks for the reply Xander.
Rather than looping the child elements, it seemed simpler to just calculate the height based on the y co-ords of the top of the View, and the lowest element in the view.
So, Rect1.qml becomes:
@
import QtQuick 1.1
Rectangle {
id: r1
anchors {
left: parent.left
right: parent.right
}
color: "red"
height: (text2.y - r1.y + text2.height)
Text {
text: "rectext1\ntextline2"
id: text1
maximumLineCount: 1
}
Text {
id: text2
anchors.top: text1.bottom
anchors.right: parent.right
text: "rectext1right"
}
onChildrenRectChanged: {
console.log("onChildrenRectChanged")
}
MouseArea {
anchors.fill: parent
onClicked: {
console.log("pre resize child height: " + r1.childrenRect.height)
if (text1.maximumLineCount === 1) text1.maximumLineCount = 2
else text1.maximumLineCount = 1
console.log("post resize child height: " + r1.childrenRect.height)
}
}
}
@
This seems like a reasonable work around to me. Once again, thanks for your help.