diff options
author | Christian Stromme <christian.stromme@qt.io> | 2017-11-26 15:56:26 +0100 |
---|---|---|
committer | Christian Stromme <christian.stromme@qt.io> | 2017-12-01 12:48:44 +0000 |
commit | 9e35f9e4beafdea9c6dd0b88496198cd7590a566 (patch) | |
tree | c490963b987f4ed2de9d16f3823fc57cd7aa0e5f /src/animation/frontend | |
parent | 239d3cac8aa3558f3ac889b8a348ab0c5e18df06 (diff) |
Move animation callback handling to QAbstractClipAnimator
The code that triggers the callbacks on the GUI thread should be the used
for all clip animators, and not just the QClipAnimator.
This change also fixes the scene change event handler to call the parent
implementation for all events not handled by the clip animator, so it
doesn't silently drops all events not handled explicitly.
Change-Id: I0b1f57f362f2dc2e82e05d432426cc46d4a100ae
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/animation/frontend')
-rw-r--r-- | src/animation/frontend/qabstractclipanimator.cpp | 13 | ||||
-rw-r--r-- | src/animation/frontend/qabstractclipanimator.h | 2 | ||||
-rw-r--r-- | src/animation/frontend/qclipanimator.cpp | 13 | ||||
-rw-r--r-- | src/animation/frontend/qclipanimator.h | 1 |
4 files changed, 15 insertions, 14 deletions
diff --git a/src/animation/frontend/qabstractclipanimator.cpp b/src/animation/frontend/qabstractclipanimator.cpp index 78ad01508..9cdffee92 100644 --- a/src/animation/frontend/qabstractclipanimator.cpp +++ b/src/animation/frontend/qabstractclipanimator.cpp @@ -41,6 +41,7 @@ #include "qabstractclipanimator_p.h" #include <Qt3DAnimation/qchannelmapper.h> #include <Qt3DAnimation/qclock.h> +#include <Qt3DAnimation/private/qanimationcallbacktrigger_p.h> QT_BEGIN_NAMESPACE @@ -116,6 +117,18 @@ QAbstractClipAnimator::QAbstractClipAnimator(QAbstractClipAnimatorPrivate &dd, Q { } +/*! \internal */ +void QAbstractClipAnimator::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) +{ + if (change->type() == Qt3DCore::CallbackTriggered) { + QAnimationCallbackTriggerPtr callbackTrigger = qSharedPointerCast<Qt3DAnimation::QAnimationCallbackTrigger>(change); + if (callbackTrigger->callback()) + callbackTrigger->callback()->valueChanged(callbackTrigger->value()); + } else { + QComponent::sceneChangeEvent(change); + } +} + QAbstractClipAnimator::~QAbstractClipAnimator() { } diff --git a/src/animation/frontend/qabstractclipanimator.h b/src/animation/frontend/qabstractclipanimator.h index 8fdb114f3..9e8d3c457 100644 --- a/src/animation/frontend/qabstractclipanimator.h +++ b/src/animation/frontend/qabstractclipanimator.h @@ -90,6 +90,8 @@ protected: explicit QAbstractClipAnimator(Qt3DCore::QNode *parent = nullptr); QAbstractClipAnimator(QAbstractClipAnimatorPrivate &dd, Qt3DCore::QNode *parent = nullptr); + void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) override; + private: Q_DECLARE_PRIVATE(QAbstractClipAnimator) }; diff --git a/src/animation/frontend/qclipanimator.cpp b/src/animation/frontend/qclipanimator.cpp index 6b503e87f..5383e2c9b 100644 --- a/src/animation/frontend/qclipanimator.cpp +++ b/src/animation/frontend/qclipanimator.cpp @@ -42,7 +42,6 @@ #include <Qt3DAnimation/qabstractanimationclip.h> #include <Qt3DAnimation/qchannelmapper.h> #include <Qt3DAnimation/qclock.h> -#include <Qt3DAnimation/private/qanimationcallbacktrigger_p.h> QT_BEGIN_NAMESPACE @@ -167,18 +166,6 @@ Qt3DCore::QNodeCreatedChangeBasePtr QClipAnimator::createNodeCreationChange() co return creationChange; } -/*! \internal */ -void QClipAnimator::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) -{ - if (change->type() == Qt3DCore::CallbackTriggered) { - QAnimationCallbackTriggerPtr callbackTrigger = qSharedPointerCast<Qt3DAnimation::QAnimationCallbackTrigger>(change); - if (callbackTrigger->callback()) - callbackTrigger->callback()->valueChanged(callbackTrigger->value()); - } else if (change->type() == Qt3DCore::PropertyUpdated) { - QAbstractClipAnimator::sceneChangeEvent(change); - } -} - } // namespace Qt3DAnimation QT_END_NAMESPACE diff --git a/src/animation/frontend/qclipanimator.h b/src/animation/frontend/qclipanimator.h index 7b06f9878..311ac4ab0 100644 --- a/src/animation/frontend/qclipanimator.h +++ b/src/animation/frontend/qclipanimator.h @@ -70,7 +70,6 @@ Q_SIGNALS: protected: QClipAnimator(QClipAnimatorPrivate &dd, Qt3DCore::QNode *parent = nullptr); - void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) override; private: Q_DECLARE_PRIVATE(QClipAnimator) |