Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QQuick3DPickResult Class Reference

#include <qquick3dpickresult_p.h>

+ Collaboration diagram for QQuick3DPickResult:

Public Types

enum class  HitType { Null , Model , Item }
 

Public Member Functions

 QQuick3DPickResult ()
 \qmlvaluetype pickResult \inqmlmodule QtQuick3D
 
 QQuick3DPickResult (QQuick3DModel *hitObject, float distanceFromCamera, const QVector2D &uvPosition, const QVector3D &scenePosition, const QVector3D &position, const QVector3D &normal, int instanceIndex)
 
 QQuick3DPickResult (QQuickItem *itemHit, float distanceFromCamera, const QVector2D &uvPosition, const QVector3D &scenePosition, const QVector3D &position, const QVector3D &sceneNormal)
 
QQuick3DModelobjectHit () const
 \qmlproperty Model pickResult::objectHit \readonly
 
float distance () const
 \qmlproperty float pickResult::distance \readonly
 
QVector2D uvPosition () const
 \qmlproperty vector2d pickResult::uvPosition \readonly
 
QVector3D scenePosition () const
 \qmlproperty vector3d pickResult::scenePosition \readonly
 
QVector3D position () const
 \qmlproperty vector3d pickResult::position \readonly
 
QVector3D normal () const
 \qmlproperty vector3d pickResult::normal \readonly
 
QVector3D sceneNormal () const
 \qmlproperty vector3d pickResult::sceneNormal \readonly
 
int instanceIndex () const
 \qmlproperty int pickResult::instanceIndex \readonly
 
 Q_REVISION (6, 8) QQuickItem *itemHit() const
 
 Q_REVISION (6, 8) HitType hitType() const
 

Properties

QQuick3DModelobjectHit
 
float distance
 
QVector2D uvPosition
 
QVector3D scenePosition
 
QVector3D position
 
QVector3D normal
 
QVector3D sceneNormal
 
int instanceIndex
 
QQuickItemitemHit
 \qmlproperty Item pickResult::itemHit \readonly
 
HitType hitType
 \qmlproperty enumeration pickResult::hitType \readonly
 

Detailed Description

Definition at line 27 of file qquick3dpickresult_p.h.

Member Enumeration Documentation

◆ HitType

enum class QQuick3DPickResult::HitType
strong
Enumerator
Null 
Model 
Item 

Definition at line 43 of file qquick3dpickresult_p.h.

Constructor & Destructor Documentation

◆ QQuick3DPickResult() [1/3]

QT_BEGIN_NAMESPACE QQuick3DPickResult::QQuick3DPickResult ( )

\qmlvaluetype pickResult \inqmlmodule QtQuick3D

Contains the results of a pick.

Created as a return object to View3D::pick.

Definition at line 17 of file qquick3dpickresult.cpp.

◆ QQuick3DPickResult() [2/3]

QQuick3DPickResult::QQuick3DPickResult ( QQuick3DModel * hitObject,
float distanceFromCamera,
const QVector2D & uvPosition,
const QVector3D & scenePosition,
const QVector3D & position,
const QVector3D & normal,
int instanceIndex )
explicit

Definition at line 27 of file qquick3dpickresult.cpp.

◆ QQuick3DPickResult() [3/3]

QQuick3DPickResult::QQuick3DPickResult ( QQuickItem * itemHit,
float distanceFromCamera,
const QVector2D & uvPosition,
const QVector3D & scenePosition,
const QVector3D & position,
const QVector3D & sceneNormal )
explicit

Definition at line 49 of file qquick3dpickresult.cpp.

Member Function Documentation

◆ distance()

float QQuick3DPickResult::distance ( ) const

\qmlproperty float pickResult::distance \readonly

This property holds the distance between the pick origin and the hit position i.e. the length of the ray. In the case of using viewport coordinates for picking the pick origin will be the active camera's position.

Definition at line 90 of file qquick3dpickresult.cpp.

◆ instanceIndex()

int QQuick3DPickResult::instanceIndex ( ) const

\qmlproperty int pickResult::instanceIndex \readonly

Since
6.5

This property holds the index in the instance table for the case where the pick hit an instance of an instanced model.

Definition at line 176 of file qquick3dpickresult.cpp.

◆ normal()

