Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | | - |
7 | | - |
8 | class QGraphicsItemAnimationPrivate | - |
9 | { | - |
10 | public: | - |
11 | inline QGraphicsItemAnimationPrivate() | - |
12 | : q(0), timeLine(0), item(0), step(0) | - |
13 | { } executed: } Execution Count:6 | 6 |
14 | | - |
15 | QGraphicsItemAnimation *q; | - |
16 | | - |
17 | QPointer<QTimeLine> timeLine; | - |
18 | QGraphicsItem *item; | - |
19 | | - |
20 | QPointF startPos; | - |
21 | QMatrix startMatrix; | - |
22 | | - |
23 | qreal step; | - |
24 | | - |
25 | struct Pair { | - |
26 | Pair(qreal a, qreal b) : step(a), value(b) {} executed: } Execution Count:41 | 41 |
27 | bool operator <(const Pair &other) const | - |
28 | { return step < other.step; } executed: return step < other.step; Execution Count:42 | 42 |
29 | bool operator==(const Pair &other) const | - |
30 | { return step == other.step; } never executed: return step == other.step; | 0 |
31 | qreal step; | - |
32 | qreal value; | - |
33 | }; | - |
34 | QList<Pair> xPosition; | - |
35 | QList<Pair> yPosition; | - |
36 | QList<Pair> rotation; | - |
37 | QList<Pair> verticalScale; | - |
38 | QList<Pair> horizontalScale; | - |
39 | QList<Pair> verticalShear; | - |
40 | QList<Pair> horizontalShear; | - |
41 | QList<Pair> xTranslation; | - |
42 | QList<Pair> yTranslation; | - |
43 | | - |
44 | qreal linearValueForStep(qreal step, QList<Pair> *source, qreal defaultValue = 0); | - |
45 | void insertUniquePair(qreal step, qreal value, QList<Pair> *binList, const char* method); | - |
46 | }; | - |
47 | | - |
48 | qreal QGraphicsItemAnimationPrivate::linearValueForStep(qreal step, QList<Pair> *source, qreal defaultValue) | - |
49 | { | - |
50 | if (source->isEmpty()) evaluated: source->isEmpty() yes Evaluation Count:63 | yes Evaluation Count:57 |
| 57-63 |
51 | return defaultValue; executed: return defaultValue; Execution Count:63 | 63 |
52 | step = qMin<qreal>(qMax<qreal>(step, 0), 1); | - |
53 | | - |
54 | if (step == 1) evaluated: step == 1 yes Evaluation Count:7 | yes Evaluation Count:50 |
| 7-50 |
55 | return source->last().value; executed: return source->last().value; Execution Count:7 | 7 |
56 | | - |
57 | qreal stepBefore = 0; | - |
58 | qreal stepAfter = 1; | - |
59 | qreal valueBefore = source->first().step == 0 ? source->first().value : defaultValue; partially evaluated: source->first().step == 0 no Evaluation Count:0 | yes Evaluation Count:50 |
| 0-50 |
60 | qreal valueAfter = source->last().value; | - |
61 | | - |
62 | | - |
63 | for (int i = 0; i < source->size() && step >= source->at(i).step; ++i) { partially evaluated: i < source->size() yes Evaluation Count:50 | no Evaluation Count:0 |
partially evaluated: step >= source->at(i).step no Evaluation Count:0 | yes Evaluation Count:50 |
| 0-50 |
64 | stepBefore = source->at(i).step; | - |
65 | valueBefore = source->at(i).value; | - |
66 | } | 0 |
67 | | - |
68 | | - |
69 | for (int j = source->size() - 1; j >= 0 && step < source->at(j).step; --j) { evaluated: j >= 0 yes Evaluation Count:50 | yes Evaluation Count:50 |
partially evaluated: step < source->at(j).step yes Evaluation Count:50 | no Evaluation Count:0 |
| 0-50 |
70 | stepAfter = source->at(j).step; | - |
71 | valueAfter = source->at(j).value; | - |
72 | } executed: } Execution Count:50 | 50 |
73 | | - |
74 | | - |
75 | return valueBefore + (valueAfter - valueBefore) * ((step - stepBefore) / (stepAfter - stepBefore)); executed: return valueBefore + (valueAfter - valueBefore) * ((step - stepBefore) / (stepAfter - stepBefore)); Execution Count:50 | 50 |
76 | } | - |
77 | | - |
78 | void QGraphicsItemAnimationPrivate::insertUniquePair(qreal step, qreal value, QList<Pair> *binList, const char* method) | - |
79 | { | - |
80 | if (step < 0.0 || step > 1.0) { partially evaluated: step < 0.0 no Evaluation Count:0 | yes Evaluation Count:43 |
evaluated: step > 1.0 yes Evaluation Count:2 | yes Evaluation Count:41 |
| 0-43 |
81 | QMessageLogger("graphicsview/qgraphicsitemanimation.cpp", 171, __PRETTY_FUNCTION__).warning("QGraphicsItemAnimation::%s: invalid step = %f", method, step); | - |
82 | return; executed: return; Execution Count:2 | 2 |
83 | } | - |
84 | | - |
85 | Pair pair(step, value); | - |
86 | | - |
87 | QList<Pair>::iterator result = qBinaryFind(binList->begin(), binList->end(), pair); | - |
88 | if (result != binList->end()) evaluated: result != binList->end() yes Evaluation Count:18 | yes Evaluation Count:23 |
| 18-23 |
89 | result->value = value; executed: result->value = value; Execution Count:18 | 18 |
90 | else { | - |
91 | *binList << pair; | - |
92 | qSort(binList->begin(), binList->end()); | - |
93 | } executed: } Execution Count:23 | 23 |
94 | } | - |
95 | | - |
96 | | - |
97 | | - |
98 | | - |
99 | QGraphicsItemAnimation::QGraphicsItemAnimation(QObject *parent) | - |
100 | : QObject(parent), d(new QGraphicsItemAnimationPrivate) | - |
101 | { | - |
102 | d->q = this; | - |
103 | } executed: } Execution Count:6 | 6 |
104 | | - |
105 | | - |
106 | | - |
107 | | - |
108 | QGraphicsItemAnimation::~QGraphicsItemAnimation() | - |
109 | { | - |
110 | delete d; | - |
111 | } executed: } Execution Count:6 | 6 |
112 | | - |
113 | | - |
114 | | - |
115 | | - |
116 | | - |
117 | | - |
118 | QGraphicsItem *QGraphicsItemAnimation::item() const | - |
119 | { | - |
120 | return d->item; executed: return d->item; Execution Count:1 | 1 |
121 | } | - |
122 | | - |
123 | | - |
124 | | - |
125 | | - |
126 | | - |
127 | | - |
128 | void QGraphicsItemAnimation::setItem(QGraphicsItem *item) | - |
129 | { | - |
130 | d->item = item; | - |
131 | d->startPos = d->item->pos(); | - |
132 | } | 0 |
133 | | - |
134 | | - |
135 | | - |
136 | | - |
137 | | - |
138 | | - |
139 | | - |
140 | QTimeLine *QGraphicsItemAnimation::timeLine() const | - |
141 | { | - |
142 | return d->timeLine; executed: return d->timeLine; Execution Count:7 | 7 |
143 | } | - |
144 | | - |
145 | | - |
146 | | - |
147 | | - |
148 | | - |
149 | | - |
150 | | - |
151 | void QGraphicsItemAnimation::setTimeLine(QTimeLine *timeLine) | - |
152 | { | - |
153 | if (d->timeLine == timeLine) evaluated: d->timeLine == timeLine yes Evaluation Count:1 | yes Evaluation Count:3 |
| 1-3 |
154 | return; executed: return; Execution Count:1 | 1 |
155 | if (d->timeLine) evaluated: d->timeLine yes Evaluation Count:1 | yes Evaluation Count:2 |
| 1-2 |
156 | delete d->timeLine; executed: delete d->timeLine; Execution Count:1 | 1 |
157 | if (!timeLine) evaluated: !timeLine yes Evaluation Count:1 | yes Evaluation Count:2 |
| 1-2 |
158 | return; executed: return; Execution Count:1 | 1 |
159 | d->timeLine = timeLine; | - |
160 | connect(timeLine, "2""valueChanged(qreal)", this, "1""setStep(qreal)"); | - |
161 | } executed: } Execution Count:2 | 2 |
162 | | - |
163 | | - |
164 | | - |
165 | | - |
166 | | - |
167 | | - |
168 | QPointF QGraphicsItemAnimation::posAt(qreal step) const | - |
169 | { | - |
170 | if (step < 0.0 || step > 1.0) partially evaluated: step < 0.0 no Evaluation Count:0 | yes Evaluation Count:48 |
evaluated: step > 1.0 yes Evaluation Count:1 | yes Evaluation Count:47 |
| 0-48 |
171 | QMessageLogger("graphicsview/qgraphicsitemanimation.cpp", 261, __PRETTY_FUNCTION__).warning("QGraphicsItemAnimation::posAt: invalid step = %f", step); executed: QMessageLogger("graphicsview/qgraphicsitemanimation.cpp", 261, __PRETTY_FUNCTION__).warning("QGraphicsItemAnimation::posAt: invalid step = %f", step); Execution Count:1 | 1 |
172 | | - |
173 | return QPointF(d->linearValueForStep(step, &d->xPosition, d->startPos.x()), | 48 |
174 | d->linearValueForStep(step, &d->yPosition, d->startPos.y())); executed: return QPointF(d->linearValueForStep(step, &d->xPosition, d->startPos.x()), d->linearValueForStep(step, &d->yPosition, d->startPos.y())); Execution Count:48 | 48 |
175 | } | - |
176 | void QGraphicsItemAnimation::setPosAt(qreal step, const QPointF &pos) | - |
177 | { | - |
178 | d->insertUniquePair(step, pos.x(), &d->xPosition, "setPosAt"); | - |
179 | d->insertUniquePair(step, pos.y(), &d->yPosition, "setPosAt"); | - |
180 | } executed: } Execution Count:7 | 7 |
181 | | - |
182 | | - |
183 | | - |
184 | | - |
185 | | - |
186 | | - |
187 | QList<QPair<qreal, QPointF> > QGraphicsItemAnimation::posList() const | - |
188 | { | - |
189 | QList<QPair<qreal, QPointF> > list; | - |
190 | for (int i = 0; i < d->xPosition.size(); ++i) evaluated: i < d->xPosition.size() yes Evaluation Count:9 | yes Evaluation Count:6 |
| 6-9 |
191 | list << QPair<qreal, QPointF>(d->xPosition.at(i).step, QPointF(d->xPosition.at(i).value, d->yPosition.at(i).value)); executed: list << QPair<qreal, QPointF>(d->xPosition.at(i).step, QPointF(d->xPosition.at(i).value, d->yPosition.at(i).value)); Execution Count:9 | 9 |
192 | | - |
193 | return list; executed: return list; Execution Count:6 | 6 |
194 | } | - |
195 | | - |
196 | | - |
197 | | - |
198 | | - |
199 | QMatrix QGraphicsItemAnimation::matrixAt(qreal step) const | - |
200 | { | - |
201 | if (step < 0.0 || step > 1.0) partially evaluated: step < 0.0 no Evaluation Count:0 | yes Evaluation Count:3 |
partially evaluated: step > 1.0 no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
202 | QMessageLogger("graphicsview/qgraphicsitemanimation.cpp", 300, __PRETTY_FUNCTION__).warning("QGraphicsItemAnimation::matrixAt: invalid step = %f", step); never executed: QMessageLogger("graphicsview/qgraphicsitemanimation.cpp", 300, __PRETTY_FUNCTION__).warning("QGraphicsItemAnimation::matrixAt: invalid step = %f", step); | 0 |
203 | | - |
204 | QMatrix matrix; | - |
205 | if (!d->rotation.isEmpty()) partially evaluated: !d->rotation.isEmpty() no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
206 | matrix.rotate(rotationAt(step)); never executed: matrix.rotate(rotationAt(step)); | 0 |
207 | if (!d->verticalScale.isEmpty()) partially evaluated: !d->verticalScale.isEmpty() no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
208 | matrix.scale(horizontalScaleAt(step), verticalScaleAt(step)); never executed: matrix.scale(horizontalScaleAt(step), verticalScaleAt(step)); | 0 |
209 | if (!d->verticalShear.isEmpty()) partially evaluated: !d->verticalShear.isEmpty() no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
210 | matrix.shear(horizontalShearAt(step), verticalShearAt(step)); never executed: matrix.shear(horizontalShearAt(step), verticalShearAt(step)); | 0 |
211 | if (!d->xTranslation.isEmpty()) partially evaluated: !d->xTranslation.isEmpty() no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
212 | matrix.translate(xTranslationAt(step), yTranslationAt(step)); never executed: matrix.translate(xTranslationAt(step), yTranslationAt(step)); | 0 |
213 | return matrix; executed: return matrix; Execution Count:3 | 3 |
214 | } | - |
215 | | - |
216 | | - |
217 | | - |
218 | | - |
219 | | - |
220 | | - |
221 | qreal QGraphicsItemAnimation::rotationAt(qreal step) const | - |
222 | { | - |
223 | if (step < 0.0 || step > 1.0) partially evaluated: step < 0.0 no Evaluation Count:0 | yes Evaluation Count:14 |
partially evaluated: step > 1.0 no Evaluation Count:0 | yes Evaluation Count:14 |
| 0-14 |
224 | QMessageLogger("graphicsview/qgraphicsitemanimation.cpp", 322, __PRETTY_FUNCTION__).warning("QGraphicsItemAnimation::rotationAt: invalid step = %f", step); never executed: QMessageLogger("graphicsview/qgraphicsitemanimation.cpp", 322, __PRETTY_FUNCTION__).warning("QGraphicsItemAnimation::rotationAt: invalid step = %f", step); | 0 |
225 | | - |
226 | return d->linearValueForStep(step, &d->rotation); executed: return d->linearValueForStep(step, &d->rotation); Execution Count:14 | 14 |
227 | } | - |
228 | | - |
229 | | - |
230 | | - |
231 | | - |
232 | | - |
233 | | - |
234 | void QGraphicsItemAnimation::setRotationAt(qreal step, qreal angle) | - |
235 | { | - |
236 | d->insertUniquePair(step, angle, &d->rotation, "setRotationAt"); | - |
237 | } executed: } Execution Count:5 | 5 |
238 | | - |
239 | | - |
240 | | - |
241 | | - |
242 | | - |
243 | | - |
244 | QList<QPair<qreal, qreal> > QGraphicsItemAnimation::rotationList() const | - |
245 | { | - |
246 | QList<QPair<qreal, qreal> > list; | - |
247 | for (int i = 0; i < d->rotation.size(); ++i) evaluated: i < d->rotation.size() yes Evaluation Count:5 | yes Evaluation Count:5 |
| 5 |
248 | list << QPair<qreal, qreal>(d->rotation.at(i).step, d->rotation.at(i).value); executed: list << QPair<qreal, qreal>(d->rotation.at(i).step, d->rotation.at(i).value); Execution Count:5 | 5 |
249 | | - |
250 | return list; executed: return list; Execution Count:5 | 5 |
251 | } | - |
252 | | - |
253 | | - |
254 | | - |
255 | | - |
256 | | - |
257 | | - |
258 | qreal QGraphicsItemAnimation::xTranslationAt(qreal step) const | - |
259 | { | - |
260 | if (step < 0.0 || step > 1.0) partially evaluated: step < 0.0 no Evaluation Count:0 | yes Evaluation Count:3 |
partially evaluated: step > 1.0 no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
261 | QMessageLogger("graphicsview/qgraphicsitemanimation.cpp", 359, __PRETTY_FUNCTION__).warning("QGraphicsItemAnimation::xTranslationAt: invalid step = %f", step); never executed: QMessageLogger("graphicsview/qgraphicsitemanimation.cpp", 359, __PRETTY_FUNCTION__).warning("QGraphicsItemAnimation::xTranslationAt: invalid step = %f", step); | 0 |
262 | | - |
263 | return d->linearValueForStep(step, &d->xTranslation); executed: return d->linearValueForStep(step, &d->xTranslation); Execution Count:3 | 3 |
264 | } | - |
265 | | - |
266 | | - |
267 | | - |
268 | | - |
269 | | - |
270 | | - |
271 | qreal QGraphicsItemAnimation::yTranslationAt(qreal step) const | - |
272 | { | - |
273 | if (step < 0.0 || step > 1.0) partially evaluated: step < 0.0 no Evaluation Count:0 | yes Evaluation Count:3 |
partially evaluated: step > 1.0 no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
274 | QMessageLogger("graphicsview/qgraphicsitemanimation.cpp", 372, __PRETTY_FUNCTION__).warning("QGraphicsItemAnimation::yTranslationAt: invalid step = %f", step); never executed: QMessageLogger("graphicsview/qgraphicsitemanimation.cpp", 372, __PRETTY_FUNCTION__).warning("QGraphicsItemAnimation::yTranslationAt: invalid step = %f", step); | 0 |
275 | | - |
276 | return d->linearValueForStep(step, &d->yTranslation); executed: return d->linearValueForStep(step, &d->yTranslation); Execution Count:3 | 3 |
277 | } | - |
278 | | - |
279 | | - |
280 | | - |
281 | | - |
282 | | - |
283 | | - |
284 | | - |
285 | void QGraphicsItemAnimation::setTranslationAt(qreal step, qreal dx, qreal dy) | - |
286 | { | - |
287 | d->insertUniquePair(step, dx, &d->xTranslation, "setTranslationAt"); | - |
288 | d->insertUniquePair(step, dy, &d->yTranslation, "setTranslationAt"); | - |
289 | } executed: } Execution Count:4 | 4 |
290 | | - |
291 | | - |
292 | | - |
293 | | - |
294 | | - |
295 | | - |
296 | QList<QPair<qreal, QPointF> > QGraphicsItemAnimation::translationList() const | - |
297 | { | - |
298 | QList<QPair<qreal, QPointF> > list; | - |
299 | for (int i = 0; i < d->xTranslation.size(); ++i) evaluated: i < d->xTranslation.size() yes Evaluation Count:5 | yes Evaluation Count:5 |
| 5 |
300 | list << QPair<qreal, QPointF>(d->xTranslation.at(i).step, QPointF(d->xTranslation.at(i).value, d->yTranslation.at(i).value)); executed: list << QPair<qreal, QPointF>(d->xTranslation.at(i).step, QPointF(d->xTranslation.at(i).value, d->yTranslation.at(i).value)); Execution Count:5 | 5 |
301 | | - |
302 | return list; executed: return list; Execution Count:5 | 5 |
303 | } | - |
304 | | - |
305 | | - |
306 | | - |
307 | | - |
308 | | - |
309 | | - |
310 | qreal QGraphicsItemAnimation::verticalScaleAt(qreal step) const | - |
311 | { | - |
312 | if (step < 0.0 || step > 1.0) partially evaluated: step < 0.0 no Evaluation Count:0 | yes Evaluation Count:1 |
partially evaluated: step > 1.0 no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
313 | QMessageLogger("graphicsview/qgraphicsitemanimation.cpp", 411, __PRETTY_FUNCTION__).warning("QGraphicsItemAnimation::verticalScaleAt: invalid step = %f", step); never executed: QMessageLogger("graphicsview/qgraphicsitemanimation.cpp", 411, __PRETTY_FUNCTION__).warning("QGraphicsItemAnimation::verticalScaleAt: invalid step = %f", step); | 0 |
314 | | - |
315 | return d->linearValueForStep(step, &d->verticalScale, 1); executed: return d->linearValueForStep(step, &d->verticalScale, 1); Execution Count:1 | 1 |
316 | } | - |
317 | | - |
318 | | - |
319 | | - |
320 | | - |
321 | | - |
322 | | - |
323 | qreal QGraphicsItemAnimation::horizontalScaleAt(qreal step) const | - |
324 | { | - |
325 | if (step < 0.0 || step > 1.0) partially evaluated: step < 0.0 no Evaluation Count:0 | yes Evaluation Count:1 |
partially evaluated: step > 1.0 no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
326 | QMessageLogger("graphicsview/qgraphicsitemanimation.cpp", 424, __PRETTY_FUNCTION__).warning("QGraphicsItemAnimation::horizontalScaleAt: invalid step = %f", step); never executed: QMessageLogger("graphicsview/qgraphicsitemanimation.cpp", 424, __PRETTY_FUNCTION__).warning("QGraphicsItemAnimation::horizontalScaleAt: invalid step = %f", step); | 0 |
327 | | - |
328 | return d->linearValueForStep(step, &d->horizontalScale, 1); executed: return d->linearValueForStep(step, &d->horizontalScale, 1); Execution Count:1 | 1 |
329 | } | - |
330 | | - |
331 | | - |
332 | | - |
333 | | - |
334 | | - |
335 | | - |
336 | | - |
337 | void QGraphicsItemAnimation::setScaleAt(qreal step, qreal sx, qreal sy) | - |
338 | { | - |
339 | d->insertUniquePair(step, sx, &d->horizontalScale, "setScaleAt"); | - |
340 | d->insertUniquePair(step, sy, &d->verticalScale, "setScaleAt"); | - |
341 | } executed: } Execution Count:4 | 4 |
342 | | - |
343 | | - |
344 | | - |
345 | | - |
346 | | - |
347 | | - |
348 | QList<QPair<qreal, QPointF> > QGraphicsItemAnimation::scaleList() const | - |
349 | { | - |
350 | QList<QPair<qreal, QPointF> > list; | - |
351 | for (int i = 0; i < d->horizontalScale.size(); ++i) evaluated: i < d->horizontalScale.size() yes Evaluation Count:5 | yes Evaluation Count:5 |
| 5 |
352 | list << QPair<qreal, QPointF>(d->horizontalScale.at(i).step, QPointF(d->horizontalScale.at(i).value, d->verticalScale.at(i).value)); executed: list << QPair<qreal, QPointF>(d->horizontalScale.at(i).step, QPointF(d->horizontalScale.at(i).value, d->verticalScale.at(i).value)); Execution Count:5 | 5 |
353 | | - |
354 | return list; executed: return list; Execution Count:5 | 5 |
355 | } | - |
356 | | - |
357 | | - |
358 | | - |
359 | | - |
360 | | - |
361 | | - |
362 | qreal QGraphicsItemAnimation::verticalShearAt(qreal step) const | - |
363 | { | - |
364 | if (step < 0.0 || step > 1.0) partially evaluated: step < 0.0 no Evaluation Count:0 | yes Evaluation Count:1 |
partially evaluated: step > 1.0 no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
365 | QMessageLogger("graphicsview/qgraphicsitemanimation.cpp", 463, __PRETTY_FUNCTION__).warning("QGraphicsItemAnimation::verticalShearAt: invalid step = %f", step); never executed: QMessageLogger("graphicsview/qgraphicsitemanimation.cpp", 463, __PRETTY_FUNCTION__).warning("QGraphicsItemAnimation::verticalShearAt: invalid step = %f", step); | 0 |
366 | | - |
367 | return d->linearValueForStep(step, &d->verticalShear, 0); executed: return d->linearValueForStep(step, &d->verticalShear, 0); Execution Count:1 | 1 |
368 | } | - |
369 | | - |
370 | | - |
371 | | - |
372 | | - |
373 | | - |
374 | | - |
375 | qreal QGraphicsItemAnimation::horizontalShearAt(qreal step) const | - |
376 | { | - |
377 | if (step < 0.0 || step > 1.0) partially evaluated: step < 0.0 no Evaluation Count:0 | yes Evaluation Count:1 |
partially evaluated: step > 1.0 no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
378 | QMessageLogger("graphicsview/qgraphicsitemanimation.cpp", 476, __PRETTY_FUNCTION__).warning("QGraphicsItemAnimation::horizontalShearAt: invalid step = %f", step); never executed: QMessageLogger("graphicsview/qgraphicsitemanimation.cpp", 476, __PRETTY_FUNCTION__).warning("QGraphicsItemAnimation::horizontalShearAt: invalid step = %f", step); | 0 |
379 | | - |
380 | return d->linearValueForStep(step, &d->horizontalShear, 0); executed: return d->linearValueForStep(step, &d->horizontalShear, 0); Execution Count:1 | 1 |
381 | } | - |
382 | | - |
383 | | - |
384 | | - |
385 | | - |
386 | | - |
387 | | - |
388 | | - |
389 | void QGraphicsItemAnimation::setShearAt(qreal step, qreal sh, qreal sv) | - |
390 | { | - |
391 | d->insertUniquePair(step, sh, &d->horizontalShear, "setShearAt"); | - |
392 | d->insertUniquePair(step, sv, &d->verticalShear, "setShearAt"); | - |
393 | } executed: } Execution Count:4 | 4 |
394 | | - |
395 | | - |
396 | | - |
397 | | - |
398 | | - |
399 | | - |
400 | QList<QPair<qreal, QPointF> > QGraphicsItemAnimation::shearList() const | - |
401 | { | - |
402 | QList<QPair<qreal, QPointF> > list; | - |
403 | for (int i = 0; i < d->horizontalShear.size(); ++i) evaluated: i < d->horizontalShear.size() yes Evaluation Count:5 | yes Evaluation Count:5 |
| 5 |
404 | list << QPair<qreal, QPointF>(d->horizontalShear.at(i).step, QPointF(d->horizontalShear.at(i).value, d->verticalShear.at(i).value)); executed: list << QPair<qreal, QPointF>(d->horizontalShear.at(i).step, QPointF(d->horizontalShear.at(i).value, d->verticalShear.at(i).value)); Execution Count:5 | 5 |
405 | | - |
406 | return list; executed: return list; Execution Count:5 | 5 |
407 | } | - |
408 | | - |
409 | | - |
410 | | - |
411 | | - |
412 | | - |
413 | void QGraphicsItemAnimation::clear() | - |
414 | { | - |
415 | d->xPosition.clear(); | - |
416 | d->yPosition.clear(); | - |
417 | d->rotation.clear(); | - |
418 | d->verticalScale.clear(); | - |
419 | d->horizontalScale.clear(); | - |
420 | d->verticalShear.clear(); | - |
421 | d->horizontalShear.clear(); | - |
422 | d->xTranslation.clear(); | - |
423 | d->yTranslation.clear(); | - |
424 | } executed: } Execution Count:1 | 1 |
425 | | - |
426 | | - |
427 | | - |
428 | | - |
429 | | - |
430 | | - |
431 | | - |
432 | void QGraphicsItemAnimation::setStep(qreal x) | - |
433 | { | - |
434 | if (x < 0.0 || x > 1.0) { | 0 |
435 | QMessageLogger("graphicsview/qgraphicsitemanimation.cpp", 533, __PRETTY_FUNCTION__).warning("QGraphicsItemAnimation::setStep: invalid step = %f", x); | - |
436 | return; | 0 |
437 | } | - |
438 | | - |
439 | beforeAnimationStep(x); | - |
440 | | - |
441 | d->step = x; | - |
442 | if (d->item) { | 0 |
443 | if (!d->xPosition.isEmpty() || !d->yPosition.isEmpty()) never evaluated: !d->xPosition.isEmpty() never evaluated: !d->yPosition.isEmpty() | 0 |
444 | d->item->setPos(posAt(x)); never executed: d->item->setPos(posAt(x)); | 0 |
445 | if (!d->rotation.isEmpty() never evaluated: !d->rotation.isEmpty() | 0 |
446 | || !d->verticalScale.isEmpty() never evaluated: !d->verticalScale.isEmpty() | 0 |
447 | || !d->horizontalScale.isEmpty() never evaluated: !d->horizontalScale.isEmpty() | 0 |
448 | || !d->verticalShear.isEmpty() never evaluated: !d->verticalShear.isEmpty() | 0 |
449 | || !d->horizontalShear.isEmpty() never evaluated: !d->horizontalShear.isEmpty() | 0 |
450 | || !d->xTranslation.isEmpty() never evaluated: !d->xTranslation.isEmpty() | 0 |
451 | || !d->yTranslation.isEmpty()) { never evaluated: !d->yTranslation.isEmpty() | 0 |
452 | d->item->setMatrix(d->startMatrix * matrixAt(x)); | - |
453 | } | 0 |
454 | } | 0 |
455 | | - |
456 | afterAnimationStep(x); | - |
457 | } | 0 |
458 | void QGraphicsItemAnimation::reset() | - |
459 | { | - |
460 | if (!d->item) never evaluated: !d->item | 0 |
461 | return; | 0 |
462 | d->startPos = d->item->pos(); | - |
463 | d->startMatrix = d->item->matrix(); | - |
464 | } | 0 |
465 | void QGraphicsItemAnimation::beforeAnimationStep(qreal step) | - |
466 | { | - |
467 | (void)step;; | - |
468 | } | 0 |
469 | void QGraphicsItemAnimation::afterAnimationStep(qreal step) | - |
470 | { | - |
471 | (void)step;; | - |
472 | } | 0 |
473 | | - |
474 | | - |
475 | | - |
| | |