4pragma ComponentBehavior: Bound
7import QtQuick.Templates as T
32 enum TickVisibilityMode {
50 property int labelBehavior: Slider.LabelBehavior.Floating
55 property int tickVisibilityMode: Slider.TickVisibilityMode.AutoLimit
60 property int size: Slider.Size.ExtraSmall
65 property bool centered: false
68 property string trackIconActiveStart
71 property string trackIconActiveEnd
74 property string trackIconInactiveStart
77 property string trackIconInactiveEnd
80 property color trackIconActiveColor: control.enabled ? control.MD.Style.onPrimaryColor : control.MD.Style.inverseOnSurfaceColor
82 property color trackIconInactiveColor: control.enabled ? control.MD.Style.onSecondaryContainerColor : control.MD.Style.onSurfaceColor
88 property string valueIndicatorText: control.value.toLocaleString(Qt.locale(), "f", Number.isInteger(control.value) ? 0 : 2)
90 value: centered ? (from + to) / 2 : from
91 snapMode: T.
Slider.SnapAlways
93 focusPolicy: Qt.StrongFocus
95 implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, implicitHandleWidth + leftPadding + rightPadding)
96 implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, implicitHandleHeight + topPadding + bottomPadding)
101 readonly property real handleHeight: {
102 switch (control.size) {
103 case Slider.Size.ExtraSmall:
111 case Slider.Size.ExtraLarge:
114 return MD.Tokens.slider.activeHandleHeightExtraSmall;
117 readonly
property real trackHeight: {
118 switch (control.size) {
119 case Slider.Size.ExtraSmall:
127 case Slider.Size.ExtraLarge:
130 return MD.Tokens.slider.activeTrackHeightExtraSmall;
133 readonly
property real trackOuterCornerRadius: {
134 switch (control.size) {
135 case Slider.Size.ExtraSmall:
143 case Slider.Size.ExtraLarge:
146 return MD.Tokens.slider.activeTrackLeadingCornerRadiusExtraSmall;
149 readonly
property real trackIconSize: {
150 switch (control.size) {
155 case Slider.Size.ExtraLarge:
161 readonly
property real trackIconPadding: {
162 switch (control.size) {
167 case Slider.Size.ExtraLarge:
173 readonly
property real effectiveHandleWidth: control.pressed ? MD.Tokens.slider.pressedHandleWidth : (control.visualFocus ? MD.Tokens.slider.focusHandleWidth : MD.Tokens.slider.handleWidth)
174 readonly property real handleContainerSize: trackOuterCornerRadius * 2
175 readonly property bool reservesLabelSpace: control.labelBehavior ===
Slider.LabelBehavior.WithinBounds || control.labelBehavior ===
Slider.LabelBehavior.Visible
176 readonly property real labelSpace: {
177 if (!reservesLabelSpace)
179 const indicatorSize = control.horizontal ? sliderHandle.valueIndicatorHeight : sliderHandle.valueIndicatorWidth;
183 readonly
property color activeTrackColor: control.enabled ? control.MD.Style.primaryColor : control.MD.Style.onSurfaceColor
184 readonly
property color inactiveTrackColor: control.enabled ? control.MD.Style.secondaryContainerColor : control.MD.Style.onSurfaceColor
185 readonly
property color activeTickColor: control.enabled ? control.MD.Style.onPrimaryColor : control.MD.Style.inverseOnSurfaceColor
186 readonly
property color inactiveTickColor: control.enabled ? control.MD.Style.onSecondaryContainerColor : control.MD.Style.onSurfaceColor
187 readonly
property color handleColor: control.enabled ? control.MD.Style.primaryColor : control.MD.Style.onSurfaceColor
188 readonly
property real activeTrackOpacity: control.enabled ? MD.Tokens.slider.visibleOpacity : MD.Tokens.slider.disabledActiveTrackOpacity
189 readonly
property real inactiveTrackOpacity: control.enabled ? MD.Tokens.slider.visibleOpacity : MD.Tokens.slider.disabledInactiveTrackOpacity
190 readonly
property real handleOpacity: control.enabled ? MD.Tokens.slider.visibleOpacity : MD.Tokens.slider.disabledHandleOpacity
193 background: MD.SliderTrack {
194 horizontal: control.horizontal
195 mirrored: control.mirrored
196 centered: control.centered
198 controlEnabled: control.enabled
199 visualPosition: control.visualPosition
200 secondVisualPosition: control.visualPosition
201 rangeFrom: control.from
203 stepSize: control.stepSize
204 tickVisibilityMode: control.tickVisibilityMode
205 autoLimitMode:
Slider.TickVisibilityMode.AutoLimit
206 autoHideMode:
Slider.TickVisibilityMode.AutoHide
207 hiddenMode:
Slider.TickVisibilityMode.Hidden
208 trackHeight: metrics.trackHeight
209 trackOuterCornerRadius: metrics.trackOuterCornerRadius
211 effectiveHandleWidth: metrics.effectiveHandleWidth
212 labelSpace: metrics.labelSpace
213 activeTrackColor: metrics.activeTrackColor
214 inactiveTrackColor: metrics.inactiveTrackColor
215 activeTickColor: metrics.activeTickColor
216 inactiveTickColor: metrics.inactiveTickColor
217 activeTrackOpacity: metrics.activeTrackOpacity
218 inactiveTrackOpacity: metrics.inactiveTrackOpacity
219 trackIconActiveStart: control.trackIconActiveStart
220 trackIconActiveEnd: control.trackIconActiveEnd
221 trackIconInactiveStart: control.trackIconInactiveStart
222 trackIconInactiveEnd: control.trackIconInactiveEnd
223 trackIconActiveColor: control.trackIconActiveColor
224 trackIconInactiveColor: control.trackIconInactiveColor
225 trackIconSize: metrics.trackIconSize
226 trackIconPadding: metrics.trackIconPadding
229 handle: MD.SliderHandle {
232 x: control.leftPadding + (control.horizontal ? control.visualPosition * (control.availableWidth - width) : (control.mirrored ? (control.availableWidth - metrics.labelSpace - width) / 2 : metrics.labelSpace + (control.availableWidth - metrics.labelSpace - width) / 2))
233 y: control.topPadding + (control.horizontal ? metrics.labelSpace + (control.availableHeight - metrics.labelSpace - height) / 2 : control.visualPosition * (control.availableHeight - height))
235 valueIndicatorText: control.valueIndicatorText
236 labelBehavior: control.labelBehavior
237 handleHasFocus: control.visualFocus
238 handlePressed: control.pressed
239 handleHovered: control.hovered
240 controlEnabled: control.enabled
241 horizontal: control.horizontal
242 mirrored: control.mirrored
243 controlWidth: control.width
244 controlHeight: control.height
245 activeHandleWidth: metrics.effectiveHandleWidth
246 handleHeight: metrics.handleHeight
247 handleContainerSize: metrics.handleContainerSize
248 handleColor: metrics.handleColor
249 handleOpacity: metrics.handleOpacity
250 valueIndicatorContainerColor: control.MD.Style.inverseSurfaceColor
251 valueIndicatorLabelColor: control.MD.Style.inverseOnSurfaceColor
Material Design 3 Expressive slider tokens.
qreal trackIconSizeMedium
qreal activeTrackHeightSmall
qreal activeHandleHeightExtraSmall
qreal activeTrackHeightExtraLarge
qreal trackIconPaddingExtraLarge
qreal activeTrackLeadingCornerRadiusSmall
qreal activeHandleHeightLarge
qreal activeHandleHeightMedium
QML_ANONYMOUSqreal activeTrackHeightExtraSmall
qreal activeHandleHeightSmall
qreal activeTrackLeadingCornerRadiusExtraLarge READ activeTrackLeadingCornerRadiusExtraLarge
qreal activeTrackHeightMedium
qreal trackIconSizeExtraLarge
qreal trackIconPaddingMedium
qreal trackIconPaddingLarge
qreal activeTrackHeightLarge
qreal valueIndicatorActiveBottomSpace
qreal activeTrackLeadingCornerRadiusLarge
qreal activeTrackLeadingCornerRadiusMedium
qreal activeHandleHeightExtraLarge
qreal activeTrackLeadingCornerRadiusExtraSmall READ activeTrackLeadingCornerRadiusExtraSmall