2020-10-11 21:01:21 +02:00
|
|
|
import QtQuick 2.0
|
|
|
|
import QtQuick.Controls 2.0
|
|
|
|
import QtQuick.Layouts 1.0
|
2020-10-13 01:58:14 +02:00
|
|
|
import QtQuick.Controls.Material 2.0
|
2020-10-11 21:01:21 +02:00
|
|
|
|
2020-10-13 01:58:14 +02:00
|
|
|
ItemDelegate {
|
2020-10-11 21:01:21 +02:00
|
|
|
id: control
|
|
|
|
|
2020-10-13 01:58:14 +02:00
|
|
|
implicitHeight: 50
|
2020-10-11 21:01:21 +02:00
|
|
|
|
2020-10-13 01:58:14 +02:00
|
|
|
Rectangle {
|
|
|
|
anchors {
|
|
|
|
top: parent.top
|
|
|
|
left: parent.left
|
|
|
|
right: parent.right
|
|
|
|
topMargin: - control.ListView.view.spacing * 0.5
|
|
|
|
}
|
2020-10-11 21:01:21 +02:00
|
|
|
|
2020-10-13 01:58:14 +02:00
|
|
|
color: "lightgrey"
|
|
|
|
height: 1
|
|
|
|
visible: model.index !== 0
|
|
|
|
}
|
2020-10-11 21:01:21 +02:00
|
|
|
|
2020-10-13 01:58:14 +02:00
|
|
|
text: model.text
|
|
|
|
|
|
|
|
contentItem: RowLayout {
|
|
|
|
spacing: 5
|
|
|
|
|
|
|
|
Text {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
|
|
|
elide: Text.ElideRight
|
|
|
|
|
|
|
|
opacity: model.active ? 1:0.5
|
|
|
|
|
|
|
|
color: control.Material.foreground
|
|
|
|
|
|
|
|
text: control.text
|
|
|
|
|
|
|
|
Behavior on opacity {
|
|
|
|
NumberAnimation {}
|
2020-10-11 21:01:21 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-15 12:52:19 +02:00
|
|
|
Chip {
|
2020-10-15 14:21:34 +02:00
|
|
|
Layout.preferredHeight: control.height * 0.6
|
2020-10-15 13:16:46 +02:00
|
|
|
Layout.preferredWidth: model.scroll ? control.width * 0.15 : 0
|
2020-10-11 21:01:21 +02:00
|
|
|
|
2020-10-13 01:58:14 +02:00
|
|
|
visible: model.scroll
|
|
|
|
|
2020-10-15 12:52:19 +02:00
|
|
|
color: Material.accent
|
2020-10-13 01:58:14 +02:00
|
|
|
|
2020-10-15 12:52:19 +02:00
|
|
|
opacity: model.active ? 1:0.5
|
2020-10-13 01:58:14 +02:00
|
|
|
|
|
|
|
Behavior on color {
|
|
|
|
ColorAnimation {}
|
|
|
|
}
|
|
|
|
|
2020-10-15 12:52:19 +02:00
|
|
|
text: model.scroll ? qsTr("scrolling"):qsTr("false")
|
2020-10-15 13:16:46 +02:00
|
|
|
|
|
|
|
onClicked: {
|
|
|
|
control.clicked()
|
|
|
|
}
|
2020-10-15 12:52:19 +02:00
|
|
|
}
|
2020-10-13 01:58:14 +02:00
|
|
|
|
2020-10-15 12:52:19 +02:00
|
|
|
Chip {
|
2020-10-15 14:21:34 +02:00
|
|
|
Layout.preferredHeight: control.height * 0.6
|
2020-10-15 13:16:46 +02:00
|
|
|
Layout.preferredWidth: height
|
2020-10-13 01:58:14 +02:00
|
|
|
|
2020-10-15 12:52:19 +02:00
|
|
|
opacity: model.active ? 1:0.5
|
2020-10-13 01:58:14 +02:00
|
|
|
|
2020-10-15 12:52:19 +02:00
|
|
|
color: model.color
|
2020-10-15 13:16:46 +02:00
|
|
|
|
|
|
|
onClicked: {
|
|
|
|
control.clicked()
|
|
|
|
}
|
2020-10-11 21:01:21 +02:00
|
|
|
}
|
|
|
|
|
2020-10-15 12:52:19 +02:00
|
|
|
Chip {
|
2020-10-15 14:21:34 +02:00
|
|
|
Layout.preferredHeight: control.height * 0.6
|
2020-10-15 13:16:46 +02:00
|
|
|
Layout.preferredWidth: control.width * 0.15
|
2020-10-11 21:01:21 +02:00
|
|
|
|
2020-10-15 12:52:19 +02:00
|
|
|
color: model.active ? "#4CAF50" : "#F44336"
|
2020-10-11 21:01:21 +02:00
|
|
|
|
2020-10-15 12:52:19 +02:00
|
|
|
text: model.active ? qsTr(" active "):qsTr("inactive")
|
2020-10-13 01:58:14 +02:00
|
|
|
|
2020-10-15 12:52:19 +02:00
|
|
|
onClicked: model.active = !model.active
|
2020-10-13 01:58:14 +02:00
|
|
|
}
|
2020-10-11 21:01:21 +02:00
|
|
|
}
|
|
|
|
}
|