RangeSlider QML Type

A slider control used to select a range of values. More...

Import Statement: import Qt.labs.controls 1.0
Inherits:

Control

Properties

Methods

Detailed Description

RangeSlider is used to select a range specified by two values, by sliding each handle along a track.

A range slider in its normal state.

A range slider whose first handle has active focus.

A range slider whose second handle has active focus.

A range slider that is disabled.
RangeSlider {
    first.value: 0.25
    second.value: 0.75
}

Note: Types in the Qt.labs module are not guaranteed to remain compatible in future versions.

See also Customizing RangeSlider and Input Controls.

Property Documentation

first.value : real

Property Description
value This property holds the value of the first handle in the range from - to.

If to is greater than from, the value of the first handle must be greater than the second, and vice versa.

Unlike position, value is not updated while the handle is dragged, but rather when it has been released.

The default value is 0.0.

handle This property holds the first handle item.
visualPosition This property holds the visual position of the first handle.

The position is defined as a percentage of the control's size, scaled to 0.0 - 1.0. When the control is mirrored, the value is equal to 1.0 - position. This makes the value suitable for visualizing the slider, taking right-to-left support into account.

position This property holds the logical position of the first handle.

The position is defined as a percentage of the control's size, scaled to 0.0 - 1.0. Unlike value, position is continuously updated while the handle is dragged. For visualizing a slider, the right-to-left aware visualPosition should be used instead.

pressed This property holds whether the first handle is pressed.

See also first.increase() and first.decrease().

from : real

This property holds the starting value for the range. The default value is 0.0.

See also to, first.value, and second.value.

orientation : enumeration

This property holds the orientation.

Possible values:

Constant Description
Qt.Horizontal Horizontal (default)
Qt.Vertical Vertical

second.value : real

Property Description
value This property holds the value of the second handle in the range from - to.

If to is greater than from, the value of the first handle must be greater than the second, and vice versa.

Unlike position, value is not updated while the handle is dragged, but rather when it has been released.

The default value is 0.0.

handle This property holds the second handle item.
visualPosition This property holds the visual position of the second handle.

The position is defined as a percentage of the control's size, scaled to 0.0 - 1.0. When the control is mirrored, the value is equal to 1.0 - position. This makes the value suitable for visualizing the slider, taking right-to-left support into account.

position This property holds the logical position of the second handle.

The position is defined as a percentage of the control's size, scaled to 0.0 - 1.0. Unlike value, position is continuously updated while the handle is dragged. For visualizing a slider, the right-to-left aware visualPosition should be used instead.

pressed This property holds whether the second handle is pressed.

See also second.increase() and second.decrease().

snapMode : enumeration

This property holds the snap mode.

Possible values:

Constant Description
RangeSlider.NoSnap The slider does not snap (default).
RangeSlider.SnapAlways The slider snaps while the handle is dragged.
RangeSlider.SnapOnRelease The slider does not snap while being dragged, but only after the handle is released.

See also stepSize.

stepSize : real

This property holds the step size. The default value is 0.0.

See also snapMode, first.increase(), and first.decrease().

to : real

This property holds the end value for the range. The default value is 1.0.

See also from, first.value, and second.value.

track : Item

This property holds the track item.

See also Customizing Slider.

Method Documentation

void first.decrease()

Decreases the value of the handle by stepSize, or 0.1 if stepSize is not defined.

See also first.

void first.increase()

Increases the value of the handle by stepSize, or 0.1 if stepSize is not defined.

See also first.

void second.decrease()

Decreases the value of the handle by stepSize, or 0.1 if stepSize is not defined.

See also second.

void second.increase()

Increases the value of the handle by stepSize, or 0.1 if stepSize is not defined.

See also second.

void setValues(real firstValue, real secondValue)

Sets first.value and second.value with the given arguments.

If to is larger than from and firstValue is larger than secondValue, firstValue will be clamped to secondValue.

If from is larger than to and secondValue is larger than firstValue, secondValue will be clamped to firstValue.

This function may be necessary to set the first and second values after the control has been completed, as there is a circular dependency between firstValue and secondValue which can cause assigned values to be clamped to each other.

See also stepSize.

© The Qt Company Ltd
Licensed under the GNU Free Documentation License, Version 1.3.
https://doc.qt.io/archives/qt-5.6/qml-qt-labs-controls-rangeslider.html