QVector3D QQuick3DPickResult::normal ( ) const

\qmlproperty vector3d pickResult::normal \readonly

This property holds the normal of the face that was hit in local coordinate space.

Note
for 2D Items this will always be (0, 0, 1).

Definition at line 143 of file qquick3dpickresult.cpp.

◆ objectHit()

QQuick3DModel * QQuick3DPickResult::objectHit ( ) const

\qmlproperty Model pickResult::objectHit \readonly

This property holds the model object hit by the pick. This value will be null if \l{pickResult::hitType} {hitType} is not pickResult.Model.

See also
itemHit

Definition at line 77 of file qquick3dpickresult.cpp.

◆ position()

QVector3D QQuick3DPickResult::position ( ) const

\qmlproperty vector3d pickResult::position \readonly

This property holds the scene position of the hit in local coordinate space.

Definition at line 129 of file qquick3dpickresult.cpp.

◆ Q_REVISION() [1/2]

QQuick3DPickResult::Q_REVISION ( 6 ,
8  ) const

◆ Q_REVISION() [2/2]

QQuick3DPickResult::Q_REVISION ( 6 ,
8  ) const

◆ sceneNormal()

QVector3D QQuick3DPickResult::sceneNormal ( ) const

\qmlproperty vector3d pickResult::sceneNormal \readonly

This property holds the normal of the face that was hit in scene coordinate space.

Definition at line 159 of file qquick3dpickresult.cpp.

References QQuick3DNode::mapDirectionToScene().

+ Here is the call graph for this function:

◆ scenePosition()

QVector3D QQuick3DPickResult::scenePosition ( ) const

\qmlproperty vector3d pickResult::scenePosition \readonly

This property holds the scene position of the hit.

Definition at line 117 of file qquick3dpickresult.cpp.

◆ uvPosition()

QVector2D QQuick3DPickResult::uvPosition ( ) const

\qmlproperty vector2d pickResult::uvPosition \readonly

This property holds the UV position of the hit. The UV position is calculated as the normalized local x and y coordinates of the hit point relative to the bounding volume. Useful for further picking against an offscreen-rendered object.

When \l{pickResult::}{hitType} is pickResult.Item this value will represent the position of the hit in the coordinate space of \l{pickResult::}{itemHit}.

Definition at line 106 of file qquick3dpickresult.cpp.

Property Documentation

◆ distance

float QQuick3DPickResult::distance
read

Definition at line 31 of file qquick3dpickresult_p.h.

◆ hitType

QQuick3DPickResult::HitType QQuick3DPickResult::hitType
read

\qmlproperty enumeration pickResult::hitType \readonly

Since
6.8

This property holds the hit type of the pick result.

\value pickResult.Null The pick did not hit anything. \value pickResult.Model The pick hit a Model. \value pickResult.Item The pick hit a QQuickItem.

Definition at line 39 of file qquick3dpickresult_p.h.

◆ instanceIndex

int QQuick3DPickResult::instanceIndex
read

Definition at line 37 of file qquick3dpickresult_p.h.

◆ itemHit

QQuickItem * QQuick3DPickResult::itemHit
read

\qmlproperty Item pickResult::itemHit \readonly

Since
6.8

This property holds the Qt Quick Item hit by the pick. This value will be null if \l{pickResult::}{hitType} is not pickResult.Item.

See also
objectHit

Definition at line 38 of file qquick3dpickresult_p.h.

◆ normal

QVector3D QQuick3DPickResult::normal
read

Definition at line 35 of file qquick3dpickresult_p.h.

◆ objectHit

QQuick3DModel* QQuick3DPickResult::objectHit
read

Definition at line 30 of file qquick3dpickresult_p.h.

◆ position

QVector3D QQuick3DPickResult::position
read

Definition at line 34 of file qquick3dpickresult_p.h.

◆ sceneNormal

QVector3D QQuick3DPickResult::sceneNormal
read

Definition at line 36 of file qquick3dpickresult_p.h.

◆ scenePosition

QVector3D QQuick3DPickResult::scenePosition
read

Definition at line 33 of file qquick3dpickresult_p.h.

◆ uvPosition

QVector2D QQuick3DPickResult::uvPosition
read

Definition at line 32 of file qquick3dpickresult_p.h.


The documentation for this class was generated from the following files: