[SliderStyle] Allow providing a "hint-handle-size" element

This hints the actual size of the handle, excluding any padding and shadows
and allows for the handle to touch the outermost border of the rail underneath.

Differential Revision: https://phabricator.kde.org/D4762
This commit is contained in:
Kai Uwe Broulik 2017-02-28 10:22:36 +01:00
parent 916bcbf6c0
commit 6b70fd983b
2 changed files with 7 additions and 4 deletions

View File

@ -40,12 +40,13 @@ QtQuickControlStyle.SliderStyle {
} }
handle: Item { handle: Item {
width: handle.naturalSize.width width: grooveSvg.hasElement("hint-handle-size") ? grooveSvg.elementSize("hint-handle-size").width : handle.width
height: handle.naturalSize.height height: grooveSvg.hasElement("hint-handle-size") ? grooveSvg.elementSize("hint-handle-size").height : handle.height
//keep this opaque to not show half highlight beneath //keep this opaque to not show half highlight beneath
Private.RoundShadow { Private.RoundShadow {
id: shadow id: shadow
anchors.fill: parent anchors.fill: handle
imagePath: "widgets/slider" imagePath: "widgets/slider"
focusElement: "horizontal-slider-focus" focusElement: "horizontal-slider-focus"
hoverElement: "horizontal-slider-hover" hoverElement: "horizontal-slider-hover"
@ -54,7 +55,9 @@ QtQuickControlStyle.SliderStyle {
} }
PlasmaCore.SvgItem { PlasmaCore.SvgItem {
id: handle id: handle
anchors.fill: parent anchors.centerIn: parent
width: naturalSize.width
height: naturalSize.height
svg: grooveSvg svg: grooveSvg
elementId: "horizontal-slider-handle" elementId: "horizontal-slider-handle"
} }