[solved]How to animate "width" property of ListView Item ?
-
I have following code which is supposed to animate the "width" property of the Item which is being added to a ListView. But it doesn't work. However if i replace the "width" property with "x" or "opacity" it works.
Following is the code :@ListView {
anchors.fill: parent
spacing: 10
model: listmodel
delegate: mydelegate
add: Transition {
PropertyAnimation { property: "width"; from:0; to: 780; duration: 500 }
}
ListModel { id: listmodel }
}Component {
id: mydelegate
Item {
width: 780;
height: 40;
Rectangle {
width: 780
height: 40
color: "#FAFAFA"; radius: 5
Text {
text: mytext
}
}
}
}@So is this the right way to animate the ListView item ? Please help.
-
Got the above code working. Setting the width of Rectangle to parent.width made it work. Posting here just in case if some one comes under simliar situation.
@Component {
id: mydelegate
Item {
width: 780;
height: 40;
Rectangle {
width: parent.width
height: 40
color: "#FAFAFA"; radius: 5
Text {
text: mytext
}
}
}
}@