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
qtimeline.h
Go to the documentation of this file.
1// Copyright (C) 2020 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 QTIMELINE_H
5#define QTIMELINE_H
6
7#include <QtCore/qglobal.h>
8
9QT_REQUIRE_CONFIG(easingcurve);
10
11#include <QtCore/qeasingcurve.h>
12#include <QtCore/qobject.h>
13
15
16
18class Q_CORE_EXPORT QTimeLine : public QObject
19{
21 Q_PROPERTY(int duration READ duration WRITE setDuration BINDABLE bindableDuration)
22 Q_PROPERTY(int updateInterval READ updateInterval WRITE setUpdateInterval
23 BINDABLE bindableUpdateInterval)
24 Q_PROPERTY(int currentTime READ currentTime WRITE setCurrentTime BINDABLE bindableCurrentTime)
25 Q_PROPERTY(Direction direction READ direction WRITE setDirection BINDABLE bindableDirection)
26 Q_PROPERTY(int loopCount READ loopCount WRITE setLoopCount BINDABLE bindableLoopCount)
27 Q_PROPERTY(QEasingCurve easingCurve READ easingCurve WRITE setEasingCurve
28 BINDABLE bindableEasingCurve)
29public:
35 enum Direction {
37 Backward
38 };
39
40 explicit QTimeLine(int duration = 1000, QObject *parent = nullptr);
41 virtual ~QTimeLine();
42
43 State state() const;
44
45 int loopCount() const;
46 void setLoopCount(int count);
47 QBindable<int> bindableLoopCount();
48
49 Direction direction() const;
50 void setDirection(Direction direction);
51 QBindable<Direction> bindableDirection();
52
53 int duration() const;
54 void setDuration(int duration);
55 QBindable<int> bindableDuration();
56
57 int startFrame() const;
58 void setStartFrame(int frame);
59 int endFrame() const;
60 void setEndFrame(int frame);
61 void setFrameRange(int startFrame, int endFrame);
62
63 int updateInterval() const;
64 void setUpdateInterval(int interval);
65 QBindable<int> bindableUpdateInterval();
66
67 QEasingCurve easingCurve() const;
68 void setEasingCurve(const QEasingCurve &curve);
69 QBindable<QEasingCurve> bindableEasingCurve();
70
71 int currentTime() const;
72 QBindable<int> bindableCurrentTime();
73 int currentFrame() const;
74 qreal currentValue() const;
75
76 int frameForTime(int msec) const;
77 virtual qreal valueForTime(int msec) const;
78
79public Q_SLOTS:
80 void start();
81 void resume();
82 void stop();
83 void setPaused(bool paused);
84 void setCurrentTime(int msec);
85 void toggleDirection();
86
88 void valueChanged(qreal x, QPrivateSignal);
89 void frameChanged(int, QPrivateSignal);
90 void stateChanged(QTimeLine::State newState, QPrivateSignal);
91 void finished(QPrivateSignal);
92
93protected:
94 void timerEvent(QTimerEvent *event) override;
95
96private:
97 Q_DISABLE_COPY(QTimeLine)
98 Q_DECLARE_PRIVATE(QTimeLine)
99};
100
102
103#endif
104
\inmodule QtCore
\inmodule QtCore
Definition qobject.h:103
\inmodule QtCore
Definition qtimeline.h:19
void frameChanged(int, QPrivateSignal)
QTimeLine emits this signal at regular intervals when in \l Running state, but only if the current fr...
void valueChanged(qreal x, QPrivateSignal)
QTimeLine emits this signal at regular intervals when in \l Running state, but only if the current va...
void finished(QPrivateSignal)
This signal is emitted when QTimeLine finishes (i.e., reaches the end of its time line),...
void stateChanged(QTimeLine::State newState, QPrivateSignal)
This signal is emitted whenever QTimeLine's state changes.
State
This enum describes the state of the timeline.
Definition qtimeline.h:30
Direction
This enum describes the direction of the timeline when in \l Running state.
Definition qtimeline.h:35
\inmodule QtCore
Definition qcoreevent.h:366
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.
GLint GLint GLint GLint GLint x
[0]
GLenum GLenum GLsizei count
GLuint start
struct _cl_event * event
#define QT_REQUIRE_CONFIG(feature)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_SLOTS
#define Q_SIGNALS
double qreal
Definition qtypes.h:187
static double currentTime()
future resume()
animation setEasingCurve(QEasingCurve::InOutQuad)
animation setDuration(1000)
timeLine setFrameRange(0, 100)
QFrame frame
[0]