From 80540edee66a1822146c35c22a02cfaa1edd34e8 Mon Sep 17 00:00:00 2001 From: Paul Lemire Date: Fri, 31 Oct 2014 11:35:45 +0100 Subject: 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 --- examples/wireframe/main.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'examples/wireframe') 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(&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(); -- cgit v1.2.3