82 lines
1.6 KiB
QML
82 lines
1.6 KiB
QML
pragma ComponentBehavior: Bound
|
|
|
|
import QtQuick
|
|
import QtQuick.Layouts
|
|
import ZShell.Components
|
|
import qs.Components
|
|
import ZShell.Config
|
|
import qs.Services
|
|
|
|
ConnectedRect {
|
|
id: root
|
|
|
|
property string icon
|
|
property color iconColor: Colors.palette.m3onSurfaceVariant
|
|
property alias label: label.text
|
|
property Component leadingComponent: icon ? iconComp : null
|
|
property string subtext
|
|
property alias value: value.text
|
|
|
|
Layout.fillWidth: true
|
|
implicitHeight: rowLayout.implicitHeight + rowLayout.anchors.margins * 2
|
|
|
|
Component {
|
|
id: iconComp
|
|
|
|
MaterialIcon {
|
|
color: root.iconColor
|
|
fontStyle: Tokens.font.icon.small
|
|
text: root.icon
|
|
}
|
|
}
|
|
|
|
SnapLayout {
|
|
id: rowLayout
|
|
|
|
anchors.fill: parent
|
|
anchors.leftMargin: Tokens.padding.largeIncreased
|
|
anchors.margins: Tokens.padding.small
|
|
anchors.rightMargin: Tokens.padding.largeIncreased
|
|
spacing: Tokens.spacing.small
|
|
|
|
Loader {
|
|
active: root.leadingComponent
|
|
sourceComponent: root.leadingComponent
|
|
visible: root.leadingComponent
|
|
}
|
|
|
|
SnapLayout {
|
|
orientation: Qt.Vertical
|
|
Layout.fillWidth: true
|
|
spacing: 0
|
|
|
|
CustomText {
|
|
id: label
|
|
|
|
Layout.fillWidth: true
|
|
elide: Text.ElideRight
|
|
font: Tokens.font.body.small
|
|
}
|
|
|
|
CustomText {
|
|
Layout.fillWidth: true
|
|
color: Colors.palette.m3outline
|
|
elide: Text.ElideRight
|
|
font: Tokens.font.label.small
|
|
text: root.subtext
|
|
visible: root.subtext
|
|
}
|
|
}
|
|
|
|
CustomText {
|
|
id: value
|
|
|
|
Layout.maximumWidth: root.width / 2
|
|
color: Colors.palette.m3onSurfaceVariant
|
|
elide: Text.ElideRight
|
|
font: Tokens.font.body.small
|
|
horizontalAlignment: Text.AlignRight
|
|
}
|
|
}
|
|
}
|