Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qabstractanimation.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
4#ifndef QABSTRACTANIMATION_H
5#define QABSTRACTANIMATION_H
6
7#include <QtCore/qobject.h>
8
10
12
13class QAnimationGroup;
16class QUnifiedTimer;
17
19class Q_CORE_EXPORT QAbstractAnimation : public QObject
20{
22
23 Q_PROPERTY(State state READ state NOTIFY stateChanged BINDABLE bindableState)
24 Q_PROPERTY(int loopCount READ loopCount WRITE setLoopCount BINDABLE bindableLoopCount)
25 Q_PROPERTY(int currentTime READ currentTime WRITE setCurrentTime BINDABLE bindableCurrentTime)
26 Q_PROPERTY(int currentLoop READ currentLoop NOTIFY currentLoopChanged
27 BINDABLE bindableCurrentLoop)
28 Q_PROPERTY(Direction direction READ direction WRITE setDirection NOTIFY directionChanged
29 BINDABLE bindableDirection)
30 Q_PROPERTY(int duration READ duration)
31
32public:
33 enum Direction {
35 Backward
36 };
37 Q_ENUM(Direction)
38
45
47 KeepWhenStopped = 0,
48 DeleteWhenStopped
49 };
50
51 QAbstractAnimation(QObject *parent = nullptr);
52 virtual ~QAbstractAnimation();
53
54 State state() const;
55 QBindable<QAbstractAnimation::State> bindableState() const;
56
57 QAnimationGroup *group() const;
58
59 Direction direction() const;
60 void setDirection(Direction direction);
61 QBindable<Direction> bindableDirection();
62
63 int currentTime() const;
64 QBindable<int> bindableCurrentTime();
65
66 int currentLoopTime() const;
67
68 int loopCount() const;
69 void setLoopCount(int loopCount);
70 QBindable<int> bindableLoopCount();
71
72 int currentLoop() const;
73 QBindable<int> bindableCurrentLoop() const;
74
75 virtual int duration() const = 0;
76 int totalDuration() const;
77
79 void finished();
81 void currentLoopChanged(int currentLoop);
83
84public Q_SLOTS:
85 void start(QAbstractAnimation::DeletionPolicy policy = KeepWhenStopped);
86 void pause();
87 void resume();
88 void setPaused(bool);
89 void stop();
90 void setCurrentTime(int msecs);
91
92protected:
94 bool event(QEvent *event) override;
95
96 virtual void updateCurrentTime(int currentTime) = 0;
97 virtual void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState);
98 virtual void updateDirection(QAbstractAnimation::Direction direction);
99
100private:
101 Q_DISABLE_COPY(QAbstractAnimation)
102 Q_DECLARE_PRIVATE(QAbstractAnimation)
103};
104
106class Q_CORE_EXPORT QAnimationDriver : public QObject
107{
109 Q_DECLARE_PRIVATE(QAnimationDriver)
110
111public:
112 QAnimationDriver(QObject *parent = nullptr);
114
115 virtual void advance();
116
117 void install();
118 void uninstall();
119
120 bool isRunning() const;
121
122 virtual qint64 elapsed() const;
123
125 void started();
126 void stopped();
127
128protected:
129 void advanceAnimation();
130 virtual void start();
131 virtual void stop();
132
133 QAnimationDriver(QAnimationDriverPrivate &dd, QObject *parent = nullptr);
134
135private:
136 friend class QUnifiedTimer;
137
138};
139
141
142#endif // QABSTRACTANIMATION_H
State
This enum describes the state of the animation.
DeletionPolicy
\value KeepWhenStopped The animation will not be deleted when stopped.
virtual void updateCurrentTime(int currentTime)=0
This pure virtual function is called every time the animation's currentTime changes.
Direction
This enum describes the direction of the animation when in \l Running state.
void directionChanged(QAbstractAnimation::Direction)
QAbstractAnimation emits this signal whenever the direction has been changed.
void stateChanged(QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
QAbstractAnimation emits this signal whenever the state of the animation has changed from oldState to...
void finished()
QAbstractAnimation emits this signal after the animation has stopped and has reached the end.
virtual int duration() const =0
This pure virtual function returns the duration of the animation, and defines for how long QAbstractA...
void currentLoopChanged(int currentLoop)
QAbstractAnimation emits this signal whenever the current loop changes.
\inmodule QtCore
void started()
This signal is emitted by the animation framework to notify the driver that continuous animation has ...
void stopped()
This signal is emitted by the animation framework to notify the driver that continuous animation has ...
\inmodule QtCore
\inmodule QtCore
Definition qcoreevent.h:45
\inmodule QtCore
Definition qobject.h:103
\inmodule QtCore
direction
else opt state
[0]
void newState(QList< State > &states, const char *token, const char *lexem, bool pre)
Combined button and popup list for selecting options.
GLboolean GLuint group
GLuint start
struct _cl_event * event
static bool isRunning()
Definition main.cpp:452
static double elapsed(qint64 after, qint64 before)
#define QT_REQUIRE_CONFIG(feature)
#define Q_ENUM(x)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_SLOTS
#define Q_SIGNALS
long long qint64
Definition qtypes.h:60
static double currentTime()
future resume()
QPropertyAnimation animation
[0]
QSizePolicy policy