diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2018-03-20 15:26:57 +0100 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2018-03-20 15:31:08 +0000 |
commit | e90de0736b3d5bfa52af38250df3218b21c744e0 (patch) | |
tree | 2509a41a8590c5c3b6d79666bb4d5910bc35017d /src/imports/studio3d/q3dsstudio3ditem.cpp | |
parent | 5d34c984ecbed1a6d6f27fbaa3d83a137e052b65 (diff) |
Reuse QQmlEngine for behaviors and subpresentations
...when there is already one due to using Studio3D in a Quick scene.
Change-Id: I7c102ba714a4311f889a4242b2838199d1e2e990
Reviewed-by: Christian Stromme <christian.stromme@qt.io>
Diffstat (limited to 'src/imports/studio3d/q3dsstudio3ditem.cpp')
-rw-r--r-- | src/imports/studio3d/q3dsstudio3ditem.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/imports/studio3d/q3dsstudio3ditem.cpp b/src/imports/studio3d/q3dsstudio3ditem.cpp index cfb30bd..e5d3740 100644 --- a/src/imports/studio3d/q3dsstudio3ditem.cpp +++ b/src/imports/studio3d/q3dsstudio3ditem.cpp @@ -39,6 +39,8 @@ #include <QQuickRenderControl> #include <QOffscreenSurface> #include <QQmlFile> +#include <QQmlEngine> +#include <QQmlContext> #include <QGuiApplication> #include <private/q3dsengine_p.h> #include <private/q3dsutils_p.h> @@ -173,6 +175,11 @@ void Q3DSStudio3DItem::createEngine() // We create the render aspect ourselves on the Quick render thread. m_engine->setFlags(Q3DSEngine::WithoutRenderAspect); + // Use our QQmlEngine for QML subpresentations and behavior scripts. + QQmlEngine *qmlEngine = QQmlEngine::contextForObject(this)->engine(); + m_engine->setSharedSubPresentationQmlEngine(qmlEngine); + m_engine->setSharedBehaviorQmlEngine(qmlEngine); + initializePresentationController(m_engine, m_presentation); if (QWindow *rw = QQuickRenderControl::renderWindowFor(w)) { |