1/****************************************************************************
2**
3** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB).
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the Qt3D module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40#include "qpicklineevent.h"
41#include "qpickevent_p.h"
42#include <private/qobject_p.h>
43
44QT_BEGIN_NAMESPACE
45
46namespace Qt3DRender {
47
48class QPickLineEventPrivate : public QPickEventPrivate
49{
50public:
51 QPickLineEventPrivate()
52 : QPickEventPrivate()
53 , m_edgeIndex(0)
54 , m_vertex1Index(0)
55 , m_vertex2Index(0)
56 {
57 }
58
59 uint m_edgeIndex;
60 uint m_vertex1Index;
61 uint m_vertex2Index;
62};
63
64/*!
65 \class Qt3DRender::QPickLineEvent
66 \inmodule Qt3DRender
67
68 \brief The QPickLineEvent class holds information when a segment of a line is picked.
69
70 \sa QPickEvent
71 \since 5.10
72*/
73
74/*!
75 * \qmltype PickLineEvent
76 * \instantiates Qt3DRender::QPickLineEvent
77 * \inqmlmodule Qt3D.Render
78 * \brief PickLineEvent holds information when a segment of a line is picked.
79 * \sa ObjectPicker
80 */
81
82
83/*!
84 \fn Qt3DRender::QPickLineEvent::QPickLineEvent()
85 Constructs a new QPickEvent.
86 */
87QPickLineEvent::QPickLineEvent()
88 : QPickEvent(*new QPickLineEventPrivate())
89{
90}
91
92QPickLineEvent::QPickLineEvent(const QPointF &position, const QVector3D &worldIntersection,
93 const QVector3D &localIntersection, float distance,
94 uint edgeIndex, uint vertex1Index, uint vertex2Index,
95 QPickEvent::Buttons button, int buttons, int modifiers)
96 : QPickEvent(*new QPickLineEventPrivate())
97{
98 Q_D(QPickLineEvent);
99 d->m_position = position;
100 d->m_distance = distance;
101 d->m_worldIntersection = worldIntersection;
102 d->m_localIntersection = localIntersection;
103 d->m_edgeIndex = edgeIndex;
104 d->m_vertex1Index = vertex1Index;
105 d->m_vertex2Index = vertex2Index;
106 d->m_button = button;
107 d->m_buttons = buttons;
108 d->m_modifiers = modifiers;
109}
110
111/*! \internal */
112QPickLineEvent::~QPickLineEvent()
113{
114}
115
116/*!
117 \qmlproperty uint Qt3D.Render::PickLineEvent::triangleIndex
118 Specifies the triangle index of the event
119*/
120/*!
121 \property Qt3DRender::QPickLineEvent::edgeIndex
122 Specifies the index of the edge that was picked
123 */
124/*!
125 * \brief QPickLineEvent::edgeIndex
126 * Returns the index of the picked edge
127 */
128uint QPickLineEvent::edgeIndex() const
129{
130 Q_D(const QPickLineEvent);
131 return d->m_edgeIndex;
132}
133
134/*!
135 \qmlproperty uint Qt3D.Render::PickLineEvent::vertex1Index
136 Specifies the index of the first point of the picked edge
137*/
138/*!
139 \property Qt3DRender::QPickLineEvent::vertex1Index
140 Specifies the index of the first point of the picked edge
141 */
142/*!
143 * \brief QPickLineEvent::vertex1Index
144 * Returns the index of the first point of the picked edge
145 */
146uint QPickLineEvent::vertex1Index() const
147{
148 Q_D(const QPickLineEvent);
149 return d->m_vertex1Index;
150}
151
152/*!
153 \qmlproperty uint Qt3D.Render::PickLineEvent::vertex2Index
154 Specifies the index of the second point of the picked edge
155*/
156/*!
157 \property Qt3DRender::QPickLineEvent::vertex2Index
158 Specifies the index of the second point of the picked edge
159 */
160/*!
161 * \brief QPickLineEvent::vertex2Index
162 * Returns the index of the second point of the picked triangle
163 */
164uint QPickLineEvent::vertex2Index() const
165{
166 Q_D(const QPickLineEvent);
167 return d->m_vertex2Index;
168}
169
170} // Qt3DRender
171
172QT_END_NAMESPACE
173
174

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