summaryrefslogtreecommitdiffstats
path: root/src/render/picking/qpickevent.h
diff options
context:
space:
mode:
authorMike Krus <mike.krus@kdab.com>2015-12-08 12:06:12 +0000
committerMike Krus <mike.krus@kdab.com>2016-01-25 09:03:41 +0000
commit4ad00b344bc79e34f2ba2f8355e65c7948791389 (patch)
tree277ff0f997b962ccb6034728e780cbf77f60c643 /src/render/picking/qpickevent.h
parentd798eb52ae1b22fa38d398cdae0012a34cb51922 (diff)
Expose picking details to front end
Intersection (world and local) and distance added to pick event Modified test so that it includes the event Change-Id: I8631d626e5108d2e044374ee3425625f5588c38c Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/render/picking/qpickevent.h')
-rw-r--r--src/render/picking/qpickevent.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/render/picking/qpickevent.h b/src/render/picking/qpickevent.h
index 793377ad8..4734a912d 100644
--- a/src/render/picking/qpickevent.h
+++ b/src/render/picking/qpickevent.h
@@ -38,6 +38,7 @@
#define QT3DRENDER_QPICKEVENT_H
#include <QObject>
+#include <QVector3D>
#include <Qt3DRender/qt3drender_global.h>
QT_BEGIN_NAMESPACE
@@ -46,12 +47,19 @@ namespace Qt3DRender {
class QPickEventPrivate;
+class QPickEvent;
+typedef QSharedPointer<QPickEvent> QPickEventPtr;
+
class QT3DRENDERSHARED_EXPORT QPickEvent : public QObject
{
Q_OBJECT
Q_PROPERTY(bool accepted READ isAccepted WRITE setAccepted NOTIFY acceptedChanged)
+ Q_PROPERTY(float distance READ distance CONSTANT)
+ Q_PROPERTY(QVector3D localIntersection READ localIntersection CONSTANT)
+ Q_PROPERTY(QVector3D worldIntersection READ worldIntersection CONSTANT)
public:
QPickEvent();
+ QPickEvent(const QVector3D& worldIntersection, const QVector3D& localIntersection, float distance);
~QPickEvent();
bool isAccepted() const;
@@ -59,6 +67,10 @@ public:
public Q_SLOTS:
void setAccepted(bool accepted);
+ float distance() const;
+ const QVector3D &worldIntersection() const;
+ const QVector3D &localIntersection() const;
+
Q_SIGNALS:
void acceptedChanged(bool accepted);
@@ -70,4 +82,6 @@ private:
QT_END_NAMESPACE
+Q_DECLARE_METATYPE(Qt3DRender::QPickEvent*)
+
#endif // QT3DRENDER_QPICKEVENT_H