Qt3DInput::QMouseDevice Class
class Qt3DInput::QMouseDevice将鼠标事件委托给关联的MouseHandler 对象。更多内容...
| 标题: | #include <qmousedevice.h> |
| 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 } |
属性
- sensitivity : float
- updateAxesContinuously : bool
公共函数
| 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::X | 0 |
Qt3DInput::QMouseDevice::Y | 1 |
Qt3DInput::QMouseDevice::WheelX | 2 |
Qt3DInput::QMouseDevice::WheelY | 3 |
属性文档
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) |
通知信号:
| void | updateAxesContinuouslyChanged(bool updateAxesContinuously) |
成员函数文档
[explicit] QMouseDevice::QMouseDevice(Qt3DCore::QNode *parent = nullptr)
创建一个新的 QMouseDevice 实例,其父对象为parent 。
[override virtual] int QMouseDevice::axisCount() const
重写:QAbstractPhysicalDevice::axisCount() const。
返回轴数。
注意:目前 始终返回 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() const。
返回轴的名称。
注意:目前 始终返回 StringList["X", "Y"]
[override virtual] int QMouseDevice::buttonCount() const
重写了:QAbstractPhysicalDevice::buttonCount() const。
返回按钮的数量。
注意:目前 始终返回 3。
[override virtual] int QMouseDevice::buttonIdentifier(const QString &name) const
重写了:QAbstractPhysicalDevice::buttonIdentifier(const QString &name) const。
返回与指定的name 对应的按钮标识符。可能的返回值在QMouseEvent::Buttons 中有详细说明。
[override virtual] QStringList QMouseDevice::buttonNames() const
重写:QAbstractPhysicalDevice::buttonNames() const。
返回按钮的名称。
注意:目前 始终返回 StringList["Left", "Right", "Center"]
© 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.