diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2018-03-26 12:58:29 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2018-03-26 14:40:28 +0000 |
commit | cde5e29ca2bf4d37df7af34a07557d6ce14142e8 (patch) | |
tree | 7643ba8adf4f076d98fead6f1a1917da78b75121 /src/imports/studio3d/q3dsstudio3ditem.cpp | |
parent | 40f677db563c66032417044a1e9015b7c42720be (diff) |
Q3DSPresentation: add profilingEnabled property
Have a way in the public API to enable the profile UI and to load
presentations with QObject tracking enabled. The private API separates
these two but for simplicity the public API has a single flag for both.
Defaults to disabled which is what applications need in production.
During development one can just do profilingEnabled: true.
Change-Id: I228d7936897b6891bf4727ade126b4dbda72f73f
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/imports/studio3d/q3dsstudio3ditem.cpp')
-rw-r--r-- | src/imports/studio3d/q3dsstudio3ditem.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/imports/studio3d/q3dsstudio3ditem.cpp b/src/imports/studio3d/q3dsstudio3ditem.cpp index e5d3740..1005580 100644 --- a/src/imports/studio3d/q3dsstudio3ditem.cpp +++ b/src/imports/studio3d/q3dsstudio3ditem.cpp @@ -128,7 +128,7 @@ void Q3DSStudio3DItem::componentComplete() QQuickItem::componentComplete(); } -void Q3DSStudio3DItem::handlePresentationSource(const QUrl &source) +void Q3DSStudio3DItem::handlePresentationSource(const QUrl &source, SourceFlags flags) { if (source == m_source) return; @@ -137,6 +137,7 @@ void Q3DSStudio3DItem::handlePresentationSource(const QUrl &source) releaseEngineAndRenderer(); m_source = source; + m_sourceFlags = flags; if (window()) // else defer to itemChange() createEngine(); @@ -171,9 +172,18 @@ void Q3DSStudio3DItem::createEngine() } m_engine = new Q3DSEngine; + // Rendering will be driven manually from the Quick render thread via the QRenderAspect. // We create the render aspect ourselves on the Quick render thread. - m_engine->setFlags(Q3DSEngine::WithoutRenderAspect); + Q3DSEngine::Flags flags = Q3DSEngine::WithoutRenderAspect; + if (m_sourceFlags.testFlag(Q3DSPresentationController::Profiling)) { + flags |= Q3DSEngine::EnableProfiling; + m_engine->setProfileUiEnabled(true); + } else { + m_engine->setProfileUiEnabled(false); + } + + m_engine->setFlags(flags); // Use our QQmlEngine for QML subpresentations and behavior scripts. QQmlEngine *qmlEngine = QQmlEngine::contextForObject(this)->engine(); |