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:1330
evaluated: propertyName.isEmpty()
TRUEFALSE
yes
Evaluation Count:434
yes
Evaluation Count:896
0-1330
10 propertyType = QVariant::Invalid; -
11 propertyIndex = -1; -
12 return;
executed: return;
Execution Count:434
434
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:896
no
Evaluation Count:0
0-896
21 convertValues(propertyType);
executed: convertValues(propertyType);
Execution Count:896
896
22 if (propertyIndex == -1) {
evaluated: propertyIndex == -1
TRUEFALSE
yes
Evaluation Count:181
yes
Evaluation Count:715
181-715
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:715
0-715
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:2212
66-2212
35 return;
executed: return;
Execution Count:66
66
36 -
37 if (!target) {
evaluated: !target
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:2211
1-2211
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:1124
yes
Evaluation Count:1087
1087-1124
43 -
44 -
45 int status = -1; -
46 int flags = 0; -
47 void *argv[] = { const_cast<void *>(newValue.constData()), const_cast<QVariant *>(&newValue), &status, &flags }; -
48 QMetaObject::metacall(targetValue, QMetaObject::WriteProperty, propertyIndex, argv); -
49 } else {
executed: }
Execution Count:1124
1124
50 targetValue->setProperty(propertyName.constData(), newValue); -
51 }
executed: }
Execution Count:1087
1087
52} -
53 -
54 -
55 -
56 -
57 -
58QPropertyAnimation::QPropertyAnimation(QObject *parent) -
59 : QVariantAnimation(*new QPropertyAnimationPrivate, parent) -
60{ -
61}
executed: }
Execution Count:79
79
62QPropertyAnimation::QPropertyAnimation(QObject *target, const QByteArray &propertyName, QObject *parent) -
63 : QVariantAnimation(*new QPropertyAnimationPrivate, parent) -
64{ -
65 setTargetObject(target); -
66 setPropertyName(propertyName); -
67}
executed: }
Execution Count:395
395
68 -
69 -
70 -
71 -
72QPropertyAnimation::~QPropertyAnimation() -
73{ -
74 stop(); -
75}
executed: }
Execution Count:470
470
76 -
77 -
78 -
79 -
80 -
81 -
82 -
83QObject *QPropertyAnimation::targetObject() const -
84{ -
85 return d_func()->target.data();
executed: return d_func()->target.data();
Execution Count:333
333
86} -
87 -
88void QPropertyAnimation::setTargetObject(QObject *target) -
89{ -
90 QPropertyAnimationPrivate * const d = d_func(); -
91 if (d->target.data() == target)
partially evaluated: d->target.data() == target
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:434
0-434
92 return;
never executed: return;
0
93 -
94 if (d->state != QAbstractAnimation::Stopped) {
partially evaluated: d->state != QAbstractAnimation::Stopped
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:434
0-434
95 QMessageLogger("animation/qpropertyanimation.cpp", 198, __PRETTY_FUNCTION__).warning("QPropertyAnimation::setTargetObject: you can't change the target of a running animation"); -
96 return;
never executed: return;
0
97 } -
98 -
99 d->target = d->targetValue = target; -
100 d->updateMetaProperty(); -
101}
executed: }
Execution Count:434
434
102QByteArray QPropertyAnimation::propertyName() const -
103{ -
104 const QPropertyAnimationPrivate * const d = d_func(); -
105 return d->propertyName;
executed: return d->propertyName;
Execution Count:46
46
106} -
107 -
108void QPropertyAnimation::setPropertyName(const QByteArray &propertyName) -
109{ -
110 QPropertyAnimationPrivate * const d = d_func(); -
111 if (d->state != QAbstractAnimation::Stopped) {
partially evaluated: d->state != QAbstractAnimation::Stopped
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:434
0-434
112 QMessageLogger("animation/qpropertyanimation.cpp", 223, __PRETTY_FUNCTION__).warning("QPropertyAnimation::setPropertyName: you can't change the property name of a running animation"); -
113 return;
never executed: return;
0
114 } -
115 -
116 d->propertyName = propertyName; -
117 d->updateMetaProperty(); -
118}
executed: }
Execution Count:434
434
119 -
120 -
121 -
122 -
123 -
124bool QPropertyAnimation::event(QEvent *event) -
125{ -
126 return QVariantAnimation::event(event);
executed: return QVariantAnimation::event(event);
Execution Count:249
249
127} -
128void QPropertyAnimation::updateCurrentValue(const QVariant &value) -
129{ -
130 QPropertyAnimationPrivate * const d = d_func(); -
131 d->updateProperty(value); -
132}
executed: }
Execution Count:2278
2278
133 -
134 -
135 -
136 -
137 -
138 -
139 -
140void QPropertyAnimation::updateState(QAbstractAnimation::State newState, -
141 QAbstractAnimation::State oldState) -
142{ -
143 QPropertyAnimationPrivate * const d = d_func(); -
144 -
145 if (!d->target && oldState == Stopped) {
evaluated: !d->target
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:943
partially evaluated: oldState == Stopped
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6
0-943
146 QMessageLogger("animation/qpropertyanimation.cpp", 265, __PRETTY_FUNCTION__).warning("QPropertyAnimation::updateState (%s): Changing state of an animation without target", -
147 d->propertyName.constData()); -
148 return;
never executed: return;
0
149 } -
150 -
151 QVariantAnimation::updateState(newState, oldState); -
152 -
153 QPropertyAnimation *animToStop = 0; -
154 { -
155 -
156 static QBasicMutex mutex; -
157 QMutexLocker locker(&mutex); -
158 -
159 typedef QPair<QObject *, QByteArray> QPropertyAnimationPair; -
160 typedef QHash<QPropertyAnimationPair, QPropertyAnimation*> QPropertyAnimationHash; -
161 static QPropertyAnimationHash hash; -
162 -
163 -
164 QPropertyAnimationPair key(d->targetValue, d->propertyName); -
165 if (newState == Running) {
evaluated: newState == Running
TRUEFALSE
yes
Evaluation Count:462
yes
Evaluation Count:487
462-487
166 d->updateMetaProperty(); -
167 animToStop = hash.value(key, 0); -
168 hash.insert(key, this); -
169 locker.unlock(); -
170 -
171 if (oldState == Stopped) {
evaluated: oldState == Stopped
TRUEFALSE
yes
Evaluation Count:458
yes
Evaluation Count:4
4-458
172 d->setDefaultStartEndValue(d->targetValue->property(d->propertyName.constData())); -
173 -
174 if (!startValue().isValid() && (d->direction == Backward || !d->defaultStartEndValue.isValid())) {
evaluated: !startValue().isValid()
TRUEFALSE
yes
Evaluation Count:422
yes
Evaluation Count:36
partially evaluated: d->direction == Backward
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:422
partially evaluated: !d->defaultStartEndValue.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:422
0-422
175 QMessageLogger("animation/qpropertyanimation.cpp", 294, __PRETTY_FUNCTION__).warning("QPropertyAnimation::updateState (%s, %s, %s): starting an animation without start value", -
176 d->propertyName.constData(), d->target.data()->metaObject()->className(), -
177 QString(d->target.data()->objectName()).toLocal8Bit().constData()); -
178 }
never executed: }
0
179 if (!endValue().isValid() && (d->direction == Forward || !d->defaultStartEndValue.isValid())) {
evaluated: !endValue().isValid()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:456
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-456
180 QMessageLogger("animation/qpropertyanimation.cpp", 299, __PRETTY_FUNCTION__).warning("QPropertyAnimation::updateState (%s, %s, %s): starting an animation without end value", -
181 d->propertyName.constData(), d->target.data()->metaObject()->className(), -
182 QString(d->target.data()->objectName()).toLocal8Bit().constData()); -
183 }
never executed: }
0
184 }
executed: }
Execution Count:458
458
185 } else if (hash.value(key) == this) {
executed: }
Execution Count:462
evaluated: hash.value(key) == this
TRUEFALSE
yes
Evaluation Count:461
yes
Evaluation Count:26
26-462
186 hash.remove(key); -
187 }
executed: }
Execution Count:461
461
188 } -
189 -
190 -
191 if (animToStop) {
evaluated: animToStop
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:948
1-948
192 -
193 QAbstractAnimation *current = animToStop; -
194 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
195 current = current->group();
never executed: current = current->group();
0
196 current->stop(); -
197 }
executed: }
Execution Count:1
1
198}
executed: }
Execution Count:949
949
199 -
200 -
201 -
202 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial