QObjectPicker Class | Qt 3D 5.13.0

Qt 5.13 | Qt 3D | C++ Classes | QObjectPicker

Qt 5.13.0 Reference Documentation

# QObjectPicker Class

(Qt3DRender::QObjectPicker)

The QObjectPicker class instantiates a component that can be used to interact with a QEntity by a process known as picking. More...

Header: | #include <QObjectPicker>
qmake: | QT += 3drender
Since: | Qt 5.6
Instantiated By: | ObjectPicker
Inherits: | Qt3DCore::QComponent

This class was introduced in Qt 5.6.

- List of all members, including inherited members
- Obsolete members

## Properties

- containsMouse : const bool
- dragEnabled : bool
- hoverEnabled : bool

- pressed : const bool
- priority : int

- 1 property inherited from Qt3DCore::QComponent
- 3 properties inherited from Qt3DCore::QNode
- 1 property inherited from QObject

## Public Functions

bool | containsMouse() const
bool | isDragEnabled() const
bool | isHoverEnabled() const
bool | isPressed() const
int | priority() const

- 2 public functions inherited from Qt3DCore::QComponent
- 13 public functions inherited from Qt3DCore::QNode
- 30 public functions inherited from QObject

## Public Slots

void | setDragEnabled(bool dragEnabled)
void | setHoverEnabled(bool hoverEnabled)
void | setPriority(int priority)

- 1 public slot inherited from Qt3DCore::QComponent
- 3 public slots inherited from Qt3DCore::QNode
- 1 public slot inherited from QObject

## Signals

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 | priorityChanged(int priority)
void | released(Qt3DRender::QPickEvent *pick)

- 3 signals inherited from Qt3DCore::QComponent
- 4 signals inherited from Qt3DCore::QNode
- 2 signals inherited from QObject

## Related Non-Members

typedef | QNodePtr
typedef | QNodeVector
typedef | QObjectList
QList<T> | qFindChildren(const QObject *obj, const QRegExp &regExp)
Qt3DCore::QNodeId | qIdForNode(Qt3DCore::QNode *node)
Qt3DCore::QNodeIdVector | qIdsForNodes(const T &nodes)
T | qobject_cast(QObject *object)
T | qobject_cast(const QObject *object)

## Macros

| QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
| Q_CLASSINFO(Name, Value)
| Q_DISABLE_COPY(Class)
| Q_DISABLE_COPY_MOVE(Class)
| Q_DISABLE_MOVE(Class)
| Q_EMIT
| Q_ENUM(...)
| Q_ENUM_NS(...)
| Q_FLAG(...)
| Q_FLAG_NS(...)
| Q_GADGET
| Q_INTERFACES(...)
| Q_INVOKABLE
| Q_NAMESPACE
| Q_OBJECT
| Q_PROPERTY(...)
| Q_REVISION
| Q_SET_OBJECT_NAME(Object)
| Q_SIGNAL
| Q_SIGNALS
| Q_SLOT
| Q_SLOTS

### Additional Inherited Members

- 9 static public members inherited from QObject
- 2 protected functions inherited from Qt3DCore::QNode
- 9 protected functions inherited from QObject

## Detailed Description

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(), and 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.

Note: Instances of this component shouldn't be shared, not respecting that condition will most likely result in undefined behavior.

See also Qt3DRender::QPickingSettings, Qt3DRender::QGeometry, Qt3DRender::QAttribute, Qt3DRender::QPickEvent, and Qt3DRender::QPickTriangleEvent.

## Property Documentation

### containsMouse : const bool

Specifies if the object picker currently contains the mouse

Access functions:

bool | containsMouse() const

Notifier signal:

void | containsMouseChanged(bool containsMouse)

### dragEnabled : bool

Specifies if drag is enabled

Access functions:

bool | isDragEnabled() const
void | setDragEnabled(bool dragEnabled)

Notifier signal:

void | dragEnabledChanged(bool dragEnabled)

### hoverEnabled : bool

Specifies if hover is enabled

Access functions:

bool | isHoverEnabled() const
void | setHoverEnabled(bool hoverEnabled)

Notifier signal:

void | hoverEnabledChanged(bool hoverEnabled)

### pressed : const bool

Specifies if the object picker is currently pressed

Access functions:

bool | isPressed() const

Notifier signal:

void | pressedChanged(bool pressed)

### priority : int

The priority to be used when filtering pick results by priority when QPickingSettings::pickResultMode is set to QPickingSettings::NearestPriorityPick.

Access functions:

int | priority() const
void | setPriority(int priority)

Notifier signal:

void | priorityChanged(int priority)

## Member Function Documentation

### `[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.

### `[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.

### `[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)

Sets the dragEnabled Property to dragEnabled

Note: Setter function for property dragEnabled.

See also isDragEnabled().

### `[slot]` void QObjectPicker::setHoverEnabled(bool hoverEnabled)

Sets the hoverEnabled Property to hoverEnabled

Note: Setter function for property hoverEnabled.

See also isHoverEnabled().

### `[slot]` void QObjectPicker::setPriority(int priority)

Sets the picker's priority to priority. This is used when the pick result mode on QPickingSettings is set to QPickingSettings::NearestPriorityPick. Picking results are sorted by highest priority and shortest picking distance.

This function was introduced in Qt 5.13.

Note: Setter function for property priority.

See also priority().

### bool QObjectPicker::containsMouse() const

Returns true if the object picker currently contains the mouse

Note: Getter function for property containsMouse.

### bool QObjectPicker::isDragEnabled() const

Returns true if dragging is enabled

Note: Getter function for property dragEnabled.

### bool QObjectPicker::isHoverEnabled() const

Returns true if hover enabled

Note: Getter function for property hoverEnabled.