Round slider handle position
We are dividing by two and additionally availableHeight can be fractional (observed when running kirigami gallery with plasma style for example). Round the resulting values to avoid blurry rendering due to fractional positioning.
This commit is contained in:
parent
4d5ff92b2c
commit
a187141e73
@ -23,8 +23,8 @@ T.RangeSlider {
|
||||
}
|
||||
first.handle: Item {
|
||||
property bool horizontal: control.orientation === Qt.Horizontal
|
||||
x: control.leftPadding + (horizontal ? control.first.visualPosition * (control.availableWidth - width) : (control.availableWidth - width) / 2)
|
||||
y: control.topPadding + (horizontal ? (control.availableHeight - height) / 2 : control.first.visualPosition * (control.availableHeight - height))
|
||||
x: Math.round(control.leftPadding + (horizontal ? control.first.visualPosition * (control.availableWidth - width) : (control.availableWidth - width) / 2))
|
||||
y: Math.round(control.topPadding + (horizontal ? (control.availableHeight - height) / 2 : control.first.visualPosition * (control.availableHeight - height)))
|
||||
|
||||
width: grooveSvg.hasElement("hint-handle-size") ? grooveSvg.elementSize("hint-handle-size").width : firstHandle.width
|
||||
height: grooveSvg.hasElement("hint-handle-size") ? grooveSvg.elementSize("hint-handle-size").height : firstHandle.height
|
||||
|
@ -26,8 +26,8 @@ T.Slider {
|
||||
}
|
||||
handle: Item {
|
||||
property bool horizontal: control.orientation === Qt.Horizontal
|
||||
x: control.leftPadding + (horizontal ? control.visualPosition * (control.availableWidth - width) : (control.availableWidth - width) / 2)
|
||||
y: control.topPadding + (horizontal ? (control.availableHeight - height) / 2 : control.visualPosition * (control.availableHeight - height))
|
||||
x: Math.round(control.leftPadding + (horizontal ? control.visualPosition * (control.availableWidth - width) : (control.availableWidth - width) / 2))
|
||||
y: Math.round(control.topPadding + (horizontal ? (control.availableHeight - height) / 2 : control.visualPosition * (control.availableHeight - height)))
|
||||
|
||||
width: grooveSvg.hasElement("hint-handle-size") ? grooveSvg.elementSize("hint-handle-size").width : firstHandle.width
|
||||
height: grooveSvg.hasElement("hint-handle-size") ? grooveSvg.elementSize("hint-handle-size").height : firstHandle.height
|
||||
|
Loading…
Reference in New Issue
Block a user