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
qpauseanimation.cpp
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
/*!
6
\class QPauseAnimation
7
\inmodule QtCore
8
\brief The QPauseAnimation class provides a pause for QSequentialAnimationGroup.
9
\since 4.6
10
\ingroup animation
11
12
If you wish to introduce a delay between animations in a
13
QSequentialAnimationGroup, you can insert a QPauseAnimation. This
14
class does not animate anything, but does not
15
\l{QAbstractAnimation::finished()}{finish} before a specified
16
number of milliseconds have elapsed from when it was started. You
17
specify the duration of the pause in the constructor. It can also
18
be set directly with setDuration().
19
20
It is not necessary to construct a QPauseAnimation yourself.
21
QSequentialAnimationGroup provides the convenience functions
22
\l{QSequentialAnimationGroup::}{addPause()} and
23
\l{QSequentialAnimationGroup::}{insertPause()}. These functions
24
simply take the number of milliseconds the pause should last.
25
26
\sa QSequentialAnimationGroup
27
*/
28
29
#
include
"qpauseanimation.h"
30
#
include
"qabstractanimation_p.h"
31
#
include
"private/qproperty_p.h"
32
33
QT_BEGIN_NAMESPACE
34
35
class
QPauseAnimationPrivate
:
public
QAbstractAnimationPrivate
36
{
37
Q_DECLARE_PUBLIC(QPauseAnimation)
38
public
:
39
QPauseAnimationPrivate
() :
QAbstractAnimationPrivate
(),
duration
(250)
40
{
41
isPause
=
true
;
42
}
43
44
void
setDuration
(
int
msecs
) {
q_func
()->
setDuration
(
msecs
); }
45
Q_OBJECT_COMPAT_PROPERTY
(
QPauseAnimationPrivate
,
int
,
duration
,
46
&
QPauseAnimationPrivate
::
setDuration
)
47
};
48
49
/*!
50
Constructs a QPauseAnimation.
51
\a parent is passed to QObject's constructor.
52
The default duration is 0.
53
*/
54
55
QPauseAnimation::QPauseAnimation(QObject *parent) : QAbstractAnimation(*
new
QPauseAnimationPrivate, parent)
56
{
57
}
58
59
/*!
60
Constructs a QPauseAnimation.
61
\a msecs is the duration of the pause.
62
\a parent is passed to QObject's constructor.
63
*/
64
65
QPauseAnimation::QPauseAnimation(
int
msecs, QObject *parent) : QAbstractAnimation(*
new
QPauseAnimationPrivate, parent)
66
{
67
setDuration(msecs);
68
}
69
70
/*!
71
Destroys the pause animation.
72
*/
73
QPauseAnimation::~QPauseAnimation()
74
{
75
}
76
77
/*!
78
\property QPauseAnimation::duration
79
\brief the duration of the pause.
80
81
The duration of the pause. The duration should not be negative.
82
The default duration is 250 milliseconds.
83
*/
84
int
QPauseAnimation::duration()
const
85
{
86
Q_D(
const
QPauseAnimation);
87
return
d->duration;
88
}
89
90
void
QPauseAnimation::setDuration(
int
msecs)
91
{
92
if
(msecs < 0) {
93
qWarning(
"QPauseAnimation::setDuration: cannot set a negative duration"
);
94
return
;
95
}
96
Q_D(QPauseAnimation);
97
98
d->duration.removeBindingUnlessInWrapper();
99
if
(msecs != d->duration.valueBypassingBindings()) {
100
d->duration.setValueBypassingBindings(msecs);
101
d->duration.notify();
102
}
103
}
104
105
QBindable<
int
> QPauseAnimation::bindableDuration()
106
{
107
Q_D(QPauseAnimation);
108
return
&d->duration;
109
}
110
111
/*!
112
\reimp
113
*/
114
bool
QPauseAnimation::event(QEvent *e)
115
{
116
return
QAbstractAnimation::event(e);
117
}
118
119
/*!
120
\reimp
121
*/
122
void
QPauseAnimation::updateCurrentTime(
int
)
123
{
124
}
125
126
127
QT_END_NAMESPACE
128
129
#
include
"moc_qpauseanimation.cpp"
QPauseAnimationPrivate
Definition
qpauseanimation.cpp:36
QPlatformGraphicsBufferHelper
\inmodule QtGui
qtbase
src
corelib
animation
qpauseanimation.cpp
Generated on
for Qt by
1.14.0