diff options
author | Kaj Grönholm <kaj.gronholm@qt.io> | 2020-10-12 09:44:02 +0300 |
---|---|---|
committer | Kaj Grönholm <kaj.gronholm@qt.io> | 2020-10-12 13:09:09 +0300 |
commit | f67d5eb8e262d1bd92d63ca99366b0e58695c112 (patch) | |
tree | 3bb75dee3c45facc6d8d926a33cbfe32b179ad3b | |
parent | 746c1665c08b63c32b5a84273decef7a85ea03ad (diff) |
Don't switch deactivating component slide
When component is about to become deactivated, don't proceed with slide
switching as that may cause deactivation not proceeding.
Task-number: QT3DS-4169
Change-Id: I1157f8a76afbc4d3592486a05fa2eb7607ae55ea
Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io>
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
-rw-r--r-- | src/runtime/Qt3DSComponentManager.cpp | 3 | ||||
-rw-r--r-- | src/runtime/Qt3DSElementSystem.h | 10 |
2 files changed, 12 insertions, 1 deletions
diff --git a/src/runtime/Qt3DSComponentManager.cpp b/src/runtime/Qt3DSComponentManager.cpp index 5eaf52a..73c3467 100644 --- a/src/runtime/Qt3DSComponentManager.cpp +++ b/src/runtime/Qt3DSComponentManager.cpp @@ -85,7 +85,8 @@ void CComponentManager::GotoSlideIndex(TElement *inComponent, return; } - if (theComponent->GetActive() == false) { + if (!theComponent->GetActive() || theComponent->AboutToDeactivate()) { + // When (becoming) not active, don't proceed slide switching m_ComponentInitialSlideMap[inComponent] = inGotoData; return; } diff --git a/src/runtime/Qt3DSElementSystem.h b/src/runtime/Qt3DSElementSystem.h index f2430ed..d8790d7 100644 --- a/src/runtime/Qt3DSElementSystem.h +++ b/src/runtime/Qt3DSElementSystem.h @@ -460,6 +460,7 @@ namespace runtime { bool GetActive() const { return m_Flags.IsActive(); } // Return true if we are about to activate, but have not yet been activated + // Also returns true when dirty and already active bool AboutToActivate() const { if (!IsDirty()) @@ -467,6 +468,15 @@ namespace runtime { return IsExplicitActive(); } + // Return true if we are about to deactivate, but have not yet been deactivated + // Also returns true when dirty and already not active + bool AboutToDeactivate() const + { + if (!IsDirty()) + return false; + return !IsExplicitActive(); + } + bool IsAnyParentAboutToActivate() { SElement *parent = GetParent(); |