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/wireframe | |
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/wireframe')
-rw-r--r-- | examples/wireframe/main.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/examples/wireframe/main.cpp b/examples/wireframe/main.cpp index 435ab09dd..71d792ac9 100644 --- a/examples/wireframe/main.cpp +++ b/examples/wireframe/main.cpp @@ -54,16 +54,19 @@ int main(int argc, char* argv[]) initializeAssetResources("../exampleresources/example-assets.qrb"); Qt3D::Quick::QuickWindow view; - view.registerAspect(new Qt3D::QRenderAspect()); + Qt3D::Quick::QQmlAspectEngine engine; + + engine.aspectEngine()->registerAspect(new Qt3D::QRenderAspect()); // Expose the window as a context property so we can set the aspect ratio - view.engine()->rootContext()->setContextProperty("_window", &view); + engine.qmlEngine()->rootContext()->setContextProperty("_window", &view); + 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")); - // There should be some synchronising mechanism to make sure - // the source is set after all 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")); view.show(); return app.exec(); |