Name Description Size Coverage
qabstractanimation.cpp ! \class QAbstractAnimation \inmodule QtCore \ingroup animation \brief The QAbstractAnimation class is the base of all animations. \since 4.6 The class defines the functions for the functionality shared by all animations. By inheriting this class, you can create custom animations that plug into the rest of the animation framework. The progress of an animation is given by its current time (currentLoopTime()), which is measured in milliseconds from the start of the animation (0) to its end (duration()). The value is updated automatically while the animation is running. It can also be set directly with setCurrentTime(). At any point an animation is in one of three states: \l{QAbstractAnimation::}{Running}, \l{QAbstractAnimation::}{Stopped}, or \l{QAbstractAnimation::}{Paused}--as defined by the \l{QAbstractAnimation::}{State} enum. The current state can be changed by calling start(), stop(), pause(), or resume(). An animation will always reset its \l{currentTime()}{current time} when it is started. If paused, it will continue with the same current time when resumed. When an animation is stopped, it cannot be resumed, but will keep its current time (until started again). QAbstractAnimation will emit stateChanged() whenever its state changes. An animation can loop any number of times by setting the loopCount property. When an animation's current time reaches its duration(), it will reset the current time and keep running. A loop count of 1 (the default value) means that the animation will run one time. Note that a duration of -1 means that the animation will run until stopped; the current time will increase indefinitely. When the current time equals duration() and the animation is in its final loop, the \l{QAbstractAnimation::}{Stopped} state is entered, and the finished() signal is emitted. QAbstractAnimation provides pure virtual functions used by subclasses to track the progress of the animation: duration() and updateCurrentTime(). The duration() function lets you report a duration for the animation (as discussed above). The animation framework calls updateCurrentTime() when current time has changed. By reimplementing this function, you can track the animation progress. Note that neither the interval between calls nor the number of calls to this function are defined; though, it will normally be 60 updates per second. By reimplementing updateState(), you can track the animation's state changes, which is particularly useful for animations that are not driven by time. \sa QVariantAnimation, QPropertyAnimation, QAnimationGroup, {The Animation Framework} 47670 -
qabstractanimation.h 3667 -
qabstractanimation_p.h this allows to have a consistent timer interval at each tick from the timer not taking the real time that passed into account. 8432 -
qanimationgroup.cpp ! \class QAnimationGroup \inmodule QtCore \brief The QAnimationGroup class is an abstract base class for groups of animations. \since 4.6 \ingroup animation An animation group is a container for animations (subclasses of QAbstractAnimation). A group is usually responsible for managing the \l{QAbstractAnimation::State}{state} of its animations, i.e., it decides when to start, stop, resume, and pause them. Currently, Qt provides two such groups: QParallelAnimationGroup and QSequentialAnimationGroup. Look up their class descriptions for details. Since QAnimationGroup inherits from QAbstractAnimation, you can combine groups, and easily construct complex animation graphs. You can query QAbstractAnimation for the group it belongs to (using the \l{QAbstractAnimation::}{group()} function). To start a top-level animation group, you simply use the \l{QAbstractAnimation::}{start()} function from QAbstractAnimation. By a top-level animation group, we think of a group that itself is not contained within another group. Starting sub groups directly is not supported, and may lead to unexpected behavior. \omit OK, we'll put in a snippet on this here \endomit QAnimationGroup provides methods for adding and retrieving animations. Besides that, you can remove animations by calling \l removeAnimation(), and clear the animation group by calling clear(). You may keep track of changes in the group's animations by listening to QEvent::ChildAdded and QEvent::ChildRemoved events. \omit OK, let's find a snippet here as well. \endomit QAnimationGroup takes ownership of the animations it manages, and ensures that they are deleted when the animation group is deleted. \sa QAbstractAnimation, QVariantAnimation, {The Animation Framework} 9812 -
qanimationgroup.h 1176 -
qanimationgroup_p.h 1522 -
qparallelanimationgroup.cpp ! \class QParallelAnimationGroup \inmodule QtCore \brief The QParallelAnimationGroup class provides a parallel group of animations. \since 4.6 \ingroup animation QParallelAnimationGroup--a \l{QAnimationGroup}{container for animations}--starts all its animations when it is \l{QAbstractAnimation::start()}{started} itself, i.e., runs all animations in parallel. The animation group finishes when the longest lasting animation has finished. You can treat QParallelAnimationGroup as any other QAbstractAnimation, e.g., pause, resume, or add it to other animation groups. \snippet code/src_corelib_animation_qparallelanimationgroup.cpp 0 In this example, \c anim1 and \c anim2 are two \l{QPropertyAnimation}s that have already been set up. \sa QAnimationGroup, QPropertyAnimation, {The Animation Framework} 9147 -
qparallelanimationgroup.h 1200 -
qparallelanimationgroup_p.h 1491 -
qpauseanimation.cpp ! \class QPauseAnimation \inmodule QtCore \brief The QPauseAnimation class provides a pause for QSequentialAnimationGroup. \since 4.6 \ingroup animation If you wish to introduce a delay between animations in a QSequentialAnimationGroup, you can insert a QPauseAnimation. This class does not animate anything, but does not \l{QAbstractAnimation::finished()}{finish} before a specified number of milliseconds have elapsed from when it was started. You specify the duration of the pause in the constructor. It can also be set directly with setDuration(). It is not necessary to construct a QPauseAnimation yourself. QSequentialAnimationGroup provides the convenience functions \l{QSequentialAnimationGroup::}{addPause()} and \l{QSequentialAnimationGroup::}{insertPause()}. These functions simply take the number of milliseconds the pause should last. \sa QSequentialAnimationGroup 3328 -
qpauseanimation.h 1003 -
qpropertyanimation.cpp ! \class QPropertyAnimation \inmodule QtCore \brief The QPropertyAnimation class animates Qt properties. \since 4.6 \ingroup animation QPropertyAnimation interpolates over \l{Qt's Property System}{Qt properties}. As property values are stored in \l{QVariant}s, the class inherits QVariantAnimation, and supports animation of the same \l{QMetaType::Type}{meta types} as its super class. A class declaring properties must be a QObject. To make it possible to animate a property, it must provide a setter (so that QPropertyAnimation can set the property's value). Note that this makes it possible to animate many of Qt's widgets. Let's look at an example: \snippet code/src_corelib_animation_qpropertyanimation.cpp includes \snippet code/src_corelib_animation_qpropertyanimation.cpp class_decl \snippet code/src_corelib_animation_qpropertyanimation.cpp ctor_impl \snippet code/src_corelib_animation_qpropertyanimation.cpp first_example \snippet code/src_corelib_animation_qpropertyanimation.cpp ctor_close \snippet code/src_corelib_animation_qpropertyanimation.cpp main \note You can also control an animation's lifespan by choosing a \l{QAbstractAnimation::DeletionPolicy}{delete policy} while starting the animation. The property name and the QObject instance of which property should be animated are passed to the constructor. You can then specify the start and end value of the property. The procedure is equal for properties in classes you have implemented yourself--just check with QVariantAnimation that your QVariant type is supported. The QVariantAnimation class description explains how to set up the animation in detail. Note, however, that if a start value is not set, the property will start at the value it had when the QPropertyAnimation instance was created. QPropertyAnimation works like a charm on its own. For complex animations that, for instance, contain several objects, QAnimationGroup is provided. An animation group is an animation that can contain other animations, and that can manage when its animations are played. Look at QParallelAnimationGroup for an example. \sa QVariantAnimation, QAnimationGroup, {The Animation Framework} 11883 -
qpropertyanimation.h 1525 -
qpropertyanimation_p.h 1996 -
qsequentialanimationgroup.cpp ! \class QSequentialAnimationGroup \inmodule QtCore \brief The QSequentialAnimationGroup class provides a sequential group of animations. \since 4.6 \ingroup animation QSequentialAnimationGroup is a QAnimationGroup that runs its animations in sequence, i.e., it starts one animation after another has finished playing. The animations are played in the order they are added to the group (using \l{QAnimationGroup::}{addAnimation()} or \l{QAnimationGroup::}{insertAnimation()}). The animation group finishes when its last animation has finished. At each moment there is at most one animation that is active in the group; it is returned by currentAnimation(). An empty group has no current animation. A sequential animation group can be treated as any other animation, i.e., it can be started, stopped, and added to other groups. You can also call addPause() or insertPause() to add a pause to a sequential animation group. \snippet code/src_corelib_animation_qsequentialanimationgroup.cpp 0 In this example, \c anim1 and \c anim2 are two already set up \l{QPropertyAnimation}s. \sa QAnimationGroup, QAbstractAnimation, {The Animation Framework} 19204 -
qsequentialanimationgroup.h 1684 -
qsequentialanimationgroup_p.h 2424 -
qvariantanimation.cpp ! \class QVariantAnimation \inmodule QtCore \ingroup animation \brief The QVariantAnimation class provides a base class for animations. \since 4.6 This class is part of \l{The Animation Framework}. It serves as a base class for property and item animations, with functions for shared functionality. The class performs interpolation over \l{QVariant}s, but leaves using the interpolated values to its subclasses. Currently, Qt provides QPropertyAnimation, which animates Qt \l{Qt's Property System}{properties}. See the QPropertyAnimation class description if you wish to animate such properties. You can then set start and end values for the property by calling setStartValue() and setEndValue(), and finally call start() to start the animation. QVariantAnimation will interpolate the property of the target object and emit valueChanged(). To react to a change in the current value you have to reimplement the updateCurrentValue() virtual function or connect to said signal. It is also possible to set values at specified steps situated between the start and end value. The interpolation will then touch these points at the specified steps. Note that the start and end values are defined as the key values at 0.0 and 1.0. There are two ways to affect how QVariantAnimation interpolates the values. You can set an easing curve by calling setEasingCurve(), and configure the duration by calling setDuration(). You can change how the \l{QVariant}s are interpolated by creating a subclass of QVariantAnimation, and reimplementing the virtual interpolated() function. Subclassing QVariantAnimation can be an alternative if you have \l{QVariant}s that you do not wish to declare as Qt properties. Note, however, that you in most cases will be better off declaring your QVariant as a property. Not all QVariant types are supported. Below is a list of currently supported QVariant types: \list \li \l{QMetaType::}{Int} \li \l{QMetaType::}{UInt} \li \l{QMetaType::}{Double} \li \l{QMetaType::}{Float} \li \l{QMetaType::}{QLine} \li \l{QMetaType::}{QLineF} \li \l{QMetaType::}{QPoint} \li \l{QMetaType::}{QPointF} \li \l{QMetaType::}{QSize} \li \l{QMetaType::}{QSizeF} \li \l{QMetaType::}{QRect} \li \l{QMetaType::}{QRectF} \li \l{QMetaType::}{QColor} \endlist If you need to interpolate other variant types, including custom types, you have to implement interpolation for these yourself. To do this, you can register an interpolator function for a given type. This function takes 3 parameters: the start value, the end value, and the current progress. Example: \snippet code/src_corelib_animation_qvariantanimation.cpp 0 Another option is to reimplement interpolated(), which returns interpolation values for the value being interpolated. \omit We need some snippets around here. \endomit \sa QPropertyAnimation, QAbstractAnimation, {The Animation Framework} 23581 -
qvariantanimation.h 2993 -
qvariantanimation_p.h 2952 -