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/tessellation-modes | |
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/tessellation-modes')
-rw-r--r-- | examples/tessellation-modes/main.cpp | 13 |
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(); |