QPickingSettings Class

class Qt3DRender::QPickingSettings

The QPickingSettings class specifies how entity picking is handled. More...

Header: #include <QPickingSettings>
CMake: find_package(Qt6 REQUIRED COMPONENTS 3drender)
target_link_libraries(mytarget PRIVATE Qt6::3drender)
qmake: QT += 3drender
Instantiated By: PickingSettings
Inherits: Qt3DCore::QNode

Public Types

enum FaceOrientationPickingMode { FrontFace, BackFace, FrontAndBackFace }
enum PickMethod { BoundingVolumePicking, TrianglePicking, LinePicking, PointPicking, PrimitivePicking }
enum PickResultMode { NearestPick, AllPicks, NearestPriorityPick }

Properties

Public Functions

Qt3DRender::QPickingSettings::FaceOrientationPickingMode faceOrientationPickingMode() const
Qt3DRender::QPickingSettings::PickMethod pickMethod() const
Qt3DRender::QPickingSettings::PickResultMode pickResultMode() const
float worldSpaceTolerance() const

Public Slots

void setFaceOrientationPickingMode(Qt3DRender::QPickingSettings::FaceOrientationPickingMode faceOrientationPickingMode)
void setPickMethod(Qt3DRender::QPickingSettings::PickMethod pickMethod)
void setPickResultMode(Qt3DRender::QPickingSettings::PickResultMode pickResultMode)
void setWorldSpaceTolerance(float worldSpaceTolerance)

Signals

void faceOrientationPickingModeChanged(QPickingSettings::FaceOrientationPickingMode faceOrientationPickingMode)
void pickMethodChanged(QPickingSettings::PickMethod pickMethod)
void pickResultModeChanged(QPickingSettings::PickResultMode pickResult)
void worldSpaceToleranceChanged(float worldSpaceTolerance)

Detailed Description

The picking settings determine how the entity picking is handled. For more details about entity picking, see QObjectPicker and QRayCaster component documentation.

When using QObjectPicker components, picking is triggered by mouse events.

When using QRayCaster or QScreenRayCaster components, picking can be explicitly triggered by the application.

In both cases, a ray will be cast through the scene to find geometry intersecting the ray.

See also QObjectPicker, QPickEvent, QPickTriangleEvent, QRayCaster, and QScreenRayCaster.

Member Type Documentation

enum QPickingSettings::FaceOrientationPickingMode

Specifies how face orientation affects triangle picking

ConstantValueDescription
Qt3DRender::QPickingSettings::FrontFace0x01Only front-facing triangles will be picked (default).
Qt3DRender::QPickingSettings::BackFace0x02Only back-facing triangles will be picked.
Qt3DRender::QPickingSettings::FrontAndBackFace0x03Both front- and back-facing triangles will be picked.

enum QPickingSettings::PickMethod

Specifies the picking method.

ConstantValueDescription
Qt3DRender::QPickingSettings::BoundingVolumePicking0x00An entity is considered picked if the picking ray intersects the bounding volume of the entity (default).
Qt3DRender::QPickingSettings::TrianglePicking0x01An entity is considered picked if the picking ray intersects with any triangle of the entity's mesh component.
Qt3DRender::QPickingSettings::LinePicking0x02An entity is considered picked if the picking ray intersects with any edge of the entity's mesh component.
Qt3DRender::QPickingSettings::PointPicking0x04An entity is considered picked if the picking ray intersects with any point of the entity's mesh component.
Qt3DRender::QPickingSettings::PrimitivePickingTrianglePicking | LinePicking | PointPickingAn entity is considered picked if the picking ray intersects with any point, edge or triangle of the entity's mesh component.

enum QPickingSettings::PickResultMode

Specifies what is included into the picking results.

ConstantValueDescription
Qt3DRender::QPickingSettings::NearestPick0Only the nearest entity to picking ray origin intersected by the picking ray is picked (default).
Qt3DRender::QPickingSettings::AllPicks1All entities that intersect the picking ray are picked.
Qt3DRender::QPickingSettings::NearestPriorityPick2Selects the entity whose object picker has the highest value. If several object pickers have the same priority, the closest one on the ray is selected.

See also Qt3DRender::QPickEvent.

Property Documentation

faceOrientationPickingMode : FaceOrientationPickingMode

Specifies how face orientation affects triangle picking

Access functions:

Qt3DRender::QPickingSettings::FaceOrientationPickingMode faceOrientationPickingMode() const
void setFaceOrientationPickingMode(Qt3DRender::QPickingSettings::FaceOrientationPickingMode faceOrientationPickingMode)

Notifier signal:

void faceOrientationPickingModeChanged(QPickingSettings::FaceOrientationPickingMode faceOrientationPickingMode)

pickMethod : PickMethod

Holds the current pick method.

By default, for performance reasons, ray casting will use bounding volume picking. This may however lead to unexpected results if a small object is englobed in the bounding sphere of a large object behind it.

Triangle picking will produce exact results but is computationally more expensive.

Access functions:

Qt3DRender::QPickingSettings::PickMethod pickMethod() const
void setPickMethod(Qt3DRender::QPickingSettings::PickMethod pickMethod)

Notifier signal:

void pickMethodChanged(QPickingSettings::PickMethod pickMethod)

pickResultMode : PickResultMode

Holds the current pick results mode.

By default, pick results will only be produced for the entity closest to the camera.

When setting the pick method to AllPicks, events will be triggered for all the entities with a QObjectPicker along the ray.

When setting the pick method to NearestPriorityPick, events will be triggered for the nearest highest priority picker. This can be used when a given element should always be selected even if others are in front of it.

If a QObjectPicker is assigned to an entity with multiple children, an event will be triggered for each child entity that intersects the ray.

Access functions:

Qt3DRender::QPickingSettings::PickResultMode pickResultMode() const
void setPickResultMode(Qt3DRender::QPickingSettings::PickResultMode pickResultMode)

Notifier signal:

void pickResultModeChanged(QPickingSettings::PickResultMode pickResult)

worldSpaceTolerance : float

Holds the threshold, in model space coordinates, used to evaluate line and point picking.

Access functions:

float worldSpaceTolerance() const
void setWorldSpaceTolerance(float worldSpaceTolerance)

Notifier signal:

void worldSpaceToleranceChanged(float worldSpaceTolerance)

Member Function Documentation

[slot] void QPickingSettings::setWorldSpaceTolerance(float worldSpaceTolerance)

Sets the threshold used for line and point picking to worldSpaceTolerance.

Note: Setter function for property worldSpaceTolerance.

See also worldSpaceTolerance().

float QPickingSettings::worldSpaceTolerance() const

Returns the line and point precision worldSpaceTolerance

Note: Getter function for property worldSpaceTolerance.

See also setWorldSpaceTolerance().

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