Handle 0 as marker high level
This commit is contained in:
parent
342a1a82f0
commit
1e6be94965
1 changed files with 3 additions and 2 deletions
|
@ -11,6 +11,7 @@ import "../components"
|
||||||
property int low_level: 10
|
property int low_level: 10
|
||||||
property string name: ""
|
property string name: ""
|
||||||
property string type: ""
|
property string type: ""
|
||||||
|
property real value_fraction: level/(high_level == 0 ? 100 : high_level)
|
||||||
|
|
||||||
spacing: Theme.paddingMedium
|
spacing: Theme.paddingMedium
|
||||||
bottomPadding: Theme.paddingMedium
|
bottomPadding: Theme.paddingMedium
|
||||||
|
@ -19,13 +20,13 @@ import "../components"
|
||||||
{
|
{
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
color: parent.color
|
color: parent.color
|
||||||
value: (level/high_level)
|
value: value_fraction
|
||||||
}
|
}
|
||||||
Label
|
Label
|
||||||
{
|
{
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
width: Theme.itemSizeExtraSmall
|
width: Theme.itemSizeExtraSmall
|
||||||
text: ""+(100*level/high_level)+"%"
|
text: ""+(100*value_fraction)+"%"
|
||||||
color: level <= low_level ? "red" : Theme.highlightColor
|
color: level <= low_level ? "red" : Theme.highlightColor
|
||||||
font.pixelSize: Theme.fontSizeExtraSmall
|
font.pixelSize: Theme.fontSizeExtraSmall
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue