Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qsequentialanimationgroupjob_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant
4
5#ifndef QSEQUENTIALANIMATIONGROUPJOB_P_H
6#define QSEQUENTIALANIMATIONGROUPJOB_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <private/qanimationgroupjob_p.h>
20
22
23QT_BEGIN_NAMESPACE
24
25class QPauseAnimationJob;
26class Q_QML_EXPORT QSequentialAnimationGroupJob : public QAnimationGroupJob
27{
28 Q_DISABLE_COPY(QSequentialAnimationGroupJob)
29public:
30 QSequentialAnimationGroupJob();
31 ~QSequentialAnimationGroupJob();
32
33 int duration() const override;
34
35 QAbstractAnimationJob *currentAnimation() const { return m_currentAnimation; }
36 void clear() override;
37
38protected:
39 void updateCurrentTime(int) override;
40 void updateState(QAbstractAnimationJob::State newState, QAbstractAnimationJob::State oldState) override;
41 void updateDirection(QAbstractAnimationJob::Direction direction) override;
42 void uncontrolledAnimationFinished(QAbstractAnimationJob *animation) override;
43 void debugAnimation(QDebug d) const override;
44
45private:
46 struct AnimationIndex
47 {
48 AnimationIndex() {}
49 // AnimationIndex points to the animation at timeOffset, skipping 0 duration animations.
50 // Note that the index semantic is slightly different depending on the direction.
51 bool afterCurrent = false; //whether animation is before or after m_currentAnimation //TODO: make enum Before/After/Same
52 int timeOffset = 0; // time offset when the animation at index starts.
53 const QAbstractAnimationJob *animation = nullptr; //points to the animation at timeOffset
54 };
55
56 int animationActualTotalDuration(const QAbstractAnimationJob *anim) const;
57 AnimationIndex indexForCurrentTime() const;
58
59 void setCurrentAnimation(const QAbstractAnimationJob *anim, bool intermediate = false);
60 void activateCurrentAnimation(bool intermediate = false);
61
62 void animationInserted(QAbstractAnimationJob *anim) override;
63 void animationRemoved(QAbstractAnimationJob *anim, QAbstractAnimationJob *, QAbstractAnimationJob *) override;
64
65 bool atEnd() const;
66
67 void restart();
68
69 // handle time changes
70 void rewindForwards(const AnimationIndex &newAnimationIndex);
71 void advanceForwards(const AnimationIndex &newAnimationIndex);
72
73 //state
74 QAbstractAnimationJob *m_currentAnimation = nullptr;
75 int m_previousLoop = 0;
76};
77
78QT_END_NAMESPACE
79
80#endif //QSEQUENTIALANIMATIONGROUPJOB_P_H
QT_REQUIRE_CONFIG(qml_animation)