| 12
 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
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 
 | ...
ScrollView {
        id : scroll
        anchors.rightMargin: 0
        anchors.top: contener.top
        anchors.topMargin: 0
        anchors.left: contener.right
        anchors.right: parent.right
        anchors.bottom: contener.bottom
        anchors.bottomMargin: 0
        anchors.leftMargin: 0
        clip: true
        ScrollBar.horizontal.interactive: true
        ScrollBar.vertical.interactive: true
 
 
        ListModel {
            id: test
 
            ListElement {
                name:1
            }
            ListElement {
                name:1
            }
 
 
            onCountChanged: {
                if(count >= 16)
                    listView.footer = footEmpty;
                else
                    listView.footer = foot;
            }
        }
 
        Component {
            id: deleg
            SlaveRoom {
                id: slaveRoom
                width: 250
                height: scroll.height
 
                Rectangle {
                    id: rect_delete
                    width: 20
                    height: 20
                    color: "#ffffff"
 
                    MouseArea {
                        id: mouseArea_delete
                        hoverEnabled: true
                        anchors.fill: parent
 
                        onEntered: cursorShape = Qt.PointingHandCursor
 
                        onPressed: {
                            console.log ("deleted");
                        }
                    }
                }
 
                Connections {
                    target: mainRoom
                    onMain_sample1_volumeChanged: {
                        slaveRoom.slave_sample1_volume = value;
                    }
                    onMain_sample2_volumeChanged: {
                        slaveRoom.slave_sample2_volume = value;
                    }
                    onMain_sample3_volumeChanged: {
                        slaveRoom.slave_sample3_volume = value;
                    }
                    onMain_sample4_volumeChanged: {
                        slaveRoom.slave_sample4_volume = value;
                    }
                    onMain_sample5_volumeChanged: {
                        slaveRoom.slave_sample5_volume = value;
                    }
                }
            }
        }
 
        Component {
            id: foot
            Item {
                id: item_addSlave
                width: 250
                height: scroll.height
 
                Rectangle {
                    id: rectangle
                    width: 100
                    height: 100
                    anchors.horizontalCenter: parent.horizontalCenter
                    anchors.verticalCenter: parent.verticalCenter
                    opacity: 0.3
 
                    MouseArea {
                        id: mouseArea
                        hoverEnabled: true
                        anchors.fill: parent
 
                        onEntered: cursorShape = Qt.PointingHandCursor
 
                        onPressed: {
                            if (test.count < 16)
                                test.append({"name": 1})
                        }
                    }
 
                    Text {
                        id: text1
                        text: qsTr("+")
                        wrapMode: Text.NoWrap
                        elide: Text.ElideMiddle
                        anchors.horizontalCenter: parent.horizontalCenter
                        anchors.verticalCenter: parent.verticalCenter
                        verticalAlignment: Text.AlignVCenter
                        horizontalAlignment: Text.AlignHCenter
                        font.pixelSize: 80
                    }
                }
 
            }
        }
 
        Component {
            id: footEmpty
            Item {}
        }
 
        ListView {
            id: listView
            width: scroll.width
            height: scroll.height
            orientation: Qt.Horizontal
            layoutDirection: Qt.LeftToRight
            contentWidth: 320
            flickableDirection: Flickable.AutoFlickDirection
            model:test
            delegate: deleg
            footer: foot
 
        }
 
    }
... | 
Partager