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 + bottomPadding
17 bottomPadding: 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
33 color: qgcPal.windowInset
35 border.color: qgcPal.borderSubtle
38 width: control.horizontal ? Math.max(0, Math.min(control.handle.x - control.leftPadding + control.handle.width / 2, parent.width)) : parent.width
39 height: control.horizontal ? parent.height : Math.max(0, Math.min(parent.height - (control.handle.y - control.topPadding + control.handle.height / 2), parent.height))
40 y: control.horizontal ? 0 : parent.height - height
47 x: control.horizontal ?
48 control.leftPadding + control.visualPosition * (control.availableWidth - width) :
49 control.leftPadding + control.availableWidth / 2 - width / 2
50 y: control.horizontal ?
51 control.topPadding + control.availableHeight / 2 - height / 2 :
52 control.topPadding + control.visualPosition * (control.availableHeight - height)
53 implicitWidth: _radius * 2
54 implicitHeight: _radius * 2
58 property real _radius: ScreenTools.defaultFontPixelHeight / 2
61 text: control.value.toFixed(control.to <= 1 ? 1 : 0)
62 visible: control.displayValue
63 anchors.centerIn: parent
64 font.family: ScreenTools.normalFontFamily
65 font.pointSize: ScreenTools.smallFontPointSize
66 color: qgcPal.accentText
72 anchors.left: parent.left
73 anchors.leftMargin: control.leftPadding
74 anchors.bottom: parent.bottom
75 text: control.from.toFixed(1)
76 font.pointSize: ScreenTools.smallFontPointSize
77 color: qgcPal.textSecondary
78 visible: control.showBoundaryValues
83 anchors.right: parent.right
84 anchors.rightMargin: control.rightPadding
85 anchors.bottom: parent.bottom
86 text: control.to.toFixed(1)
87 font.pointSize: ScreenTools.smallFontPointSize
88 color: qgcPal.textSecondary
89 visible: control.showBoundaryValues