Dial QML Type | Qt Labs Controls 5.6

Qt 5.6 | Qt Labs Controls | QML Types | Dial QML Type

Qt 5.6.2 Reference Documentation

# Dial QML Type

A circular dial that is rotated to set a value. More...

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

- List of all members, including inherited members

## Properties

- angle : real
- from : real
- handle : component
- position : real
- pressed : bool
- snapMode : enumeration
- stepSize : real
- to : real
- value : real

## Methods

- void decrease()
- void increase()

## Detailed Description

The Dial is similar to a traditional dial knob that is found on devices such as stereos or industrial equipment. It allows the user to specify a value within a range.

The value of the dial is set with the value property. The range is set with the from and to properties.

The dial can be manipulated with a keyboard. It supports the following actions:

Action | Key
--- | ---
Decrease value by stepSize | `Qt.Key_Left`
Decrease value by stepSize | `Qt.Key_Down`
Set value to from | `Qt.Key_Home`
Increase value by stepSize | `Qt.Key_Right`
Increase value by stepSize | `Qt.Key_Up`
Set value to to | `Qt.Key_End`

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

See also Customizing Dial and Input Controls.

## Property Documentation

[read-only] angle : real

This property holds the angle of the handle.

Like the position property, angle is continuously updated while the handle is dragged.

See also position.

from : real

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

See also to and value.

handle : component

This property holds the handle of the dial.

The handle acts as a visual indicator of the position of the dial.

See also Customizing Dial.

[read-only] position : real

This property holds the logical position of the handle.

The position is defined as a percentage of the control's angle range (the range within which the handle can be moved) scaled to `0.0 - 1.0`. Unlike the value property, the `position` is continuously updated while the handle is dragged.

See also value and angle.

pressed : bool

This property holds whether the dial is pressed.

The dial will be pressed when either the mouse is pressed over it, or a key such as `Qt.Key_Left` is held down. If you'd prefer not to have the dial be pressed upon key presses (due to styling reasons, for example), you can use the Keys attached property:

      Dial {
          Keys.onLeftPressed: {}
      }

This will result in pressed only being `true` upon mouse presses.

snapMode : enumeration

This property holds the snap mode.

The snap mode works with the stepSize to allow the handle to snap to certain points along the dial.

Possible values:

Constant | Description
--- | ---
`Dial.NoSnap` | The dial does not snap (default).
`Dial.SnapAlways` | The dial snaps while the handle is dragged.
`Dial.SnapOnRelease` | The dial 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, increase(), and decrease().

to : real

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

See also from and value.

value : real

This property holds the value in the range `from` - `to`. The default value is `0.0`.

Unlike the position property, the `value` is not updated while the handle is dragged. The value is updated after the value has been chosen and the dial has been released.

See also position.

## Method Documentation

void decrease()

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

See also stepSize.

void increase()

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

See also stepSize.