diff options
author | Paul Lemire <paul.lemire.ecortex@kdab.com> | 2014-10-31 11:35:45 +0100 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2014-11-14 17:44:32 +0100 |
commit | 80540edee66a1822146c35c22a02cfaa1edd34e8 (patch) | |
tree | b1853d44cf183414f87cd160058d11be561ff476 /examples/cylinder-cpp | |
parent | 1ce287c11d139ae32c0b593c482c8e826473f7a0 (diff) |
Qt3D::Window simplified
The Qt3D::Window doesn't contain the QAspectEngine anymore. This will allow
to to pass any kind of surface to the QAspectEngine.
We could still have a wrapper like QQuickView around the QQmlAspectEngine if
needed but if it weren't for the camera controller that we need to keep a
little longer, a simple QWindow could be used in every example.
All examples were updated.
Change-Id: I4921df0df6f1066cd409ea886faf41d7e8834ef6
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'examples/cylinder-cpp')
-rw-r--r-- | examples/cylinder-cpp/main.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/examples/cylinder-cpp/main.cpp b/examples/cylinder-cpp/main.cpp index 20800f389..39469c2af 100644 --- a/examples/cylinder-cpp/main.cpp +++ b/examples/cylinder-cpp/main.cpp @@ -58,6 +58,7 @@ #include <Qt3DCore/qrotatetransform.h> #include <Qt3DCore/qlookattransform.h> #include <Qt3DCore/qtransform.h> +#include <Qt3DCore/qaspectengine.h> #include <Qt3DRenderer/qcameraselector.h> #include <Qt3DRenderer/qrenderpassfilter.h> @@ -72,7 +73,13 @@ int main(int argc, char **argv) QGuiApplication app(argc, argv); Qt3D::Window view; - view.registerAspect(new Qt3D::QRenderAspect()); + Qt3D::QAspectEngine engine; + engine.registerAspect(new Qt3D::QRenderAspect()); + engine.initialize(); + QVariantMap data; + data.insert(QStringLiteral("surface"), QVariant::fromValue(static_cast<QSurface *>(&view))); + data.insert(QStringLiteral("window"), QVariant::fromValue(&view)); + engine.setData(data); // Root entity Qt3D::QEntity *rootEntity = new Qt3D::QEntity(); @@ -132,7 +139,8 @@ int main(int argc, char **argv) rootEntity->addComponent(frameGraph); // Set root object of the scene - view.setRootEntity(rootEntity); + engine.setRootEntity(rootEntity); + // Show window view.show(); return app.exec(); |