When clicking an item in the ListView, it should be moved to the first implementation.
I wanted to animate the opacity, but it seems not to be possible. Then I saw that the contentY of the listView changes, the moved item is at contentY -105.
Am I doing something wrong, is this the desired behaviour or is it a bug?
import QtQuick 2.0
ListView {
id: listView
width: 300;
height: 350
model: ListModel
{
ListElement{borderColor: "red"}
ListElement{borderColor: "blue"}
ListElement{borderColor: "green"}
ListElement{borderColor: "yellow"}
ListElement{borderColor: "purple"}
ListElement{borderColor: "pink"}
ListElement{borderColor: "red"}
ListElement{borderColor: "grey"}
}
onContentYChanged: console.log("contentY: " + contentY)
spacing: 5
delegate: Rectangle {
width: 200
height: 100
border.width: 2
border.color: borderColor
MouseArea
{
anchors.fill: parent
onClicked: listView.model.move(index, 0, 1)
}
}
cacheBuffer: 150*count
}
↧