XrInputAction QML Type
代表来自输入控制器的操作。更多
Import Statement: | import QtQuick3D.Xr |
Since: | Qt 6.8 |
Inherits: | |
Status: | Technical Preview |
属性
- actionId : List<enumeration>
- actionName : string
- controller : enumeration
(since 6.10)
- enabled : bool
(since 6.9)
- pressed : bool
- value : real
信号
详细说明
操作可以是布尔操作(如按下按钮),也可以是模拟操作(如操纵杆轴)。
使用pressed 属性或triggered 信号可对布尔操作作出反应。模拟操作将设置value 属性。
注: 为方便起见,模拟属性也会设置pressed
属性并发出triggered
信号,而布尔属性在按下时会将value
设置为 1.0。
下面显示的是如何对右手握柄按下或手部追踪的右手捏手势做出反应:
XrInputAction { hand: XrInputAction.RightHand actionId: [XrInputAction.SqueezePressed, XrInputAction.SqueezeValue, XrInputAction.IndexFingerPinch] onTriggered: console.log("Do action here.") }
同时指定SqueezePressed
和SqueezeValue
的原因是,有些控制器有一个模拟手柄按钮,而有些控制器只有一个开/关手柄开关。
属性文档
actionId : List<enumeration> |
指定要作出反应的动作
持有一个 ID 列表,可以是以下值:
常量 | 说明 |
---|---|
XrInputAction.Button1Pressed | 按钮 1 已按下。布尔值。 |
XrInputAction.Button1Touched | 按钮 1 被触摸。布尔值。 |
XrInputAction.Button2Pressed | 按钮 2 被按下。布尔。 |
XrInputAction.Button2Touched | 按钮 2 被触碰。布尔。 |
XrInputAction.ButtonMenuPressed | 菜单按钮被按下。布尔。 |
XrInputAction.ButtonMenuTouched | 触摸菜单按钮。布尔。 |
XrInputAction.ButtonSystemPressed | 系统按钮被按下。布尔。 |
XrInputAction.ButtonSystemTouched | 系统按钮被触摸。布尔值。 |
XrInputAction.SqueezeValue | 手柄按钮按下的距离。模拟 |
XrInputAction.SqueezeForce | 施加到手柄按钮上的力。模拟。 |
XrInputAction.SqueezePressed | 手柄按钮被按下的程度。布尔值。 |
XrInputAction.TriggerValue | 触发按钮被按下的程度。模拟 |
XrInputAction.TriggerPressed | 触发器已按下。布尔值。 |
XrInputAction.TriggerTouched | 触发器被触动。布尔值。 |
XrInputAction.ThumbstickX | 拇指摇杆的 X 轴值。模拟 |
XrInputAction.ThumbstickY | 拇指摇杆的 Y 轴值。模拟。 |
XrInputAction.ThumbstickPressed | 拇指摇杆已按下。布尔值。 |
XrInputAction.ThumbstickTouched | 拇指摇杆被触碰。布尔值。 |
XrInputAction.ThumbrestTouched | 触碰拇指托。布尔值。 |
XrInputAction.TrackpadX | 触控板上的 X 轴位置。模拟 |
XrInputAction.TrackpadY | 触控板上的 Y 轴位置。模拟 |
XrInputAction.TrackpadForce | 施加在触控板上的力。模拟 |
XrInputAction.TrackpadTouched | 触控板被触碰。布尔值。 |
XrInputAction.TrackpadPressed | 触控板被按下。布尔。 |
XrInputAction.IndexFingerPinch | 拇指与食指捏合手势。布尔。 |
XrInputAction.MiddleFingerPinch | 拇指到中指的捏合手势。布尔。 |
XrInputAction.RingFingerPinch | 拇指掐无名指手势布尔。 |
XrInputAction.LittleFingerPinch | 拇指掐小指手势布尔手势 |
XrInputAction.HandTrackingMenuPress | 手部追踪菜单手势布尔。 |
controller : enumeration |
此输入操作将适用的控制器。
指定要作出反应的控制器。
它可以是
常量 | 说明 |
---|---|
XrInputAction.LeftController | |
XrInputAction.RightController | |
XrInputAction.Unknown | |
XrInputAction.LeftHand | (LeftController 的别名) |
XrInputAction.RightHand | (RightController 的别名 ) |
注: 在 Qt 6.9 中,此属性称为 "hand"。
此属性在 Qt 6.10 中引入。
enabled : bool |
该属性决定输入动作是否对事件做出反应。
此属性在 Qt 6.9 中引入。
pressed : bool |
表示输入操作当前是否已按下。
使用该属性可检查输入操作(如按钮)当前是否被按下。
value : real |
输入操作的模拟值。
对于模拟输入(如拇指杆位置),该属性保存输入值(通常范围为 [0,1])。
信号文档
triggered() |
该信号在布尔操作被激活时发出。这与pressed 属性设置为true
时同时发生。
注: 相应的处理程序是onTriggered
。
© 2025 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.