Merge branch 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into master-integration
[qt-netbsd.git] / src / corelib / animation / qpauseanimation.cpp
blobd3a3062033ad2bbee4b8ba1b805206717cc0c7c3
1 /****************************************************************************
2 **
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: Nokia Corporation (qt-info@nokia.com)
6 **
7 ** This file is part of the QtCore module of the Qt Toolkit.
8 **
9 ** $QT_BEGIN_LICENSE:LGPL$
10 ** No Commercial Usage
11 ** This file contains pre-release code and may not be distributed.
12 ** You may use this file in accordance with the terms and conditions
13 ** contained in the Technology Preview License Agreement accompanying
14 ** this package.
16 ** GNU Lesser General Public License Usage
17 ** Alternatively, this file may be used under the terms of the GNU Lesser
18 ** General Public License version 2.1 as published by the Free Software
19 ** Foundation and appearing in the file LICENSE.LGPL included in the
20 ** packaging of this file. Please review the following information to
21 ** ensure the GNU Lesser General Public License version 2.1 requirements
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 ** In addition, as a special exception, Nokia gives you certain additional
25 ** rights. These rights are described in the Nokia Qt LGPL Exception
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
38 ** $QT_END_LICENSE$
40 ****************************************************************************/
42 /*!
43 \class QPauseAnimation
44 \brief The QPauseAnimation class provides a pause for QSequentialAnimationGroup.
45 \since 4.6
46 \ingroup animation
48 If you wish to introduce a delay between animations in a
49 QSequentialAnimationGroup, you can insert a QPauseAnimation. This
50 class does not animate anything, but does not
51 \l{QAbstractAnimation::finished()}{finish} before a specified
52 number of milliseconds have elapsed from when it was started. You
53 specify the duration of the pause in the constructor. It can also
54 be set directly with setDuration().
56 It is not necessary to construct a QPauseAnimation yourself.
57 QSequentialAnimationGroup provides the convenience functions
58 \l{QSequentialAnimationGroup::}{addPause()} and
59 \l{QSequentialAnimationGroup::}{insertPause()}. These functions
60 simply take the number of milliseconds the pause should last.
62 \sa QSequentialAnimationGroup
65 #include "qpauseanimation.h"
66 #include "qabstractanimation_p.h"
69 #ifndef QT_NO_ANIMATION
71 QT_BEGIN_NAMESPACE
73 class QPauseAnimationPrivate : public QAbstractAnimationPrivate
75 public:
76 QPauseAnimationPrivate() : QAbstractAnimationPrivate(), duration(250)
78 isPause = true;
81 int duration;
84 /*!
85 Constructs a QPauseAnimation.
86 \a parent is passed to QObject's constructor.
87 The default duration is 0.
90 QPauseAnimation::QPauseAnimation(QObject *parent) : QAbstractAnimation(*new QPauseAnimationPrivate, parent)
94 /*!
95 Constructs a QPauseAnimation.
96 \a msecs is the duration of the pause.
97 \a parent is passed to QObject's constructor.
100 QPauseAnimation::QPauseAnimation(int msecs, QObject *parent) : QAbstractAnimation(*new QPauseAnimationPrivate, parent)
102 setDuration(msecs);
106 Destroys the pause animation.
108 QPauseAnimation::~QPauseAnimation()
113 \property QPauseAnimation::duration
114 \brief the duration of the pause.
116 The duration of the pause. The duration should not be negative.
117 The default duration is 250 milliseconds.
119 int QPauseAnimation::duration() const
121 Q_D(const QPauseAnimation);
122 return d->duration;
125 void QPauseAnimation::setDuration(int msecs)
127 if (msecs < 0) {
128 qWarning("QPauseAnimation::setDuration: cannot set a negative duration");
129 return;
131 Q_D(QPauseAnimation);
132 d->duration = msecs;
136 \reimp
138 bool QPauseAnimation::event(QEvent *e)
140 return QAbstractAnimation::event(e);
144 \reimp
146 void QPauseAnimation::updateCurrentTime(int)
151 QT_END_NAMESPACE
153 #include "moc_qpauseanimation.cpp"
155 #endif //QT_NO_ANIMATION