本页内容

XrVirtualMouse QML Type

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

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

Item

Status: Technology 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

指示虚拟鼠标是否已启用。当值为 true 时,虚拟鼠标会向场景中的 2D 对象发送鼠标事件。

leftMouseButton : bool

设置鼠标左键的状态。

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

middleMouseButton : bool

设置鼠标中键的状态。

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

rightMouseButton : bool

设置鼠标右键的状态。

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

scrollPixelDelta : real [default: 15]

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

当滚动速度为1时,即为滚动此距离。

另请参阅 scrollWheelX 和scrollWheelY 。

scrollTimerInterval : int [default: 30]

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

scrollWheelX : real

设置水平滚动速度。

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

另请参阅 scrollPixelDelta 。

scrollWheelY : real

设置垂直滚动速度。

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

另请参阅 scrollPixelDelta 。

source : Node

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

source 属性通常设置为XrController 。当source 节点的forward vector 与某个2D元素相交时,会在该位置生成鼠标事件。

view : XrView

与虚拟鼠标关联的 XR 视图。用于保持虚拟鼠标操作时的视图。

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