diff options
Diffstat (limited to 'examples/qt3d')
-rw-r--r-- | examples/qt3d/examples-common/qt3dquickwindow.cpp | 15 | ||||
-rw-r--r-- | examples/qt3d/examples-common/qt3dwindow.cpp | 6 |
2 files changed, 8 insertions, 13 deletions
diff --git a/examples/qt3d/examples-common/qt3dquickwindow.cpp b/examples/qt3d/examples-common/qt3dquickwindow.cpp index 759405541..7b0f4a70f 100644 --- a/examples/qt3d/examples-common/qt3dquickwindow.cpp +++ b/examples/qt3d/examples-common/qt3dquickwindow.cpp @@ -41,6 +41,7 @@ #include <Qt3DRender/qframegraph.h> #include <Qt3DRender/qrendersurfaceselector.h> #include <Qt3DInput/qinputaspect.h> +#include <Qt3DInput/qinputsettings.h> #include <Qt3DLogic/qlogicaspect.h> #include <QQmlContext> @@ -123,12 +124,6 @@ void Qt3DQuickWindow::showEvent(QShowEvent *e) { if (!m_initialized) { - // TODO: Get rid of this - QVariantMap data; - data.insert(QStringLiteral("surface"), QVariant::fromValue(static_cast<QSurface *>(this))); - data.insert(QStringLiteral("eventSource"), QVariant::fromValue(this)); - m_engine->aspectEngine()->setData(data); - // Connect to the QQmlAspectEngine's statusChanged signal so that when the QML is loaded // and th eobjects hav ebeen instantiated, but before we set them on the QAspectEngine we // can swoop in and set the window surface and camera on the framegraph and ensure the camera @@ -165,7 +160,13 @@ void Qt3DQuickWindow::onSceneCreated(QObject *rootObject) } } - // TODO: Set ourselves up as a source of input events for the input aspect + // Set ourselves up as a source of input events for the input aspect + Qt3DInput::QInputSettings *inputSettings = rootObject->findChild<Qt3DInput::QInputSettings *>(); + if (inputSettings) { + inputSettings->setEventSource(this); + } else { + qWarning() << "No Input Settings found, keyboard and mouse events won't be handled"; + } } void Qt3DQuickWindow::setWindowSurface(QObject *rootObject) diff --git a/examples/qt3d/examples-common/qt3dwindow.cpp b/examples/qt3d/examples-common/qt3dwindow.cpp index a7728771e..805d92efb 100644 --- a/examples/qt3d/examples-common/qt3dwindow.cpp +++ b/examples/qt3d/examples-common/qt3dwindow.cpp @@ -171,12 +171,6 @@ void Qt3DWindow::showEvent(QShowEvent *e) if (m_userRoot != nullptr) m_userRoot->setParent(m_root); - // TODO: Get rid of this - QVariantMap data; - data.insert(QStringLiteral("surface"), QVariant::fromValue(static_cast<QSurface *>(this))); - data.insert(QStringLiteral("eventSource"), QVariant::fromValue(this)); - m_aspectEngine->setData(data); - m_root->addComponent(m_frameGraph); m_aspectEngine->setRootEntity(m_root); |