diff options
author | Kevin Ottens <kevin.ottens@kdab.com> | 2015-01-20 15:16:21 +0100 |
---|---|---|
committer | Kevin Ottens <kevin.ottens@kdab.com> | 2015-01-23 07:51:29 +0100 |
commit | ae03c0af3b07712f6a5a1c75fe729215ea820d54 (patch) | |
tree | ed9d117f4a384c1f3a113b47347c16d0c4537c01 /src/input/qinputaspect.cpp | |
parent | f901090a4144d64bd8b483b75af3af4fd7142b45 (diff) |
Move CameraController in the input aspect
With this move it also becomes a private class. As a result I had to
touch all the examples as you won't get camera navigation anymore if the
input aspect is not registered.
Quick3DConfiguration doesn't depend on the QuickWindow singleton hack
anymore, it tries to get back to the aspects and set the camera on the
ones having a corresponding property.
It also mostly empties Window and QuickWindow.
Change-Id: Ife1644bd338e51929bad1e99089bd5e4c68ebc68
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/input/qinputaspect.cpp')
-rw-r--r-- | src/input/qinputaspect.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/input/qinputaspect.cpp b/src/input/qinputaspect.cpp index b43f24ae2..6068acf79 100644 --- a/src/input/qinputaspect.cpp +++ b/src/input/qinputaspect.cpp @@ -41,6 +41,7 @@ #include "qinputaspect.h" #include "qinputaspect_p.h" +#include "cameracontroller_p.h" #include "inputhandler_p.h" #include "keyboardcontroller_p.h" #include "keyboardinput_p.h" @@ -57,6 +58,7 @@ namespace Qt3D { QInputAspectPrivate::QInputAspectPrivate(QInputAspect *qq) : QAbstractAspectPrivate(qq) , m_inputHandler(new Input::InputHandler()) + , m_cameraController(new Input::CameraController()) { m_aspectType = QAbstractAspect::AspectOther; } @@ -68,6 +70,18 @@ QInputAspect::QInputAspect(QObject *parent) registerBackendType<QKeyboardInput>(QBackendNodeFunctorPtr(new Input::KeyboardInputFunctor(d_func()->m_inputHandler))); } +QCamera *QInputAspect::camera() const +{ + Q_D(const QInputAspect); + return d->m_cameraController->camera(); +} + +void QInputAspect::setCamera(QCamera *camera) +{ + Q_D(QInputAspect); + d->m_cameraController->setCamera(camera); +} + QVector<QAspectJobPtr> QInputAspect::jobsToExecute(qint64 time) { Q_UNUSED(time); @@ -110,12 +124,15 @@ void QInputAspect::onInitialize(const QVariantMap &data) if (v.isValid()) w = v.value<QWindow *>(); Q_D(QInputAspect); + if (w) + w->installEventFilter(d->m_cameraController); d->m_inputHandler->setWindow(w); } void QInputAspect::onCleanup() { Q_D(QInputAspect); + d->m_inputHandler->window()->removeEventFilter(d->m_cameraController); d->m_inputHandler->setWindow(Q_NULLPTR); } |