QAbstract3DInputHandler Class
输入处理程序实现的基类。更多...
| 头文件: | #include <QAbstract3DInputHandler> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS DataVisualization) target_link_libraries(mytarget PRIVATE Qt6::DataVisualization) |
| qmake: | QT += datavisualization |
| 自: | QtDataVisualization 1.0 |
| 在 QML 中: | AbstractInputHandler3D |
| 继承自: | QObject |
| 被继承类: | |
| 状态: | 已弃用 |
该类已弃用。我们强烈建议不要在新代码中使用它。
公共类型
| enum | InputView { InputViewNone, InputViewOnPrimary, InputViewOnSecondary } |
属性
- inputPosition : QPoint
- inputView : InputView
- scene : Q3DScene*
公共函数
| virtual | ~QAbstract3DInputHandler() |
| QPoint | inputPosition() const |
| QAbstract3DInputHandler::InputView | inputView() const |
| virtual void | mouseDoubleClickEvent(QMouseEvent *event) |
| virtual void | mouseMoveEvent(QMouseEvent *event, const QPoint &mousePos) |
| virtual void | mousePressEvent(QMouseEvent *event, const QPoint &mousePos) |
| virtual void | mouseReleaseEvent(QMouseEvent *event, const QPoint &mousePos) |
| Q3DScene * | scene() const |
| void | setInputPosition(const QPoint &position) |
| void | setInputView(QAbstract3DInputHandler::InputView inputView) |
| void | setScene(Q3DScene *scene) |
| virtual void | touchEvent(QTouchEvent *event) |
| virtual void | wheelEvent(QWheelEvent *event) |
信号
| void | inputViewChanged(QAbstract3DInputHandler::InputView view) |
| void | positionChanged(const QPoint &position) |
| void | sceneChanged(Q3DScene *scene) |
受保护函数
| QAbstract3DInputHandler(QObject *parent = nullptr) | |
| int | prevDistance() const |
| QPoint | previousInputPos() const |
| void | setPrevDistance(int distance) |
| void | setPreviousInputPos(const QPoint &position) |
详细说明
QAbstract3DInputHandler 是基类,各种输入处理实现类均继承自该基类,这些实现类负责接收输入事件并将其转换为摄像机和灯光的移动。输入处理程序还会将原始输入事件转换为场景中的切片和选择事件。
成员类型文档
enum QAbstract3DInputHandler::InputView
针对鼠标和触控输入处理程序的预定义输入视图。
| 常量 | 值 | 描述 |
|---|---|---|
QAbstract3DInputHandler::InputViewNone | 0 | 鼠标或触摸未位于视图上。 |
QAbstract3DInputHandler::InputViewOnPrimary | 1 | 在主视图区域接收到的鼠标或触摸输入。如果当inputView 变为InputViewOnPrimary时显示了次要视图,则关闭次要视图。 |
QAbstract3DInputHandler::InputViewOnSecondary | 2 | 在次要视图区域接收到鼠标或触摸输入。 |
属性文档
inputPosition : QPoint
该属性根据已处理的输入事件保存最后的输入位置。
访问函数:
| QPoint | inputPosition() const |
| void | setInputPosition(const QPoint &position) |
通知信号:
| void | positionChanged(const QPoint &position) |
inputView : InputView
该属性根据已处理的输入事件的视图,存储当前的枚举输入视图。
InputView 枚举值之一。
当视图发生变化时,将触发inputViewChanged 信号。
访问函数:
| QAbstract3DInputHandler::InputView | inputView() const |
| void | setInputView(QAbstract3DInputHandler::InputView inputView) |
通知信号:
| void | inputViewChanged(QAbstract3DInputHandler::InputView view) |
另请参阅 InputView 。
scene : Q3DScene*
该属性保存了此抽象输入处理器所控制的 3D 场景。
一个输入处理程序只能控制一个场景。将场景设置给输入处理程序不会转移该场景的所有权。
访问函数:
| Q3DScene * | scene() const |
| void | setScene(Q3DScene *scene) |
通知器信号:
| void | sceneChanged(Q3DScene *scene) |
成员函数文档
[explicit protected] QAbstract3DInputHandler::QAbstract3DInputHandler(QObject *parent = nullptr)
构建基类。可以提供一个可选的parent 参数,该参数随后将传递给QObject 构造函数。
[virtual noexcept] QAbstract3DInputHandler::~QAbstract3DInputHandler()
销毁基类。
[virtual] void QAbstract3DInputHandler::mouseDoubleClickEvent(QMouseEvent *event)
重写此方法以处理鼠标双击事件。鼠标双击事件由event 提供。
[virtual] void QAbstract3DInputHandler::mouseMoveEvent(QMouseEvent *event, const QPoint &mousePos)
重写此方法以处理鼠标移动事件。鼠标移动事件通过event 传递,鼠标位置通过mousePos 传递。
[virtual] void QAbstract3DInputHandler::mousePressEvent(QMouseEvent *event, const QPoint &mousePos)
重写此方法以处理鼠标按下事件。鼠标按下事件通过event 传入,鼠标位置通过mousePos 传入。
[virtual] void QAbstract3DInputHandler::mouseReleaseEvent(QMouseEvent *event, const QPoint &mousePos)
重写此方法以处理鼠标释放事件。鼠标释放事件通过event 传递,鼠标位置通过mousePos 传递。
[protected] int QAbstract3DInputHandler::prevDistance() const
返回最后两个输入位置之间的曼哈顿距离。
另请参阅 setPrevDistance()。
[protected] QPoint QAbstract3DInputHandler::previousInputPos() const
返回上一个输入位置。
另请参阅 setPreviousInputPos()。
[protected] void QAbstract3DInputHandler::setPrevDistance(int distance)
设置最后两个输入位置之间的distance (曼哈顿距离)。
另请参阅 prevDistance()。
[protected] void QAbstract3DInputHandler::setPreviousInputPos(const QPoint &position)
将上一次的输入位置设置为由 `position` 指定的点。
另请参阅 previousInputPos()。
[virtual] void QAbstract3DInputHandler::touchEvent(QTouchEvent *event)
重写此方法以处理触摸输入事件。触摸事件通过event 传递。
[virtual] void 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.