QML animation not working
-
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.1Page {
id: page
ListModel{
id: listModelListElement{ 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 {} } } }
}
@ -
To apply animations related to changes to the model, you should use the transition properties of the ListView.
See "ListView.move":http://qt-project.org/doc/qt-5.1/qtquick/qml-qtquick2-listview.html -
[quote author="Kysymys" date="1387069766"]To apply animations related to changes to the model, you should use the transition properties of the ListView.
See "ListView.move":http://qt-project.org/doc/qt-5.1/qtquick/qml-qtquick2-listview.html[/quote]
That function is available only in Qt 5, I am using Qt 4.7.