The QObjectPicker class instantiates a component that can be used to interact with a QEntity by a process known as picking. 更多...
| 頭: | #include <QObjectPicker> |
| qmake: | QT += 3drender |
| Since: | Qt 5.6 |
| 實例化: | ObjectPicker |
| 繼承: | Qt3DCore::QComponent |
| QObjectPicker (Qt3DCore::QNode * parent = nullptr) | |
| bool | containsMouse () const |
| bool | isDragEnabled () const |
| bool | isHoverEnabled () const |
| bool | isPressed () const |
| void | setDragEnabled (bool dragEnabled ) |
| void | setHoverEnabled (bool hoverEnabled ) |
| void | clicked (Qt3DRender::QPickEvent * pick ) |
| void | containsMouseChanged (bool containsMouse ) |
| void | dragEnabledChanged (bool dragEnabled ) |
| void | entered () |
| void | exited () |
| void | hoverEnabledChanged (bool hoverEnabled ) |
| void | moved (Qt3DRender::QPickEvent * pick ) |
| void | pressed (Qt3DRender::QPickEvent * pick ) |
| void | pressedChanged (bool pressed ) |
| void | released (Qt3DRender::QPickEvent * pick ) |
| const QMetaObject | staticMetaObject |
The QObjectPicker class instantiates a component that can be used to interact with a QEntity by a process known as picking.
For every combination of viewport and camera, picking casts a ray through the scene to find entities who's bounding volume intersects the ray. The bounding volume is computed using the values in the attribute buffer specified by the boundingVolumePositionAttribute of the geometry.
The signals pressed (), released (), clicked (), moved (), entered (),和 exited () are emitted when the bounding volume defined by the pickAttribute property intersects with a ray.
Most signals carry a QPickEvent instance. If QPickingSettings::pickMode() is set to QPickingSettings::TrianglePicking , the actual type of the pick parameter will be QPickTriangleEvent .
Pick queries are performed on mouse press and mouse release. If drag is enabled, queries also happen on each mouse move while any button is pressed. If hover is enabled, queries happen on every mouse move even if no button is pressed.
For generalised ray casting queries, see Qt3DRender::QRayCaster and Qt3DRender::QScreenRayCaster .
注意: Instances of this component shouldn't be shared, not respecting that condition will most likely result in undefined behavior.
另請參閱 Qt3DRender::QPickingSettings , Qt3DRender::QGeometry , Qt3DRender::QAttribute , Qt3DRender::QPickEvent ,和 Qt3DRender::QPickTriangleEvent .
Specifies if the object picker currently contains the mouse
訪問函數:
| bool | containsMouse () const |
通知程序信號:
| void | containsMouseChanged (bool containsMouse ) |
Specifies if drag is enabled
訪問函數:
| bool | isDragEnabled () const |
| void | setDragEnabled (bool dragEnabled ) |
通知程序信號:
| void | dragEnabledChanged (bool dragEnabled ) |
Specifies if hover is enabled
訪問函數:
| bool | isHoverEnabled () const |
| void | setHoverEnabled (bool hoverEnabled ) |
通知程序信號:
| void | hoverEnabledChanged (bool hoverEnabled ) |
Specifies if the object picker is currently pressed
訪問函數:
| bool | isPressed () const |
通知程序信號:
| void | pressedChanged (bool pressed ) |
Default constructs an instance of QObjectPicker.
[signal]
void
QObjectPicker::
clicked
(
Qt3DRender::QPickEvent
*
pick
)
This signal is emitted when the bounding volume defined by the pickAttribute property intersects with a ray on a mouse click the QPickEvent pick contains details of the event.
Returns true if the object picker currently contains the mouse
注意: getter 函數對於特性 containsMouse .
[signal]
void
QObjectPicker::
entered
()
This signal is emitted when the bounding volume defined by the pickAttribute property intersects with a ray on the mouse entering the volume.
[signal]
void
QObjectPicker::
exited
()
This signal is emitted when the bounding volume defined by the pickAttribute property intersects with a ray on the ray exiting the volume.
Returns true if dragging is enabled
注意: getter 函數對於特性 dragEnabled .
Returns true if hover enabled
注意: getter 函數對於特性 hoverEnabled .
[signal]
void
QObjectPicker::
moved
(
Qt3DRender::QPickEvent
*
pick
)
This signal is emitted when the bounding volume defined by the pickAttribute property intersects with a ray on a mouse move with a button pressed the QPickEvent pick contains details of the event.
[signal]
void
QObjectPicker::
pressed
(
Qt3DRender::QPickEvent
*
pick
)
This signal is emitted when the bounding volume defined by the pickAttribute property intersects with a ray on a mouse press the QPickEvent pick contains details of the event.
[signal]
void
QObjectPicker::
released
(
Qt3DRender::QPickEvent
*
pick
)
This signal is emitted when the bounding volume defined by the pickAttribute property intersects with a ray on a mouse release the QPickEvent pick contains details of the event.
[slot]
void
QObjectPicker::
setDragEnabled
(
bool
dragEnabled
)
設置 dragEnabled Property to dragEnabled
注意: setter 函數對於特性 dragEnabled .
另請參閱 isDragEnabled ().
[slot]
void
QObjectPicker::
setHoverEnabled
(
bool
hoverEnabled
)
設置 hoverEnabled Property to hoverEnabled
注意: setter 函數對於特性 hoverEnabled .
另請參閱 isHoverEnabled ().