A slider lets the user select a value within a fixed range by sliding the slider's handle. More...
You can set up a slider by specifying the minimum and maximum values and the step size value between the minimum and maximum values. The user can set the slider's value by sliding the slider's handle along the slider. The smallest and biggest values the user can set are the slider's minimum and maximum values respectively. Other possible values are those calculated by adding the step size value once or more to the minimum value. For example, if the minimum value is 0, the maximum value is 100, and the step size value is 40, the values that the user can set are 0, 40, 80, and 100. All the numeric values of the slider are floating point values.
When the user drags the slider's handle the current value is updated. The value indicator is shown beside the handle when the user presses the slider's handle if the valueIndicatorVisible value is true. The value indicator shows the slider's current value if valueIndicatorText contains an empty string; otherwise the text of valueIndicatorText is shown. The valueChanged signal is emitted when the value of the slider changes.
In this example the user can select with the check boxes whether or not the slider's
Note: The inverted orientation is a Symbian-specific property.
CheckBox { id: valueIndToggle text: "Value indicator" checked: true } CheckBox { id: inversionToggle text: "Inverted" }
In the code snippet below the slider's maximum, minimum, and current values are set as well as the step size. Additionally the check boxes' checked values are bound to slider's valueIndicatorVisible and inverted values. When the slider value changes the application prints the "The 'valueChanged' signal." message on the screen.
Slider { id: slider1 maximumValue: 150 minimumValue: -150 value: 150 stepSize: 50 valueIndicatorVisible: valueIndToggle.checked inverted: inversionToggle.checked onValueChanged: { txtLog.text = txtLog.text + "The 'valueChanged' signal. <br>" } }
The title text shows that the slider is horizontal and it also shows the slider's current value in brackets.
Text { text: "Horizontal slider (" + slider1.value + ")" color: "white" }
The screenshot below illustrates the case where the user has selected the horizontal slider's value indicator to be visible. Then the user drags the slider's handle. The slider's current value is shown on the value indicator and also in the brackets after the 'Horizontal slider' text.
The application's vertical slider is configured the same as the horizontal slider with one exception: the orientation value is Qt.Vertical.
The screenshot below illustrates the case where the user has selected the vertical slider's value indicator to be visible and the slider to be inverted, so the minimum value is at the bottom of the slider. The slider's valueIndicatorText value is 'Volume'. When the user drags the slider's handle, the value indicator shows the 'Volume' text and the current value is shown in the brackets after the 'Vertical slider' text.
Symbian: The inverted property controls whether the slider shows its values as inverted.
If the inverted value is false,
If the inverted value is true,
The inverted value is false by default.
The orientation of the slider. Use Qt.Horizontal for left-right sliding and Qt.Vertical for up-down sliding. The default value is Qt.Horizontal.
While the user presses and holds the slider handle, the pressed value is true; otherwise false.
The current value of the slider. The position of the slider's handle indicates graphically the current value. The default value is 0.
If valueIndicatorText is an empty string, the sliders current value will be displayed when the user drags the slider handle. If you set valueIndicatorText to some value, that value will be shown when the user drags the slider handle. The value indicator is shown only if the valueIndicatorVisible value is true and the user presses the slider handle; otherwise the value indicator is not shown. The default value is an empty string.
See also valueIndicatorVisible.
Controls whether the value indicator is shown or not when the user presses the slider handle. The value indicator is shown only when the valueIndicatorVisible value is true and the user presses the slider handle; otherwise the value indicator is not shown. The default value is false.
See also valueIndicatorText.
Slider::valueChanged ( value ) |
Symbian: This signal is emitted when the value of the slider changes.