Handle 0 as marker high level

This commit is contained in:
Anton Thomasson 2022-05-27 14:28:32 +02:00
parent 342a1a82f0
commit 1e6be94965

View file

@ -11,6 +11,7 @@ import "../components"
property int low_level: 10
property string name: ""
property string type: ""
property real value_fraction: level/(high_level == 0 ? 100 : high_level)
spacing: Theme.paddingMedium
bottomPadding: Theme.paddingMedium
@ -19,13 +20,13 @@ import "../components"
{
anchors.verticalCenter: parent.verticalCenter
color: parent.color
value: (level/high_level)
value: value_fraction
}
Label
{
anchors.verticalCenter: parent.verticalCenter
width: Theme.itemSizeExtraSmall
text: ""+(100*level/high_level)+"%"
text: ""+(100*value_fraction)+"%"
color: level <= low_level ? "red" : Theme.highlightColor
font.pixelSize: Theme.fontSizeExtraSmall
}