import Qt 4.7 Rectangle { width: 200 height: 200 ListModel { id: theModel ListElement { theIndex: 0; theColor: "red" } ListElement { theIndex: 1; theColor: "green" } ListElement { theIndex: 2; theColor: "blue" } ListElement { theIndex: 3; theColor: "cyan" } ListElement { theIndex: 4; theColor: "magenta" } ListElement { theIndex: 5; theColor: "yellow" } } Component { id: theDelegate Rectangle { id: theRectangle property int randomAngle: Math.random() * (2 * 6 + 1) - 6; color: theColor; x: 0; y: 0; z: PathView.z; rotation: theRectangle.randomAngle width: 80; height: 103 opacity: PathView.onPath ? 1.0 : 0.0 Text { text: theIndex; anchors.centerIn: parent; } MouseArea { anchors.fill: parent onClicked: { var index1 = Math.floor(Math.random() * (theModel.count - 1)); var index2 = index1; while(index2 == index1) { index2 = Math.floor(Math.random() * (theModel.count - 1)); } console.log("moving " + index1 + " to " + index2 + ", count in model = " + theModel.count); theModel.move(index1, index2, 1); } } } } PathView { id: thePathView anchors.centerIn: parent model: theModel delegate: theDelegate pathItemCount: 5 interactive: false path: Path { PathAttribute { name: 'z'; value: 9999.0 } PathLine { x: 1; y: 1 } PathAttribute { name: 'z'; value: 0.0 } } } }