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/torus-qml | |
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/torus-qml')
-rw-r--r-- | examples/torus-qml/main.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/examples/torus-qml/main.cpp b/examples/torus-qml/main.cpp index 9e80a8936..30ce9b65e 100644 --- a/examples/torus-qml/main.cpp +++ b/examples/torus-qml/main.cpp @@ -51,12 +51,15 @@ int main(int argc, char* argv[]) QGuiApplication app(argc, argv); Qt3D::Quick::QuickWindow view; - view.registerAspect(new Qt3D::QRenderAspect()); - // There should be some synchronising mechanism to make sure - // the source is set after alll aspects have been completely initialized - // Otherwise we might encounter cases where an Aspect's QML elements have - // not yet been registered - view.setSource(QUrl("qrc:/main.qml")); + Qt3D::Quick::QQmlAspectEngine engine; + + engine.aspectEngine()->registerAspect(new Qt3D::QRenderAspect()); + QVariantMap data; + data.insert(QStringLiteral("surface"), QVariant::fromValue(static_cast<QSurface *>(&view))); + data.insert(QStringLiteral("window"), QVariant::fromValue(&view)); + engine.aspectEngine()->setData(data); + engine.aspectEngine()->initialize(); + engine.setSource(QUrl("qrc:/main.qml")); view.show(); return app.exec(); |