[556] | 1 | /****************************************************************************
|
---|
| 2 | **
|
---|
[846] | 3 | ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
---|
[556] | 4 | ** All rights reserved.
|
---|
| 5 | ** Contact: Nokia Corporation ([email protected])
|
---|
| 6 | **
|
---|
| 7 | ** This file is part of the QtCore module of the Qt Toolkit.
|
---|
| 8 | **
|
---|
| 9 | ** $QT_BEGIN_LICENSE:LGPL$
|
---|
| 10 | ** Commercial Usage
|
---|
| 11 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
---|
| 12 | ** accordance with the Qt Commercial License Agreement provided with the
|
---|
| 13 | ** Software or, alternatively, in accordance with the terms contained in
|
---|
| 14 | ** a written agreement between you and Nokia.
|
---|
| 15 | **
|
---|
| 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.
|
---|
| 23 | **
|
---|
| 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.
|
---|
| 27 | **
|
---|
| 28 | ** GNU General Public License Usage
|
---|
| 29 | ** Alternatively, this file may be used under the terms of the GNU
|
---|
| 30 | ** General Public License version 3.0 as published by the Free Software
|
---|
| 31 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
| 32 | ** packaging of this file. Please review the following information to
|
---|
| 33 | ** ensure the GNU General Public License version 3.0 requirements will be
|
---|
| 34 | ** met: http://www.gnu.org/copyleft/gpl.html.
|
---|
| 35 | **
|
---|
| 36 | ** If you have questions regarding the use of this file, please contact
|
---|
| 37 | ** Nokia at [email protected].
|
---|
| 38 | ** $QT_END_LICENSE$
|
---|
| 39 | **
|
---|
| 40 | ****************************************************************************/
|
---|
| 41 |
|
---|
| 42 | /*!
|
---|
| 43 | \class QPauseAnimation
|
---|
| 44 | \brief The QPauseAnimation class provides a pause for QSequentialAnimationGroup.
|
---|
| 45 | \since 4.6
|
---|
| 46 | \ingroup animation
|
---|
| 47 |
|
---|
| 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().
|
---|
| 55 |
|
---|
| 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.
|
---|
| 61 |
|
---|
| 62 | \sa QSequentialAnimationGroup
|
---|
| 63 | */
|
---|
| 64 |
|
---|
| 65 | #include "qpauseanimation.h"
|
---|
| 66 | #include "qabstractanimation_p.h"
|
---|
| 67 |
|
---|
| 68 |
|
---|
| 69 | #ifndef QT_NO_ANIMATION
|
---|
| 70 |
|
---|
| 71 | QT_BEGIN_NAMESPACE
|
---|
| 72 |
|
---|
| 73 | class QPauseAnimationPrivate : public QAbstractAnimationPrivate
|
---|
| 74 | {
|
---|
| 75 | public:
|
---|
| 76 | QPauseAnimationPrivate() : QAbstractAnimationPrivate(), duration(250)
|
---|
| 77 | {
|
---|
| 78 | isPause = true;
|
---|
| 79 | }
|
---|
| 80 |
|
---|
| 81 | int duration;
|
---|
| 82 | };
|
---|
| 83 |
|
---|
| 84 | /*!
|
---|
| 85 | Constructs a QPauseAnimation.
|
---|
| 86 | \a parent is passed to QObject's constructor.
|
---|
| 87 | The default duration is 0.
|
---|
| 88 | */
|
---|
| 89 |
|
---|
| 90 | QPauseAnimation::QPauseAnimation(QObject *parent) : QAbstractAnimation(*new QPauseAnimationPrivate, parent)
|
---|
| 91 | {
|
---|
| 92 | }
|
---|
| 93 |
|
---|
| 94 | /*!
|
---|
| 95 | Constructs a QPauseAnimation.
|
---|
| 96 | \a msecs is the duration of the pause.
|
---|
| 97 | \a parent is passed to QObject's constructor.
|
---|
| 98 | */
|
---|
| 99 |
|
---|
| 100 | QPauseAnimation::QPauseAnimation(int msecs, QObject *parent) : QAbstractAnimation(*new QPauseAnimationPrivate, parent)
|
---|
| 101 | {
|
---|
| 102 | setDuration(msecs);
|
---|
| 103 | }
|
---|
| 104 |
|
---|
| 105 | /*!
|
---|
| 106 | Destroys the pause animation.
|
---|
| 107 | */
|
---|
| 108 | QPauseAnimation::~QPauseAnimation()
|
---|
| 109 | {
|
---|
| 110 | }
|
---|
| 111 |
|
---|
| 112 | /*!
|
---|
| 113 | \property QPauseAnimation::duration
|
---|
| 114 | \brief the duration of the pause.
|
---|
| 115 |
|
---|
| 116 | The duration of the pause. The duration should not be negative.
|
---|
| 117 | The default duration is 250 milliseconds.
|
---|
| 118 | */
|
---|
| 119 | int QPauseAnimation::duration() const
|
---|
| 120 | {
|
---|
| 121 | Q_D(const QPauseAnimation);
|
---|
| 122 | return d->duration;
|
---|
| 123 | }
|
---|
| 124 |
|
---|
| 125 | void QPauseAnimation::setDuration(int msecs)
|
---|
| 126 | {
|
---|
| 127 | if (msecs < 0) {
|
---|
| 128 | qWarning("QPauseAnimation::setDuration: cannot set a negative duration");
|
---|
| 129 | return;
|
---|
| 130 | }
|
---|
| 131 | Q_D(QPauseAnimation);
|
---|
| 132 | d->duration = msecs;
|
---|
| 133 | }
|
---|
| 134 |
|
---|
| 135 | /*!
|
---|
| 136 | \reimp
|
---|
| 137 | */
|
---|
| 138 | bool QPauseAnimation::event(QEvent *e)
|
---|
| 139 | {
|
---|
| 140 | return QAbstractAnimation::event(e);
|
---|
| 141 | }
|
---|
| 142 |
|
---|
| 143 | /*!
|
---|
| 144 | \reimp
|
---|
| 145 | */
|
---|
| 146 | void QPauseAnimation::updateCurrentTime(int)
|
---|
| 147 | {
|
---|
| 148 | }
|
---|
| 149 |
|
---|
| 150 |
|
---|
| 151 | QT_END_NAMESPACE
|
---|
| 152 |
|
---|
| 153 | #include "moc_qpauseanimation.cpp"
|
---|
| 154 |
|
---|
| 155 | #endif //QT_NO_ANIMATION
|
---|