I have a listview and a textarea below it. I want that the height of listview increases or decreases with respect to the size of the textarea. I tried anchoring the bottom of listview to the textarea's top, didn't work. Then I tried anchoring the top of textarea to the bottom of listview, didn't work either. Tried both together, neither that. Everytime it gives the runtime error/warning of Binding loop detected for property "height" I also tried this in textarea's scope, yet I have the same runtime error/warning and no results:
onTextChanged: {
listView.anchors.bottomMargin = height;
}
How can I achieve this?
Here's the code:
ListView{
id: listView
// anchors.fill: parent
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.bottomMargin: 0
anchors.margins: 10
delegate: ChatMessageItem{}
model: listModel
spacing: 15
}
Rectangle{
id: rectInput
height: childrenRect.height + 6
width: parent.width
// anchors.top: listView.bottom
anchors.bottom: parent.bottom
color: "#BDC3C7"
TextArea{
id: tMsg
placeholderText: qsTr("Enter message")
width: parent.width - 30
anchors.bottom: parent.bottom
anchors.bottomMargin: 2
anchors.left: parent.left
anchors.leftMargin: 1
focus: true
wrapMode: TextArea.Wrap
background: Rectangle {
border.color: "#BDC3C7"
border.width: 2
color: "#ECF0F1"
}
onTextChanged: {
listView.anchors.bottomMargin = height;
}
}
}