나는 그 아래에 listview 및 textarea가 있습니다. 나는 textviewa의 크기에 따라 listview의 높이가 증가하거나 감소하기를 원한다. textarea의 상단에 listview의 맨 아래에 고정 시키려고 시도했지만 작동하지 않았습니다. 그런 다음 listview의 맨 아래에 텍스트 영역의 맨 위에 고정 시키려고 시도했으나 작동하지 않았습니다. 둘 다 시도했는데 그 중 하나도하지 않았습니다. 매번 내가 또한 텍스트 영역의 범위에이 시도 재산 "높이"에 대한 검색 바인딩 루프의 런타임 오류/경고를 제공, 아직 나는 같은 런타임 오류/경고없이 결과가 있습니다QML 아래 항목의 높이 변화에 대한 항목의 높이 변경
onTextChanged: {
listView.anchors.bottomMargin = height;
}
어떻게을 나는 이것을 성취합니까?
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;
}
}
}
답변을 삭제하지 않아야합니다. 그것은 나를 위해 일했습니다. 문제는 내 listview가 저 밑으로 스크롤되지 않아서 작동하지 않는다고 생각하게 만들었습니다. 나는 그것을 고쳤다. 그래도 바인딩 루프 오류가 발생합니다. @ coyotte508 –
@ coyotte508 어쩌면 다시 바인딩 루프 문제를보고 잘 받아 들일 수있는 대답을 볼 수 있습니다. –