Ubuntu Pastebin

Paste from Albert Astals Cid at Tue, 10 Nov 2015 10:38:41 +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
import QtQuick 2.4

ListView {
    height: 400
    width: height
    model: ListModel {
        id: lmodel
        ListElement { dummy: 0 }
        ListElement { dummy: 0 }
        ListElement { dummy: 0 }
        ListElement { dummy: 0 }
        ListElement { dummy: 0 }
        ListElement { dummy: 0 }
    }

    orientation: ListView.Horizontal
    snapMode: ListView.SnapOneItem
    highlightRangeMode: ListView.StrictlyEnforceRange

    removeDisplaced: Transition {
        PropertyAnimation { property: "x"; duration: 5000 }
    }

    delegate: Text {
        text: index + " of " + lmodel.count
        width: 400
        height: 400

        Rectangle {
            color: "green"
            anchors.bottom: parent.bottom
            height: 100
            width: parent.width

            Text {
                text: "Remove me"
                anchors.centerIn: parent
            }

            MouseArea {
                anchors.fill: parent
                onClicked: lmodel.remove(index)
            }
        }
    }
}
Download as text