diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2018-05-02 13:38:08 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2018-05-02 13:02:03 +0000 |
commit | 45854d68d1bcdc94a1f7b774f839b2a3ebb206c1 (patch) | |
tree | 61f981f647468134ca9474729295842ba0a534c3 /src/imports/studio3d/q3dsstudio3ditem.cpp | |
parent | 3b894ecbf961dac43fd358475b9e2ea101f40f3b (diff) |
Add a dummy ViewerSettings
Only showRenderStats is supported now. Other values are ignored.
This allows using QML code written for 1.x without having to remove the
ViewerSettings element. We may also support some of the other properties
later on, e.g. the scale mode (to be decided).
The design problems of the 1.x class are corrected, as usual: there is no
need for a private class here, uses Q_ENUM instead of Q_ENUMS, uses
argument-less signals as is the custom with qml, etc.
Task-number: QT3DS-1521
Change-Id: I0a1ce763d263353876113f3675fc620767f8b966
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/imports/studio3d/q3dsstudio3ditem.cpp')
-rw-r--r-- | src/imports/studio3d/q3dsstudio3ditem.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/imports/studio3d/q3dsstudio3ditem.cpp b/src/imports/studio3d/q3dsstudio3ditem.cpp index 2bfd76f..c640d1b 100644 --- a/src/imports/studio3d/q3dsstudio3ditem.cpp +++ b/src/imports/studio3d/q3dsstudio3ditem.cpp @@ -31,6 +31,7 @@ #include "q3dsstudio3drenderer_p.h" #include "q3dsstudio3dnode_p.h" #include "q3dspresentationitem_p.h" +#include "q3dsviewersettings_p.h" #include <QSGNode> #include <QLoggingCategory> #include <QThread> @@ -133,6 +134,16 @@ void Q3DSStudio3DItem::componentComplete() qWarning("Studio3D: Duplicate Presentation"); else m_presentation = presentation; + } else if (Q3DSViewerSettings *viewerSettings = qobject_cast<Q3DSViewerSettings *>(child)) { + if (m_viewerSettings) { + qWarning("Studio3D: Duplicate ViewerSettings"); + } else { + m_viewerSettings = viewerSettings; + connect(m_viewerSettings, &Q3DSViewerSettings::showRenderStatsChanged, m_viewerSettings, [this] { + if (m_engine) + m_engine->setProfileUiVisible(m_viewerSettings->isShowRenderStats()); + }); + } } } @@ -228,6 +239,8 @@ void Q3DSStudio3DItem::createEngine() qCDebug(lcStudio3D, "created engine %p", m_engine); connect(m_engine, &Q3DSEngine::presentationLoaded, this, [this]() { + if (m_viewerSettings && m_viewerSettings->isShowRenderStats()) + m_engine->setProfileUiVisible(true); m_presentation->studio3DPresentationLoaded(); if (!m_running) { m_running = true; |