- Qt 6.8
- Qt Quick 3D
- QML Types
- QtQuick3D.Xr (Technical Preview)
- XrInputAction
- Qt Quick 3D | Commercial or GPLv3

# XrInputAction QML Type

Represents an action from an input controller. More...

Import Statement: | `import QtQuick3D.Xr`
Since: | Qt 6.8
Status: | Technical Preview

- List of all members, including inherited members

## Properties

- actionId : List<enumeration>
- actionName : string
- hand : enumeration
- pressed : bool
- value : real

## Signals

- triggered()

## Detailed Description

Actions can be boolean, such as a button press, or analog, such as a joystick axis.

Use the pressed property or the triggered signal to react to a boolean action. An analog action will set the value property.

Note: For convenience, an analog property will also set the `pressed` property and emit the `triggered` signal, while a boolean property will set `value` to 1.0 when pressed.

The following shows how to react to either the right hand grip being pressed or to a right hand pinch gesture from hand tracking:

     XrInputAction {
         hand: XrInputAction.RightHand
         actionId: [XrInputAction.SqueezePressed, XrInputAction.SqueezeValue, XrInputAction.IndexFingerPinch]
         onTriggered: console.log("Do action here.")
     }

The reason for specifying both `SqueezePressed` and `SqueezeValue` is that some controllers have an analog grip button, and some controllers just have an on/off grip switch.

## Property Documentation

actionId : List<enumeration>

Specifies the action(s) to react to

Holds a List of IDs that can be of the following values:

Constant | Description
--- | ---
`XrInputAction.Button1Pressed` | Button 1 is pressed. Boolean.
`XrInputAction.Button1Touched` | Button 1 is touched. Boolean.
`XrInputAction.Button2Pressed` | Button 2 is pressed. Boolean.
`XrInputAction.Button2Touched` | Button 2 is touched. Boolean.
`XrInputAction.ButtonMenuPressed` | The menu button is pressed. Boolean.
`XrInputAction.ButtonMenuTouched` | The menu button is touched. Boolean.
`XrInputAction.ButtonSystemPressed` | The system button is pressed. Boolean.
`XrInputAction.ButtonSystemTouched` | The system button is touched. Boolean.
`XrInputAction.SqueezeValue` | How far the grip button is pressed. Analog.
`XrInputAction.SqueezeForce` | The force applied to the grip button. Analog.
`XrInputAction.SqueezePressed` | The grip button is pressed. Boolean.
`XrInputAction.TriggerValue` | How far the trigger button is pressed. Analog.
`XrInputAction.TriggerPressed` | The trigger is pressed. Boolean.
`XrInputAction.TriggerTouched` | The trigger is touched. Boolean.
`XrInputAction.ThumbstickX` | The X-axis value of the thumbstick. Analog.
`XrInputAction.ThumbstickY` | The Y-axis value of the thumbstick. Analog.
`XrInputAction.ThumbstickPressed` | The thumbstick is pressed. Boolean.
`XrInputAction.ThumbstickTouched` | The thumbstick is touched. Boolean.
`XrInputAction.ThumbrestTouched` | The thumbrest is touched. Boolean.
`XrInputAction.TrackpadX` | The X-axis position on the trackpad. Analog.
`XrInputAction.TrackpadY` | The Y-axis position on the trackpad. Analog.
`XrInputAction.TrackpadForce` | The force applied on the trackpad. Analog.
`XrInputAction.TrackpadTouched` | The trackpad is touched. Boolean.
`XrInputAction.TrackpadPressed` | The trackpad is pressed. Boolean.
`XrInputAction.IndexFingerPinch` | Thumb to index finger pinch gesture. Boolean.
`XrInputAction.MiddleFingerPinch` | Thumb to middle finger pinch gesture. Boolean.
`XrInputAction.RingFingerPinch` | Thumb to ring finger pinch gesture. Boolean.
`XrInputAction.LittleFingerPinch` | Thumb to little finger pinch gesture. Boolean.
`XrInputAction.HandTrackingMenuPress` | Hand tracking menu gesture. Boolean.

actionName : string

The name of the input action.

Use this property to specify the name of the custom input action you want to react to. This property does not have an effect if actionId is set.

hand : enumeration

The Hand that this input action will apply to.

Specifies the hand ro react to.

It can be one of:

Constant | Value
--- | ---
`XrInputAction.LeftHand`
`XrInputAction.RightHand`
`XrInputAction.Unknown`

pressed : bool

Indicates whether the input action is currently pressed.

Use this property to check if the input action (for example, a button) is currently pressed.

value : real

The analog value of the input action.

For analog inputs, such as a thumbstick position, this property holds the value of the input (usually in the range [0, 1]).

## Signal Documentation

triggered()

This signal is emitted when a boolean action is activated. This happens at the same time as the pressed property is set to `true`.

Note: The corresponding handler is `onTriggered`.