[ create a new paste ] login | about

Link: http://codepad.org/6bX1Dr4p    [ raw code | output | fork ]

Python, pasted on Dec 15:
    ListModel {
        id: menusModel

        ListElement {
            name: ""
        }

        ListElement {
            name: ""
        }

        ListElement {
            name: ""
        }

        function title(index) {
            if (title["text"] === undefined) {
                title.text = [
                    qsTr("Friends"),
                    qsTr("Communities"),
                    qsTr("Messages")
                ]
            }
            return title.text[index]
        }
    }

    SilicaListView {
        id: menuView

        anchors.fill: parent

        header: PageHeader { title: qsTr ("Profile") }

        model: menusModel
        spacing: Theme.paddingMedium

        delegate: ListItem {
            id: rootDelegateItem

            width: menuView.width

            Label {
                anchors.left: parent.left
                anchors.leftMargin: Theme.paddingMedium
                anchors.right: parent.right
                anchors.rightMargin: Theme.paddingMedium
                anchors.verticalCenter: parent.verticalCenter

                text: menuView.model.title (menuView.currentIndex)
            }
        }
    }


Output:
1
2
3
4
  Line 1
    ListModel {
    ^
IndentationError: unexpected indent


Create a new paste based on this one


Comments: