Qt3DInput::QMouseDevice Class

class Qt3DInput::QMouseDevice

将鼠标事件委托给附加的MouseHandler 对象。更多

Header: #include <QMouseDevice>
CMake: find_package(Qt6 REQUIRED COMPONENTS 3dinput)
target_link_libraries(mytarget PRIVATE Qt6::3dinput)
qmake: QT += 3dinput
在 QML 中: MouseDevice
继承: Qt3DInput::QAbstractPhysicalDevice
状态:已废弃

公共类型

enum Axis { X, Y, WheelX, WheelY }

属性

公共函数

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

重新实现的公共函数

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

公共插槽

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

信号

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

详细说明

QMouseDevice 将鼠标事件从物理鼠标设备委托给QMouseHandler 对象。鼠标的灵敏度可通过QMouseDevice::sensitivity 属性进行控制,该属性可指定逻辑鼠标坐标随鼠标物理移动而变化的速率。

另请参阅 QMouseHandler

成员类型文档

enum QMouseDevice::Axis

鼠标轴

常数
Qt3DInput::QMouseDevice::X0
Qt3DInput::QMouseDevice::Y1
Qt3DInput::QMouseDevice::WheelX2
Qt3DInput::QMouseDevice::WheelY3

另请参阅 Qt3DInput::QAnalogAxisInput::setAxis

属性文档

sensitivity : float

鼠标设备的灵敏度。默认为 0.1。

访问功能:

float sensitivity() const
void setSensitivity(float value)

提示信号:

void sensitivityChanged(float value)

updateAxesContinuously : bool

如果true ,则无论是否按下任何鼠标键,坐标轴都会随时更新。否则,只有按下其中一个鼠标按钮时,才会更新坐标轴。

默认值为false

访问功能:

bool updateAxesContinuously() const
void setUpdateAxesContinuously(bool updateAxesContinuously)

Notifier 信号:

void updateAxesContinuouslyChanged(bool updateAxesContinuously)

成员函数 文档

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

构建一个新的 QMouseDevice 实例,其父级parent

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

重实现:QAbstractPhysicalDevice::axisCount() 常量。

返回轴数。

注意: 目前总是返回 4。

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

重实现:QAbstractPhysicalDevice::axisIdentifier(const QString &name) const.

将轴name 转换为轴标识符。

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

重实现:QAbstractPhysicalDevice::axisNames() 常量。

返回轴的名称。

注意: 目前总是返回 StringList["X", "Y"]

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

重实现:QAbstractPhysicalDevice::buttonCount() 常量。

返回按钮计数。

注意: 目前总是返回 3。

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

重实现:QAbstractPhysicalDevice::buttonIdentifier(const QString &name) 常量。

返回与指定name 对应的按钮标识符。QMouseEvent::Buttons 中记录了可能的返回值。

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

重实现:QAbstractPhysicalDevice::buttonNames() 常量。

返回按钮的名称。

注意: 目前总是返回 StringList["左"、"右"、"中]

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