fix(StatusSlider): Fixed background behavior (#667)

This commit is contained in:
Igor Sirotin 2022-05-13 21:24:07 +03:00 committed by Michał Cieślak
parent 85713de833
commit 5a9f9527a7
1 changed files with 5 additions and 16 deletions

View File

@ -27,25 +27,14 @@ Slider {
implicitHeight: 4 implicitHeight: 4
width: statusSlider.availableWidth width: statusSlider.availableWidth
height: implicitHeight height: implicitHeight
color: Theme.palette.primaryColor3
color: {
if (statusSlider.value === statusSlider.to) {
return Theme.palette.primaryColor1
}
return Theme.palette.primaryColor3
}
radius: 2 radius: 2
Rectangle { Rectangle {
width: statusSlider.visualPosition * parent.width
height: parent.height
color: Theme.palette.primaryColor1
radius: 2 radius: 2
anchors.fill: parent
visible: statusSlider.value > statusSlider.from && statusSlider.value < statusSlider.to
gradient: Gradient {
GradientStop { color: Theme.palette.primaryColor1 ; position: 0 }
GradientStop { color: Theme.palette.primaryColor3 ; position: (((statusSlider.value - statusSlider.from) * 100) / (statusSlider.to - statusSlider.from) / 100).toFixed(2) }
GradientStop { color: Theme.palette.primaryColor1 ; position: (((statusSlider.value - statusSlider.from) * 100) / (statusSlider.to - statusSlider.from) / 100).toFixed(2) }
GradientStop { color: Theme.palette.primaryColor3 ; position: 1 }
orientation: Gradient.Horizontal
}
} }
} // background } // background