1// Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include "qpickpointevent.h"
5#include "qpickevent_p.h"
6#include <private/qobject_p.h>
7
8QT_BEGIN_NAMESPACE
9
10namespace Qt3DRender {
11
12class QPickPointEventPrivate : public QPickEventPrivate
13{
14public:
15 QPickPointEventPrivate()
16 : QPickEventPrivate()
17 , m_pointIndex(0)
18 {
19 }
20
21 uint m_pointIndex;
22};
23
24/*!
25 \class Qt3DRender::QPickPointEvent
26 \inmodule Qt3DRender
27
28 \brief The QPickPointEvent class holds information when a segment of a point cloud is picked.
29
30 \sa QPickEvent
31 \since 5.10
32*/
33
34/*!
35 * \qmltype PickPointEvent
36 * \instantiates Qt3DRender::QPickPointEvent
37 * \inqmlmodule Qt3D.Render
38 * \brief PickPointEvent holds information when a segment of a point cloud is picked.
39 * \sa ObjectPicker
40 */
41
42
43/*!
44 \fn Qt3DRender::QPickPointEvent::QPickPointEvent()
45 Constructs a new QPickPointEvent.
46 */
47QPickPointEvent::QPickPointEvent()
48 : QPickEvent(*new QPickPointEventPrivate())
49{
50}
51
52QPickPointEvent::QPickPointEvent(const QPointF &position, const QVector3D &worldIntersection,
53 const QVector3D &localIntersection, float distance,
54 uint pointIndex,
55 QPickEvent::Buttons button, int buttons, int modifiers)
56 : QPickEvent(*new QPickPointEventPrivate())
57{
58 Q_D(QPickPointEvent);
59 d->m_position = position;
60 d->m_distance = distance;
61 d->m_worldIntersection = worldIntersection;
62 d->m_localIntersection = localIntersection;
63 d->m_pointIndex = pointIndex;
64 d->m_button = button;
65 d->m_buttons = buttons;
66 d->m_modifiers = modifiers;
67}
68
69/*! \internal */
70QPickPointEvent::~QPickPointEvent()
71{
72}
73
74/*!
75 \qmlproperty uint Qt3D.Render::PickPointEvent::pointIndex
76 Specifies the index of the point that was picked
77*/
78/*!
79 \property Qt3DRender::QPickPointEvent::pointIndex
80 Specifies the index of the point that was picked
81 */
82/*!
83 * \brief QPickPointEvent::pointIndex
84 * Returns the index of the picked point
85 */
86uint QPickPointEvent::pointIndex() const
87{
88 Q_D(const QPickPointEvent);
89 return d->m_pointIndex;
90}
91
92} // Qt3DRender
93
94QT_END_NAMESPACE
95
96#include "moc_qpickpointevent.cpp"
97
98

source code of qt3d/src/render/picking/qpickpointevent.cpp