2022-05-02 04:31:32 -05:00
|
|
|
import QtQuick
|
|
|
|
import QtQuick.Layouts
|
|
|
|
import QtQuick.Controls
|
2021-09-28 14:43:06 -05:00
|
|
|
|
2021-09-26 00:19:10 -05:00
|
|
|
ColumnLayout {
|
2024-05-05 00:20:10 -05:00
|
|
|
id: root
|
2024-08-12 00:52:58 -05:00
|
|
|
spacing: 0
|
2024-05-05 00:20:10 -05:00
|
|
|
visible: count > 0
|
2021-09-26 00:19:10 -05:00
|
|
|
|
2024-05-05 00:20:10 -05:00
|
|
|
property int count: 0
|
|
|
|
property var titles:[""]
|
|
|
|
property string icon: ""
|
|
|
|
property string title: ""
|
2021-09-26 00:19:10 -05:00
|
|
|
|
2024-05-05 00:20:10 -05:00
|
|
|
signal checkedChanged(var index, var checked)
|
2021-09-26 00:19:10 -05:00
|
|
|
|
2024-05-05 00:20:10 -05:00
|
|
|
Connections {
|
|
|
|
target: Cpp_UI_Dashboard
|
2021-09-27 03:40:43 -05:00
|
|
|
|
2024-05-05 00:20:10 -05:00
|
|
|
function onDataReset() {
|
|
|
|
hideAll.checked = false
|
2021-09-27 03:40:43 -05:00
|
|
|
}
|
2024-05-05 00:20:10 -05:00
|
|
|
}
|
2021-09-27 03:40:43 -05:00
|
|
|
|
2024-05-05 00:20:10 -05:00
|
|
|
RowLayout {
|
2024-08-12 00:52:58 -05:00
|
|
|
spacing: 4
|
2024-05-05 00:20:10 -05:00
|
|
|
visible: root.count > 0
|
2021-09-26 00:19:10 -05:00
|
|
|
|
2024-08-12 00:52:58 -05:00
|
|
|
Image {
|
2024-05-05 00:20:10 -05:00
|
|
|
source: root.icon
|
2024-08-12 00:52:58 -05:00
|
|
|
sourceSize: Qt.size(18, 18)
|
|
|
|
Layout.alignment: Qt.AlignVCenter
|
|
|
|
}
|
2021-09-26 00:19:10 -05:00
|
|
|
|
2024-05-05 00:20:10 -05:00
|
|
|
Label {
|
|
|
|
text: root.title
|
2024-08-12 00:52:58 -05:00
|
|
|
Layout.alignment: Qt.AlignVCenter
|
2024-05-05 00:20:10 -05:00
|
|
|
opacity: hideAll.checked ? 0.5 : 1
|
2024-08-12 00:52:58 -05:00
|
|
|
font: Cpp_Misc_CommonFonts.customUiFont(10, true)
|
|
|
|
color: Cpp_ThemeManager.colors["pane_section_label"]
|
|
|
|
Component.onCompleted: font.capitalization = Font.AllUppercase
|
2024-05-05 00:20:10 -05:00
|
|
|
}
|
2021-09-26 00:19:10 -05:00
|
|
|
|
2024-05-05 00:20:10 -05:00
|
|
|
Item {
|
|
|
|
Layout.fillWidth: true
|
2021-09-26 00:19:10 -05:00
|
|
|
}
|
|
|
|
|
2024-05-05 00:20:10 -05:00
|
|
|
RoundButton {
|
|
|
|
id: hideAll
|
|
|
|
width: 24
|
|
|
|
height: 24
|
|
|
|
flat: true
|
|
|
|
checkable: true
|
2024-08-12 00:52:58 -05:00
|
|
|
icon.width: 18
|
|
|
|
icon.height: 18
|
|
|
|
Layout.rightMargin: -6
|
|
|
|
icon.color: "transparent"
|
|
|
|
icon.source: !checked ? "qrc:/rcc/icons/dashboard/show-all.svg" :
|
|
|
|
"qrc:/rcc/icons/dashboard/hide-all.svg"
|
2024-05-05 00:20:10 -05:00
|
|
|
onCheckedChanged: {
|
|
|
|
for (var i = 0; i < root.count; ++i)
|
|
|
|
root.checkedChanged(i, !checked)
|
|
|
|
}
|
2021-09-26 00:19:10 -05:00
|
|
|
}
|
2024-05-05 00:20:10 -05:00
|
|
|
}
|
2021-09-26 00:19:10 -05:00
|
|
|
|
2024-05-05 00:20:10 -05:00
|
|
|
Repeater {
|
|
|
|
model: hideAll.checked ? 0 : root.count
|
|
|
|
delegate: Switch {
|
|
|
|
checked: true
|
2024-08-12 00:52:58 -05:00
|
|
|
Layout.leftMargin: -6
|
2024-05-05 00:20:10 -05:00
|
|
|
Layout.fillWidth: true
|
|
|
|
text: root.titles[index]
|
2024-08-12 00:52:58 -05:00
|
|
|
Layout.maximumHeight: 24
|
2024-05-05 00:20:10 -05:00
|
|
|
onCheckedChanged: root.checkedChanged(index, checked)
|
2024-08-12 00:52:58 -05:00
|
|
|
palette.highlight: Cpp_ThemeManager.colors["view_switch"]
|
2021-09-26 00:19:10 -05:00
|
|
|
}
|
2024-05-05 00:20:10 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
Item {
|
2024-08-11 18:20:03 -05:00
|
|
|
height: 8
|
2024-05-05 00:20:10 -05:00
|
|
|
visible: !hideAll.checked && count > 0
|
|
|
|
}
|
2021-09-26 00:19:10 -05:00
|
|
|
}
|