summaryrefslogtreecommitdiffstats
path: root/src/quick3d/imports/scene3d
diff options
context:
space:
mode:
authorColin Ogilvie <colin.ogilvie@kdab.com>2016-02-04 15:09:30 +0000
committerSean Harmer <sean.harmer@kdab.com>2016-02-04 18:08:02 +0000
commitd07b28101ad06c51b4da20a5329470c250c747dc (patch)
treeb016b17b7a0ab9801f0632c2e62d11160236399a /src/quick3d/imports/scene3d
parent6fc0b939113c9bb61b3331617ac8006c91c373de (diff)
Set Scene3DItem as the source of mouse and keyboard input
Change-Id: Ia9a638685e253bf097c515b8609006728a8f691f Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/quick3d/imports/scene3d')
-rw-r--r--src/quick3d/imports/scene3d/scene3ditem.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/quick3d/imports/scene3d/scene3ditem.cpp b/src/quick3d/imports/scene3d/scene3ditem.cpp
index 81fab58dc..40efca7ad 100644
--- a/src/quick3d/imports/scene3d/scene3ditem.cpp
+++ b/src/quick3d/imports/scene3d/scene3ditem.cpp
@@ -50,6 +50,8 @@
#include <Qt3DRender/qframegraph.h>
#include <Qt3DRender/qrendersurfaceselector.h>
#include <Qt3DInput/QInputAspect>
+#include <Qt3DInput/qinputsettings.h>
+
#include <QtQuick/qquickwindow.h>
@@ -175,6 +177,14 @@ void Scene3DItem::applyRootEntityChange()
setCameraAspectModeHelper();
}
}
+
+ // Set ourselves up as a source of input events for the input aspect
+ Qt3DInput::QInputSettings *inputSettings = m_entity->findChild<Qt3DInput::QInputSettings *>();
+ if (inputSettings) {
+ inputSettings->setEventSource(this);
+ } else {
+ qWarning() << "No Input Settings found, keyboard and mouse events won't be handled";
+ }
}
}