- Qt 5.5
- Qt Quick
- QML Types
- Shortcut QML Type
- Qt 5.5.1 Reference Documentation

# Shortcut QML Type

Provides keyboard shortcuts More...

Import Statement: | import QtQuick 2.5
Since: | Qt 5.5

- List of all members, including inherited members

## Properties

- autoRepeat : bool
- context : enumeration
- enabled : bool
- sequence : keysequence

## Signals

- activated()
- activatedAmbiguously()

## Detailed Description

The Shortcut type provides a way of handling keyboard shortcuts. The shortcut can be set to one of the standard keyboard shortcuts, or it can be described with a string containing a sequence of up to four key presses that are needed to activate the shortcut.

    Item {
        id: view

        property int currentIndex

        Shortcut {
            sequence: StandardKey.NextChild
            onActivated: view.currentIndex++
        }
    }

See also Keys.

## Property Documentation

autoRepeat : bool

This property holds whether the shortcut can auto repeat.

The default value is `true`.

context : enumeration

This property holds the shortcut context.

Supported values are:

- `Qt.WindowShortcut` (default) - The shortcut is active when its parent item is in an active top-level window.
- `Qt.ApplicationShortcut` - The shortcut is active when one of the application's windows are active.

    Shortcut {
        sequence: StandardKey.Quit
        context: Qt.ApplicationShortcut
        onActivated: Qt.quit()
    }

enabled : bool

This property holds whether the shortcut is enabled.

The default value is `true`.

sequence : keysequence

This property holds the shortcut's key sequence. The key sequence can be set to one of the standard keyboard shortcuts, or it can be described with a string containing a sequence of up to four key presses that are needed to activate the shortcut.

The default value is an empty key sequence.

    Shortcut {
        sequence: "Ctrl+E,Ctrl+W"
        onActivated: edit.wrapMode = TextEdit.Wrap
    }

## Signal Documentation

activated()

This signal is emitted when the shortcut is activated.

The corresponding handler is `onActivated`.

activatedAmbiguously()

This signal is emitted when the shortcut is activated ambigously, meaning that it matches the start of more than one shortcut.

The corresponding handler is `onActivatedAmbiguously`.