summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJanne Kangas <janne.kangas@qt.io>2020-01-07 09:24:44 +0200
committerJanne Kangas <janne.kangas@qt.io>2020-01-13 12:26:42 +0200
commit4a81ef40986e3903ad489a9314b1c38cd7542f86 (patch)
tree0e8213e259491c1b4ced1b96d119a5f54c6426f8
parent7b5d524ab3e4cc6dd88987bd4afd2cee3054e9da (diff)
Fix SceneElement::currentSlideIndex
Fixes issue of current slide change signals not working from subpresentations. (Does not touch indexing conventions in SceneElement or Presentation.) Task-ID: QT3DS-3015 Change-Id: I74ef95d72efa1fc75674081e242c9f5526decf77 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io> Reviewed-by: Antti Määttä <antti.maatta@qt.io> Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
-rw-r--r--src/engine/Qt3DSRuntimeView.cpp48
-rw-r--r--src/runtime/Qt3DSComponentManager.cpp8
2 files changed, 35 insertions, 21 deletions
diff --git a/src/engine/Qt3DSRuntimeView.cpp b/src/engine/Qt3DSRuntimeView.cpp
index ee2a665..fd3be65 100644
--- a/src/engine/Qt3DSRuntimeView.cpp
+++ b/src/engine/Qt3DSRuntimeView.cpp
@@ -325,26 +325,31 @@ bool CRuntimeView::InitializeGraphics(const QSurfaceFormat &format, bool delayed
void CRuntimeView::connectSignals()
{
- m_Presentation->signalProxy()->moveToThread(QThread::currentThread());
signalProxy()->moveToThread(QThread::currentThread());
- QObject::connect(m_Presentation->signalProxy(), &QPresentationSignalProxy::SigSlideEntered,
- signalProxy(), &QRuntimeViewSignalProxy::SigSlideEntered);
- QObject::connect(m_Presentation->signalProxy(), &QPresentationSignalProxy::SigSlideExited,
- signalProxy(), &QRuntimeViewSignalProxy::SigSlideExited);
- QObject::connect(m_Presentation->signalProxy(), &QPresentationSignalProxy::SigCustomSignal,
- signalProxy(), &QRuntimeViewSignalProxy::SigCustomSignal);
- QObject::connect(m_Presentation->signalProxy(),
- &QPresentationSignalProxy::SigPresentationReady,
- signalProxy(), &QRuntimeViewSignalProxy::SigPresentationReady);
- QObject::connect(m_Presentation->signalProxy(), &QPresentationSignalProxy::SigElementsCreated,
- signalProxy(), &QRuntimeViewSignalProxy::SigElementsCreated);
- QObject::connect(m_Presentation->signalProxy(), &QPresentationSignalProxy::SigMaterialsCreated,
- signalProxy(), &QRuntimeViewSignalProxy::SigMaterialsCreated);
- QObject::connect(m_Presentation->signalProxy(),
- &QPresentationSignalProxy::SigDataOutputValueUpdated,
- signalProxy(),
- &QRuntimeViewSignalProxy::SigDataOutputValueUpdated);
+ const auto preslist = m_Application->GetPresentationList();
+
+ // Connect signalproxies of every presentation.
+ for (const auto &it : preslist) {
+ it->signalProxy()->moveToThread((QThread::currentThread()));
+ QObject::connect(it->signalProxy(), &QPresentationSignalProxy::SigSlideEntered,
+ signalProxy(), &QRuntimeViewSignalProxy::SigSlideEntered);
+ QObject::connect(it->signalProxy(), &QPresentationSignalProxy::SigSlideExited,
+ signalProxy(), &QRuntimeViewSignalProxy::SigSlideExited);
+ QObject::connect(it->signalProxy(), &QPresentationSignalProxy::SigCustomSignal,
+ signalProxy(), &QRuntimeViewSignalProxy::SigCustomSignal);
+ QObject::connect(it->signalProxy(),
+ &QPresentationSignalProxy::SigPresentationReady,
+ signalProxy(), &QRuntimeViewSignalProxy::SigPresentationReady);
+ QObject::connect(it->signalProxy(), &QPresentationSignalProxy::SigElementsCreated,
+ signalProxy(), &QRuntimeViewSignalProxy::SigElementsCreated);
+ QObject::connect(it->signalProxy(), &QPresentationSignalProxy::SigMaterialsCreated,
+ signalProxy(), &QRuntimeViewSignalProxy::SigMaterialsCreated);
+ QObject::connect(it->signalProxy(),
+ &QPresentationSignalProxy::SigDataOutputValueUpdated,
+ signalProxy(),
+ &QRuntimeViewSignalProxy::SigDataOutputValueUpdated);
+ }
}
void CRuntimeView::finishAsyncInit()
@@ -358,6 +363,11 @@ void CRuntimeView::Cleanup()
{
// Q3DStudio_virtual_delete( m_Timer, CTimer );
// Q3DStudio_virtual_delete( m_PerfFileStream, CFileStream );
+ const auto preslist = m_Application->GetPresentationList();
+
+ for (const auto &it : preslist)
+ QObject::disconnect(it->signalProxy(), 0, signalProxy(), 0);
+
m_Application = nullptr;
Q3DStudio_virtual_delete(m_InputEngine, CTegraInputEngine);
if (m_RenderEngine) {
@@ -367,8 +377,6 @@ void CRuntimeView::Cleanup()
CDLLManager &theDLLManager = CDLLManager::GetDLLManager();
theDLLManager.Cleanup();
- if (m_Presentation)
- QObject::disconnect(m_Presentation->signalProxy(), 0, signalProxy(), 0);
m_InputEngine = nullptr;
m_RenderEngine = nullptr;
diff --git a/src/runtime/Qt3DSComponentManager.cpp b/src/runtime/Qt3DSComponentManager.cpp
index 8849b5b..1700222 100644
--- a/src/runtime/Qt3DSComponentManager.cpp
+++ b/src/runtime/Qt3DSComponentManager.cpp
@@ -100,7 +100,13 @@ void CComponentManager::GotoSlideIndex(TElement *inComponent,
const UINT8 theCurrentSlideIndex = theComponent->GetCurrentSlide();
- QString elementPath = QString::fromUtf8(inComponent->m_Path.c_str());
+ QString elementPath;
+ // Primary presentation stores elementpaths with subpresentation prefix.
+ // Prepend it here so that slide change notification is directed at a correct elementpath.
+ if (&m_Presentation != m_Presentation.GetApplication().GetPrimaryPresentation())
+ elementPath = m_Presentation.GetName() + QLatin1Char(':');
+
+ elementPath.append(QString::fromUtf8(inComponent->m_Path.c_str()));
if (inSlideExit) {
SEventCommand theEvent = { inComponent, EVENT_ONSLIDEEXIT };