QtBase
v6.3.1
|
The QPropertyAnimation class animates Qt properties. More...
#include <qpropertyanimation.h>
Properties | |
QByteArray | propertyName |
the target property name for this animation More... | |
QObject * | targetObject |
the target QObject for this animation. More... | |
Properties inherited from QVariantAnimation | |
QVariant | startValue |
the optional start value of the animation More... | |
QVariant | endValue |
the end value of the animation More... | |
QVariant | currentValue |
the current value of the animation. More... | |
int | duration |
the duration of the animation More... | |
QEasingCurve | easingCurve |
the easing curve of the animation More... | |
Properties inherited from QAbstractAnimation | |
State | state |
state of the animation. More... | |
int | loopCount |
the loop count of the animation More... | |
int | currentTime |
the current time and progress of the animation More... | |
int | currentLoop |
the current loop of the animation More... | |
Direction | direction |
the direction of the animation when it is in \l Running state. More... | |
int | duration |
the duration of the animation. More... | |
Properties inherited from QObject | |
QString | objectName |
the name of this object More... | |
The QPropertyAnimation class animates Qt properties.
\inmodule QtCore
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:
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.
Definition at line 50 of file qpropertyanimation.h.
Construct a QPropertyAnimation object. parent is passed to QObject's constructor.
Definition at line 145 of file qpropertyanimation.cpp.
QPropertyAnimation::QPropertyAnimation | ( | QObject * | target, |
const QByteArray & | propertyName, | ||
QObject * | parent = nullptr |
||
) |
Construct a QPropertyAnimation object. parent is passed to QObject's constructor. The animation changes the property propertyName on target. The default duration is 250ms.
Definition at line 157 of file qpropertyanimation.cpp.
QPropertyAnimation::~QPropertyAnimation | ( | ) |
Destroys the QPropertyAnimation instance.
Definition at line 167 of file qpropertyanimation.cpp.
QBindable< QByteArray > QPropertyAnimation::bindablePropertyName | ( | ) |
Definition at line 243 of file qpropertyanimation.cpp.
Definition at line 183 of file qpropertyanimation.cpp.
|
overrideprotectedvirtual |
\reimp
Reimplemented from QAbstractAnimation.
Definition at line 251 of file qpropertyanimation.cpp.
QByteArray QPropertyAnimation::propertyName | ( | ) | const |
Definition at line 219 of file qpropertyanimation.cpp.
void QPropertyAnimation::setPropertyName | ( | const QByteArray & | propertyName | ) |
Definition at line 188 of file qpropertyanimation.cpp.
QObject * QPropertyAnimation::targetObject | ( | ) | const |
Definition at line 178 of file qpropertyanimation.cpp.
This virtual function is called by QVariantAnimation whenever the current value changes. value is the new, updated value. It updates the current value of the property on the target object.
Reimplemented from QVariantAnimation.
Definition at line 263 of file qpropertyanimation.cpp.
|
overrideprotectedvirtual |
\reimp
If the startValue is not defined when the state of the animation changes from Stopped to Running, the current property value is used as the initial value for the animation.
Reimplemented from QAbstractAnimation.
Reimplemented in MyComposedAnimation.
Definition at line 275 of file qpropertyanimation.cpp.
|
readwrite |
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.
Definition at line 81 of file qpropertyanimation.h.
|
readwrite |
the target QObject for this animation.
This property defines the target QObject for this animation.
Definition at line 81 of file qpropertyanimation.h.