respect svg size for handle size

This commit is contained in:
Marco Martin 2012-04-27 15:14:43 +02:00
parent 8a90947a33
commit 856b001d73

View File

@ -69,9 +69,6 @@ Plasma Properties:
alias inverted: alias inverted:
This property holds if the slider visualizations has an inverted direction. This property holds if the slider visualizations has an inverted direction.
The default value is false. The default value is false.
real handleSize:
This property holds the size of the Slider's handle.
**/ **/
import QtQuick 1.0 import QtQuick 1.0
@ -149,7 +146,8 @@ Item {
// Plasma API // Plasma API
property bool animated: true property bool animated: true
property real handleSize: theme.defaultFont.mSize.height*1.3 property real handleWidth: grooveSvg.elementSize("horizontal-slider-handle").width
property real handleHeight: grooveSvg.elementSize("horizontal-slider-handle").height
// Convenience API // Convenience API
property bool isVertical: orientation == Qt.Vertical property bool isVertical: orientation == Qt.Vertical
@ -217,8 +215,8 @@ Item {
anchors { anchors {
verticalCenter: groove.verticalCenter verticalCenter: groove.verticalCenter
} }
width: contents.handleSize width: contents.handleWidth
height: contents.handleSize height: contents.handleHeight
svg: PlasmaCore.Svg { imagePath: "widgets/slider" } svg: PlasmaCore.Svg { imagePath: "widgets/slider" }
elementId: "horizontal-slider-handle" elementId: "horizontal-slider-handle"
@ -260,7 +258,7 @@ Item {
// Debounce the press: a press event inside the handler will not // Debounce the press: a press event inside the handler will not
// change its position, the user needs to drag it. // change its position, the user needs to drag it.
if (Math.abs(newX - fakeHandle.x) > handle.width / 2) { if (Math.abs(newX - fakeHandle.x) > handle.width / 2) {
range.position = newX range.position = newX - handle.width / 2
} }
slider.forceActiveFocus() slider.forceActiveFocus()