Ubuntu Pastebin

Paste from daker at Thu, 9 Feb 2017 11:53:48 +0000

Download as text
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
import QtQuick 2.4
import Ubuntu.Components 1.3

MainView {
    objectName: "mainView"

    applicationName: "listview.daker"
    property alias mainStack: layout

    width: units.gu(100)
    height: units.gu(75)

    AdaptivePageLayout {
        id: layout
        anchors.fill: parent
        anchors.bottom: parent.bottom

        layouts: PageColumnsLayout {
            when: mainStack.width >= units.gu(90)
            PageColumn {
                maximumWidth: units.gu(50)
                minimumWidth: units.gu(40)
                preferredWidth: units.gu(40)
            }
            PageColumn {
                fillWidth: true
            }
        }
        asynchronous: false
        primaryPage: Page {
            id: conversationsPage
            header: PageHeader {
                id: conversationsPageHeader
                title: i18n.tr("demo")
            }

            Flickable {

                id: conversationsFlickable
                anchors {
                    left: parent.left
                    right: parent.right
                    top: conversationsPageHeader.bottom
                    bottom: parent.bottom
                }

                ListModel {
                    id: modelList
                    ListElement {
                        title: "Server 1"
                        isServer: true
                    }
                    ListElement {
                        title: "Server 2"
                        isServer: false
                    }
                    ListElement {
                        title: "Server 3"
                        isServer: false
                    }
                }

                UbuntuListView {
                    id: listView
                    width: parent.width
                    anchors {
                        top: parent.top
                        left: parent.left
                        right: parent.right
                        bottom: parent.bottom
                    }
                    clip: true
                    highlightFollowsCurrentItem: true
                    currentIndex: -1

                    model: modelList

                    delegate : ListItem {
                        id: listItem
                        ListItemLayout {
                            id: modelLayout
                            title.text: model.title
                            width: parent.width

                            Icon {
                                name:  "contact"
                                SlotsLayout.position: SlotsLayout.Leading;
                                width: units.gu(3)
                            }

                            Rectangle {
                                height: units.gu(2)
                                width: units.gu(2)
                                radius: height * 0.5
                                color: UbuntuColors.green
                                visible: model.isServer
                                SlotsLayout.position: SlotsLayout.Trailing;
                            }
                            ProgressionSlot {
                            }
                        }
                        onClicked: {
                            mainStack.addPageToNextColumn(conversationsPage, conversationPage)
                        }

                        leadingActions: ListItemActions {
                            id: leading
                            actions: Action {
                                iconName: "delete"
                            }
                        }
                    }
                }
            }
        }

        Page {
            id: conversationPage
            header: PageHeader {
                id: conversationPageHeader
                title: "Test"
            }

            Label {
                text: "Test"
            }
        }
    }
}
Download as text