animation/qpropertyanimation.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4 -
5 -
6 -
7void QPropertyAnimationPrivate::updateMetaProperty() -
8{ -
9 if (!target || propertyName.isEmpty()) {
partially evaluated: !target
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1138
evaluated: propertyName.isEmpty()
TRUEFALSE
yes
Evaluation Count:370
yes
Evaluation Count:768
0-1138
10 propertyType = QVariant::Invalid; -
11 propertyIndex = -1; -
12 return;
executed: return;
Execution Count:370
370
13 } -
14 -
15 -
16 -
17 propertyType = targetValue->property(propertyName).userType(); -
18 propertyIndex = targetValue->metaObject()->indexOfProperty(propertyName); -
19 -
20 if (propertyType != QVariant::Invalid)
partially evaluated: propertyType != QVariant::Invalid
TRUEFALSE
yes
Evaluation Count:768
no
Evaluation Count:0
0-768
21 convertValues(propertyType);
executed: convertValues(propertyType);
Execution Count:768
768
22 if (propertyIndex == -1) {
evaluated: propertyIndex == -1
TRUEFALSE
yes
Evaluation Count:181
yes
Evaluation Count:587
181-587
23 -
24 propertyType = QVariant::Invalid; -
25 if (!targetValue->dynamicPropertyNames().contains(propertyName))
partially evaluated: !targetValue->dynamicPropertyNames().contains(propertyName)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:181
0-181
26 QMessageLogger("animation/qpropertyanimation.cpp", 121, __PRETTY_FUNCTION__).warning("QPropertyAnimation: you're trying to animate a non-existing property %s of your QObject", propertyName.constData());
never executed: QMessageLogger("animation/qpropertyanimation.cpp", 121, __PRETTY_FUNCTION__).warning("QPropertyAnimation: you're trying to animate a non-existing property %s of your QObject", propertyName.constData());
0
27 } else if (!targetValue->metaObject()->property(propertyIndex).isWritable()) {
executed: }
Execution Count:181
partially evaluated: !targetValue->metaObject()->property(propertyIndex).isWritable()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:587
0-587
28 QMessageLogger("animation/qpropertyanimation.cpp", 123, __PRETTY_FUNCTION__).warning("QPropertyAnimation: you're trying to animate the non-writable property %s of your QObject", propertyName.constData()); -
29 }
never executed: }
0
30} -
31 -
32void QPropertyAnimationPrivate::updateProperty(const QVariant &newValue) -
33{ -
34 if (state == QAbstractAnimation::Stopped)
evaluated: state == QAbstractAnimation::Stopped
TRUEFALSE
yes
Evaluation Count:66
yes
Evaluation Count:2088
66-2088
35 return;
executed: return;
Execution Count:66
66
36 -
37 if (!target) {
evaluated: !target
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:2087
1-2087
38 q_func()->stop(); -
39 return;
executed: return;
Execution Count:1
1
40 } -
41 -
42 if (newValue.userType() == propertyType) {
evaluated: newValue.userType() == propertyType
TRUEFALSE
yes
Evaluation Count:996
yes
Evaluation Count:1091
996-1091
43 -
44 void *data = const_cast<void*>(newValue.constData()); -
45 QMetaObject::metacall(targetValue, QMetaObject::WriteProperty, propertyIndex, &data); -
46 } else {
executed: }
Execution Count:996
996
47 targetValue->setProperty(propertyName.constData(), newValue); -
48 }
executed: }
Execution Count:1091
1091
49} -
50 -
51 -
52 -
53 -
54 -
55QPropertyAnimation::QPropertyAnimation(QObject *parent) -
56 : QVariantAnimation(*new QPropertyAnimationPrivate, parent) -
57{ -
58}
executed: }
Execution Count:79
79
59QPropertyAnimation::QPropertyAnimation(QObject *target, const QByteArray &propertyName, QObject *parent) -
60 : QVariantAnimation(*new QPropertyAnimationPrivate, parent) -
61{ -
62 setTargetObject(target); -
63 setPropertyName(propertyName); -
64}
executed: }
Execution Count:331
331
65 -
66 -
67 -
68 -
69QPropertyAnimation::~QPropertyAnimation() -
70{ -
71 stop(); -
72}
executed: }
Execution Count:405
405
73 -
74 -
75 -
76 -
77 -
78 -
79 -
80QObject *QPropertyAnimation::targetObject() const -
81{ -
82 return d_func()->target.data();
executed: return d_func()->target.data();
Execution Count:269
269
83} -
84 -
85void QPropertyAnimation::setTargetObject(QObject *target) -
86{ -
87 QPropertyAnimationPrivate * const d = d_func(); -
88 if (d->target.data() == target)
partially evaluated: d->target.data() == target
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:370
0-370
89 return;
never executed: return;
0
90 -
91 if (d->state != QAbstractAnimation::Stopped) {
partially evaluated: d->state != QAbstractAnimation::Stopped
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:370
0-370
92 QMessageLogger("animation/qpropertyanimation.cpp", 195, __PRETTY_FUNCTION__).warning("QPropertyAnimation::setTargetObject: you can't change the target of a running animation"); -
93 return;
never executed: return;
0
94 } -
95 -
96 d->target = d->targetValue = target; -
97 d->updateMetaProperty(); -
98}
executed: }
Execution Count:370
370
99QByteArray QPropertyAnimation::propertyName() const -
100{ -
101 const QPropertyAnimationPrivate * const d = d_func(); -
102 return d->propertyName;
executed: return d->propertyName;
Execution Count:46
46
103} -
104 -
105void QPropertyAnimation::setPropertyName(const QByteArray &propertyName) -
106{ -
107 QPropertyAnimationPrivate * const d = d_func(); -
108 if (d->state != QAbstractAnimation::Stopped) {
partially evaluated: d->state != QAbstractAnimation::Stopped
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:370
0-370
109 QMessageLogger("animation/qpropertyanimation.cpp", 220, __PRETTY_FUNCTION__).warning("QPropertyAnimation::setPropertyName: you can't change the property name of a running animation"); -
110 return;
never executed: return;
0
111 } -
112 -
113 d->propertyName = propertyName; -
114 d->updateMetaProperty(); -
115}
executed: }
Execution Count:370
370
116 -
117 -
118 -
119 -
120 -
121bool QPropertyAnimation::event(QEvent *event) -
122{ -
123 return QVariantAnimation::event(event);
executed: return QVariantAnimation::event(event);
Execution Count:189
189
124} -
125void QPropertyAnimation::updateCurrentValue(const QVariant &value) -
126{ -
127 QPropertyAnimationPrivate * const d = d_func(); -
128 d->updateProperty(value); -
129}
executed: }
Execution Count:2154
2154
130 -
131 -
132 -
133 -
134 -
135 -
136 -
137void QPropertyAnimation::updateState(QAbstractAnimation::State newState, -
138 QAbstractAnimation::State oldState) -
139{ -
140 QPropertyAnimationPrivate * const d = d_func(); -
141 -
142 if (!d->target && oldState == Stopped) {
evaluated: !d->target
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:815
partially evaluated: oldState == Stopped
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6
0-815
143 QMessageLogger("animation/qpropertyanimation.cpp", 262, __PRETTY_FUNCTION__).warning("QPropertyAnimation::updateState (%s): Changing state of an animation without target", -
144 d->propertyName.constData()); -
145 return;
never executed: return;
0
146 } -
147 -
148 QVariantAnimation::updateState(newState, oldState); -
149 -
150 QPropertyAnimation *animToStop = 0; -
151 { -
152 -
153 static QBasicMutex mutex; -
154 QMutexLocker locker(&mutex); -
155 -
156 typedef QPair<QObject *, QByteArray> QPropertyAnimationPair; -
157 typedef QHash<QPropertyAnimationPair, QPropertyAnimation*> QPropertyAnimationHash; -
158 static QPropertyAnimationHash hash; -
159 -
160 -
161 QPropertyAnimationPair key(d->targetValue, d->propertyName); -
162 if (newState == Running) {
evaluated: newState == Running
TRUEFALSE
yes
Evaluation Count:398
yes
Evaluation Count:423
398-423
163 d->updateMetaProperty(); -
164 animToStop = hash.value(key, 0); -
165 hash.insert(key, this); -
166 locker.unlock(); -
167 -
168 if (oldState == Stopped) {
evaluated: oldState == Stopped
TRUEFALSE
yes
Evaluation Count:394
yes
Evaluation Count:4
4-394
169 d->setDefaultStartEndValue(d->targetValue->property(d->propertyName.constData())); -
170 -
171 if (!startValue().isValid() && (d->direction == Backward || !d->defaultStartEndValue.isValid())) {
evaluated: !startValue().isValid()
TRUEFALSE
yes
Evaluation Count:358
yes
Evaluation Count:36
partially evaluated: d->direction == Backward
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:358
partially evaluated: !d->defaultStartEndValue.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:358
0-358
172 QMessageLogger("animation/qpropertyanimation.cpp", 291, __PRETTY_FUNCTION__).warning("QPropertyAnimation::updateState (%s, %s, %s): starting an animation without start value", -
173 d->propertyName.constData(), d->target.data()->metaObject()->className(), -
174 QString(d->target.data()->objectName()).toLocal8Bit().constData()); -
175 }
never executed: }
0
176 if (!endValue().isValid() && (d->direction == Forward || !d->defaultStartEndValue.isValid())) {
evaluated: !endValue().isValid()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:392
partially evaluated: d->direction == Forward
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
partially evaluated: !d->defaultStartEndValue.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-392
177 QMessageLogger("animation/qpropertyanimation.cpp", 296, __PRETTY_FUNCTION__).warning("QPropertyAnimation::updateState (%s, %s, %s): starting an animation without end value", -
178 d->propertyName.constData(), d->target.data()->metaObject()->className(), -
179 QString(d->target.data()->objectName()).toLocal8Bit().constData()); -
180 }
never executed: }
0
181 }
executed: }
Execution Count:394
394
182 } else if (hash.value(key) == this) {
executed: }
Execution Count:398
evaluated: hash.value(key) == this
TRUEFALSE
yes
Evaluation Count:397
yes
Evaluation Count:26
26-398
183 hash.remove(key); -
184 }
executed: }
Execution Count:397
397
185 } -
186 -
187 -
188 if (animToStop) {
evaluated: animToStop
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:820
1-820
189 -
190 QAbstractAnimation *current = animToStop; -
191 while (current->group() && current->state() != Stopped)
partially evaluated: current->group()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
never evaluated: current->state() != Stopped
0-1
192 current = current->group();
never executed: current = current->group();
0
193 current->stop(); -
194 }
executed: }
Execution Count:1
1
195}
executed: }
Execution Count:821
821
196 -
197 -
198 -
199 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial