Slider QML Type
Slider is a component to select a value from a continuous range of values. More...
Import Statement: | import Ubuntu.Components 1.2 |
Inherits: |
Properties
- activeFocusOnPress : bool
- live : bool
- maximumValue : real
- minimumValue : real
- pressed : bool
- style : Component
- value : real
Signals
- touched(bool onThumb)
Methods
- formatValue(v)
Detailed Description
The slider's sensing area is defined by the width and height, therefore styles should take this into account when defining the visuals, and alter these values to align the graphics' sizes.
See also the Design Guidelines on Sliders.
Example:
Item { Slider { function formatValue(v) { return v.toFixed(2) } minimumValue: -3.14 maximumValue: 3.14 value: 0.0 live: true } }
Property Documentation
The property specifies whether the StyledItem can gain focus on a mouse press/touch or not. When the value is true, the focus will be set on the component when the mouse is pressed over it or touched. However if one of the component's ancestor StyledItem or derived is having the property value false, the focus will not be gained automatically.
In the following example the TextField will stay focused when clicked on the red rectangle.
import QtQuick 2.4 import Ubuntu.Components 1.2 Column { width: units.gu(50) height: units.gu(100) StyledItem { objectName: "passiveScope" width: parent.width height: units.gu(30) Rectangle { anchors.fill: parent color: "red" StyledItem { objectName: "activeScope" activeFocusOnPress: true anchors.fill: parent } } } TextField { id: input text: "The input stays focus even if red box is clicked" } Component.onCompleted: input.forceActiveFocus() Connections { target: window onActiveFocusItemChanged: console.debug("focus on", window.activeFocusItem) } }
The default value is false
.
This QML property was introduced in Ubuntu.Components 1.1.
Defines whether the value is updated while the thumb is dragged or just when the thumb is released.
The maximum value from the continuous range of values. If this value is lesser than minimumValue, the component will be in an inconsistent state.
The minimum value from the continuous range of values. If this value is greater than maximumValue, the component will be in an inconsistent state.
style : Component |
Component instantiated immediately and placed below everything else.
The current value of the slider. This property is not changed while the thumb is dragged unless the live property is set to true.
Signal Documentation
The signal is emitted when there is a click on the slider. The onThumb parameter provides information if the click, was inside of the thumb element.
Method Documentation
This function is used by the value indicator to show the current value. Reimplement this function if you want to show different information. By default, the value v is rounded to the nearest interger value.