summaryrefslogtreecommitdiffstats
path: root/src/animation/backend/clock.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/animation/backend/clock.cpp')
-rw-r--r--src/animation/backend/clock.cpp26
1 files changed, 7 insertions, 19 deletions
diff --git a/src/animation/backend/clock.cpp b/src/animation/backend/clock.cpp
index f5b2bd1d3..ab30f735c 100644
--- a/src/animation/backend/clock.cpp
+++ b/src/animation/backend/clock.cpp
@@ -52,28 +52,16 @@ Clock::Clock()
{
}
-void Clock::initializeFromPeer(const Qt3DCore::QNodeCreatedChangeBasePtr &change)
+void Clock::syncFromFrontEnd(const Qt3DCore::QNode *frontEnd, bool firstTime)
{
- const auto typedChange = qSharedPointerCast<Qt3DCore::QNodeCreatedChange<QClockData>>(change);
- const auto &data = typedChange->data;
- m_playbackRate = data.playbackRate;
-}
-
-void Clock::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e)
-{
- switch (e->type()) {
- case Qt3DCore::PropertyUpdated: {
- const auto change = qSharedPointerCast<Qt3DCore::QPropertyUpdatedChange>(e);
- if (change->propertyName() == QByteArrayLiteral("playbackRate")) {
- m_playbackRate = change.data()->value().toDouble();
- }
- break;
- }
+ BackendNode::syncFromFrontEnd(frontEnd, firstTime);
+ const QClock *node = qobject_cast<const QClock *>(frontEnd);
+ if (!node)
+ return;
- default:
- break;
+ if (!qFuzzyCompare(m_playbackRate, node->playbackRate())) {
+ m_playbackRate = node->playbackRate();
}
- QBackendNode::sceneChangeEvent(e);
}
void Clock::cleanup()