5import QGroundControl.Controls
8 property bool zeroCentered: false ///< Value indicator starts display from zero instead of min value
9 property bool displayValue: false ///< true: Show value on handle
10 property bool showBoundaryValues: false ///< true: Show min/max values at slider ends
13 implicitHeight: ScreenTools.implicitSliderHeight + (showBoundaryValues ? minLabel.contentHeight : 0)
20 property real _implicitBarLength: Math.round(ScreenTools.defaultFontPixelWidth * 20)
21 property real _barHeight: Math.round(ScreenTools.defaultFontPixelHeight / 3)
23 QGCPalette { id: qgcPal; colorGroupEnabled: control.enabled }
25 background: Rectangle {
26 x: control.horizontal ? control.leftPadding : control.leftPadding + control.availableWidth / 2 - width / 2
27 y: control.horizontal ? control.topPadding + control.availableHeight / 2 - height / 2 : control.topPadding
28 implicitWidth: control.horizontal ? control._implicitBarLength : control._barHeight
29 implicitHeight: control.horizontal ? control._barHeight : control._implicitBarLength
30 width: control.horizontal ? control.availableWidth : implicitWidth
31 height: control.horizontal ? implicitHeight : control.availableHeight
32 radius: control._barHeight / 2
35 border.color: qgcPal.buttonText
39 x: control.horizontal ?
40 control.leftPadding + control.visualPosition * (control.availableWidth - width) :
41 control.leftPadding + control.availableWidth / 2 - width / 2
42 y: control.horizontal ?
43 control.topPadding + control.availableHeight / 2 - height / 2 :
44 control.topPadding + control.visualPosition * (control.availableHeight - height)
45 implicitWidth: _radius * 2
46 implicitHeight: _radius * 2
48 border.color: qgcPal.buttonText
52 property real _radius: ScreenTools.defaultFontPixelHeight / 2
55 text: control.value.toFixed(control.to <= 1 ? 1 : 0)
56 visible: control.displayValue
57 anchors.centerIn: parent
58 font.family: ScreenTools.normalFontFamily
59 font.pointSize: ScreenTools.smallFontPointSize
60 color: qgcPal.buttonText
66 anchors.left: parent.left
67 anchors.leftMargin: control.leftPadding
68 anchors.bottom: parent.bottom
69 text: control.from.toFixed(1)
70 font.pointSize: ScreenTools.smallFontPointSize
71 color: qgcPal.buttonText
72 visible: control.showBoundaryValues
77 anchors.right: parent.right
78 anchors.rightMargin: control.rightPadding
79 anchors.bottom: parent.bottom
80 text: control.to.toFixed(1)
81 font.pointSize: ScreenTools.smallFontPointSize
82 color: qgcPal.buttonText
83 visible: control.showBoundaryValues