diff options
author | Tony Leinonen <tony.leinonen@qt.io> | 2021-03-29 15:50:41 +0300 |
---|---|---|
committer | Tony Leinonen <tony.leinonen@qt.io> | 2021-03-30 08:38:07 +0000 |
commit | 9c62fa3b6190991e7594da9a4d8b39e3ff8b5c2f (patch) | |
tree | a4aeb6e081d0090a8f7376d921d8b9268f93b438 | |
parent | 1b7c77d64cf46054c9cc565e9a65b13d2f71ba88 (diff) |
Fix component visibility when changing slides
GetActive did not get updated fast enough and returns wrong active state
changing it to IsExplicitActive fixes this situation
as slide switches change objects ExplicitActive state and can be
accessed instantly.
Task-number: QT3DS-4225
Change-Id: I2945ea74f1921c6599230ab6acbc5b17065a5405
Reviewed-by: Jere Tuliniemi <jere.tuliniemi@qt.io>
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
-rw-r--r-- | src/runtime/Qt3DSComponentManager.cpp | 11 | ||||
-rw-r--r-- | src/runtime/Qt3DSElementSystem.h | 20 |
2 files changed, 25 insertions, 6 deletions
diff --git a/src/runtime/Qt3DSComponentManager.cpp b/src/runtime/Qt3DSComponentManager.cpp index f20176b..68e6ecd 100644 --- a/src/runtime/Qt3DSComponentManager.cpp +++ b/src/runtime/Qt3DSComponentManager.cpp @@ -85,12 +85,11 @@ void CComponentManager::GotoSlideIndex(TElement *inComponent, return; } - if (!theComponent->IsAnyParentAboutToActivate()) { - if (!theComponent->GetActive() || theComponent->AboutToDeactivate()) { - // When (becoming) not active, don't proceed slide switching - m_ComponentInitialSlideMap[inComponent] = inGotoData; - return; - } + if (!theComponent->GetActive() || !theComponent->IsExplicitActive() + || !theComponent->areAllParentsActive()) { + // When (becoming) not active, don't proceed slide switching + m_ComponentInitialSlideMap[inComponent] = inGotoData; + return; } SComponentGotoSlideData theGotoSlideData(inGotoData); diff --git a/src/runtime/Qt3DSElementSystem.h b/src/runtime/Qt3DSElementSystem.h index 22cf66c..2632d9d 100644 --- a/src/runtime/Qt3DSElementSystem.h +++ b/src/runtime/Qt3DSElementSystem.h @@ -477,6 +477,26 @@ namespace runtime { return !IsExplicitActive(); } + bool areAllParentsActive() + { + SElement *parent = GetParent(); + if (parent) { + bool isActive = parent->GetActive(); + if (!isActive) + isActive = parent->AboutToActivate(); + if (Depth() > 2) { + if (isActive) + isActive = parent->areAllParentsActive(); + } else { + return true; + } + return isActive; + } else { + return true; + } + return false; + } + bool IsAnyParentAboutToActivate() { SElement *parent = GetParent(); |