summaryrefslogtreecommitdiffstats
path: root/examples/tessellation-modes/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/tessellation-modes/main.cpp')
-rw-r--r--examples/tessellation-modes/main.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/examples/tessellation-modes/main.cpp b/examples/tessellation-modes/main.cpp
index 8eb2950cb..93c006e02 100644
--- a/examples/tessellation-modes/main.cpp
+++ b/examples/tessellation-modes/main.cpp
@@ -56,19 +56,26 @@ 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());
+
+ 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();
// Register our custom types
qmlRegisterType<TessellatedQuadMesh>("Qt3D.Examples", 1, 0, "TessellatedQuadMesh");
// 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);
// 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"));
+ engine.setSource(QUrl("qrc:/main.qml"));
view.show();
return app.exec();