XrVirtualMouse QML Type

将 3D 控制器输入映射到 2D 项目中的鼠标输入。更多

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

Item

Status: Technical Preview

属性

详细说明

XrVirtualMouse 提供了一种在 3D 场景中与2D 用户界面交互的方式。

它通常是这样使用的:

// XrView { id: xrView
// XrController { id: rightController
XrInputAction {
    id: rightTrigger
    hand: XrInputAction.RightHand
    actionId: [XrInputAction.TriggerPressed, XrInputAction.TriggerValue]
}
XrVirtualMouse {
    view: xrView
    source: rightController
    leftMouseButton: rightTrigger.pressed
}

属性文档

enabled : bool

表示虚拟鼠标是否启用。为真时,虚拟鼠标会向场景中的 2D 对象发送鼠标事件。


leftMouseButton : bool

设置鼠标左键的状态。

设置为 true 时,鼠标左键被按下。


middleMouseButton : bool

设置鼠标中键的状态。

设置为 true 时,鼠标中键被按下。


rightMouseButton : bool

设置鼠标右键的状态。

设置为 true 时,鼠标右键被按下。


scrollPixelDelta : real [default: 15]

定义每次滚动事件的基本滚动距离。

这是滚动速度为 1 时的滚动距离。

另请参阅 scrollWheelXscrollWheelY


scrollTimerInterval : int [default: 30]

以毫秒为单位定义发送到系统的滚动事件之间的时间。


scrollWheelX : real

设置水平滚动速度。

正值向右滚动,负值向左滚动。滚动速度随距离零点的远近而增加。

另请参阅 scrollPixelDelta


scrollWheelY : real

设置垂直滚动速度。

正值向上滚动,负值向下滚动。滚动速度随距离零点的远近而增加。

另请参见 scrollPixelDelta


source : Node

控制虚拟鼠标的 3D 节点。

source 属性通常设置为XrController 。在source 节点的forward vector 与 2D 项目相交的位置会产生鼠标事件。


view : XrView

与虚拟鼠标关联的 XR 视图。虚拟鼠标运行时的视图。


© 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.