API Documentation

Documentation for developing SailfishOS applications

Slider QML Type

A horizontal slider More...

Import Statement: import Sailfish.Silica 1.0


Detailed Description

The Slider type provides a horizontal slider.

A slider enables the user to drag a handle along a line to select a particular value within a specific range of values.

Here is a simple slider:

 import Sailfish.Silica 1.0

 Slider {
     width: parent.width
     minimumValue: 100
     maximumValue: 200
     value: 150

The Slider may be used to indicate progress by setting the enabled property to false to prevent user input.

Slider inherits the QtQuick MouseArea type, so any properties, signals and methods of MouseArea are also available to Slider objects. See the MouseArea documentation for its full list of available properties, signals and methods.

Property Documentation

animateValue : bool

Set animateValue to false when you don't want the slider to animate the value changes.

down : bool

This property is true when the slider is pressed.

enabled : bool

If true (default) user can interact with the Slider by touching or dragging on the Slider.

If false, the user cannot interact with the Slider. This is useful for sliders that only indicate progress and should not be interactive.

handleVisible : bool

Displays a handle at the current value if true (default); otherwise no handle will be displayed and only the highlighted slider bar will be shown.

highlighted : bool

This property determines whether the slider is shown highlighted. By default it is bound to down.

label : string

The label to display under the slider. This text usually describes the function of the Slider.

See also valueText.

maximumValue : real

The maximum value of of the slider (default: 1.0).

minimumValue : real

The minimum value of of the slider (default: 0.0)

[read-only] sliderValue : real

The current value of the slider displayed in the bar, i.e. bounded by the minimum and maximum values.

See also value.

stepSize : real

The increment by which the value may be incremented/decremented. A stepSize of 0 (the default) will allow the value to be adjusted freely.

The stepSize increments are relative to the minimumValue, e.g. a stepSize of 0.5 and a minimumValue of 0.25 results in a valid sequence of 0.25, 0.75, 1.25, ...

Note this only restricts the values set by dragging the visual handle; it does not restrict the values set through the value property.

value : real

The current value of of the slider.

It is possible to set the value outside the bounds; however, the sliderValue will always be set to a valid value.

See also sliderValue.

valueText : string

Holds to text to display above the current value. This text usually represents the value of the Slider.

 import Sailfish.Silica 1.0

 Slider {
     minimumValue: 100
     maximumValue: 200
     value: 150
     valueText: "$" + value

See also label.

We use cookies to improve your user experience and to help us to develop our services. By continuing to browse the site, you approve of our use of cookies.