Hello, I am trying to build a simple listview where if the delegate is clicked, its index is changed (-1). Now, I am using a Qml ListModel and its function move(), it works fine but I want to add animation when the position is changed. I am using the “Behavior on” function, but I don’t understand why it is not working.
import QtQuick 1.1
import com.nokia.symbian 1.1
Page {
id: page
ListModel{
id: listModel
ListElement{
name: "Red"
}
ListElement{
name: "Green"
}
ListElement{
name: "Blue"
}
}
ListView{
id: listView
anchors.fill: parent
interactive: false
model: listModel
spacing: 10
delegate: Rectangle{
height: 50
width: 360
color: name
MouseArea{
anchors.fill: parent
onClicked:listModel.move(index,index-1,1)
}
Behavior on y{
NumberAnimation {}
}
}
}
}
↧