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

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