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
qquicksmoothedanimation_p_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 reason:default
4
5#ifndef QQUICKSMOOTHEDANIMATION2_P_H
6#define QQUICKSMOOTHEDANIMATION2_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
21
23
24#include <private/qobject_p.h>
25#include <QTimer>
26
28class QSmoothedAnimation;
30{
32public:
35public Q_SLOTS:
36 void stopAnimation();
37private:
38 QSmoothedAnimation *m_animation;
39};
40
42class Q_AUTOTEST_EXPORT QSmoothedAnimation : public QAbstractAnimationJob
43{
44 Q_DISABLE_COPY(QSmoothedAnimation)
45public:
46 QSmoothedAnimation(QQuickSmoothedAnimationPrivate * = nullptr);
47
48 ~QSmoothedAnimation();
49 qreal to;
50 qreal velocity;
51 int userDuration;
52
53 int maximumEasingTime;
54 QQuickSmoothedAnimation::ReversingMode reversingMode;
55
56 qreal initialVelocity;
57 qreal trackVelocity;
58
59 QQmlProperty target;
60
61 int duration() const override;
62 void restart();
63 void init();
64
65 void prepareForRestart();
66 void clearTemplate() { animationTemplate = nullptr; }
67
68protected:
69 void updateCurrentTime(int) override;
70 void updateState(QAbstractAnimationJob::State, QAbstractAnimationJob::State) override;
71 void debugAnimation(QDebug d) const override;
72
73private:
74 qreal easeFollow(qreal);
75 qreal initialValue;
76
77 bool invert;
78
79 int finalDuration;
80
81 // Parameters for use in updateCurrentTime()
82 qreal a; // Acceleration
83 qreal d; // Deceleration
84 qreal tf; // Total time
85 qreal tp; // Time at which peak velocity occurs
86 qreal td; // Time at which deceleration begins
87 qreal vp; // Velocity at tp
88 qreal sp; // Displacement at tp
89 qreal sd; // Displacement at td
90 qreal vi; // "Normalized" initialvelocity
91 qreal s; // Total s
92
93 int lastTime;
94 bool skipUpdate;
95
96 bool recalc();
97 void delayedStop();
98 QSmoothedAnimationTimer *delayedStopTimer;
99 QQuickSmoothedAnimationPrivate *animationTemplate;
100};
101
103{
104 Q_DECLARE_PUBLIC(QQuickSmoothedAnimation)
105public:
109
110 QSmoothedAnimation *anim;
112};
113
114QT_END_NAMESPACE
115
116#endif // QQUICKSMOOTHEDANIMATION2_P_H
QObject * parent
Definition qobject.h:73
QHash< QQmlProperty, QSmoothedAnimation * > activeAnimations
#define DELAY_STOP_TIMER_INTERVAL