harbour-seaprint/qml/components/SupplyItem.qml

50 lines
1.2 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
property string name: qsTr("Unknown supply")
property string type: qsTr("Unknown type")
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
{
text: name
font.pixelSize: Theme.fontSizeExtraSmall
}
Label
{
text: type
font.pixelSize: Theme.fontSizeExtraSmall
color: Theme.secondaryColor
}
}
}