- Qt 6.7
- Qt 3D
- C++ Classes
- Qt3DInput
- QMouseDevice
- Qt 6.7.3 Reference Documentation

# QMouseDevice Class

class Qt3DInput::QMouseDevice

Delegates mouse events to the attached MouseHandler objects. More...

Header: | #include <QMouseDevice>
CMake: | find_package(Qt6 REQUIRED COMPONENTS 3dinput) target_link_libraries(mytarget PRIVATE Qt6::3dinput)
qmake: | QT += 3dinput
Instantiated By: | MouseDevice
Inherits: | Qt3DInput::QAbstractPhysicalDevice

- List of all members, including inherited members

## Public Types

enum | Axis { X, Y, WheelX, WheelY }

## Properties

- sensitivity : float
- updateAxesContinuously : bool

## Public Functions

| QMouseDevice(Qt3DCore::QNode *parent = nullptr)
float | sensitivity() const
bool | updateAxesContinuously() const

## Reimplemented Public Functions

virtual int | axisCount() const override
virtual int | axisIdentifier(const QString &name) const override
virtual QStringList | axisNames() const override
virtual int | buttonCount() const override
virtual int | buttonIdentifier(const QString &name) const override
virtual QStringList | buttonNames() const override

## Public Slots

void | setSensitivity(float value)
void | setUpdateAxesContinuously(bool updateAxesContinuously)

## Signals

void | sensitivityChanged(float value)
void | updateAxesContinuouslyChanged(bool updateAxesContinuously)

## Detailed Description

A QMouseDevice delegates mouse events from physical mouse device to QMouseHandler objects. The sensitivity of the mouse can be controlled with the QMouseDevice::sensitivity property, which specifies the rate in which the logical mouse coordinates change in response to physical movement of the mouse.

See also QMouseHandler.

## Member Type Documentation

### enum QMouseDevice::Axis

The mouse axis.

Constant | Value
--- | ---
`Qt3DInput::QMouseDevice::X` | `0`
`Qt3DInput::QMouseDevice::Y` | `1`
`Qt3DInput::QMouseDevice::WheelX` | `2`
`Qt3DInput::QMouseDevice::WheelY` | `3`

See also Qt3DInput::QAnalogAxisInput::setAxis.

## Property Documentation

### sensitivity : float

Holds the sensitivity of the mouse device. The default is 0.1.

Access functions:

float | sensitivity() const
void | setSensitivity(float value)

Notifier signal:

void | sensitivityChanged(float value)

### updateAxesContinuously : bool

If `true`, axes will be updated anytime they change regardless of whether any mouse button is being pressed. Otherwise, axes are updated only when one of the mouse buttons is being pressed.

The default value is `false`.

Access functions:

bool | updateAxesContinuously() const
void | setUpdateAxesContinuously(bool updateAxesContinuously)

Notifier signal:

void | updateAxesContinuouslyChanged(bool updateAxesContinuously)

## Member Function Documentation

### `[explicit]` QMouseDevice::QMouseDevice(Qt3DCore::QNode *parent = nullptr)

Constructs a new QMouseDevice instance with parent parent.

### `[override virtual]` int QMouseDevice::axisCount() const

Reimplements: QAbstractPhysicalDevice::axisCount() const.

Returns the axis count.

Note: Currently always returns 4.

### `[override virtual]` int QMouseDevice::axisIdentifier(const QString &name) const

Reimplements: QAbstractPhysicalDevice::axisIdentifier(const QString &name) const.

Convert axis name to axis identifier.

### `[override virtual]` QStringList QMouseDevice::axisNames() const

Reimplements: QAbstractPhysicalDevice::axisNames() const.

Returns the names of the axis.

Note: Currently always returns StringList["X", "Y"]

### `[override virtual]` int QMouseDevice::buttonCount() const

Reimplements: QAbstractPhysicalDevice::buttonCount() const.

Returns the button count.

Note: Currently always returns 3.

### `[override virtual]` int QMouseDevice::buttonIdentifier(const QString &name) const

Reimplements: QAbstractPhysicalDevice::buttonIdentifier(const QString &name) const.

Returns the button identifier that corresponds with the specified name. The possible return values are documented in QMouseEvent::Buttons.

### `[override virtual]` QStringList QMouseDevice::buttonNames() const

Reimplements: QAbstractPhysicalDevice::buttonNames() const.

Returns the names of the buttons.

Note: Currently always returns StringList["Left", "Right", "Center"]