QPropertyAnimation露
The
QPropertyAnimationclass animates Qt properties. More鈥�

New in version 4.6.
Synopsis露
Functions露
def
propertyName()def
setPropertyName(propertyName)def
setTargetObject(target)def
targetObject()
Detailed Description露
QPropertyAnimationinterpolates over Qt properties . As property values are stored inQVariants, the class inheritsQVariantAnimation, and supports animation of the samemeta typesas 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 thatQPropertyAnimationcan set the property鈥檚 value). Note that this makes it possible to animate many of Qt鈥檚 widgets. Let鈥檚 look at an example:QPropertyAnimation *animation = new QPropertyAnimation(myWidget, "geometry"); animation->setDuration(10000); animation->setStartValue(QRect(0, 0, 100, 30)); animation->setEndValue(QRect(250, 250, 100, 30)); animation->start();The property name and the
QObjectinstance 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鈥搄ust check withQVariantAnimationthat yourQVarianttype is supported.The
QVariantAnimationclass 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 theQPropertyAnimationinstance was created.
QPropertyAnimationworks like a charm on its own. For complex animations that, for instance, contain several objects,QAnimationGroupis provided. An animation group is an animation that can contain other animations, and that can manage when its animations are played. Look atQParallelAnimationGroupfor an example.
- class PySide2.QtCore.QPropertyAnimation([parent=None])露
PySide2.QtCore.QPropertyAnimation(target, propertyName[, parent=None])
- param parent:
- param target:
- param propertyName:
Construct a
QPropertyAnimationobject.parentis passed toQObject鈥榮 constructor.Construct a
QPropertyAnimationobject.parentis passed toQObject鈥榮 constructor. The animation changes the propertypropertyNameontarget. The default duration is 250ms.See also
- PySide2.QtCore.QPropertyAnimation.propertyName()露
- Return type:
This property holds the target property name for this animation.
This property defines the target property name for this animation. The property name is required for the animation to operate.
- PySide2.QtCore.QPropertyAnimation.setPropertyName(propertyName)露
- Parameters:
propertyName 鈥�
PySide2.QtCore.QByteArray
This property holds the target property name for this animation.
This property defines the target property name for this animation. The property name is required for the animation to operate.
- PySide2.QtCore.QPropertyAnimation.setTargetObject(target)露
- Parameters:
target 鈥�
PySide2.QtCore.QObject
This property holds the target
QObjectfor this animation..This property defines the target
QObjectfor this animation.
漏 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.