2023-04-19 11:55:12 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Layouts 1.15
|
|
|
|
import QtQuick.Controls 2.15
|
2023-01-18 19:54:14 +00:00
|
|
|
|
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
import StatusQ.Components 0.1
|
|
|
|
|
|
|
|
Control {
|
|
|
|
id: root
|
|
|
|
|
|
|
|
property string name
|
|
|
|
property string shortName
|
2023-04-19 12:26:14 +00:00
|
|
|
property string amount
|
2023-01-18 19:54:14 +00:00
|
|
|
property url iconSource
|
2024-05-28 13:11:29 +00:00
|
|
|
property string decimals
|
2023-01-24 21:49:07 +00:00
|
|
|
property bool selected: false
|
2023-04-19 11:55:12 +00:00
|
|
|
property bool showSubItemsIcon: false
|
2023-01-18 19:54:14 +00:00
|
|
|
|
2023-04-19 11:55:12 +00:00
|
|
|
signal itemClicked
|
2023-01-18 19:54:14 +00:00
|
|
|
|
2023-07-27 13:42:12 +00:00
|
|
|
padding: 6 // by design
|
|
|
|
implicitHeight: 44 // by design
|
2023-01-18 19:54:14 +00:00
|
|
|
spacing: 8 // by design
|
|
|
|
background: Rectangle {
|
2023-07-27 13:42:12 +00:00
|
|
|
color: mouseArea.containsMouse ? Theme.palette.statusListItem.highlightColor : "transparent"
|
|
|
|
radius: 8
|
2023-01-18 19:54:14 +00:00
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
id: mouseArea
|
|
|
|
anchors.fill: parent
|
|
|
|
cursorShape: root.enabled ? Qt.PointingHandCursor : Qt.ArrowCursor
|
|
|
|
hoverEnabled: true
|
2023-04-19 11:55:12 +00:00
|
|
|
onClicked: root.itemClicked()
|
2023-01-18 19:54:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
contentItem: RowLayout {
|
|
|
|
spacing: root.spacing
|
|
|
|
|
|
|
|
StatusRoundedImage {
|
|
|
|
Layout.alignment: Qt.AlignVCenter
|
|
|
|
image.source: root.iconSource
|
|
|
|
visible: root.iconSource.toString() !== ""
|
|
|
|
Layout.preferredWidth: 32
|
|
|
|
Layout.preferredHeight: Layout.preferredWidth
|
|
|
|
}
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.alignment: Qt.AlignVCenter
|
|
|
|
spacing: 0
|
|
|
|
|
|
|
|
StatusBaseText {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
text: root.name
|
|
|
|
color: Theme.palette.directColor1
|
|
|
|
font.pixelSize: 13
|
2023-04-19 11:55:12 +00:00
|
|
|
font.weight: Font.Medium
|
2023-01-18 19:54:14 +00:00
|
|
|
elide: Text.ElideRight
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusBaseText {
|
|
|
|
visible: !!root.shortName
|
|
|
|
Layout.fillWidth: true
|
2023-04-19 11:55:12 +00:00
|
|
|
text: root.shortName
|
2023-01-18 19:54:14 +00:00
|
|
|
color: Theme.palette.baseColor1
|
|
|
|
font.pixelSize: 12
|
|
|
|
elide: Text.ElideRight
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-04-19 12:26:14 +00:00
|
|
|
StatusBaseText {
|
2023-04-25 21:24:04 +00:00
|
|
|
visible: !!root.amount && !root.selected
|
2023-04-19 12:26:14 +00:00
|
|
|
text: root.amount
|
|
|
|
color: Theme.palette.baseColor1
|
|
|
|
font.pixelSize: 12
|
|
|
|
font.weight: Font.Medium
|
|
|
|
elide: Text.ElideRight
|
|
|
|
|
|
|
|
Layout.rightMargin: root.spacing
|
|
|
|
}
|
|
|
|
|
2023-01-18 19:54:14 +00:00
|
|
|
StatusIcon {
|
2023-04-19 11:55:12 +00:00
|
|
|
icon: root.selected && !root.showSubItemsIcon ? "checkmark" : "tiny/chevron-right"
|
|
|
|
visible: root.selected || root.showSubItemsIcon
|
2023-01-18 19:54:14 +00:00
|
|
|
Layout.alignment: Qt.AlignVCenter
|
|
|
|
color: Theme.palette.baseColor1
|
|
|
|
width: 16
|
|
|
|
height: 16
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|