harbour-seaprint/qml/components/SupplyItem.qml

50 lines
1.3 KiB
QML
Raw Normal View History

2020-09-29 22:47:37 +03:00
import QtQuick 2.6
import Sailfish.Silica 1.0
2020-10-10 14:01:56 +03:00
import "../components"
2020-09-29 22:47:37 +03:00
Row
{
id: item
property var color: "white"
property int level: 100
property int high_level: 100
property int low_level: 0
2021-02-13 17:23:14 +03:00
property string name: ""
property string type: ""
2020-09-29 22:47:37 +03:00
spacing: Theme.paddingMedium
bottomPadding: Theme.paddingMedium
2020-10-10 14:01:56 +03:00
CylinderGraph
2020-09-29 22:47:37 +03:00
{
anchors.verticalCenter: parent.verticalCenter
2020-10-10 14:01:56 +03:00
color: parent.color
value: (level/high_level)
2020-09-29 22:47:37 +03:00
}
Label
{
anchors.verticalCenter: parent.verticalCenter
2020-10-10 17:59:22 +03:00
width: Theme.itemSizeExtraSmall
2020-09-29 22:47:37 +03:00
text: ""+(100*level/high_level)+"%"
color: Theme.highlightColor
2020-10-10 17:59:22 +03:00
font.pixelSize: Theme.fontSizeExtraSmall
2020-09-29 22:47:37 +03:00
}
Column
{
2020-10-10 17:59:22 +03:00
anchors.verticalCenter: parent.verticalCenter
2020-09-29 22:47:37 +03:00
Label
{
2021-02-13 17:23:14 +03:00
text: name != "" ? name : qsTr("Unknown supply")
2020-09-29 22:47:37 +03:00
font.pixelSize: Theme.fontSizeExtraSmall
}
Label
{
2021-02-13 17:23:14 +03:00
text: type != "" ? type : qsTr("Unknown type")
2020-09-29 22:47:37 +03:00
font.pixelSize: Theme.fontSizeExtraSmall
color: Theme.secondaryColor
}
}
}