- Qt 6.11
- Qt Quick 3D
- QML Types
- QtQuick3D.Xr (Technology Preview)
- XrVirtualMouse
- Qt Quick 3D | Commercial or GPLv3

# XrVirtualMouse QML Type

Maps 3D controller input to mouse input in 2D items. More...

Import Statement: | `import QtQuick3D.Xr`
Since: | Qt 6.8
Inherits: | Item
Status: | Technology Preview

- List of all members, including inherited members

## Properties

- enabled : bool
- leftMouseButton : bool
- middleMouseButton : bool
- rightMouseButton : bool
- scrollPixelDelta : real
- scrollTimerInterval : int
- scrollWheelX : real
- scrollWheelY : real
- source : Node
- view : XrView

## Detailed Description

The XrVirtualMouse provides a way to interact with 2D user interfaces in the 3D scene.

It is typically used like this:

     // 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
     }

## Property Documentation

### enabled : bool

Indicates whether the virtual mouse is enabled. When true, the virtual mouse sends mouse events to 2D objects in the scene.

### leftMouseButton : bool

Sets the state of the left mouse button.

When set to true, the left mouse button is pressed.

### middleMouseButton : bool

Sets the state of the middle mouse button.

When set to true, the middle mouse button is pressed.

### rightMouseButton : bool

Sets the state of the right mouse button.

When set to true, the right mouse button is pressed.

### scrollPixelDelta : real `[default: 15]`

Defines the base distance scrolled with each scrolling event.

This is the distance scrolled when the scrolling speed is 1.

See also scrollWheelX and scrollWheelY.

### scrollTimerInterval : int `[default: 30]`

Defines time in milliseconds between scrolling events sent to the system.

### scrollWheelX : real

Sets the horizontal scrolling speed.

Positive values scroll right and negative values scroll left. Scroll speed increases relative to distance from zero.

See also scrollPixelDelta.

### scrollWheelY : real

Sets the vertical scrolling speed.

Positive values scroll up and negative values scroll down. Scroll speed increases relative to distance from zero.

See also scrollPixelDelta.

### source : Node

The 3D node controlling the virtual mouse.

The `source` property is normally set to an XrController. Mouse events are generated for the position where the forward vector of the `source` node intersects with a 2D item.

### view : XrView

The XR view associated with the virtual mouse. Holds the view in which the virtual mouse operates.