blob: 58652baf66814462a6e35c46e89256ce6074ffa6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
/****************************************************************************
**
** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
** This file is part of the $MODULE$ of the Qt Toolkit.
**
** $TROLLTECH_DUAL_LICENSE$
**
****************************************************************************/
#include "qvalueanimation.h"
#include "qvalueanimation_p.h"
QT_BEGIN_NAMESPACE
void QValueAnimationPrivate::initDefaultStartValue()
{
Q_Q(QValueAnimation);
if (animProp && !q->startValue().isValid()
&& (currentTime == 0
|| (currentTime == duration && currentLoop == (loopCount - 1)))) {
setDefaultStartValue(animProp->read());
}
}
QValueAnimation::QValueAnimation(QObject *parent) : QVariantAnimation(*new QValueAnimationPrivate, parent)
{
}
QValueAnimation::~QValueAnimation()
{
}
void QValueAnimation::setProperty(AbstractProperty *animProp)
{
Q_D(QValueAnimation);
d->animProp = animProp;
}
/*!
\reimp
*/
void QValueAnimation::updateCurrentValue(const QVariant &value)
{
Q_D(QValueAnimation);
if (state() == QAbstractAnimation::Stopped)
return;
d->animProp->write(value);
}
/*!
\reimp
*/
void QValueAnimation::updateState(QAbstractAnimation::State oldState, QAbstractAnimation::State newState)
{
Q_D(QValueAnimation);
// Initialize start value
if (oldState == QAbstractAnimation::Stopped && newState == QAbstractAnimation::Running)
d->initDefaultStartValue();
}
#include "moc_qvalueanimation.cpp"
QT_END_NAMESPACE
|