QSequentialAnimationGroup Class
The QSequentialAnimationGroup class provides a sequential group of animations. More…
| Header | #include <QSequentialAnimationGroup> |
|---|---|
| CMake | target_link_libraries(app PRIVATE Nt::Core) |
| Module | Nt Core C++ Classes |
| Since | 4.6 |
| Inherits | QAnimationGroup |
List of all members, including inherited members
Public Functions
| QSequentialAnimationGroup(QObject *parent = nullptr) | |
| ~QSequentialAnimationGroup() | |
| QPauseAnimation * | addPause(int msecs) |
| QPauseAnimation * | insertPause(int index, int msecs) |
| QAbstractAnimation * | currentAnimation() const |
Reimplemented Public Functions
| int | duration() const |
Signals
| void | currentAnimationChanged(QAbstractAnimation *current) |
Reimplemented Protected Functions
| bool | event(QEvent *event) |
| void | updateCurrentTime(int currentTime) |
| void | updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState) |
| void | updateDirection(QAbstractAnimation::Direction direction) |
Detailed Description
A sequential group runs its animations one after another, in the order they were added: when one has finished, the next starts. The group is finished when the last one is.
auto *group = new QSequentialAnimationGroup;
group->addAnimation(fadeOut);
group->addPause(100);
group->addAnimation(move);
group->addAnimation(fadeIn);
group->start();
currentAnimation() is the animation that runs now, and currentAnimationChanged() tells when the group moves on.
See also QParallelAnimationGroup and QPauseAnimation.
Differences from Qt
The current animation is not a bindable property.
Member Function Documentation
QSequentialAnimationGroup::QSequentialAnimationGroup(QObject *parent = nullptr)
Constructs a sequential group with the given parent.
QSequentialAnimationGroup::~QSequentialAnimationGroup()
Destroys the group and the animations in it.
QPauseAnimation * QSequentialAnimationGroup::addPause(int msecs)
Adds a pause of msecs milliseconds at the end of the group and returns it.
See also insertPause() and QAnimationGroup::addAnimation().
QAbstractAnimation * QSequentialAnimationGroup::currentAnimation() const
Returns the animation that the group is at: the one that runs, or would if the group did. It is nullptr for a group without animations.
See also currentAnimationChanged().
void QSequentialAnimationGroup::currentAnimationChanged(QAbstractAnimation *current)
This signal is emitted when the group moves on to another animation, with the animation that now runs in current. It is nullptr when the group has none.
See also currentAnimation().
int QSequentialAnimationGroup::duration() const
Reimplements QAnimationGroup::duration().
Returns the sum of the durations of the animations, with their loops, or -1 while the duration of one of them is undefined.
bool QSequentialAnimationGroup::event(QEvent *event)
Reimplements QAnimationGroup::event().
QPauseAnimation * QSequentialAnimationGroup::insertPause(int index, int msecs)
Inserts a pause of msecs milliseconds into the group at index and returns it, or nullptr if the index is out of range.
See also addPause() and QAnimationGroup::insertAnimation().
void QSequentialAnimationGroup::updateCurrentTime(int currentTime)
Reimplements QAnimationGroup::updateCurrentTime().
void QSequentialAnimationGroup::updateDirection(QAbstractAnimation::Direction direction)
Reimplements QAnimationGroup::updateDirection().
void QSequentialAnimationGroup::updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
Reimplements QAnimationGroup::updateState().