qpauseanimation.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/corelib/animation/qpauseanimation.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2015 The Qt Company Ltd.-
4** Contact: http://www.qt.io/licensing/-
5**-
6** This file is part of the QtCore module of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL21$-
9** Commercial License Usage-
10** Licensees holding valid commercial Qt licenses may use this file in-
11** accordance with the commercial license agreement provided with the-
12** Software or, alternatively, in accordance with the terms contained in-
13** a written agreement between you and The Qt Company. For licensing terms-
14** and conditions see http://www.qt.io/terms-conditions. For further-
15** information use the contact form at http://www.qt.io/contact-us.-
16**-
17** GNU Lesser General Public License Usage-
18** Alternatively, this file may be used under the terms of the GNU Lesser-
19** General Public License version 2.1 or version 3 as published by the Free-
20** Software Foundation and appearing in the file LICENSE.LGPLv21 and-
21** LICENSE.LGPLv3 included in the packaging of this file. Please review the-
22** following information to ensure the GNU Lesser General Public License-
23** requirements will be met: https://www.gnu.org/licenses/lgpl.html and-
24** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.-
25**-
26** As a special exception, The Qt Company gives you certain additional-
27** rights. These rights are described in The Qt Company LGPL Exception-
28** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.-
29**-
30** $QT_END_LICENSE$-
31**-
32****************************************************************************/-
33-
34/*!-
35 \class QPauseAnimation-
36 \inmodule QtCore-
37 \brief The QPauseAnimation class provides a pause for QSequentialAnimationGroup.-
38 \since 4.6-
39 \ingroup animation-
40-
41 If you wish to introduce a delay between animations in a-
42 QSequentialAnimationGroup, you can insert a QPauseAnimation. This-
43 class does not animate anything, but does not-
44 \l{QAbstractAnimation::finished()}{finish} before a specified-
45 number of milliseconds have elapsed from when it was started. You-
46 specify the duration of the pause in the constructor. It can also-
47 be set directly with setDuration().-
48-
49 It is not necessary to construct a QPauseAnimation yourself.-
50 QSequentialAnimationGroup provides the convenience functions-
51 \l{QSequentialAnimationGroup::}{addPause()} and-
52 \l{QSequentialAnimationGroup::}{insertPause()}. These functions-
53 simply take the number of milliseconds the pause should last.-
54-
55 \sa QSequentialAnimationGroup-
56*/-
57-
58#include "qpauseanimation.h"-
59#include "qabstractanimation_p.h"-
60-
61-
62#ifndef QT_NO_ANIMATION-
63-
64QT_BEGIN_NAMESPACE-
65-
66class QPauseAnimationPrivate : public QAbstractAnimationPrivate-
67{-
68public:-
69 QPauseAnimationPrivate() : QAbstractAnimationPrivate(), duration(250)-
70 {-
71 isPause = true;-
72 }
executed 41 times by 2 tests: end of block
Executed by:
  • tst_QPauseAnimation
  • tst_QSequentialAnimationGroup
41
73-
74 int duration;-
75};-
76-
77/*!-
78 Constructs a QPauseAnimation.-
79 \a parent is passed to QObject's constructor.-
80 The default duration is 0.-
81*/-
82-
83QPauseAnimation::QPauseAnimation(QObject *parent) : QAbstractAnimation(*new QPauseAnimationPrivate, parent)-
84{-
85}
executed 19 times by 1 test: end of block
Executed by:
  • tst_QPauseAnimation
19
86-
87/*!-
88 Constructs a QPauseAnimation.-
89 \a msecs is the duration of the pause.-
90 \a parent is passed to QObject's constructor.-
91*/-
92-
93QPauseAnimation::QPauseAnimation(int msecs, QObject *parent) : QAbstractAnimation(*new QPauseAnimationPrivate, parent)-
94{-
95 setDuration(msecs);-
96}
executed 22 times by 1 test: end of block
Executed by:
  • tst_QSequentialAnimationGroup
22
97-
98/*!-
99 Destroys the pause animation.-
100*/-
101QPauseAnimation::~QPauseAnimation()-
102{-
103}-
104-
105/*!-
106 \property QPauseAnimation::duration-
107 \brief the duration of the pause.-
108-
109 The duration of the pause. The duration should not be negative.-
110 The default duration is 250 milliseconds.-
111*/-
112int QPauseAnimation::duration() const-
113{-
114 Q_D(const QPauseAnimation);-
115 return d->duration;
executed 2070 times by 2 tests: return d->duration;
Executed by:
  • tst_QPauseAnimation
  • tst_QSequentialAnimationGroup
2070
116}-
117-
118void QPauseAnimation::setDuration(int msecs)-
119{-
120 if (msecs < 0) {
msecs < 0Description
TRUEnever evaluated
FALSEevaluated 41 times by 2 tests
Evaluated by:
  • tst_QPauseAnimation
  • tst_QSequentialAnimationGroup
0-41
121 qWarning("QPauseAnimation::setDuration: cannot set a negative duration");-
122 return;
never executed: return;
0
123 }-
124 Q_D(QPauseAnimation);-
125 d->duration = msecs;-
126}
executed 41 times by 2 tests: end of block
Executed by:
  • tst_QPauseAnimation
  • tst_QSequentialAnimationGroup
41
127-
128/*!-
129 \reimp-
130 */-
131bool QPauseAnimation::event(QEvent *e)-
132{-
133 return QAbstractAnimation::event(e);
never executed: return QAbstractAnimation::event(e);
0
134}-
135-
136/*!-
137 \reimp-
138 */-
139void QPauseAnimation::updateCurrentTime(int)-
140{-
141}-
142-
143-
144QT_END_NAMESPACE-
145-
146#include "moc_qpauseanimation.cpp"-
147-
148#endif //QT_NO_ANIMATION-
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9