XrInputAction QML Type

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

Import Statement: import QtQuick3D.Xr
Since: Qt 6.8
Inherits:

Item

Status: Technical Preview

Properties

Signals

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:

ConstantDescription
XrInputAction.Button1PressedButton 1 is pressed. Boolean.
XrInputAction.Button1TouchedButton 1 is touched. Boolean.
XrInputAction.Button2PressedButton 2 is pressed. Boolean.
XrInputAction.Button2TouchedButton 2 is touched. Boolean.
XrInputAction.ButtonMenuPressedThe menu button is pressed. Boolean.
XrInputAction.ButtonMenuTouchedThe menu button is touched. Boolean.
XrInputAction.ButtonSystemPressedThe system button is pressed. Boolean.
XrInputAction.ButtonSystemTouchedThe system button is touched. Boolean.
XrInputAction.SqueezeValueHow far the grip button is pressed. Analog.
XrInputAction.SqueezeForceThe force applied to the grip button. Analog.
XrInputAction.SqueezePressedThe grip button is pressed. Boolean.
XrInputAction.TriggerValueHow far the trigger button is pressed. Analog.
XrInputAction.TriggerPressedThe trigger is pressed. Boolean.
XrInputAction.TriggerTouchedThe trigger is touched. Boolean.
XrInputAction.ThumbstickXThe X-axis value of the thumbstick. Analog.
XrInputAction.ThumbstickYThe Y-axis value of the thumbstick. Analog.
XrInputAction.ThumbstickPressedThe thumbstick is pressed. Boolean.
XrInputAction.ThumbstickTouchedThe thumbstick is touched. Boolean.
XrInputAction.ThumbrestTouchedThe thumbrest is touched. Boolean.
XrInputAction.TrackpadXThe X-axis position on the trackpad. Analog.
XrInputAction.TrackpadYThe Y-axis position on the trackpad. Analog.
XrInputAction.TrackpadForceThe force applied on the trackpad. Analog.
XrInputAction.TrackpadTouchedThe trackpad is touched. Boolean.
XrInputAction.TrackpadPressedThe trackpad is pressed. Boolean.
XrInputAction.IndexFingerPinchThumb to index finger pinch gesture. Boolean.
XrInputAction.MiddleFingerPinchThumb to middle finger pinch gesture. Boolean.
XrInputAction.RingFingerPinchThumb to ring finger pinch gesture. Boolean.
XrInputAction.LittleFingerPinchThumb to little finger pinch gesture. Boolean.
XrInputAction.HandTrackingMenuPressHand 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.


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 : float

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.


© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.