QAbstract3DInputHandler Class

The base class for implementations of 3D input handlers. 更多...

头: #include <QAbstract3DInputHandler>
CMake: find_package(Qt6 REQUIRED COMPONENTS Graphs)
target_link_libraries(mytarget PRIVATE Qt6::Graphs)
qmake: QT += graphs
实例化: AbstractInputHandler3D
继承: QObject
继承者:

Q3DInputHandler

状态: 技术预览

公共类型

enum class InputView { None, OnPrimary, OnSecondary }

特性

公共函数

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 , bool forceSelection = false)
void setInputView (QAbstract3DInputHandler::InputView inputView )
void setScene (Q3DScene * scene )
virtual void touchEvent (QTouchEvent * event )
virtual void wheelEvent (QWheelEvent * event )

公共槽

void handleSelection (const QPoint & position )

信号

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 is the base class that is subclassed by different input handling implementations that take input events and translate those to camera and light movements. Input handlers also translate raw input events to slicing and selection events in the scene.

成员类型文档编制

enum class QAbstract3DInputHandler:: InputView

Predefined input views for mouse and touch based input handlers.

常量 描述
QAbstract3DInputHandler::InputView::None 0 Mouse or touch not on a view.
QAbstract3DInputHandler::InputView::OnPrimary 1 Mouse or touch input received on the primary view area. If secondary view is displayed when inputView becomes OnPrimary, secondary view is closed.
QAbstract3DInputHandler::InputView::OnSecondary 2 Mouse or touch input received on the secondary view area.

特性文档编制

inputPosition : QPoint

This property holds the last input position based on the processed input events.

访问函数:

QPoint inputPosition () const
void setInputPosition (const QPoint & position , bool forceSelection = false)

通知程序信号:

void positionChanged (const QPoint & position )

inputView : QAbstract3DInputHandler::InputView

This property holds the current enumerated input view based on the view of the processed input events.

One of the InputView 枚举值。

When the view changes, the inputViewChanged 信号发射。

访问函数:

QAbstract3DInputHandler::InputView inputView () const
void setInputView (QAbstract3DInputHandler::InputView inputView )

通知程序信号:

void inputViewChanged (QAbstract3DInputHandler::InputView view )

另请参阅 InputView .

scene : Q3DScene *

This property holds the 3D scene this abstract input handler is controlling.

One input handler can control one scene. Setting a scene to an input handler does not transfer the ownership of the scene.

访问函数:

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

通知程序信号:

void sceneChanged (Q3DScene * scene )

成员函数文档编制

[explicit protected] QAbstract3DInputHandler:: QAbstract3DInputHandler ( QObject * parent = nullptr)

Constructs the base class. An optional parent 参数可以给出,然后会被传递给 QObject 构造函数。

[virtual noexcept] QAbstract3DInputHandler:: ~QAbstract3DInputHandler ()

Destroys the base class.

[slot] void QAbstract3DInputHandler:: handleSelection (const QPoint & position )

Converts an incoming selection query position to a selection.

另请参阅 Q3DScene::selectionQueryPosition .

[虚拟] void QAbstract3DInputHandler:: mouseDoubleClickEvent ( QMouseEvent * event )

Override this to handle mouse double click events. Mouse double click event is given in the event .

[虚拟] void QAbstract3DInputHandler:: mouseMoveEvent ( QMouseEvent * event , const QPoint & mousePos )

Override this to handle mouse move events. Mouse move event is given in the event and the mouse position in mousePos .

[虚拟] void QAbstract3DInputHandler:: mousePressEvent ( QMouseEvent * event , const QPoint & mousePos )

Override this to handle mouse press events. Mouse press event is given in the event and the mouse position in mousePos .

[虚拟] void QAbstract3DInputHandler:: mouseReleaseEvent ( QMouseEvent * event , const QPoint & mousePos )

Override this to handle mouse release events. Mouse release event is given in the event and the mouse position in mousePos .

[protected] int QAbstract3DInputHandler:: prevDistance () const

Returns the manhattan length between last two input positions.

另请参阅 setPrevDistance ().

[protected] QPoint QAbstract3DInputHandler:: previousInputPos () const

Returns the previous input position.

另请参阅 setPreviousInputPos ().

[protected] void QAbstract3DInputHandler:: setPrevDistance ( int distance )

设置 distance (manhattan length) between last two input positions.

另请参阅 prevDistance ().

[protected] void QAbstract3DInputHandler:: setPreviousInputPos (const QPoint & position )

Sets the previous input position to the point given by position .

另请参阅 previousInputPos ().

[虚拟] void QAbstract3DInputHandler:: touchEvent ( QTouchEvent * event )

Override this to handle touch input events. Touch event is given in the event .

[虚拟] void QAbstract3DInputHandler:: wheelEvent ( QWheelEvent * event )

Override this to handle wheel events. Wheel event is given in the event .