I have a ListView with a SwipeDelegate as delegate. It's contentItem consists of a ColumnLayout with two RowLayouts inside. Now I want the second RowLayout to unfold, if I click the delegate. This works like it should, but I want the "expand" to be animated, so that it smoothly unfolds. I tired it with Behaviour on height { NumberAnimation {} } but it did not work. How can I achive this?
ListView {
id: myView
visible: count > 0
clip: true
boundsBehavior: Flickable.StopAtBounds
model: mymodel
Component.onCompleted: {
Layout.preferredHeight = Qt.binding(function() {
return myView.contentHeight
})
}
spacing: 3
delegate: SwipeDelegate {
id: delegate
width: myView.width
hoverEnabled: false
property bool expanded: false
onClicked: {
expanded = !expanded
}
contentItem: ColumnLayout {
Behavior on height { NumberAnimation {} }
RowLayout {
Layout.fillWidth: true
CheckBox {
id: chkSel
Layout.fillHeight: true
checked: model.sel
padding: 0
rightPadding: 5
spacing: 0
}
Label {
Layout.fillWidth: true
font.pointSize: 14
font.bold: true
text: model.nr
}
Image {
id: swipeTipArrow
sourceSize.height: parent.height * 0.9
fillMode: Image.PreserveAspectFit
opacity: 0
source: "left.svg"
}
}
RowLayout {
Layout.fillWidth: true
visible: delegate.expanded
Label {
Layout.fillWidth: true
font.pointSize: 12
text: model.nr2
}
}
}
}