src/corelib/animation/qpropertyanimation.cpp
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
equal deleted inserted replaced
2:56cd8111b7f7 3:41300fa6a67c
    56     QPropertyAnimation can set the property's value). Note that this
    56     QPropertyAnimation can set the property's value). Note that this
    57     makes it possible to animate many of Qt's widgets. Let's look at
    57     makes it possible to animate many of Qt's widgets. Let's look at
    58     an example:
    58     an example:
    59 
    59 
    60     \code
    60     \code
    61         QPropertyAnimation animation(myWidget, "geometry");
    61         QPropertyAnimation *animation = new QPropertyAnimation(myWidget, "geometry");
    62         animation.setDuration(10000);
    62         animation->setDuration(10000);
    63         animation.setStartValue(QRect(0, 0, 100, 30));
    63         animation->setStartValue(QRect(0, 0, 100, 30));
    64         animation.setEndValue(QRect(250, 250, 100, 30));
    64         animation->setEndValue(QRect(250, 250, 100, 30));
    65 
    65 
    66         animation.start();
    66         animation->start();
    67     \endcode
    67     \endcode
    68 
    68 
    69     The property name and the QObject instance of which property
    69     The property name and the QObject instance of which property
    70     should be animated are passed to the constructor. You can then
    70     should be animated are passed to the constructor. You can then
    71     specify the start and end value of the property. The procedure is
    71     specify the start and end value of the property. The procedure is
   248     \reimp
   248     \reimp
   249 
   249 
   250     If the startValue is not defined when the state of the animation changes from Stopped to Running,
   250     If the startValue is not defined when the state of the animation changes from Stopped to Running,
   251     the current property value is used as the initial value for the animation.
   251     the current property value is used as the initial value for the animation.
   252 */
   252 */
   253 void QPropertyAnimation::updateState(QAbstractAnimation::State oldState,
   253 void QPropertyAnimation::updateState(QAbstractAnimation::State newState,
   254                                      QAbstractAnimation::State newState)
   254                                      QAbstractAnimation::State oldState)
   255 {
   255 {
   256     Q_D(QPropertyAnimation);
   256     Q_D(QPropertyAnimation);
   257 
   257 
   258     if (!d->target && oldState == Stopped) {
   258     if (!d->target && oldState == Stopped) {
   259         qWarning("QPropertyAnimation::updateState: Changing state of an animation without target");
   259         qWarning("QPropertyAnimation::updateState: Changing state of an animation without target");
   260         return;
   260         return;
   261     }
   261     }
   262 
   262 
   263     QVariantAnimation::updateState(oldState, newState);
   263     QVariantAnimation::updateState(newState, oldState);
   264 
   264 
   265     QPropertyAnimation *animToStop = 0;
   265     QPropertyAnimation *animToStop = 0;
   266     {
   266     {
   267         QMutexLocker locker(QMutexPool::globalInstanceGet(&staticMetaObject));
   267         QMutexLocker locker(QMutexPool::globalInstanceGet(&staticMetaObject));
   268         typedef QPair<QObject *, QByteArray> QPropertyAnimationPair;
   268         typedef QPair<QObject *, QByteArray> QPropertyAnimationPair;