Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import QtQuick 1.1
- import com.meego 1.0
- PageStackWindow {
- id: appWindow
- initialPage: mainPage
- Page {
- id: mainPage
- ListModel {
- id: nameModel
- ListElement { name: "Alice" }
- ListElement { name: "Bob" }
- ListElement { name: "Jane" }
- ListElement { name: "Harry" }
- ListElement { name: "Wendy" }
- }
- Component {
- id: nameDelegate
- Text {
- text: name;
- font.pixelSize: 40
- width: listView.width
- horizontalAlignment: Text.AlignHCenter
- MouseArea{
- anchors.fill: parent
- onClicked: {
- console.log("clicked: " + name + " at index: " + index);
- listView.currentIndex = index;
- }
- }
- }
- }
- ListView {
- id: listView
- anchors.fill: parent
- model: nameModel
- delegate: nameDelegate
- onCurrentIndexChanged: console.log("index")
- onCurrentItemChanged: console.log("item")
- focus: true
- highlight: Rectangle {
- width: parent.width
- color: "lightgray"
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement