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
继承于:

Q3DInputHandler

公共类型

enum InputView { InputViewNone, InputViewOnPrimary, InputViewOnSecondary }

属性

公共功能

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::InputViewNone0鼠标或触摸不在视图上。
QAbstract3DInputHandler::InputViewOnPrimary1在主视图区域接收到的鼠标或触摸输入。如果在inputView 变为 InputViewOnPrimary 时显示了辅助视图,辅助视图将被关闭。
QAbstract3DInputHandler::InputViewOnSecondary2辅助视图区域接收到的鼠标或触摸输入。

属性文档

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)

Notifier 信号:

void inputViewChanged(QAbstract3DInputHandler::InputView view)

另请参阅 InputView

scene : Q3DScene*

此属性表示此抽象输入处理程序正在控制的 3D 场景。

一个输入处理程序可以控制一个场景。将场景设置给输入处理程序并不会转移场景的所有权。

访问功能

Q3DScene *scene() const
void setScene(Q3DScene *scene)

Notifier 信号:

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 中给出。

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