| 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 "qpicklineevent.h" |
| 5 | #include "qpickevent_p.h" |
| 6 | #include <private/qobject_p.h> |
| 7 | |
| 8 | QT_BEGIN_NAMESPACE |
| 9 | |
| 10 | namespace Qt3DRender { |
| 11 | |
| 12 | class QPickLineEventPrivate : public QPickEventPrivate |
| 13 | { |
| 14 | public: |
| 15 | QPickLineEventPrivate() |
| 16 | : QPickEventPrivate() |
| 17 | , m_edgeIndex(0) |
| 18 | , m_vertex1Index(0) |
| 19 | , m_vertex2Index(0) |
| 20 | { |
| 21 | } |
| 22 | |
| 23 | uint m_edgeIndex; |
| 24 | uint m_vertex1Index; |
| 25 | uint m_vertex2Index; |
| 26 | }; |
| 27 | |
| 28 | /*! |
| 29 | \class Qt3DRender::QPickLineEvent |
| 30 | \inmodule Qt3DRender |
| 31 | |
| 32 | \brief The QPickLineEvent class holds information when a segment of a line is picked. |
| 33 | |
| 34 | \sa QPickEvent |
| 35 | \since 5.10 |
| 36 | */ |
| 37 | |
| 38 | /*! |
| 39 | * \qmltype PickLineEvent |
| 40 | * \nativetype Qt3DRender::QPickLineEvent |
| 41 | * \inqmlmodule Qt3D.Render |
| 42 | * \brief PickLineEvent holds information when a segment of a line is picked. |
| 43 | * \sa ObjectPicker |
| 44 | */ |
| 45 | |
| 46 | |
| 47 | /*! |
| 48 | \fn Qt3DRender::QPickLineEvent::QPickLineEvent() |
| 49 | Constructs a new QPickEvent. |
| 50 | */ |
| 51 | QPickLineEvent::QPickLineEvent() |
| 52 | : QPickEvent(*new QPickLineEventPrivate()) |
| 53 | { |
| 54 | } |
| 55 | |
| 56 | QPickLineEvent::QPickLineEvent(const QPointF &position, const QVector3D &worldIntersection, |
| 57 | const QVector3D &localIntersection, float distance, |
| 58 | uint edgeIndex, uint vertex1Index, uint vertex2Index, |
| 59 | QPickEvent::Buttons button, int buttons, int modifiers) |
| 60 | : QPickEvent(*new QPickLineEventPrivate()) |
| 61 | { |
| 62 | Q_D(QPickLineEvent); |
| 63 | d->m_position = position; |
| 64 | d->m_distance = distance; |
| 65 | d->m_worldIntersection = worldIntersection; |
| 66 | d->m_localIntersection = localIntersection; |
| 67 | d->m_edgeIndex = edgeIndex; |
| 68 | d->m_vertex1Index = vertex1Index; |
| 69 | d->m_vertex2Index = vertex2Index; |
| 70 | d->m_button = button; |
| 71 | d->m_buttons = buttons; |
| 72 | d->m_modifiers = modifiers; |
| 73 | } |
| 74 | |
| 75 | /*! \internal */ |
| 76 | QPickLineEvent::~QPickLineEvent() |
| 77 | { |
| 78 | } |
| 79 | |
| 80 | /*! |
| 81 | \qmlproperty uint Qt3D.Render::PickLineEvent::triangleIndex |
| 82 | Specifies the triangle index of the event |
| 83 | */ |
| 84 | /*! |
| 85 | \property Qt3DRender::QPickLineEvent::edgeIndex |
| 86 | Specifies the index of the edge that was picked |
| 87 | */ |
| 88 | /*! |
| 89 | * \brief QPickLineEvent::edgeIndex |
| 90 | * Returns the index of the picked edge |
| 91 | */ |
| 92 | uint QPickLineEvent::edgeIndex() const |
| 93 | { |
| 94 | Q_D(const QPickLineEvent); |
| 95 | return d->m_edgeIndex; |
| 96 | } |
| 97 | |
| 98 | /*! |
| 99 | \qmlproperty uint Qt3D.Render::PickLineEvent::vertex1Index |
| 100 | Specifies the index of the first point of the picked edge |
| 101 | */ |
| 102 | /*! |
| 103 | \property Qt3DRender::QPickLineEvent::vertex1Index |
| 104 | Specifies the index of the first point of the picked edge |
| 105 | */ |
| 106 | /*! |
| 107 | * \brief QPickLineEvent::vertex1Index |
| 108 | * Returns the index of the first point of the picked edge |
| 109 | */ |
| 110 | uint QPickLineEvent::vertex1Index() const |
| 111 | { |
| 112 | Q_D(const QPickLineEvent); |
| 113 | return d->m_vertex1Index; |
| 114 | } |
| 115 | |
| 116 | /*! |
| 117 | \qmlproperty uint Qt3D.Render::PickLineEvent::vertex2Index |
| 118 | Specifies the index of the second point of the picked edge |
| 119 | */ |
| 120 | /*! |
| 121 | \property Qt3DRender::QPickLineEvent::vertex2Index |
| 122 | Specifies the index of the second point of the picked edge |
| 123 | */ |
| 124 | /*! |
| 125 | * \brief QPickLineEvent::vertex2Index |
| 126 | * Returns the index of the second point of the picked triangle |
| 127 | */ |
| 128 | uint QPickLineEvent::vertex2Index() const |
| 129 | { |
| 130 | Q_D(const QPickLineEvent); |
| 131 | return d->m_vertex2Index; |
| 132 | } |
| 133 | |
| 134 | } // Qt3DRender |
| 135 | |
| 136 | QT_END_NAMESPACE |
| 137 | |
| 138 | #include "moc_qpicklineevent.cpp" |
| 139 | |
| 140 | |