Q3DInputHandler Class
基于滚轮鼠标的基本输入处理程序。更多...
| 标题: | #include <Q3DInputHandler> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS DataVisualization) target_link_libraries(mytarget PRIVATE Qt6::DataVisualization) |
| qmake: | QT += datavisualization |
| 自: | QtDataVisualization 1.0 |
| 在 QML 中: | InputHandler3D |
| 继承自: | QAbstract3DInputHandler |
| 被继承类: | |
| 状态: | 已弃用 |
该类已弃用。我们强烈建议不要在新代码中使用它。
属性
(since QtDataVisualization 1.2)rotationEnabled : bool(since QtDataVisualization 1.2)selectionEnabled : bool(since QtDataVisualization 1.2)zoomAtTargetEnabled : bool(since QtDataVisualization 1.2)zoomEnabled : bool
公共函数
| Q3DInputHandler(QObject *parent = nullptr) | |
| virtual | ~Q3DInputHandler() |
| bool | isRotationEnabled() const |
| bool | isSelectionEnabled() const |
| bool | isZoomAtTargetEnabled() const |
| bool | isZoomEnabled() const |
| void | setRotationEnabled(bool enable) |
| void | setSelectionEnabled(bool enable) |
| void | setZoomAtTargetEnabled(bool enable) |
| void | setZoomEnabled(bool enable) |
重新实现的公共函数
| virtual void | mouseMoveEvent(QMouseEvent *event, const QPoint &mousePos) override |
| virtual void | mousePressEvent(QMouseEvent *event, const QPoint &mousePos) override |
| virtual void | mouseReleaseEvent(QMouseEvent *event, const QPoint &mousePos) override |
| virtual void | wheelEvent(QWheelEvent *event) override |
信号
| void | rotationEnabledChanged(bool enable) |
| void | selectionEnabledChanged(bool enable) |
| void | zoomAtTargetEnabledChanged(bool enable) |
| void | zoomEnabledChanged(bool enable) |
详细说明
Q3DInputHandler 是用于滚轮鼠标类型输入设备的基本输入处理程序。
默认输入处理程序具有以下功能:
| 鼠标操作 | 操作 |
|---|---|
| 按住右键拖动 | 在Q3DCamera 中设定的限制范围内旋转图形。 |
| 左键单击 | 选择光标下的项目;若无项目则取消选择。根据selection mode 的设置,可能会打开次要视图。 |
| 鼠标滚轮 | 在为Q3DCamera 设置的允许缩放范围内放大/缩小。 |
| 当辅助视图可见时,在主视图上单击左键 | 关闭辅助视图。 注意:次 视图仅适用于Q3DBars 和Q3DSurface 图表。 |
可通过此类对应的属性分别禁用旋转、缩放和选择功能。
属性文档
[since QtDataVisualization 1.2] rotationEnabled : bool
该属性用于指定此输入处理程序是否允许图形旋转。
默认值为true 。
该枚举类型自 QtDataVisualization 1.2 版本起引入。
访问函数:
| bool | isRotationEnabled() const |
| void | setRotationEnabled(bool enable) |
通知信号:
| void | rotationEnabledChanged(bool enable) |
[since QtDataVisualization 1.2] selectionEnabled : bool
该属性用于指定此输入处理程序是否允许从图中进行选择。
默认值为true 。
该枚举类型在 QtDataVisualization 1.2 中引入。
访问函数:
| bool | isSelectionEnabled() const |
| void | setSelectionEnabled(bool enable) |
通知器信号:
| void | selectionEnabledChanged(bool enable) |
[since QtDataVisualization 1.2] zoomAtTargetEnabled : bool
该属性控制缩放操作是否应更改摄像机目标,以便在缩放后,图表中被放大的点仍保持在原位置。
默认值为true 。
该枚举在 QtDataVisualization 1.2 中引入。
访问函数:
| bool | isZoomAtTargetEnabled() const |
| void | setZoomAtTargetEnabled(bool enable) |
通知器信号:
| void | zoomAtTargetEnabledChanged(bool enable) |
[since QtDataVisualization 1.2] zoomEnabled : bool
该属性用于指定此输入处理程序是否允许对图表进行缩放。
默认值为true 。
该枚举类型在 QtDataVisualization 1.2 中引入。
访问函数:
| bool | isZoomEnabled() const |
| void | setZoomEnabled(bool enable) |
通知器信号:
| void | zoomEnabledChanged(bool enable) |
成员函数文档
[explicit] Q3DInputHandler::Q3DInputHandler(QObject *parent = nullptr)
构建基本的鼠标输入处理程序。可以提供一个可选的parent 参数,该参数随后将传递给QObject 构造函数。
[virtual noexcept] Q3DInputHandler::~Q3DInputHandler()
销毁输入处理程序。
[override virtual] void Q3DInputHandler::mouseMoveEvent(QMouseEvent *event, const QPoint &mousePos)
重写:QAbstract3DInputHandler::mouseMoveEvent (QMouseEvent *event, const QPoint &mousePos)。
重写此函数以更改鼠标移动事件的处理方式。鼠标移动事件通过event 传递,鼠标位置通过mousePos 传递。
[override virtual] void Q3DInputHandler::mousePressEvent(QMouseEvent *event, const QPoint &mousePos)
重写自:QAbstract3DInputHandler::mousePressEvent(QMouseEvent *event, const QPoint &mousePos)。
重写此函数以更改鼠标按下事件的处理方式。鼠标按下事件通过 `event ` 传递,鼠标位置通过 `mousePos` 传递。
[override virtual] void Q3DInputHandler::mouseReleaseEvent(QMouseEvent *event, const QPoint &mousePos)
重写:QAbstract3DInputHandler::mouseReleaseEvent(QMouseEvent *event, const QPoint &mousePos)。
重写此函数可更改鼠标释放事件的处理方式。鼠标释放事件通过 `event ` 传递,鼠标位置通过 `mousePos` 传递。
[override virtual] void Q3DInputHandler::wheelEvent(QWheelEvent *event)
重写自:QAbstract3DInputHandler::wheelEvent(QWheelEvent *event)。
重写此方法可更改滚轮事件的处理方式。滚轮事件通过event 传递。
© 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.