QAnimationGroupclass is an abstract base class for groups of animations. 更多 …
继承者: QParallelAnimationGroup , QSequentialAnimationGroup
4.6 版新增。
def
addAnimation
(animation)
def
animationAt
(index)
def
animationCount
()
def
clear
()
def
indexOfAnimation
(animation)
def
insertAnimation
(index, animation)
def
removeAnimation
(animation)
def
takeAnimation
(index)
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
QAnimationGroup继承自QAbstractAnimation, you can combine groups, and easily construct complex animation graphs. You can queryQAbstractAnimationfor the group it belongs to (using thegroup()函数)。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 toChildAddedandChildRemoved事件。
QAnimationGrouptakes ownership of the animations it manages, and ensures that they are deleted when the animation group is deleted.
QAnimationGroup
(
[
parent=None
]
)
¶
- param parent
构造
QAnimationGroup
.
parent
会被传递给
QObject
‘s constructor.
PySide2.QtCore.QAnimationGroup.
addAnimation
(
animation
)
¶
animation
–
QAbstractAnimation
添加
animation
to this group. This will call
insertAnimation
with index equals to
animationCount()
.
注意
The group takes ownership of the animation.
另请参阅
removeAnimation()
PySide2.QtCore.QAnimationGroup.
animationAt
(
index
)
¶
index
–
int
Returns a pointer to the animation at
index
in this group. This function is useful when you need access to a particular animation.
index
is between 0 and
animationCount()
- 1.
另请参阅
animationCount()
indexOfAnimation()
PySide2.QtCore.QAnimationGroup.
animationCount
(
)
¶
int
Returns the number of animations managed by this group.
另请参阅
indexOfAnimation()
addAnimation()
animationAt()
PySide2.QtCore.QAnimationGroup.
clear
(
)
¶
Removes and deletes all animations in this animation group, and resets the current time to 0.
另请参阅
addAnimation()
removeAnimation()
PySide2.QtCore.QAnimationGroup.
indexOfAnimation
(
animation
)
¶
animation
–
QAbstractAnimation
int
Returns the index of
animation
. The returned index can be passed to the other functions that take an index as an argument.
另请参阅
insertAnimation()
animationAt()
takeAnimation()
PySide2.QtCore.QAnimationGroup.
insertAnimation
(
index
,
animation
)
¶
index
–
int
animation
–
QAbstractAnimation
插入
animation
into this animation group at
index
。若
index
is 0 the animation is inserted at the beginning. If
index
is
animationCount()
, the animation is inserted at the end.
注意
The group takes ownership of the animation.
另请参阅
takeAnimation()
addAnimation()
indexOfAnimation()
removeAnimation()
PySide2.QtCore.QAnimationGroup.
removeAnimation
(
animation
)
¶
animation
–
QAbstractAnimation
移除
animation
from this group. The ownership of
animation
is transferred to the caller.
另请参阅
takeAnimation()
insertAnimation()
addAnimation()
PySide2.QtCore.QAnimationGroup.
takeAnimation
(
index
)
¶
index
–
int
Returns the animation at
index
and removes it from the animation group.
注意
The ownership of the animation is transferred to the caller.
另请参阅
removeAnimation()
addAnimation()
insertAnimation()
indexOfAnimation()