- Qt 5.3
- Qt Quick Controls
- QML Types
- SpinBox QML Type
- Qt 5.3.2 Reference Documentation

# SpinBox QML Type

Provides a spin box control. More...

Import Statement: | `import QtQuick.Controls 1.2`
Since: | Qt 5.1

- List of all members, including inherited members

## Properties

- activeFocusOnPress : bool
- decimals : int
- font : font
- horizontalAlignment : int
- hovered : bool
- maximumValue : real
- minimumValue : real
- prefix : string
- stepSize : real
- style : Component
- suffix : string
- value : real

## Signals

- editingFinished()

## Detailed Description

SpinBox allows the user to choose a value by clicking the up or down buttons, or by pressing up or down on the keyboard. The user can also type the value in manually.

By default the SpinBox provides discrete values in the range [0-99] with a stepSize of 1 and 0 decimals.

    SpinBox {
        id: spinbox
    }

Note that if you require decimal values you will need to set the decimals to a non 0 value.

    SpinBox {
        id: spinbox
        decimals: 2
    }

## Property Documentation

activeFocusOnPress : bool

This property indicates whether the Spinbox should get active focus when pressed. The default value is `true`.

decimals : int

This property indicates the amount of decimals. Note that if you enter more decimals than specified, they will be truncated to the specified amount of decimal places. The default value is `0`.

font : font

This property indicates the current font used by the SpinBox.

horizontalAlignment : int

This property indicates how the content is horizontally aligned within the text field.

The supported values are:

- Qt.AlignLeft
- Qt.AlignHCenter
- Qt.AlignRight

The default value is style dependent.

This QML property was introduced in QtQuick.Controls 1.1.

read-onlyhovered : bool

This property indicates whether the control is being hovered.

maximumValue : real

The maximum value of the SpinBox range. The value is clamped to this value. If maximumValue is smaller than minimumValue, minimumValue will be enforced.

The default value is `99`.

minimumValue : real

The minimum value of the SpinBox range. The value is clamped to this value.

The default value is `0.0`.

prefix : string

The prefix for the value. I.e "$"

stepSize : real

The amount by which the value is incremented/decremented when a spin button is pressed.

The default value is `1.0`.

style : Component

The style Component for this control.

See also Qt Quick Controls Styles QML Types.

suffix : string

The suffix for the value. I.e "cm"

value : real

The value of this SpinBox, clamped to minimumValue and maximumValue.

The default value is `0.0`.

## Signal Documentation

editingFinished()

This signal is emitted when the Return or Enter key is pressed or the control loses focus. Note that if there is a validator set on the control and enter/return is pressed, this signal will only be emitted if the validator returns an acceptable state.

The corresponding handler is `onEditingFinished`.

This QML signal was introduced in QtQuick.Controls 1.1.