QAnimationGroup¶
The
QAnimationGroupclass is an abstract base class for groups of animations. More…

Inherited by: QParallelAnimationGroup, QSequentialAnimationGroup
New in version 4.6.
Synopsis¶
Functions¶
def
addAnimation(animation)def
animationAt(index)def
animationCount()def
clear()def
indexOfAnimation(animation)def
insertAnimation(index, animation)def
removeAnimation(animation)def
takeAnimation(index)
Detailed Description¶
An animation group is a container for animations (subclasses of
QAbstractAnimation). A group is usually responsible for managing thestateof its animations, i.e., it decides when to start, stop, resume, and pause them. Currently, Qt provides two such groups:QParallelAnimationGroupandQSequentialAnimationGroup. Look up their class descriptions for details.Since
QAnimationGroupinherits fromQAbstractAnimation, you can combine groups, and easily construct complex animation graphs. You can queryQAbstractAnimationfor the group it belongs to (using thegroup()function).To start a top-level animation group, you simply use the
start()function fromQAbstractAnimation. 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.
QAnimationGroupprovides methods for adding and retrieving animations. Besides that, you can remove animations by callingremoveAnimation(), and clear the animation group by callingclear(). You may keep track of changes in the group’s animations by listening toChildAddedandChildRemovedevents.
QAnimationGrouptakes ownership of the animations it manages, and ensures that they are deleted when the animation group is deleted.
- class PySide2.QtCore.QAnimationGroup([parent=None])¶
- param parent:
Constructs a
QAnimationGroup.parentis passed toQObject‘s constructor.
- PySide2.QtCore.QAnimationGroup.addAnimation(animation)¶
- Parameters:
animation –
PySide2.QtCore.QAbstractAnimation
Adds
animationto this group. This will callinsertAnimationwith index equals toanimationCount().Note
The group takes ownership of the animation.
See also
removeAnimation()
- PySide2.QtCore.QAnimationGroup.animationAt(index)¶
- Parameters:
index – int
- Return type:
Returns a pointer to the animation at
indexin this group. This function is useful when you need access to a particular animation.indexis between 0 andanimationCount()- 1.See also
animationCount()indexOfAnimation()
- PySide2.QtCore.QAnimationGroup.animationCount()¶
- Return type:
int
Returns the number of animations managed by this group.
See also
indexOfAnimation()addAnimation()animationAt()
- PySide2.QtCore.QAnimationGroup.clear()¶
Removes and deletes all animations in this animation group, and resets the current time to 0.
See also
addAnimation()removeAnimation()
- PySide2.QtCore.QAnimationGroup.indexOfAnimation(animation)¶
- Parameters:
animation –
PySide2.QtCore.QAbstractAnimation- Return type:
int
Returns the index of
animation. The returned index can be passed to the other functions that take an index as an argument.See also
insertAnimation()animationAt()takeAnimation()
- PySide2.QtCore.QAnimationGroup.insertAnimation(index, animation)¶
- Parameters:
index – int
animation –
PySide2.QtCore.QAbstractAnimation
Inserts
animationinto this animation group atindex. Ifindexis 0 the animation is inserted at the beginning. IfindexisanimationCount(), the animation is inserted at the end.Note
The group takes ownership of the animation.
See also
takeAnimation()addAnimation()indexOfAnimation()removeAnimation()
- PySide2.QtCore.QAnimationGroup.removeAnimation(animation)¶
- Parameters:
animation –
PySide2.QtCore.QAbstractAnimation
Removes
animationfrom this group. The ownership ofanimationis transferred to the caller.See also
takeAnimation()insertAnimation()addAnimation()
- PySide2.QtCore.QAnimationGroup.takeAnimation(index)¶
- Parameters:
index – int
- Return type:
Returns the animation at
indexand removes it from the animation group.Note
The ownership of the animation is transferred to the caller.
See also
removeAnimation()addAnimation()insertAnimation()indexOfAnimation()
© 2022 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.