C
Slider QML Type
Used to select a value by sliding a handle along a track. More...
| Import Statement: | import QtQuick.Controls |
| Since: | Qt Quick Ultralite 1.0 |
| Inherits: |
- List of all members, including inherited members
- Slider is part of Input Controls.
Enumerations
Properties
- from : real
- handle : Item
- horizontal : bool
- orientation : Qt::Orientation
- position : real
- pressed : bool
- snapMode : SnapMode
- stepSize : real
- to : real
- value : real
- vertical : bool
- visualPosition : real
Signals
- moved()
Methods
- real valueAt(real position)
Detailed Description
Slider is used to select a value by sliding a handle along a track.
In the example below, custom from, value, and to values are set:
Slider { from: 1 value: 25 to: 100 }
The position property is expressed as a fraction of the control's size, in the range 0.0 - 1.0. The visualPosition is useful for positioning the handle when styling Slider.
See also Controls Styling and Input Controls.
Enumeration Documentation
SnapMode |
Provides a list of slider snap modes to choose from.
| Constant | Description |
|---|---|
Slider.NoSnap | The slider does not snap (default). |
Slider.SnapAlways | The slider snaps while the handle is dragged. |
Slider.SnapOnRelease | The slider does not snap while being dragged, but it snaps after the handle is released. |
Property Documentation
from : real |
handle : Item |
This property holds the handle item.
See also Controls Styling.
horizontal : bool |
This property holds whether the slider is horizontal.
See also orientation.
orientation : Qt::Orientation |
This property holds the orientation.
See also horizontal and vertical.
position : real |
This property holds the logical position of the handle.
The position is expressed as a fraction of the control's size, in the range 0.0 - 1.0.
See also value, visualPosition, and valueAt().
pressed : bool |
This property holds whether the slider is pressed by either touch, mouse, or keys.
snapMode : SnapMode |
This property holds the snap mode.
The snap mode determines how the slider handle behaves with regards to the stepSize.
In the following table, the various modes are illustrated with animations. The movement of the mouse cursor and the stepSize (0.2) are identical in each animation.
| Value | Example |
Slider.NoSnap | |
Slider.SnapAlways | |
Slider.SnapOnRelease |
See also stepSize.
stepSize : real |
This property holds the step size. The default value is 0.0.
to : real |
value : real |
This property holds the value in the range from - to. The default value is 0.0.
See also position.
vertical : bool |
This property holds whether the slider is vertical.
See also orientation.
visualPosition : real |
This property holds the visual position of the handle.
See also position.
Signal Documentation
moved() |
This signal is emitted when the slider has been interactively moved by the user.
Note: The corresponding handler is onMoved.
Method Documentation
Available under certain Qt licenses.
Find out more.