Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/items/qquickitemanimation.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||||||||
2 | - | |||||||||||||||||||||||||
3 | - | |||||||||||||||||||||||||
4 | - | |||||||||||||||||||||||||
5 | - | |||||||||||||||||||||||||
6 | - | |||||||||||||||||||||||||
7 | QQuickParentAnimation::QQuickParentAnimation(QObject *parent) | - | ||||||||||||||||||||||||
8 | : QQuickAnimationGroup(*(new QQuickParentAnimationPrivate), parent) | - | ||||||||||||||||||||||||
9 | { | - | ||||||||||||||||||||||||
10 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||||||||
11 | - | |||||||||||||||||||||||||
12 | QQuickParentAnimation::~QQuickParentAnimation() | - | ||||||||||||||||||||||||
13 | { | - | ||||||||||||||||||||||||
14 | } | - | ||||||||||||||||||||||||
15 | QQuickItem *QQuickParentAnimation::target() const | - | ||||||||||||||||||||||||
16 | { | - | ||||||||||||||||||||||||
17 | const QQuickParentAnimationPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
18 | return never executed: d->target;return d->target; never executed: return d->target; | 0 | ||||||||||||||||||||||||
19 | } | - | ||||||||||||||||||||||||
20 | - | |||||||||||||||||||||||||
21 | void QQuickParentAnimation::setTargetObject(QQuickItem *target) | - | ||||||||||||||||||||||||
22 | { | - | ||||||||||||||||||||||||
23 | QQuickParentAnimationPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
24 | if (target == d->target
| 0-2 | ||||||||||||||||||||||||
25 | return; never executed: return; | 0 | ||||||||||||||||||||||||
26 | - | |||||||||||||||||||||||||
27 | d->target = target; | - | ||||||||||||||||||||||||
28 | targetChanged(); | - | ||||||||||||||||||||||||
29 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||||||||
30 | QQuickItem *QQuickParentAnimation::newParent() const | - | ||||||||||||||||||||||||
31 | { | - | ||||||||||||||||||||||||
32 | const QQuickParentAnimationPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
33 | return never executed: d->newParent;return d->newParent; never executed: return d->newParent; | 0 | ||||||||||||||||||||||||
34 | } | - | ||||||||||||||||||||||||
35 | - | |||||||||||||||||||||||||
36 | void QQuickParentAnimation::setNewParent(QQuickItem *newParent) | - | ||||||||||||||||||||||||
37 | { | - | ||||||||||||||||||||||||
38 | QQuickParentAnimationPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
39 | if (newParent == d->newParent
| 0 | ||||||||||||||||||||||||
40 | return; never executed: return; | 0 | ||||||||||||||||||||||||
41 | - | |||||||||||||||||||||||||
42 | d->newParent = newParent; | - | ||||||||||||||||||||||||
43 | newParentChanged(); | - | ||||||||||||||||||||||||
44 | } never executed: end of block | 0 | ||||||||||||||||||||||||
45 | QQuickItem *QQuickParentAnimation::via() const | - | ||||||||||||||||||||||||
46 | { | - | ||||||||||||||||||||||||
47 | const QQuickParentAnimationPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
48 | return never executed: d->via;return d->via; never executed: return d->via; | 0 | ||||||||||||||||||||||||
49 | } | - | ||||||||||||||||||||||||
50 | - | |||||||||||||||||||||||||
51 | void QQuickParentAnimation::setVia(QQuickItem *via) | - | ||||||||||||||||||||||||
52 | { | - | ||||||||||||||||||||||||
53 | QQuickParentAnimationPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
54 | if (via == d->via
| 0-2 | ||||||||||||||||||||||||
55 | return; never executed: return; | 0 | ||||||||||||||||||||||||
56 | - | |||||||||||||||||||||||||
57 | d->via = via; | - | ||||||||||||||||||||||||
58 | viaChanged(); | - | ||||||||||||||||||||||||
59 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||||||||
60 | - | |||||||||||||||||||||||||
61 | - | |||||||||||||||||||||||||
62 | QPointF QQuickParentAnimationPrivate::computeTransformOrigin(QQuickItem::TransformOrigin origin, qreal width, qreal height) const | - | ||||||||||||||||||||||||
63 | { | - | ||||||||||||||||||||||||
64 | switch (origin) { | - | ||||||||||||||||||||||||
65 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||||||||
66 | case never executed: QQuickItem::TopLeft:case QQuickItem::TopLeft: never executed: case QQuickItem::TopLeft: | 0 | ||||||||||||||||||||||||
67 | return never executed: QPointF(0, 0);return QPointF(0, 0); never executed: return QPointF(0, 0); | 0 | ||||||||||||||||||||||||
68 | case never executed: QQuickItem::Top:case QQuickItem::Top: never executed: case QQuickItem::Top: | 0 | ||||||||||||||||||||||||
69 | return never executed: QPointF(width / 2., 0);return QPointF(width / 2., 0); never executed: return QPointF(width / 2., 0); | 0 | ||||||||||||||||||||||||
70 | case never executed: QQuickItem::TopRight:case QQuickItem::TopRight: never executed: case QQuickItem::TopRight: | 0 | ||||||||||||||||||||||||
71 | return never executed: QPointF(width, 0);return QPointF(width, 0); never executed: return QPointF(width, 0); | 0 | ||||||||||||||||||||||||
72 | case never executed: QQuickItem::Left:case QQuickItem::Left: never executed: case QQuickItem::Left: | 0 | ||||||||||||||||||||||||
73 | return never executed: QPointF(0, height / 2.);return QPointF(0, height / 2.); never executed: return QPointF(0, height / 2.); | 0 | ||||||||||||||||||||||||
74 | case executed 2 times by 1 test: QQuickItem::Center:case QQuickItem::Center: Executed by:
executed 2 times by 1 test: case QQuickItem::Center: Executed by:
| 2 | ||||||||||||||||||||||||
75 | return executed 2 times by 1 test: QPointF(width / 2., height / 2.);return QPointF(width / 2., height / 2.); Executed by:
executed 2 times by 1 test: return QPointF(width / 2., height / 2.); Executed by:
| 2 | ||||||||||||||||||||||||
76 | case never executed: QQuickItem::Right:case QQuickItem::Right: never executed: case QQuickItem::Right: | 0 | ||||||||||||||||||||||||
77 | return never executed: QPointF(width, height / 2.);return QPointF(width, height / 2.); never executed: return QPointF(width, height / 2.); | 0 | ||||||||||||||||||||||||
78 | case never executed: QQuickItem::BottomLeft:case QQuickItem::BottomLeft: never executed: case QQuickItem::BottomLeft: | 0 | ||||||||||||||||||||||||
79 | return never executed: QPointF(0, height);return QPointF(0, height); never executed: return QPointF(0, height); | 0 | ||||||||||||||||||||||||
80 | case never executed: QQuickItem::Bottom:case QQuickItem::Bottom: never executed: case QQuickItem::Bottom: | 0 | ||||||||||||||||||||||||
81 | return never executed: QPointF(width / 2., height);return QPointF(width / 2., height); never executed: return QPointF(width / 2., height); | 0 | ||||||||||||||||||||||||
82 | case never executed: QQuickItem::BottomRight:case QQuickItem::BottomRight: never executed: case QQuickItem::BottomRight: | 0 | ||||||||||||||||||||||||
83 | return never executed: QPointF(width, height);return QPointF(width, height); never executed: return QPointF(width, height); | 0 | ||||||||||||||||||||||||
84 | } | - | ||||||||||||||||||||||||
85 | } | - | ||||||||||||||||||||||||
86 | - | |||||||||||||||||||||||||
87 | struct QQuickParentAnimationData : public QAbstractAnimationAction | - | ||||||||||||||||||||||||
88 | { | - | ||||||||||||||||||||||||
89 | QQuickParentAnimationData() : reverse(false) {} executed 4 times by 1 test: end of block Executed by:
| 4 | ||||||||||||||||||||||||
90 | ~QQuickParentAnimationData() { qDeleteAll(pc); } executed 4 times by 1 test: end of block Executed by:
| 4 | ||||||||||||||||||||||||
91 | - | |||||||||||||||||||||||||
92 | QQuickStateActions actions; | - | ||||||||||||||||||||||||
93 | - | |||||||||||||||||||||||||
94 | bool reverse; | - | ||||||||||||||||||||||||
95 | QList<QQuickParentChange *> pc; | - | ||||||||||||||||||||||||
96 | void doAction() override | - | ||||||||||||||||||||||||
97 | { | - | ||||||||||||||||||||||||
98 | for (int ii = 0; ii < actions.count()
| 4 | ||||||||||||||||||||||||
99 | const QQuickStateAction &action = actions.at(ii); | - | ||||||||||||||||||||||||
100 | if (reverse
| 0-4 | ||||||||||||||||||||||||
101 | action.event->reverse(); never executed: action.event->reverse(); | 0 | ||||||||||||||||||||||||
102 | else | - | ||||||||||||||||||||||||
103 | action.event->execute(); executed 4 times by 1 test: action.event->execute(); Executed by:
| 4 | ||||||||||||||||||||||||
104 | } | - | ||||||||||||||||||||||||
105 | } executed 4 times by 1 test: end of block Executed by:
| 4 | ||||||||||||||||||||||||
106 | }; | - | ||||||||||||||||||||||||
107 | - | |||||||||||||||||||||||||
108 | QAbstractAnimationJob* QQuickParentAnimation::transition(QQuickStateActions &actions, | - | ||||||||||||||||||||||||
109 | QQmlProperties &modified, | - | ||||||||||||||||||||||||
110 | TransitionDirection direction, | - | ||||||||||||||||||||||||
111 | QObject *defaultTarget) | - | ||||||||||||||||||||||||
112 | { | - | ||||||||||||||||||||||||
113 | QQuickParentAnimationPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
114 | - | |||||||||||||||||||||||||
115 | QQuickParentAnimationData *data = new QQuickParentAnimationData; | - | ||||||||||||||||||||||||
116 | QQuickParentAnimationData *viaData = new QQuickParentAnimationData; | - | ||||||||||||||||||||||||
117 | - | |||||||||||||||||||||||||
118 | bool hasExplicit = false; | - | ||||||||||||||||||||||||
119 | if (d->target
| 0-2 | ||||||||||||||||||||||||
120 | data->reverse = false; | - | ||||||||||||||||||||||||
121 | QQuickStateAction myAction; | - | ||||||||||||||||||||||||
122 | QQuickParentChange *pc = new QQuickParentChange; | - | ||||||||||||||||||||||||
123 | pc->setObject(d->target); | - | ||||||||||||||||||||||||
124 | pc->setParent(d->newParent); | - | ||||||||||||||||||||||||
125 | myAction.event = pc; | - | ||||||||||||||||||||||||
126 | data->pc << pc; | - | ||||||||||||||||||||||||
127 | data->actions << myAction; | - | ||||||||||||||||||||||||
128 | hasExplicit = true; | - | ||||||||||||||||||||||||
129 | if (d->via
| 0 | ||||||||||||||||||||||||
130 | viaData->reverse = false; | - | ||||||||||||||||||||||||
131 | QQuickStateAction myVAction; | - | ||||||||||||||||||||||||
132 | QQuickParentChange *vpc = new QQuickParentChange; | - | ||||||||||||||||||||||||
133 | vpc->setObject(d->target); | - | ||||||||||||||||||||||||
134 | vpc->setParent(d->via); | - | ||||||||||||||||||||||||
135 | myVAction.event = vpc; | - | ||||||||||||||||||||||||
136 | viaData->pc << vpc; | - | ||||||||||||||||||||||||
137 | viaData->actions << myVAction; | - | ||||||||||||||||||||||||
138 | } never executed: end of block | 0 | ||||||||||||||||||||||||
139 | - | |||||||||||||||||||||||||
140 | - | |||||||||||||||||||||||||
141 | } never executed: end of block | 0 | ||||||||||||||||||||||||
142 | - | |||||||||||||||||||||||||
143 | if (!hasExplicit
| 0-2 | ||||||||||||||||||||||||
144 | for (int i = 0; i < actions.size()
| 2 | ||||||||||||||||||||||||
145 | QQuickStateAction &action = actions[i]; | - | ||||||||||||||||||||||||
146 | if (action.event
| 0-2 | ||||||||||||||||||||||||
147 | && (!d->target
| 0-2 | ||||||||||||||||||||||||
148 | - | |||||||||||||||||||||||||
149 | QQuickParentChange *pc = static_cast<QQuickParentChange*>(action.event); | - | ||||||||||||||||||||||||
150 | QQuickStateAction myAction = action; | - | ||||||||||||||||||||||||
151 | data->reverse = action.reverseEvent; | - | ||||||||||||||||||||||||
152 | - | |||||||||||||||||||||||||
153 | - | |||||||||||||||||||||||||
154 | - | |||||||||||||||||||||||||
155 | if (d->newParent
| 0-2 | ||||||||||||||||||||||||
156 | QQuickParentChange *epc = new QQuickParentChange; | - | ||||||||||||||||||||||||
157 | epc->setObject(static_cast<QQuickParentChange*>(action.event)->object()); | - | ||||||||||||||||||||||||
158 | epc->setParent(d->newParent); | - | ||||||||||||||||||||||||
159 | myAction.event = epc; | - | ||||||||||||||||||||||||
160 | data->pc << epc; | - | ||||||||||||||||||||||||
161 | data->actions << myAction; | - | ||||||||||||||||||||||||
162 | pc = epc; | - | ||||||||||||||||||||||||
163 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
164 | action.actionDone = true; | - | ||||||||||||||||||||||||
165 | data->actions << myAction; | - | ||||||||||||||||||||||||
166 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||||||||
167 | - | |||||||||||||||||||||||||
168 | if (d->via
| 0-2 | ||||||||||||||||||||||||
169 | viaData->reverse = false; | - | ||||||||||||||||||||||||
170 | QQuickStateAction myAction; | - | ||||||||||||||||||||||||
171 | QQuickParentChange *vpc = new QQuickParentChange; | - | ||||||||||||||||||||||||
172 | vpc->setObject(pc->object()); | - | ||||||||||||||||||||||||
173 | vpc->setParent(d->via); | - | ||||||||||||||||||||||||
174 | myAction.event = vpc; | - | ||||||||||||||||||||||||
175 | viaData->pc << vpc; | - | ||||||||||||||||||||||||
176 | viaData->actions << myAction; | - | ||||||||||||||||||||||||
177 | QQuickStateAction dummyAction; | - | ||||||||||||||||||||||||
178 | QQuickStateAction &xAction = pc->xIsSet()
| 0-2 | ||||||||||||||||||||||||
179 | QQuickStateAction &yAction = pc->yIsSet()
| 0-2 | ||||||||||||||||||||||||
180 | QQuickStateAction &sAction = pc->scaleIsSet()
| 0-2 | ||||||||||||||||||||||||
181 | QQuickStateAction &rAction = pc->rotationIsSet()
| 0-2 | ||||||||||||||||||||||||
182 | QQuickItem *target = pc->object(); | - | ||||||||||||||||||||||||
183 | QQuickItem *targetParent = action.reverseEvent
| 0-2 | ||||||||||||||||||||||||
184 | - | |||||||||||||||||||||||||
185 | - | |||||||||||||||||||||||||
186 | bool ok; | - | ||||||||||||||||||||||||
187 | const QTransform &transform = targetParent->itemTransform(d->via, &ok); | - | ||||||||||||||||||||||||
188 | if (transform.type() >= QTransform::TxShear
| 0-2 | ||||||||||||||||||||||||
189 | qmlWarning(this) << QQuickParentAnimation::tr("Unable to preserve appearance under complex transform"); | - | ||||||||||||||||||||||||
190 | ok = false; | - | ||||||||||||||||||||||||
191 | } never executed: end of block | 0 | ||||||||||||||||||||||||
192 | - | |||||||||||||||||||||||||
193 | qreal scale = 1; | - | ||||||||||||||||||||||||
194 | qreal rotation = 0; | - | ||||||||||||||||||||||||
195 | bool isRotate = (
| 0-2 | ||||||||||||||||||||||||
196 | if (ok
| 0-2 | ||||||||||||||||||||||||
197 | if (transform.m11() == transform.m22()
| 0 | ||||||||||||||||||||||||
198 | scale = transform.m11(); never executed: scale = transform.m11(); | 0 | ||||||||||||||||||||||||
199 | else { | - | ||||||||||||||||||||||||
200 | qmlWarning(this) << QQuickParentAnimation::tr("Unable to preserve appearance under non-uniform scale"); | - | ||||||||||||||||||||||||
201 | ok = false; | - | ||||||||||||||||||||||||
202 | } never executed: end of block | 0 | ||||||||||||||||||||||||
203 | } else if (ok
| 0-2 | ||||||||||||||||||||||||
204 | if (transform.m11() == transform.m22()
| 0-2 | ||||||||||||||||||||||||
205 | scale = qSqrt(transform.m11()*transform.m11() + transform.m12()*transform.m12()); executed 2 times by 1 test: scale = qSqrt(transform.m11()*transform.m11() + transform.m12()*transform.m12()); Executed by:
| 2 | ||||||||||||||||||||||||
206 | else { | - | ||||||||||||||||||||||||
207 | qmlWarning(this) << QQuickParentAnimation::tr("Unable to preserve appearance under non-uniform scale"); | - | ||||||||||||||||||||||||
208 | ok = false; | - | ||||||||||||||||||||||||
209 | } never executed: end of block | 0 | ||||||||||||||||||||||||
210 | - | |||||||||||||||||||||||||
211 | if (scale != 0
| 0-2 | ||||||||||||||||||||||||
212 | rotation = qRadiansToDegrees(qAtan2(transform.m12() / scale, transform.m11() / scale)); executed 2 times by 1 test: rotation = qRadiansToDegrees(qAtan2(transform.m12() / scale, transform.m11() / scale)); Executed by:
| 2 | ||||||||||||||||||||||||
213 | else { | - | ||||||||||||||||||||||||
214 | qmlWarning(this) << QQuickParentAnimation::tr("Unable to preserve appearance under scale of 0"); | - | ||||||||||||||||||||||||
215 | ok = false; | - | ||||||||||||||||||||||||
216 | } never executed: end of block | 0 | ||||||||||||||||||||||||
217 | } | - | ||||||||||||||||||||||||
218 | - | |||||||||||||||||||||||||
219 | const QPointF &point = transform.map(QPointF(xAction.toValue.toReal(),yAction.toValue.toReal())); | - | ||||||||||||||||||||||||
220 | qreal x = point.x(); | - | ||||||||||||||||||||||||
221 | qreal y = point.y(); | - | ||||||||||||||||||||||||
222 | if (ok
| 0-2 | ||||||||||||||||||||||||
223 | qreal w = target->width(); | - | ||||||||||||||||||||||||
224 | qreal h = target->height(); | - | ||||||||||||||||||||||||
225 | if (pc->widthIsSet()
| 0-2 | ||||||||||||||||||||||||
226 | w = actions.at(++i).toValue.toReal(); executed 2 times by 1 test: w = actions.at(++i).toValue.toReal(); Executed by:
| 2 | ||||||||||||||||||||||||
227 | if (pc->heightIsSet()
| 0-2 | ||||||||||||||||||||||||
228 | h = actions.at(++i).toValue.toReal(); never executed: h = actions.at(++i).toValue.toReal(); | 0 | ||||||||||||||||||||||||
229 | const QPointF &transformOrigin | - | ||||||||||||||||||||||||
230 | = d->computeTransformOrigin(target->transformOrigin(), w,h); | - | ||||||||||||||||||||||||
231 | qreal tempxt = transformOrigin.x(); | - | ||||||||||||||||||||||||
232 | qreal tempyt = transformOrigin.y(); | - | ||||||||||||||||||||||||
233 | QTransform t; | - | ||||||||||||||||||||||||
234 | t.translate(-tempxt, -tempyt); | - | ||||||||||||||||||||||||
235 | t.rotate(rotation); | - | ||||||||||||||||||||||||
236 | t.scale(scale, scale); | - | ||||||||||||||||||||||||
237 | t.translate(tempxt, tempyt); | - | ||||||||||||||||||||||||
238 | const QPointF &offset = t.map(QPointF(0,0)); | - | ||||||||||||||||||||||||
239 | x += offset.x(); | - | ||||||||||||||||||||||||
240 | y += offset.y(); | - | ||||||||||||||||||||||||
241 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||||||||
242 | - | |||||||||||||||||||||||||
243 | if (ok
| 0-2 | ||||||||||||||||||||||||
244 | - | |||||||||||||||||||||||||
245 | xAction.toValue = x; | - | ||||||||||||||||||||||||
246 | yAction.toValue = y; | - | ||||||||||||||||||||||||
247 | sAction.toValue = sAction.toValue.toReal() * scale; | - | ||||||||||||||||||||||||
248 | rAction.toValue = rAction.toValue.toReal() + rotation; | - | ||||||||||||||||||||||||
249 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||||||||
250 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||||||||
251 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||||||||
252 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||||||||
253 | - | |||||||||||||||||||||||||
254 | if (data->actions.count()
| 0-2 | ||||||||||||||||||||||||
255 | QSequentialAnimationGroupJob *topLevelGroup = new QSequentialAnimationGroupJob; | - | ||||||||||||||||||||||||
256 | QActionAnimation *viaAction = d->via
| 0-2 | ||||||||||||||||||||||||
257 | QActionAnimation *targetAction = new QActionAnimation; | - | ||||||||||||||||||||||||
258 | - | |||||||||||||||||||||||||
259 | QParallelAnimationGroupJob *ag = new QParallelAnimationGroupJob; | - | ||||||||||||||||||||||||
260 | - | |||||||||||||||||||||||||
261 | if (d->via
| 0-2 | ||||||||||||||||||||||||
262 | viaAction->setAnimAction(viaData); executed 2 times by 1 test: viaAction->setAnimAction(viaData); Executed by:
| 2 | ||||||||||||||||||||||||
263 | targetAction->setAnimAction(data); | - | ||||||||||||||||||||||||
264 | - | |||||||||||||||||||||||||
265 | - | |||||||||||||||||||||||||
266 | bool valid = d->defaultProperty.isValid(); | - | ||||||||||||||||||||||||
267 | QAbstractAnimationJob* anim; | - | ||||||||||||||||||||||||
268 | for (int ii = 0; ii < d->animations.count()
| 2 | ||||||||||||||||||||||||
269 | if (valid
| 0-2 | ||||||||||||||||||||||||
270 | d->animations.at(ii)->setDefaultTarget(d->defaultProperty); never executed: d->animations.at(ii)->setDefaultTarget(d->defaultProperty); | 0 | ||||||||||||||||||||||||
271 | anim = d->animations.at(ii)->transition(actions, modified, direction, defaultTarget); | - | ||||||||||||||||||||||||
272 | if (anim
| 0-2 | ||||||||||||||||||||||||
273 | ag->appendAnimation(anim); executed 2 times by 1 test: ag->appendAnimation(anim); Executed by:
| 2 | ||||||||||||||||||||||||
274 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||||||||
275 | - | |||||||||||||||||||||||||
276 | - | |||||||||||||||||||||||||
277 | bool forwards = direction == QQuickAbstractAnimation::Forward; | - | ||||||||||||||||||||||||
278 | if (forwards
| 0-2 | ||||||||||||||||||||||||
279 | topLevelGroup->appendAnimation(d->via ? viaAction : targetAction); | - | ||||||||||||||||||||||||
280 | topLevelGroup->appendAnimation(ag); | - | ||||||||||||||||||||||||
281 | if (d->via
| 0-2 | ||||||||||||||||||||||||
282 | topLevelGroup->appendAnimation(targetAction); executed 2 times by 1 test: topLevelGroup->appendAnimation(targetAction); Executed by:
| 2 | ||||||||||||||||||||||||
283 | } executed 2 times by 1 test: else {end of block Executed by:
| 2 | ||||||||||||||||||||||||
284 | if (d->via
| 0 | ||||||||||||||||||||||||
285 | topLevelGroup->appendAnimation(targetAction); never executed: topLevelGroup->appendAnimation(targetAction); | 0 | ||||||||||||||||||||||||
286 | topLevelGroup->appendAnimation(ag); | - | ||||||||||||||||||||||||
287 | topLevelGroup->appendAnimation(d->via ? viaAction : targetAction); | - | ||||||||||||||||||||||||
288 | } never executed: end of block | 0 | ||||||||||||||||||||||||
289 | return executed 2 times by 1 test: initInstance(topLevelGroup);return initInstance(topLevelGroup); Executed by:
executed 2 times by 1 test: return initInstance(topLevelGroup); Executed by:
| 2 | ||||||||||||||||||||||||
290 | } else { | - | ||||||||||||||||||||||||
291 | delete data; | - | ||||||||||||||||||||||||
292 | delete viaData; | - | ||||||||||||||||||||||||
293 | } never executed: end of block | 0 | ||||||||||||||||||||||||
294 | return never executed: nullptr;return nullptr; never executed: return nullptr; | 0 | ||||||||||||||||||||||||
295 | } | - | ||||||||||||||||||||||||
296 | QQuickAnchorAnimation::QQuickAnchorAnimation(QObject *parent) | - | ||||||||||||||||||||||||
297 | : QQuickAbstractAnimation(*(new QQuickAnchorAnimationPrivate), parent) | - | ||||||||||||||||||||||||
298 | { | - | ||||||||||||||||||||||||
299 | } executed 6 times by 2 tests: end of block Executed by:
| 6 | ||||||||||||||||||||||||
300 | - | |||||||||||||||||||||||||
301 | QQuickAnchorAnimation::~QQuickAnchorAnimation() | - | ||||||||||||||||||||||||
302 | { | - | ||||||||||||||||||||||||
303 | } | - | ||||||||||||||||||||||||
304 | QQmlListProperty<QQuickItem> QQuickAnchorAnimation::targets() | - | ||||||||||||||||||||||||
305 | { | - | ||||||||||||||||||||||||
306 | QQuickAnchorAnimationPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
307 | return never executed: QQmlListProperty<QQuickItem>(this, d->targets);return QQmlListProperty<QQuickItem>(this, d->targets); never executed: return QQmlListProperty<QQuickItem>(this, d->targets); | 0 | ||||||||||||||||||||||||
308 | } | - | ||||||||||||||||||||||||
309 | - | |||||||||||||||||||||||||
310 | - | |||||||||||||||||||||||||
311 | - | |||||||||||||||||||||||||
312 | - | |||||||||||||||||||||||||
313 | - | |||||||||||||||||||||||||
314 | - | |||||||||||||||||||||||||
315 | - | |||||||||||||||||||||||||
316 | int QQuickAnchorAnimation::duration() const | - | ||||||||||||||||||||||||
317 | { | - | ||||||||||||||||||||||||
318 | const QQuickAnchorAnimationPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
319 | return never executed: d->duration;return d->duration; never executed: return d->duration; | 0 | ||||||||||||||||||||||||
320 | } | - | ||||||||||||||||||||||||
321 | - | |||||||||||||||||||||||||
322 | void QQuickAnchorAnimation::setDuration(int duration) | - | ||||||||||||||||||||||||
323 | { | - | ||||||||||||||||||||||||
324 | if (duration < 0
| 0-4 | ||||||||||||||||||||||||
325 | qmlWarning(this) << tr("Cannot set a duration of < 0"); | - | ||||||||||||||||||||||||
326 | return; never executed: return; | 0 | ||||||||||||||||||||||||
327 | } | - | ||||||||||||||||||||||||
328 | - | |||||||||||||||||||||||||
329 | QQuickAnchorAnimationPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
330 | if (d->duration == duration
| 0-4 | ||||||||||||||||||||||||
331 | return; never executed: return; | 0 | ||||||||||||||||||||||||
332 | d->duration = duration; | - | ||||||||||||||||||||||||
333 | durationChanged(duration); | - | ||||||||||||||||||||||||
334 | } executed 4 times by 2 tests: end of block Executed by:
| 4 | ||||||||||||||||||||||||
335 | QEasingCurve QQuickAnchorAnimation::easing() const | - | ||||||||||||||||||||||||
336 | { | - | ||||||||||||||||||||||||
337 | const QQuickAnchorAnimationPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
338 | return never executed: d->easing;return d->easing; never executed: return d->easing; | 0 | ||||||||||||||||||||||||
339 | } | - | ||||||||||||||||||||||||
340 | - | |||||||||||||||||||||||||
341 | void QQuickAnchorAnimation::setEasing(const QEasingCurve &e) | - | ||||||||||||||||||||||||
342 | { | - | ||||||||||||||||||||||||
343 | QQuickAnchorAnimationPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
344 | if (d->easing == e
| 0-2 | ||||||||||||||||||||||||
345 | return; never executed: return; | 0 | ||||||||||||||||||||||||
346 | - | |||||||||||||||||||||||||
347 | d->easing = e; | - | ||||||||||||||||||||||||
348 | easingChanged(e); | - | ||||||||||||||||||||||||
349 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||||||||
350 | - | |||||||||||||||||||||||||
351 | QAbstractAnimationJob* QQuickAnchorAnimation::transition(QQuickStateActions &actions, | - | ||||||||||||||||||||||||
352 | QQmlProperties &modified, | - | ||||||||||||||||||||||||
353 | TransitionDirection direction, | - | ||||||||||||||||||||||||
354 | QObject *defaultTarget) | - | ||||||||||||||||||||||||
355 | { | - | ||||||||||||||||||||||||
356 | (void)modified;; | - | ||||||||||||||||||||||||
357 | (void)defaultTarget;; | - | ||||||||||||||||||||||||
358 | QQuickAnchorAnimationPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
359 | QQuickAnimationPropertyUpdater *data = new QQuickAnimationPropertyUpdater; | - | ||||||||||||||||||||||||
360 | data->interpolatorType = QMetaType::QReal; | - | ||||||||||||||||||||||||
361 | data->interpolator = d->interpolator; | - | ||||||||||||||||||||||||
362 | data->reverse = direction == Backward
| 0-12 | ||||||||||||||||||||||||
363 | data->fromSourced = false; | - | ||||||||||||||||||||||||
364 | data->fromDefined = false; | - | ||||||||||||||||||||||||
365 | - | |||||||||||||||||||||||||
366 | for (int ii = 0; ii < actions.count()
| 10-12 | ||||||||||||||||||||||||
367 | QQuickStateAction &action = actions[ii]; | - | ||||||||||||||||||||||||
368 | if (action.event
| 0-10 | ||||||||||||||||||||||||
369 | && (d->targets.isEmpty()
| 0-10 | ||||||||||||||||||||||||
370 | data->actions << static_cast<QQuickAnchorChanges*>(action.event)->additionalActions(); | - | ||||||||||||||||||||||||
371 | } executed 10 times by 2 tests: end of block Executed by:
| 10 | ||||||||||||||||||||||||
372 | } executed 10 times by 2 tests: end of block Executed by:
| 10 | ||||||||||||||||||||||||
373 | - | |||||||||||||||||||||||||
374 | QQuickBulkValueAnimator *animator = new QQuickBulkValueAnimator; | - | ||||||||||||||||||||||||
375 | if (data->actions.count()
| 2-10 | ||||||||||||||||||||||||
376 | animator->setAnimValue(data); | - | ||||||||||||||||||||||||
377 | animator->setFromSourcedValue(&data->fromSourced); | - | ||||||||||||||||||||||||
378 | } executed 10 times by 2 tests: else {end of block Executed by:
| 10 | ||||||||||||||||||||||||
379 | delete data; | - | ||||||||||||||||||||||||
380 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||||||||
381 | - | |||||||||||||||||||||||||
382 | animator->setDuration(d->duration); | - | ||||||||||||||||||||||||
383 | animator->setEasingCurve(d->easing); | - | ||||||||||||||||||||||||
384 | return executed 12 times by 2 tests: initInstance(animator);return initInstance(animator); Executed by:
executed 12 times by 2 tests: return initInstance(animator); Executed by:
| 12 | ||||||||||||||||||||||||
385 | } | - | ||||||||||||||||||||||||
386 | QQuickPathAnimation::QQuickPathAnimation(QObject *parent) | - | ||||||||||||||||||||||||
387 | : QQuickAbstractAnimation(*(new QQuickPathAnimationPrivate), parent) | - | ||||||||||||||||||||||||
388 | { | - | ||||||||||||||||||||||||
389 | } executed 16 times by 2 tests: end of block Executed by:
| 16 | ||||||||||||||||||||||||
390 | - | |||||||||||||||||||||||||
391 | QQuickPathAnimation::~QQuickPathAnimation() | - | ||||||||||||||||||||||||
392 | { | - | ||||||||||||||||||||||||
393 | typedef QHash<QQuickItem*, QQuickPathAnimationAnimator* >::iterator ActiveAnimationsIt; | - | ||||||||||||||||||||||||
394 | - | |||||||||||||||||||||||||
395 | QQuickPathAnimationPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
396 | for (ActiveAnimationsIt it = d->activeAnimations.begin(), end = d->activeAnimations.end(); it != end
| 8-10 | ||||||||||||||||||||||||
397 | it.value()->clearTemplate(); executed 8 times by 1 test: it.value()->clearTemplate(); Executed by:
| 8 | ||||||||||||||||||||||||
398 | } executed 10 times by 2 tests: end of block Executed by:
| 10 | ||||||||||||||||||||||||
399 | - | |||||||||||||||||||||||||
400 | - | |||||||||||||||||||||||||
401 | - | |||||||||||||||||||||||||
402 | - | |||||||||||||||||||||||||
403 | - | |||||||||||||||||||||||||
404 | - | |||||||||||||||||||||||||
405 | - | |||||||||||||||||||||||||
406 | int QQuickPathAnimation::duration() const | - | ||||||||||||||||||||||||
407 | { | - | ||||||||||||||||||||||||
408 | const QQuickPathAnimationPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
409 | return executed 2 times by 1 test: d->duration;return d->duration; Executed by:
executed 2 times by 1 test: return d->duration; Executed by:
| 2 | ||||||||||||||||||||||||
410 | } | - | ||||||||||||||||||||||||
411 | - | |||||||||||||||||||||||||
412 | void QQuickPathAnimation::setDuration(int duration) | - | ||||||||||||||||||||||||
413 | { | - | ||||||||||||||||||||||||
414 | if (duration < 0
| 0-16 | ||||||||||||||||||||||||
415 | qmlWarning(this) << tr("Cannot set a duration of < 0"); | - | ||||||||||||||||||||||||
416 | return; never executed: return; | 0 | ||||||||||||||||||||||||
417 | } | - | ||||||||||||||||||||||||
418 | - | |||||||||||||||||||||||||
419 | QQuickPathAnimationPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
420 | if (d->duration == duration
| 0-16 | ||||||||||||||||||||||||
421 | return; never executed: return; | 0 | ||||||||||||||||||||||||
422 | d->duration = duration; | - | ||||||||||||||||||||||||
423 | durationChanged(duration); | - | ||||||||||||||||||||||||
424 | } executed 16 times by 2 tests: end of block Executed by:
| 16 | ||||||||||||||||||||||||
425 | QEasingCurve QQuickPathAnimation::easing() const | - | ||||||||||||||||||||||||
426 | { | - | ||||||||||||||||||||||||
427 | const QQuickPathAnimationPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
428 | return executed 4 times by 2 tests: d->easingCurve;return d->easingCurve; Executed by:
executed 4 times by 2 tests: return d->easingCurve; Executed by:
| 4 | ||||||||||||||||||||||||
429 | } | - | ||||||||||||||||||||||||
430 | - | |||||||||||||||||||||||||
431 | void QQuickPathAnimation::setEasing(const QEasingCurve &e) | - | ||||||||||||||||||||||||
432 | { | - | ||||||||||||||||||||||||
433 | QQuickPathAnimationPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
434 | if (d->easingCurve == e
| 0-4 | ||||||||||||||||||||||||
435 | return; never executed: return; | 0 | ||||||||||||||||||||||||
436 | - | |||||||||||||||||||||||||
437 | d->easingCurve = e; | - | ||||||||||||||||||||||||
438 | easingChanged(e); | - | ||||||||||||||||||||||||
439 | } executed 4 times by 2 tests: end of block Executed by:
| 4 | ||||||||||||||||||||||||
440 | - | |||||||||||||||||||||||||
441 | - | |||||||||||||||||||||||||
442 | - | |||||||||||||||||||||||||
443 | - | |||||||||||||||||||||||||
444 | - | |||||||||||||||||||||||||
445 | - | |||||||||||||||||||||||||
446 | - | |||||||||||||||||||||||||
447 | QQuickPath *QQuickPathAnimation::path() const | - | ||||||||||||||||||||||||
448 | { | - | ||||||||||||||||||||||||
449 | const QQuickPathAnimationPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
450 | return never executed: d->path;return d->path; never executed: return d->path; | 0 | ||||||||||||||||||||||||
451 | } | - | ||||||||||||||||||||||||
452 | - | |||||||||||||||||||||||||
453 | void QQuickPathAnimation::setPath(QQuickPath *path) | - | ||||||||||||||||||||||||
454 | { | - | ||||||||||||||||||||||||
455 | QQuickPathAnimationPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
456 | if (d->path == path
| 0-16 | ||||||||||||||||||||||||
457 | return; never executed: return; | 0 | ||||||||||||||||||||||||
458 | - | |||||||||||||||||||||||||
459 | d->path = path; | - | ||||||||||||||||||||||||
460 | pathChanged(); | - | ||||||||||||||||||||||||
461 | } executed 16 times by 2 tests: end of block Executed by:
| 16 | ||||||||||||||||||||||||
462 | - | |||||||||||||||||||||||||
463 | - | |||||||||||||||||||||||||
464 | - | |||||||||||||||||||||||||
465 | - | |||||||||||||||||||||||||
466 | - | |||||||||||||||||||||||||
467 | QQuickItem *QQuickPathAnimation::target() const | - | ||||||||||||||||||||||||
468 | { | - | ||||||||||||||||||||||||
469 | const QQuickPathAnimationPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
470 | return executed 2 times by 1 test: d->target;return d->target; Executed by:
executed 2 times by 1 test: return d->target; Executed by:
| 2 | ||||||||||||||||||||||||
471 | } | - | ||||||||||||||||||||||||
472 | - | |||||||||||||||||||||||||
473 | void QQuickPathAnimation::setTargetObject(QQuickItem *target) | - | ||||||||||||||||||||||||
474 | { | - | ||||||||||||||||||||||||
475 | QQuickPathAnimationPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
476 | if (d->target == target
| 0-16 | ||||||||||||||||||||||||
477 | return; never executed: return; | 0 | ||||||||||||||||||||||||
478 | - | |||||||||||||||||||||||||
479 | d->target = target; | - | ||||||||||||||||||||||||
480 | targetChanged(); | - | ||||||||||||||||||||||||
481 | } executed 16 times by 2 tests: end of block Executed by:
| 16 | ||||||||||||||||||||||||
482 | QQuickPathAnimation::Orientation QQuickPathAnimation::orientation() const | - | ||||||||||||||||||||||||
483 | { | - | ||||||||||||||||||||||||
484 | const QQuickPathAnimationPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
485 | return executed 4 times by 1 test: d->orientation;return d->orientation; Executed by:
executed 4 times by 1 test: return d->orientation; Executed by:
| 4 | ||||||||||||||||||||||||
486 | } | - | ||||||||||||||||||||||||
487 | - | |||||||||||||||||||||||||
488 | void QQuickPathAnimation::setOrientation(Orientation orientation) | - | ||||||||||||||||||||||||
489 | { | - | ||||||||||||||||||||||||
490 | QQuickPathAnimationPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
491 | if (d->orientation == orientation
| 0-6 | ||||||||||||||||||||||||
492 | return; never executed: return; | 0 | ||||||||||||||||||||||||
493 | - | |||||||||||||||||||||||||
494 | d->orientation = orientation; | - | ||||||||||||||||||||||||
495 | orientationChanged(d->orientation); | - | ||||||||||||||||||||||||
496 | } executed 6 times by 2 tests: end of block Executed by:
| 6 | ||||||||||||||||||||||||
497 | QPointF QQuickPathAnimation::anchorPoint() const | - | ||||||||||||||||||||||||
498 | { | - | ||||||||||||||||||||||||
499 | const QQuickPathAnimationPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
500 | return never executed: d->anchorPoint;return d->anchorPoint; never executed: return d->anchorPoint; | 0 | ||||||||||||||||||||||||
501 | } | - | ||||||||||||||||||||||||
502 | - | |||||||||||||||||||||||||
503 | void QQuickPathAnimation::setAnchorPoint(const QPointF &point) | - | ||||||||||||||||||||||||
504 | { | - | ||||||||||||||||||||||||
505 | QQuickPathAnimationPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
506 | if (d->anchorPoint == point
| 0-2 | ||||||||||||||||||||||||
507 | return; never executed: return; | 0 | ||||||||||||||||||||||||
508 | - | |||||||||||||||||||||||||
509 | d->anchorPoint = point; | - | ||||||||||||||||||||||||
510 | anchorPointChanged(point); | - | ||||||||||||||||||||||||
511 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||||||||
512 | int QQuickPathAnimation::orientationEntryDuration() const | - | ||||||||||||||||||||||||
513 | { | - | ||||||||||||||||||||||||
514 | const QQuickPathAnimationPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
515 | return executed 2 times by 1 test: d->entryDuration;return d->entryDuration; Executed by:
executed 2 times by 1 test: return d->entryDuration; Executed by:
| 2 | ||||||||||||||||||||||||
516 | } | - | ||||||||||||||||||||||||
517 | - | |||||||||||||||||||||||||
518 | void QQuickPathAnimation::setOrientationEntryDuration(int duration) | - | ||||||||||||||||||||||||
519 | { | - | ||||||||||||||||||||||||
520 | QQuickPathAnimationPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
521 | if (d->entryDuration == duration
| 0-2 | ||||||||||||||||||||||||
522 | return; never executed: return; | 0 | ||||||||||||||||||||||||
523 | d->entryDuration = duration; | - | ||||||||||||||||||||||||
524 | orientationEntryDurationChanged(duration); | - | ||||||||||||||||||||||||
525 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||||||||
526 | int QQuickPathAnimation::orientationExitDuration() const | - | ||||||||||||||||||||||||
527 | { | - | ||||||||||||||||||||||||
528 | const QQuickPathAnimationPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
529 | return executed 2 times by 1 test: d->exitDuration;return d->exitDuration; Executed by:
executed 2 times by 1 test: return d->exitDuration; Executed by:
| 2 | ||||||||||||||||||||||||
530 | } | - | ||||||||||||||||||||||||
531 | - | |||||||||||||||||||||||||
532 | void QQuickPathAnimation::setOrientationExitDuration(int duration) | - | ||||||||||||||||||||||||
533 | { | - | ||||||||||||||||||||||||
534 | QQuickPathAnimationPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
535 | if (d->exitDuration == duration
| 0-2 | ||||||||||||||||||||||||
536 | return; never executed: return; | 0 | ||||||||||||||||||||||||
537 | d->exitDuration = duration; | - | ||||||||||||||||||||||||
538 | orientationExitDurationChanged(duration); | - | ||||||||||||||||||||||||
539 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||||||||
540 | qreal QQuickPathAnimation::endRotation() const | - | ||||||||||||||||||||||||
541 | { | - | ||||||||||||||||||||||||
542 | const QQuickPathAnimationPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
543 | return executed 2 times by 1 test: d->endRotation.isNull ? qreal(0) : d->endRotation.value;return d->endRotation.isNull ? qreal(0) : d->endRotation.value; Executed by:
executed 2 times by 1 test: return d->endRotation.isNull ? qreal(0) : d->endRotation.value; Executed by:
| 2 | ||||||||||||||||||||||||
544 | } | - | ||||||||||||||||||||||||
545 | - | |||||||||||||||||||||||||
546 | void QQuickPathAnimation::setEndRotation(qreal rotation) | - | ||||||||||||||||||||||||
547 | { | - | ||||||||||||||||||||||||
548 | QQuickPathAnimationPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
549 | if (!d->endRotation.isNull
| 0-2 | ||||||||||||||||||||||||
550 | return; never executed: return; | 0 | ||||||||||||||||||||||||
551 | - | |||||||||||||||||||||||||
552 | d->endRotation = rotation; | - | ||||||||||||||||||||||||
553 | endRotationChanged(d->endRotation); | - | ||||||||||||||||||||||||
554 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||||||||
555 | - | |||||||||||||||||||||||||
556 | QAbstractAnimationJob* QQuickPathAnimation::transition(QQuickStateActions &actions, | - | ||||||||||||||||||||||||
557 | QQmlProperties &modified, | - | ||||||||||||||||||||||||
558 | TransitionDirection direction, | - | ||||||||||||||||||||||||
559 | QObject *defaultTarget) | - | ||||||||||||||||||||||||
560 | { | - | ||||||||||||||||||||||||
561 | QQuickPathAnimationPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
562 | - | |||||||||||||||||||||||||
563 | QQuickItem *target = d->target
| 0-24 | ||||||||||||||||||||||||
564 | - | |||||||||||||||||||||||||
565 | QQuickPathAnimationUpdater prevData; | - | ||||||||||||||||||||||||
566 | bool havePrevData = false; | - | ||||||||||||||||||||||||
567 | if (d->activeAnimations.contains(target)
| 8-16 | ||||||||||||||||||||||||
568 | havePrevData = true; | - | ||||||||||||||||||||||||
569 | prevData = *d->activeAnimations[target]->pathUpdater(); | - | ||||||||||||||||||||||||
570 | } executed 8 times by 1 test: end of block Executed by:
| 8 | ||||||||||||||||||||||||
571 | - | |||||||||||||||||||||||||
572 | for (auto it = d->activeAnimations.begin(); it != d->activeAnimations.end()
| 8-24 | ||||||||||||||||||||||||
573 | QQuickPathAnimationAnimator *anim = it.value(); | - | ||||||||||||||||||||||||
574 | if (anim->state() == QAbstractAnimationJob::Stopped
| 0-8 | ||||||||||||||||||||||||
575 | anim->clearTemplate(); | - | ||||||||||||||||||||||||
576 | it = d->activeAnimations.erase(it); | - | ||||||||||||||||||||||||
577 | } executed 8 times by 1 test: else {end of block Executed by:
| 8 | ||||||||||||||||||||||||
578 | ++it; | - | ||||||||||||||||||||||||
579 | } never executed: end of block | 0 | ||||||||||||||||||||||||
580 | } | - | ||||||||||||||||||||||||
581 | - | |||||||||||||||||||||||||
582 | QQuickPathAnimationUpdater *data = new QQuickPathAnimationUpdater(); | - | ||||||||||||||||||||||||
583 | QQuickPathAnimationAnimator *pa = new QQuickPathAnimationAnimator(d); | - | ||||||||||||||||||||||||
584 | - | |||||||||||||||||||||||||
585 | d->activeAnimations[target] = pa; | - | ||||||||||||||||||||||||
586 | - | |||||||||||||||||||||||||
587 | data->orientation = d->orientation; | - | ||||||||||||||||||||||||
588 | data->anchorPoint = d->anchorPoint; | - | ||||||||||||||||||||||||
589 | data->entryInterval = d->duration
| 0-24 | ||||||||||||||||||||||||
590 | data->exitInterval = d->duration
| 0-24 | ||||||||||||||||||||||||
591 | data->endRotation = d->endRotation; | - | ||||||||||||||||||||||||
592 | data->reverse = direction == Backward
| 2-22 | ||||||||||||||||||||||||
593 | data->fromSourced = false; | - | ||||||||||||||||||||||||
594 | data->fromDefined = (d->path
| 0-24 | ||||||||||||||||||||||||
595 | data->toDefined = d->path
| 0-24 | ||||||||||||||||||||||||
596 | int origModifiedSize = modified.count(); | - | ||||||||||||||||||||||||
597 | - | |||||||||||||||||||||||||
598 | for (int i = 0; i < actions.count()
| 8-24 | ||||||||||||||||||||||||
599 | QQuickStateAction &action = actions[i]; | - | ||||||||||||||||||||||||
600 | if (action.event
| 0-8 | ||||||||||||||||||||||||
601 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||
602 | if (action.specifiedObject == target
| 0-8 | ||||||||||||||||||||||||
603 | data->toX = action.toValue.toReal(); | - | ||||||||||||||||||||||||
604 | modified << action.property; | - | ||||||||||||||||||||||||
605 | action.fromValue = action.toValue; | - | ||||||||||||||||||||||||
606 | } executed 4 times by 1 test: end of block Executed by:
| 4 | ||||||||||||||||||||||||
607 | if (action.specifiedObject == target
| 0-8 | ||||||||||||||||||||||||
608 | data->toY = action.toValue.toReal(); | - | ||||||||||||||||||||||||
609 | modified << action.property; | - | ||||||||||||||||||||||||
610 | action.fromValue = action.toValue; | - | ||||||||||||||||||||||||
611 | } executed 4 times by 1 test: end of block Executed by:
| 4 | ||||||||||||||||||||||||
612 | } executed 8 times by 1 test: end of block Executed by:
| 8 | ||||||||||||||||||||||||
613 | - | |||||||||||||||||||||||||
614 | if (target
| 0-24 | ||||||||||||||||||||||||
615 | (modified.count() > origModifiedSize
| 0-20 | ||||||||||||||||||||||||
616 | data->target = target; | - | ||||||||||||||||||||||||
617 | data->path = d->path; | - | ||||||||||||||||||||||||
618 | data->path->invalidateSequentialHistory(); | - | ||||||||||||||||||||||||
619 | - | |||||||||||||||||||||||||
620 | if (havePrevData
| 8-16 | ||||||||||||||||||||||||
621 | - | |||||||||||||||||||||||||
622 | data->startRotation = prevData.startRotation; | - | ||||||||||||||||||||||||
623 | - | |||||||||||||||||||||||||
624 | - | |||||||||||||||||||||||||
625 | if ((data->reverse
| 0-6 | ||||||||||||||||||||||||
626 | if (!data->fromDefined
| 0 | ||||||||||||||||||||||||
627 | QPointF pathPos = QQuickPath::sequentialPointAt(prevData.painterPath, prevData.pathLength, prevData.attributePoints, prevData.prevBez, prevData.currentV); | - | ||||||||||||||||||||||||
628 | if (!prevData.anchorPoint.isNull()
| 0 | ||||||||||||||||||||||||
629 | pathPos -= prevData.anchorPoint; never executed: pathPos -= prevData.anchorPoint; | 0 | ||||||||||||||||||||||||
630 | if (pathPos == data->target->position()
| 0 | ||||||||||||||||||||||||
631 | data->painterPath = prevData.painterPath; | - | ||||||||||||||||||||||||
632 | data->toDefined = data->fromDefined = data->fromSourced = true; | - | ||||||||||||||||||||||||
633 | data->prevBez.isValid = false; | - | ||||||||||||||||||||||||
634 | data->interruptStart = prevData.currentV; | - | ||||||||||||||||||||||||
635 | data->startRotation = prevData.startRotation; | - | ||||||||||||||||||||||||
636 | data->pathLength = prevData.pathLength; | - | ||||||||||||||||||||||||
637 | data->attributePoints = prevData.attributePoints; | - | ||||||||||||||||||||||||
638 | } never executed: end of block | 0 | ||||||||||||||||||||||||
639 | } never executed: end of block | 0 | ||||||||||||||||||||||||
640 | } never executed: end of block | 0 | ||||||||||||||||||||||||
641 | } executed 8 times by 1 test: end of block Executed by:
| 8 | ||||||||||||||||||||||||
642 | pa->setFromSourcedValue(&data->fromSourced); | - | ||||||||||||||||||||||||
643 | pa->setAnimValue(data); | - | ||||||||||||||||||||||||
644 | pa->setDuration(d->duration); | - | ||||||||||||||||||||||||
645 | pa->setEasingCurve(d->easingCurve); | - | ||||||||||||||||||||||||
646 | return executed 24 times by 2 tests: initInstance(pa);return initInstance(pa); Executed by:
executed 24 times by 2 tests: return initInstance(pa); Executed by:
| 24 | ||||||||||||||||||||||||
647 | } else { | - | ||||||||||||||||||||||||
648 | pa->setFromSourcedValue(nullptr); | - | ||||||||||||||||||||||||
649 | pa->setAnimValue(nullptr); | - | ||||||||||||||||||||||||
650 | delete pa; | - | ||||||||||||||||||||||||
651 | delete data; | - | ||||||||||||||||||||||||
652 | } never executed: end of block | 0 | ||||||||||||||||||||||||
653 | return never executed: nullptr;return nullptr; never executed: return nullptr; | 0 | ||||||||||||||||||||||||
654 | } | - | ||||||||||||||||||||||||
655 | - | |||||||||||||||||||||||||
656 | void QQuickPathAnimationUpdater::setValue(qreal v) | - | ||||||||||||||||||||||||
657 | { | - | ||||||||||||||||||||||||
658 | v = qMin(qMax(v, (qreal)0.0), (qreal)1.0);; | - | ||||||||||||||||||||||||
659 | - | |||||||||||||||||||||||||
660 | if (interruptStart.isValid()
| 0-287 | ||||||||||||||||||||||||
661 | if (reverse
| 0 | ||||||||||||||||||||||||
662 | v = 1 - v; never executed: v = 1 - v; | 0 | ||||||||||||||||||||||||
663 | qreal end = reverse
| 0 | ||||||||||||||||||||||||
664 | v = interruptStart + v * (end-interruptStart); | - | ||||||||||||||||||||||||
665 | } never executed: end of block | 0 | ||||||||||||||||||||||||
666 | currentV = v; | - | ||||||||||||||||||||||||
667 | bool atStart = ((reverse
| 2-247 | ||||||||||||||||||||||||
668 | if (!fromSourced
| 0-170 | ||||||||||||||||||||||||
669 | qreal startX = reverse
| 2-8 | ||||||||||||||||||||||||
670 | qreal startY = reverse
| 2-8 | ||||||||||||||||||||||||
671 | qreal endX = reverse
| 2-8 | ||||||||||||||||||||||||
672 | qreal endY = reverse
| 2-8 | ||||||||||||||||||||||||
673 | - | |||||||||||||||||||||||||
674 | prevBez.isValid = false; | - | ||||||||||||||||||||||||
675 | painterPath = path->createPath(QPointF(startX, startY), QPointF(endX, endY), QStringList(), pathLength, attributePoints); | - | ||||||||||||||||||||||||
676 | fromSourced = true; | - | ||||||||||||||||||||||||
677 | } executed 10 times by 1 test: end of block Executed by:
| 10 | ||||||||||||||||||||||||
678 | - | |||||||||||||||||||||||||
679 | qreal angle; | - | ||||||||||||||||||||||||
680 | bool fixed = orientation == QQuickPathAnimation::Fixed; | - | ||||||||||||||||||||||||
681 | QPointF currentPos = !painterPath.isEmpty()
| 127-160 | ||||||||||||||||||||||||
682 | - | |||||||||||||||||||||||||
683 | - | |||||||||||||||||||||||||
684 | if (!anchorPoint.isNull()
| 0-287 | ||||||||||||||||||||||||
685 | currentPos -= anchorPoint; | - | ||||||||||||||||||||||||
686 | if (atStart
| 0 | ||||||||||||||||||||||||
687 | if (!anchorPoint.isNull()
| 0 | ||||||||||||||||||||||||
688 | target->setTransformOriginPoint(anchorPoint); never executed: target->setTransformOriginPoint(anchorPoint); | 0 | ||||||||||||||||||||||||
689 | } never executed: end of block | 0 | ||||||||||||||||||||||||
690 | } never executed: end of block | 0 | ||||||||||||||||||||||||
691 | - | |||||||||||||||||||||||||
692 | target->setPosition(currentPos); | - | ||||||||||||||||||||||||
693 | - | |||||||||||||||||||||||||
694 | - | |||||||||||||||||||||||||
695 | if (!fixed
| 12-275 | ||||||||||||||||||||||||
696 | switch (orientation) { | - | ||||||||||||||||||||||||
697 | case executed 12 times by 1 test: QQuickPathAnimation::RightFirst:case QQuickPathAnimation::RightFirst: Executed by:
executed 12 times by 1 test: case QQuickPathAnimation::RightFirst: Executed by:
| 12 | ||||||||||||||||||||||||
698 | angle = -angle; | - | ||||||||||||||||||||||||
699 | break; executed 12 times by 1 test: break; Executed by:
| 12 | ||||||||||||||||||||||||
700 | case never executed: QQuickPathAnimation::TopFirst:case QQuickPathAnimation::TopFirst: never executed: case QQuickPathAnimation::TopFirst: | 0 | ||||||||||||||||||||||||
701 | angle = -angle + 90; | - | ||||||||||||||||||||||||
702 | break; never executed: break; | 0 | ||||||||||||||||||||||||
703 | case never executed: QQuickPathAnimation::LeftFirst:case QQuickPathAnimation::LeftFirst: never executed: case QQuickPathAnimation::LeftFirst: | 0 | ||||||||||||||||||||||||
704 | angle = -angle + 180; | - | ||||||||||||||||||||||||
705 | break; never executed: break; | 0 | ||||||||||||||||||||||||
706 | case never executed: QQuickPathAnimation::BottomFirst:case QQuickPathAnimation::BottomFirst: never executed: case QQuickPathAnimation::BottomFirst: | 0 | ||||||||||||||||||||||||
707 | angle = -angle + 270; | - | ||||||||||||||||||||||||
708 | break; never executed: break; | 0 | ||||||||||||||||||||||||
709 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||||||||
710 | angle = 0; | - | ||||||||||||||||||||||||
711 | break; never executed: break; | 0 | ||||||||||||||||||||||||
712 | } | - | ||||||||||||||||||||||||
713 | - | |||||||||||||||||||||||||
714 | if (atStart
| 0-8 | ||||||||||||||||||||||||
715 | startRotation = target->rotation(); | - | ||||||||||||||||||||||||
716 | - | |||||||||||||||||||||||||
717 | - | |||||||||||||||||||||||||
718 | qreal diff = angle - startRotation; | - | ||||||||||||||||||||||||
719 | while (diff > 180.0
| 0-4 | ||||||||||||||||||||||||
720 | startRotation.value += 360.0; | - | ||||||||||||||||||||||||
721 | diff -= 360.0; | - | ||||||||||||||||||||||||
722 | } never executed: end of block | 0 | ||||||||||||||||||||||||
723 | while (diff < -180.0
| 2-4 | ||||||||||||||||||||||||
724 | startRotation.value -= 360.0; | - | ||||||||||||||||||||||||
725 | diff += 360.0; | - | ||||||||||||||||||||||||
726 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||||||||
727 | } executed 4 times by 1 test: end of block Executed by:
| 4 | ||||||||||||||||||||||||
728 | - | |||||||||||||||||||||||||
729 | - | |||||||||||||||||||||||||
730 | - | |||||||||||||||||||||||||
731 | if (startRotation.isValid()
| 0-12 | ||||||||||||||||||||||||
732 | if (reverse
| 0-12 | ||||||||||||||||||||||||
733 | angle = startRotation; never executed: angle = startRotation; | 0 | ||||||||||||||||||||||||
734 | else if (v < entryInterval
| 2-10 | ||||||||||||||||||||||||
735 | angle = angle * v / entryInterval + startRotation * (entryInterval - v) / entryInterval; executed 2 times by 1 test: angle = angle * v / entryInterval + startRotation * (entryInterval - v) / entryInterval; Executed by:
| 2 | ||||||||||||||||||||||||
736 | } executed 12 times by 1 test: end of block Executed by:
| 12 | ||||||||||||||||||||||||
737 | if (endRotation.isValid()
| 6 | ||||||||||||||||||||||||
738 | qreal exitStart = 1 - entryInterval; | - | ||||||||||||||||||||||||
739 | if (!reverse
| 0-6 | ||||||||||||||||||||||||
740 | angle = endRotation; executed 2 times by 1 test: angle = endRotation; Executed by:
| 2 | ||||||||||||||||||||||||
741 | else if (v > exitStart
| 0-4 | ||||||||||||||||||||||||
742 | angle = endRotation * (v - exitStart) / exitInterval + angle * (exitInterval - (v - exitStart)) / exitInterval; never executed: angle = endRotation * (v - exitStart) / exitInterval + angle * (exitInterval - (v - exitStart)) / exitInterval; | 0 | ||||||||||||||||||||||||
743 | } executed 6 times by 1 test: end of block Executed by:
| 6 | ||||||||||||||||||||||||
744 | target->setRotation(angle); | - | ||||||||||||||||||||||||
745 | } executed 12 times by 1 test: end of block Executed by:
| 12 | ||||||||||||||||||||||||
746 | - | |||||||||||||||||||||||||
747 | - | |||||||||||||||||||||||||
748 | - | |||||||||||||||||||||||||
749 | - | |||||||||||||||||||||||||
750 | - | |||||||||||||||||||||||||
751 | - | |||||||||||||||||||||||||
752 | - | |||||||||||||||||||||||||
753 | if ((reverse
| 2-247 | ||||||||||||||||||||||||
754 | if (!anchorPoint.isNull()
| 0-26 | ||||||||||||||||||||||||
755 | target->setTransformOriginPoint(QPointF()); never executed: target->setTransformOriginPoint(QPointF()); | 0 | ||||||||||||||||||||||||
756 | } executed 26 times by 1 test: end of block Executed by:
| 26 | ||||||||||||||||||||||||
757 | } executed 287 times by 1 test: end of block Executed by:
| 287 | ||||||||||||||||||||||||
758 | - | |||||||||||||||||||||||||
759 | QQuickPathAnimationAnimator::QQuickPathAnimationAnimator(QQuickPathAnimationPrivate *priv) | - | ||||||||||||||||||||||||
760 | : animationTemplate(priv) | - | ||||||||||||||||||||||||
761 | { | - | ||||||||||||||||||||||||
762 | } executed 24 times by 2 tests: end of block Executed by:
| 24 | ||||||||||||||||||||||||
763 | - | |||||||||||||||||||||||||
764 | QQuickPathAnimationAnimator::~QQuickPathAnimationAnimator() | - | ||||||||||||||||||||||||
765 | { | - | ||||||||||||||||||||||||
766 | if (animationTemplate
| 0-14 | ||||||||||||||||||||||||
767 | QHash<QQuickItem*, QQuickPathAnimationAnimator* >::iterator it = | - | ||||||||||||||||||||||||
768 | animationTemplate->activeAnimations.find(pathUpdater()->target); | - | ||||||||||||||||||||||||
769 | if (it != animationTemplate->activeAnimations.end()
| 0-2 | ||||||||||||||||||||||||
770 | animationTemplate->activeAnimations.erase(it); executed 2 times by 1 test: animationTemplate->activeAnimations.erase(it); Executed by:
| 2 | ||||||||||||||||||||||||
771 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||||||||
772 | } executed 16 times by 2 tests: end of block Executed by:
| 16 | ||||||||||||||||||||||||
773 | - | |||||||||||||||||||||||||
774 | - | |||||||||||||||||||||||||
775 | - | |||||||||||||||||||||||||
776 | - | |||||||||||||||||||||||||
777 | - | |||||||||||||||||||||||||
Switch to Source code | Preprocessed file |