import QtQuick 2.0
Rectangle {
width: 400; height: 240
color: "white"
ListModel {
id: appModel
ListElement { name: "Music"}
ListElement { name: "Movies"}
ListElement { name: "Camera"}
ListElement { name: "Calendar"}
function shuffle() {
appModel.move(0, 3, 1);
}
}
Component {
id: appDelegate
Item {
width: 100; height: 100
scale: PathView.iconScale
Text {
anchors { horizontalCenter: parent.horizontalCenter }
text: name
smooth: true
}
MouseArea {
anchors.fill: parent
onClicked: view.currentIndex = index
}
}
}
Component {
id: appHighlight
Rectangle { width: 80; height: 80; color: "lightsteelblue" }
}
PathView {
id: view
anchors.fill: parent
highlight: appHighlight
preferredHighlightBegin: 0.5
preferredHighlightEnd: 0.5
focus: true
model: appModel
delegate: appDelegate
path: Path {
startX: 10
startY: 50
PathAttribute { name: "iconScale"; value: 0.5 }
PathQuad { x: 200; y: 150; controlX: 50; controlY: 200 }
PathAttribute { name: "iconScale"; value: 1.0 }
PathQuad { x: 390; y: 50; controlX: 350; controlY: 200 }
PathAttribute { name: "iconScale"; value: 0.5 }
}
Keys.onReturnPressed: {
appModel.shuffle();
highlightMoveDuration = 0 currentIndex = 3;
highlightMoveDuration = 200
}
}
}