OpenCoverage

qquickpath.cpp

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/util/qquickpath.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2016 The Qt Company Ltd.-
4** Contact: https://www.qt.io/licensing/-
5**-
6** This file is part of the QtQuick module of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL$-
9** Commercial License Usage-
10** Licensees holding valid commercial Qt licenses may use this file in-
11** accordance with the commercial license agreement provided with the-
12** Software or, alternatively, in accordance with the terms contained in-
13** a written agreement between you and The Qt Company. For licensing terms-
14** and conditions see https://www.qt.io/terms-conditions. For further-
15** information use the contact form at https://www.qt.io/contact-us.-
16**-
17** GNU Lesser General Public License Usage-
18** Alternatively, this file may be used under the terms of the GNU Lesser-
19** General Public License version 3 as published by the Free Software-
20** Foundation and appearing in the file LICENSE.LGPL3 included in the-
21** packaging of this file. Please review the following information to-
22** ensure the GNU Lesser General Public License version 3 requirements-
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
24**-
25** GNU General Public License Usage-
26** Alternatively, this file may be used under the terms of the GNU-
27** General Public License version 2.0 or (at your option) the GNU General-
28** Public license version 3 or any later version approved by the KDE Free-
29** Qt Foundation. The licenses are as published by the Free Software-
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
31** included in the packaging of this file. Please review the following-
32** information to ensure the GNU General Public License requirements will-
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
34** https://www.gnu.org/licenses/gpl-3.0.html.-
35**-
36** $QT_END_LICENSE$-
37**-
38****************************************************************************/-
39-
40#include "qquickpath_p.h"-
41#include "qquickpath_p_p.h"-
42#include "qquicksvgparser_p.h"-
43-
44#include <QSet>-
45#include <QTime>-
46-
47#include <private/qbezier_p.h>-
48#include <QtCore/qmath.h>-
49#include <QtCore/private/qnumeric_p.h>-
50-
51QT_BEGIN_NAMESPACE-
52-
53/*!-
54 \qmltype PathElement-
55 \instantiates QQuickPathElement-
56 \inqmlmodule QtQuick-
57 \ingroup qtquick-animation-paths-
58 \brief PathElement is the base path type.-
59-
60 This type is the base for all path types. It cannot-
61 be instantiated.-
62-
63 \sa Path, PathAttribute, PathPercent, PathLine, PathQuad, PathCubic, PathArc,-
64 PathAngleArc, PathCurve, PathSvg-
65*/-
66-
67/*!-
68 \qmltype Path-
69 \instantiates QQuickPath-
70 \inqmlmodule QtQuick-
71 \ingroup qtquick-animation-paths-
72 \brief Defines a path for use by \l PathView and \l Shape.-
73-
74 A Path is composed of one or more path segments - PathLine, PathQuad,-
75 PathCubic, PathArc, PathAngleArc, PathCurve, PathSvg.-
76-
77 The spacing of the items along the Path can be adjusted via a-
78 PathPercent object.-
79-
80 PathAttribute allows named attributes with values to be defined-
81 along the path.-
82-
83 Path and the other types for specifying path elements are shared between-
84 \l PathView and \l Shape. The following table provides an overview of the-
85 applicability of the various path elements:-
86-
87 \table-
88 \header-
89 \li Element-
90 \li PathView-
91 \li Shape-
92 \li Shape, GL_NV_path_rendering-
93 \li Shape, software-
94 \row-
95 \li PathMove-
96 \li N/A-
97 \li Yes-
98 \li Yes-
99 \li Yes-
100 \row-
101 \li PathLine-
102 \li Yes-
103 \li Yes-
104 \li Yes-
105 \li Yes-
106 \row-
107 \li PathQuad-
108 \li Yes-
109 \li Yes-
110 \li Yes-
111 \li Yes-
112 \row-
113 \li PathCubic-
114 \li Yes-
115 \li Yes-
116 \li Yes-
117 \li Yes-
118 \row-
119 \li PathArc-
120 \li Yes-
121 \li Yes-
122 \li Yes-
123 \li Yes-
124 \row-
125 \li PathAngleArc-
126 \li Yes-
127 \li Yes-
128 \li Yes-
129 \li Yes-
130 \row-
131 \li PathSvg-
132 \li Yes-
133 \li Yes-
134 \li Yes-
135 \li Yes-
136 \row-
137 \li PathAttribute-
138 \li Yes-
139 \li N/A-
140 \li N/A-
141 \li N/A-
142 \row-
143 \li PathPercent-
144 \li Yes-
145 \li N/A-
146 \li N/A-
147 \li N/A-
148 \row-
149 \li PathCurve-
150 \li Yes-
151 \li No-
152 \li No-
153 \li No-
154 \endtable-
155-
156 \note Path is a non-visual type; it does not display anything on its own.-
157 To draw a path, use \l Shape.-
158-
159 \sa PathView, Shape, PathAttribute, PathPercent, PathLine, PathMove, PathQuad, PathCubic, PathArc, PathAngleArc, PathCurve, PathSvg-
160*/-
161QQuickPath::QQuickPath(QObject *parent)-
162 : QObject(*(new QQuickPathPrivate), parent)-
163{-
164}
executed 330 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
330
165-
166QQuickPath::QQuickPath(QQuickPathPrivate &dd, QObject *parent)-
167 : QObject(dd, parent)-
168{-
169}
executed 1072 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickshape
1072
170-
171QQuickPath::~QQuickPath()-
172{-
173}-
174-
175/*!-
176 \qmlproperty real QtQuick::Path::startX-
177 \qmlproperty real QtQuick::Path::startY-
178 These properties hold the starting position of the path.-
179*/-
180qreal QQuickPath::startX() const-
181{-
182 Q_D(const QQuickPath);-
183 return d->startX.isNull ? 0 : d->startX.value;
executed 20 times by 3 tests: return d->startX.isNull ? 0 : d->startX.value;
Executed by:
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickshape
20
184}-
185-
186void QQuickPath::setStartX(qreal x)-
187{-
188 Q_D(QQuickPath);-
189 if (d->startX.isValid() && qFuzzyCompare(x, d->startX))
d->startX.isValid()Description
TRUEevaluated 20 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickshape
FALSEevaluated 408 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickshape
  • tst_qquickvisualdatamodel
qFuzzyCompare(x, d->startX)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 18 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickshape
2-408
190 return;
executed 2 times by 1 test: return;
Executed by:
  • tst_qquickpathview
2
191 d->startX = x;-
192 emit startXChanged();-
193 processPath();-
194}
executed 426 times by 6 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickshape
  • tst_qquickvisualdatamodel
426
195-
196bool QQuickPath::hasStartX() const-
197{-
198 Q_D(const QQuickPath);-
199 return d->startX.isValid();
executed 24 times by 2 tests: return d->startX.isValid();
Executed by:
  • tst_examples
  • tst_qquickanimations
24
200}-
201-
202qreal QQuickPath::startY() const-
203{-
204 Q_D(const QQuickPath);-
205 return d->startY.isNull ? 0 : d->startY.value;
executed 18 times by 2 tests: return d->startY.isNull ? 0 : d->startY.value;
Executed by:
  • tst_qquickpath
  • tst_qquickpathview
18
206}-
207-
208void QQuickPath::setStartY(qreal y)-
209{-
210 Q_D(QQuickPath);-
211 if (d->startY.isValid() && qFuzzyCompare(y, d->startY))
d->startY.isValid()Description
TRUEevaluated 16 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
FALSEevaluated 408 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickshape
  • tst_qquickvisualdatamodel
qFuzzyCompare(y, d->startY)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 14 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
2-408
212 return;
executed 2 times by 1 test: return;
Executed by:
  • tst_qquickpathview
2
213 d->startY = y;-
214 emit startYChanged();-
215 processPath();-
216}
executed 422 times by 6 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickshape
  • tst_qquickvisualdatamodel
422
217-
218bool QQuickPath::hasStartY() const-
219{-
220 Q_D(const QQuickPath);-
221 return d->startY.isValid();
executed 14 times by 2 tests: return d->startY.isValid();
Executed by:
  • tst_examples
  • tst_qquickanimations
14
222}-
223-
224/*!-
225 \qmlproperty bool QtQuick::Path::closed-
226 This property holds whether the start and end of the path are identical.-
227*/-
228bool QQuickPath::isClosed() const-
229{-
230 Q_D(const QQuickPath);-
231 return d->closed;
executed 6 times by 2 tests: return d->closed;
Executed by:
  • tst_qquickpath
  • tst_qquickpathview
6
232}-
233-
234/*!-
235 \qmlproperty list<PathElement> QtQuick::Path::pathElements-
236 This property holds the objects composing the path.-
237-
238 \default-
239-
240 A path can contain the following path objects:-
241 \list-
242 \li \l PathLine - a straight line to a given position.-
243 \li \l PathQuad - a quadratic Bezier curve to a given position with a control point.-
244 \li \l PathCubic - a cubic Bezier curve to a given position with two control points.-
245 \li \l PathArc - an arc to a given position with a radius.-
246 \li \l PathAngleArc - an arc specified by center point, radii, and angles.-
247 \li \l PathSvg - a path specified as an SVG path data string.-
248 \li \l PathCurve - a point on a Catmull-Rom curve.-
249 \li \l PathAttribute - an attribute at a given position in the path.-
250 \li \l PathPercent - a way to spread out items along various segments of the path.-
251 \endlist-
252-
253 \snippet qml/pathview/pathattributes.qml 2-
254*/-
255-
256QQmlListProperty<QQuickPathElement> QQuickPath::pathElements()-
257{-
258 return QQmlListProperty<QQuickPathElement>(this,
executed 1448 times by 6 tests: return QQmlListProperty<QQuickPathElement>(this, nullptr, pathElements_append, pathElements_count, pathElements_at, pathElements_clear);
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickshape
  • tst_qquickvisualdatamodel
1448
259 nullptr,
executed 1448 times by 6 tests: return QQmlListProperty<QQuickPathElement>(this, nullptr, pathElements_append, pathElements_count, pathElements_at, pathElements_clear);
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickshape
  • tst_qquickvisualdatamodel
1448
260 pathElements_append,
executed 1448 times by 6 tests: return QQmlListProperty<QQuickPathElement>(this, nullptr, pathElements_append, pathElements_count, pathElements_at, pathElements_clear);
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickshape
  • tst_qquickvisualdatamodel
1448
261 pathElements_count,
executed 1448 times by 6 tests: return QQmlListProperty<QQuickPathElement>(this, nullptr, pathElements_append, pathElements_count, pathElements_at, pathElements_clear);
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickshape
  • tst_qquickvisualdatamodel
1448
262 pathElements_at,
executed 1448 times by 6 tests: return QQmlListProperty<QQuickPathElement>(this, nullptr, pathElements_append, pathElements_count, pathElements_at, pathElements_clear);
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickshape
  • tst_qquickvisualdatamodel
1448
263 pathElements_clear);
executed 1448 times by 6 tests: return QQmlListProperty<QQuickPathElement>(this, nullptr, pathElements_append, pathElements_count, pathElements_at, pathElements_clear);
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickshape
  • tst_qquickvisualdatamodel
1448
264}-
265-
266static QQuickPathPrivate *privatePath(QObject *object)-
267{-
268 QQuickPath *path = static_cast<QQuickPath*>(object);-
269-
270 return QQuickPathPrivate::get(path);
executed 10752 times by 6 tests: return QQuickPathPrivate::get(path);
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickshape
  • tst_qquickvisualdatamodel
10752
271}-
272-
273QQuickPathElement *QQuickPath::pathElements_at(QQmlListProperty<QQuickPathElement> *property, int index)-
274{-
275 QQuickPathPrivate *d = privatePath(property->object);-
276-
277 return d->_pathElements.at(index);
executed 44 times by 3 tests: return d->_pathElements.at(index);
Executed by:
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickshape
44
278}-
279-
280void QQuickPath::pathElements_append(QQmlListProperty<QQuickPathElement> *property, QQuickPathElement *pathElement)-
281{-
282 QQuickPathPrivate *d = privatePath(property->object);-
283 QQuickPath *path = static_cast<QQuickPath*>(property->object);-
284-
285 d->_pathElements.append(pathElement);-
286-
287 if (d->componentComplete) {
d->componentCompleteDescription
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 10642 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickshape
  • tst_qquickvisualdatamodel
16-10642
288 QQuickCurve *curve = qobject_cast<QQuickCurve *>(pathElement);-
289 if (curve)
curveDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquickpathview
4-12
290 d->_pathCurves.append(curve);
executed 4 times by 1 test: d->_pathCurves.append(curve);
Executed by:
  • tst_qquickpathview
4
291 else {-
292 QQuickPathAttribute *attribute = qobject_cast<QQuickPathAttribute *>(pathElement);-
293 if (attribute && !d->_attributes.contains(attribute->name()))
attributeDescription
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEnever evaluated
!d->_attribute...ibute->name())Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquickpathview
0-12
294 d->_attributes.append(attribute->name());
executed 2 times by 1 test: d->_attributes.append(attribute->name());
Executed by:
  • tst_qquickpathview
2
295 }
executed 12 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
12
296-
297 path->processPath();-
298-
299 connect(pathElement, SIGNAL(changed()), path, SLOT(processPath()));-
300 }
executed 16 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
16
301}
executed 10658 times by 6 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickshape
  • tst_qquickvisualdatamodel
10658
302-
303int QQuickPath::pathElements_count(QQmlListProperty<QQuickPathElement> *property)-
304{-
305 QQuickPathPrivate *d = privatePath(property->object);-
306-
307 return d->_pathElements.count();
executed 48 times by 3 tests: return d->_pathElements.count();
Executed by:
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickshape
48
308}-
309-
310void QQuickPath::pathElements_clear(QQmlListProperty<QQuickPathElement> *property)-
311{-
312 QQuickPathPrivate *d = privatePath(property->object);-
313 QQuickPath *path = static_cast<QQuickPath*>(property->object);-
314-
315 path->disconnectPathElements();-
316 d->_pathElements.clear();-
317 d->_pathCurves.clear();-
318 d->_pointCache.clear();-
319}
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
2
320-
321void QQuickPath::interpolate(int idx, const QString &name, qreal value)-
322{-
323 Q_D(QQuickPath);-
324 interpolate(d->_attributePoints, idx, name, value);-
325}
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
4
326-
327void QQuickPath::interpolate(QList<AttributePoint> &attributePoints, int idx, const QString &name, qreal value)-
328{-
329 if (!idx)
!idxDescription
TRUEevaluated 216 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
FALSEevaluated 392 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
216-392
330 return;
executed 216 times by 2 tests: return;
Executed by:
  • tst_examples
  • tst_qquickpathview
216
331-
332 qreal lastValue = 0;-
333 qreal lastPercent = 0;-
334 int search = idx - 1;-
335 while(search >= 0) {
search >= 0Description
TRUEevaluated 394 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickpathview
4-394
336 const AttributePoint &point = attributePoints.at(search);-
337 if (point.values.contains(name)) {
point.values.contains(name)Description
TRUEevaluated 388 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickpathview
6-388
338 lastValue = point.values.value(name);-
339 lastPercent = point.origpercent;-
340 break;
executed 388 times by 2 tests: break;
Executed by:
  • tst_examples
  • tst_qquickpathview
388
341 }-
342 --search;-
343 }
executed 6 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
6
344-
345 ++search;-
346-
347 const AttributePoint &curPoint = attributePoints.at(idx);-
348-
349 for (int ii = search; ii < idx; ++ii) {
ii < idxDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 392 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
6-392
350 AttributePoint &point = attributePoints[ii];-
351-
352 qreal val = lastValue + (value - lastValue) * (point.origpercent - lastPercent) / (curPoint.origpercent - lastPercent);-
353 point.values.insert(name, val);-
354 }
executed 6 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
6
355}
executed 392 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
392
356-
357void QQuickPath::endpoint(const QString &name)-
358{-
359 Q_D(QQuickPath);-
360 const AttributePoint &first = d->_attributePoints.first();-
361 qreal val = first.values.value(name);-
362 for (int ii = d->_attributePoints.count() - 1; ii >= 0; ii--) {
ii >= 0Description
TRUEnever evaluated
FALSEnever evaluated
0
363 const AttributePoint &point = d->_attributePoints.at(ii);-
364 if (point.values.contains(name)) {
point.values.contains(name)Description
TRUEnever evaluated
FALSEnever evaluated
0
365 for (int jj = ii + 1; jj < d->_attributePoints.count(); ++jj) {
jj < d->_attri...Points.count()Description
TRUEnever evaluated
FALSEnever evaluated
0
366 AttributePoint &setPoint = d->_attributePoints[jj];-
367 setPoint.values.insert(name, val);-
368 }
never executed: end of block
0
369 return;
never executed: return;
0
370 }-
371 }
never executed: end of block
0
372}
never executed: end of block
0
373-
374void QQuickPath::endpoint(QList<AttributePoint> &attributePoints, const QString &name)-
375{-
376 const AttributePoint &first = attributePoints.first();-
377 qreal val = first.values.value(name);-
378 for (int ii = attributePoints.count() - 1; ii >= 0; ii--) {
ii >= 0Description
TRUEevaluated 80 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
FALSEnever evaluated
0-80
379 const AttributePoint &point = attributePoints.at(ii);-
380 if (point.values.contains(name)) {
point.values.contains(name)Description
TRUEevaluated 38 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
FALSEevaluated 42 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
38-42
381 for (int jj = ii + 1; jj < attributePoints.count(); ++jj) {
jj < attributePoints.count()Description
TRUEevaluated 42 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
FALSEevaluated 38 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
38-42
382 AttributePoint &setPoint = attributePoints[jj];-
383 setPoint.values.insert(name, val);-
384 }
executed 42 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
42
385 return;
executed 38 times by 2 tests: return;
Executed by:
  • tst_examples
  • tst_qquickpathview
38
386 }-
387 }
executed 42 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
42
388}
never executed: end of block
0
389-
390void QQuickPath::processPath()-
391{-
392 Q_D(QQuickPath);-
393-
394 if (!d->componentComplete)
!d->componentCompleteDescription
TRUEevaluated 816 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickshape
  • tst_qquickvisualdatamodel
FALSEevaluated 1528 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickshape
  • tst_qquickvisualdatamodel
816-1528
395 return;
executed 816 times by 6 tests: return;
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickshape
  • tst_qquickvisualdatamodel
816
396-
397 d->_pointCache.clear();-
398 d->prevBez.isValid = false;-
399-
400 if (d->isShapePath) {
d->isShapePathDescription
TRUEevaluated 1158 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickshape
FALSEevaluated 370 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
370-1158
401 // This path is a ShapePath, so avoid extra overhead-
402 d->_path = createShapePath(QPointF(), QPointF(), d->pathLength, &d->closed);-
403 } else {
executed 1158 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickshape
1158
404 d->_path = createPath(QPointF(), QPointF(), d->_attributes, d->pathLength, d->_attributePoints, &d->closed);-
405 }
executed 370 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
370
406-
407 emit changed();-
408}
executed 1528 times by 6 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickshape
  • tst_qquickvisualdatamodel
1528
409-
410QPainterPath QQuickPath::createPath(const QPointF &startPoint, const QPointF &endPoint, const QStringList &attributes, qreal &pathLength, QList<AttributePoint> &attributePoints, bool *closed)-
411{-
412 Q_D(QQuickPath);-
413-
414 pathLength = 0;-
415 attributePoints.clear();-
416-
417 if (!d->componentComplete)
!d->componentCompleteDescription
TRUEnever evaluated
FALSEevaluated 380 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
0-380
418 return QPainterPath();
never executed: return QPainterPath();
0
419-
420 QPainterPath path;-
421-
422 AttributePoint first;-
423 for (int ii = 0; ii < attributes.count(); ++ii)
ii < attributes.count()Description
TRUEevaluated 216 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
FALSEevaluated 380 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
216-380
424 first.values[attributes.at(ii)] = 0;
executed 216 times by 2 tests: first.values[attributes.at(ii)] = 0;
Executed by:
  • tst_examples
  • tst_qquickpathview
216
425 attributePoints << first;-
426-
427 qreal startX = d->startX.isValid() ? d->startX.value : startPoint.x();
d->startX.isValid()Description
TRUEevaluated 356 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 24 times by 3 tests
Evaluated by:
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
24-356
428 qreal startY = d->startY.isValid() ? d->startY.value : startPoint.y();
d->startY.isValid()Description
TRUEevaluated 356 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 24 times by 3 tests
Evaluated by:
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
24-356
429 path.moveTo(startX, startY);-
430-
431 const QString percentString = QStringLiteral("_qfx_percent");-
432-
433 bool usesPercent = false;-
434 int index = 0;-
435 for (QQuickPathElement *pathElement : qAsConst(d->_pathElements)) {-
436 if (QQuickCurve *curve = qobject_cast<QQuickCurve *>(pathElement)) {
QQuickCurve *c...>(pathElement)Description
TRUEevaluated 784 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 604 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
604-784
437 QQuickPathData data;-
438 data.index = index;-
439 data.endPoint = endPoint;-
440 data.curves = d->_pathCurves;-
441 curve->addToPath(path, data);-
442 AttributePoint p;-
443 p.origpercent = path.length();-
444 attributePoints << p;-
445 ++index;-
446 } else if (QQuickPathAttribute *attribute = qobject_cast<QQuickPathAttribute *>(pathElement)) {
executed 784 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
QQuickPathAttr...>(pathElement)Description
TRUEevaluated 600 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickpathview
4-784
447 AttributePoint &point = attributePoints.last();-
448 point.values[attribute->name()] = attribute->value();-
449 interpolate(attributePoints, attributePoints.count() - 1, attribute->name(), attribute->value());-
450 } else if (QQuickPathPercent *percent = qobject_cast<QQuickPathPercent *>(pathElement)) {
executed 600 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
QQuickPathPerc...>(pathElement)Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEnever evaluated
0-600
451 AttributePoint &point = attributePoints.last();-
452 point.values[percentString] = percent->value();-
453 interpolate(attributePoints, attributePoints.count() - 1, percentString, percent->value());-
454 usesPercent = true;-
455 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
4
456 }
executed 1388 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
1388
457-
458 // Fixup end points-
459 const AttributePoint &last = attributePoints.constLast();-
460 for (int ii = 0; ii < attributes.count(); ++ii) {
ii < attributes.count()Description
TRUEevaluated 216 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
FALSEevaluated 380 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
216-380
461 if (!last.values.contains(attributes.at(ii)))
!last.values.c...ibutes.at(ii))Description
TRUEevaluated 38 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
FALSEevaluated 178 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
38-178
462 endpoint(attributePoints, attributes.at(ii));
executed 38 times by 2 tests: endpoint(attributePoints, attributes.at(ii));
Executed by:
  • tst_examples
  • tst_qquickpathview
38
463 }
executed 216 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
216
464 if (usesPercent && !last.values.contains(percentString)) {
usesPercentDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 376 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
!last.values.c...percentString)Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEnever evaluated
0-376
465 d->_attributePoints.last().values[percentString] = 1;-
466 interpolate(d->_attributePoints.count() - 1, percentString, 1);-
467 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
4
468-
469-
470 // Adjust percent-
471 qreal length = path.length();-
472 qreal prevpercent = 0;-
473 qreal prevorigpercent = 0;-
474 for (int ii = 0; ii < attributePoints.count(); ++ii) {
ii < attributePoints.count()Description
TRUEevaluated 1164 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 380 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
380-1164
475 const AttributePoint &point = attributePoints.at(ii);-
476 if (point.values.contains(percentString)) { //special string for QQuickPathPercent
point.values.c...percentString)Description
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 1150 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
14-1150
477 if ( ii > 0) {
ii > 0Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickpathview
4-10
478 qreal scale = (attributePoints[ii].origpercent/length - prevorigpercent) /-
479 (point.values.value(percentString)-prevpercent);-
480 attributePoints[ii].scale = scale;-
481 }
executed 10 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
10
482 attributePoints[ii].origpercent /= length;-
483 attributePoints[ii].percent = point.values.value(percentString);-
484 prevorigpercent = attributePoints.at(ii).origpercent;-
485 prevpercent = attributePoints.at(ii).percent;-
486 } else {
executed 14 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
14
487 attributePoints[ii].origpercent /= length;-
488 attributePoints[ii].percent = attributePoints.at(ii).origpercent;-
489 }
executed 1150 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
1150
490 }-
491-
492 if (closed) {
closedDescription
TRUEevaluated 370 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquickanimations
10-370
493 QPointF end = path.currentPosition();-
494 *closed = length > 0 && startX == end.x() && startY == end.y();
length > 0Description
TRUEevaluated 352 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 18 times by 2 tests
Evaluated by:
  • tst_qquickanimations
  • tst_qquickpathview
startX == end.x()Description
TRUEevaluated 178 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 174 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
startY == end.y()Description
TRUEevaluated 142 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
FALSEevaluated 36 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
18-352
495 }
executed 370 times by 5 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
370
496 pathLength = length;-
497-
498 return path;
executed 380 times by 5 tests: return path;
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
380
499}-
500-
501QPainterPath QQuickPath::createShapePath(const QPointF &startPoint, const QPointF &endPoint, qreal &pathLength, bool *closed)-
502{-
503 Q_D(QQuickPath);-
504-
505 if (!d->componentComplete)
!d->componentCompleteDescription
TRUEnever evaluated
FALSEevaluated 1158 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickshape
0-1158
506 return QPainterPath();
never executed: return QPainterPath();
0
507-
508 QPainterPath path;-
509-
510 qreal startX = d->startX.isValid() ? d->startX.value : startPoint.x();
d->startX.isValid()Description
TRUEevaluated 176 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickshape
FALSEevaluated 982 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickshape
176-982
511 qreal startY = d->startY.isValid() ? d->startY.value : startPoint.y();
d->startY.isValid()Description
TRUEevaluated 176 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickshape
FALSEevaluated 982 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickshape
176-982
512 path.moveTo(startX, startY);-
513-
514 int index = 0;-
515 for (QQuickCurve *curve : qAsConst(d->_pathCurves)) {-
516 QQuickPathData data;-
517 data.index = index;-
518 data.endPoint = endPoint;-
519 data.curves = d->_pathCurves;-
520 curve->addToPath(path, data);-
521 ++index;-
522 }
executed 9580 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickshape
9580
523-
524 if (closed) {
closedDescription
TRUEevaluated 1158 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickshape
FALSEnever evaluated
0-1158
525 QPointF end = path.currentPosition();-
526 *closed = startX == end.x() && startY == end.y();
startX == end.x()Description
TRUEevaluated 66 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickshape
FALSEevaluated 1092 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickshape
startY == end.y()Description
TRUEevaluated 58 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickshape
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_examples
8-1092
527 }
executed 1158 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickshape
1158
528-
529 // Note: Length of paths inside ShapePath is not used, so currently-
530 // length is always 0. This avoids potentially heavy path.length()-
531 //pathLength = path.length();-
532 pathLength = 0;-
533-
534 return path;
executed 1158 times by 2 tests: return path;
Executed by:
  • tst_examples
  • tst_qquickshape
1158
535}-
536-
537void QQuickPath::classBegin()-
538{-
539 Q_D(QQuickPath);-
540 d->componentComplete = false;-
541}
executed 1402 times by 6 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickshape
  • tst_qquickvisualdatamodel
1402
542-
543void QQuickPath::disconnectPathElements()-
544{-
545 Q_D(const QQuickPath);-
546-
547 for (QQuickPathElement *pathElement : d->_pathElements)-
548 disconnect(pathElement, SIGNAL(changed()), this, SLOT(processPath()));
executed 10 times by 1 test: disconnect(pathElement, qFlagLocation("2""changed()" "\0" __FILE__ ":" "548"), this, qFlagLocation("1""processPath()" "\0" __FILE__ ":" "548"));
Executed by:
  • tst_qquickpathview
10
549}
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
2
550-
551void QQuickPath::connectPathElements()-
552{-
553 Q_D(const QQuickPath);-
554-
555 for (QQuickPathElement *pathElement : d->_pathElements)-
556 connect(pathElement, SIGNAL(changed()), this, SLOT(processPath()));
executed 10642 times by 6 tests: connect(pathElement, qFlagLocation("2""changed()" "\0" __FILE__ ":" "556"), this, qFlagLocation("1""processPath()" "\0" __FILE__ ":" "556"));
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickshape
  • tst_qquickvisualdatamodel
10642
557}
executed 1402 times by 6 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickshape
  • tst_qquickvisualdatamodel
1402
558-
559void QQuickPath::gatherAttributes()-
560{-
561 Q_D(QQuickPath);-
562-
563 QSet<QString> attributes;-
564-
565 // First gather up all the attributes-
566 for (QQuickPathElement *pathElement : qAsConst(d->_pathElements)) {-
567 if (QQuickCurve *curve = qobject_cast<QQuickCurve *>(pathElement))
QQuickCurve *c...>(pathElement)Description
TRUEevaluated 10100 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickshape
  • tst_qquickvisualdatamodel
FALSEevaluated 542 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
542-10100
568 d->_pathCurves.append(curve);
executed 10100 times by 6 tests: d->_pathCurves.append(curve);
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickshape
  • tst_qquickvisualdatamodel
10100
569 else if (QQuickPathAttribute *attribute = qobject_cast<QQuickPathAttribute *>(pathElement))
QQuickPathAttr...>(pathElement)Description
TRUEevaluated 538 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickpathview
4-538
570 attributes.insert(attribute->name());
executed 538 times by 2 tests: attributes.insert(attribute->name());
Executed by:
  • tst_examples
  • tst_qquickpathview
538
571 }
executed 10642 times by 6 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickshape
  • tst_qquickvisualdatamodel
10642
572-
573 d->_attributes = attributes.toList();-
574}
executed 1402 times by 6 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickshape
  • tst_qquickvisualdatamodel
1402
575-
576void QQuickPath::componentComplete()-
577{-
578 Q_D(QQuickPath);-
579 d->componentComplete = true;-
580-
581 gatherAttributes();-
582-
583 processPath();-
584-
585 connectPathElements();-
586}
executed 1402 times by 6 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickshape
  • tst_qquickvisualdatamodel
1402
587-
588QPainterPath QQuickPath::path() const-
589{-
590 Q_D(const QQuickPath);-
591 return d->_path;
executed 1239 times by 4 tests: return d->_path;
Executed by:
  • tst_examples
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickshape
1239
592}-
593-
594QStringList QQuickPath::attributes() const-
595{-
596 Q_D(const QQuickPath);-
597 if (!d->componentComplete) {
!d->componentCompleteDescription
TRUEnever evaluated
FALSEevaluated 44259 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
0-44259
598 QSet<QString> attrs;-
599-
600 // First gather up all the attributes-
601 for (QQuickPathElement *pathElement : d->_pathElements) {-
602 if (QQuickPathAttribute *attribute =
QQuickPathAttr...>(pathElement)Description
TRUEnever evaluated
FALSEnever evaluated
0
603 qobject_cast<QQuickPathAttribute *>(pathElement))
QQuickPathAttr...>(pathElement)Description
TRUEnever evaluated
FALSEnever evaluated
0
604 attrs.insert(attribute->name());
never executed: attrs.insert(attribute->name());
0
605 }
never executed: end of block
0
606 return attrs.toList();
never executed: return attrs.toList();
0
607 }-
608 return d->_attributes;
executed 44259 times by 3 tests: return d->_attributes;
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
44259
609}-
610-
611static inline QBezier nextBezier(const QPainterPath &path, int *current, qreal *bezLength, bool reverse = false)-
612{-
613 const int lastElement = reverse ? 0 : path.elementCount() - 1;
reverseDescription
TRUEevaluated 18 times by 1 test
Evaluated by:
  • tst_qquickanimations
FALSEevaluated 708 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
18-708
614 const int start = reverse ? *current - 1 : *current + 1;
reverseDescription
TRUEevaluated 18 times by 1 test
Evaluated by:
  • tst_qquickanimations
FALSEevaluated 708 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
18-708
615 for (int i=start; reverse ? i >= lastElement : i <= lastElement; reverse ? --i : ++i) {
reverse ? i >=...<= lastElementDescription
TRUEevaluated 1554 times by 5 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEnever evaluated
reverseDescription
TRUEnever evaluated
FALSEnever evaluated
0-1554
616 const QPainterPath::Element &e = path.elementAt(i);-
617-
618 switch (e.type) {-
619 case QPainterPath::MoveToElement:
executed 332 times by 5 tests: case QPainterPath::MoveToElement:
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
332
620 break;
executed 332 times by 5 tests: break;
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
332
621 case QPainterPath::LineToElement:
executed 234 times by 5 tests: case QPainterPath::LineToElement:
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
234
622 {-
623 QLineF line(path.elementAt(i-1), e);-
624 *bezLength = line.length();-
625 QPointF a = path.elementAt(i-1);-
626 QPointF delta = e - a;-
627 *current = i;-
628 return QBezier::fromPoints(a, a + delta / 3, a + 2 * delta / 3, e);
executed 234 times by 5 tests: return QBezier::fromPoints(a, a + delta / 3, a + 2 * delta / 3, e);
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
234
629 }-
630 case QPainterPath::CurveToElement:
executed 492 times by 4 tests: case QPainterPath::CurveToElement:
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
492
631 {-
632 QBezier b = QBezier::fromPoints(path.elementAt(i-1),-
633 e,-
634 path.elementAt(i+1),-
635 path.elementAt(i+2));-
636 *bezLength = b.length();-
637 *current = i;-
638 return b;
executed 492 times by 4 tests: return b;
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
492
639 }-
640 default:
executed 496 times by 4 tests: default:
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
496
641 break;
executed 496 times by 4 tests: break;
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
496
642 }-
643 }-
644 *current = lastElement;-
645 *bezLength = 0;-
646 return QBezier();
never executed: return QBezier();
0
647}-
648-
649static inline int segmentCount(const QPainterPath &path, qreal pathLength)-
650{-
651 // In the really simple case of a single straight line we can interpolate without jitter-
652 // between just two points.-
653 if (path.elementCount() == 2
path.elementCount() == 2Description
TRUEevaluated 68 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 236 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpath
  • tst_qquickpathview
68-236
654 && path.elementAt(0).type == QPainterPath::MoveToElement
path.elementAt...:MoveToElementDescription
TRUEevaluated 68 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEnever evaluated
0-68
655 && path.elementAt(1).type == QPainterPath::LineToElement) {
path.elementAt...:LineToElementDescription
TRUEevaluated 68 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEnever evaluated
0-68
656 return 1;
executed 68 times by 4 tests: return 1;
Executed by:
  • tst_examples
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
68
657 }-
658 // more points means less jitter between items as they move along the-
659 // path, but takes longer to generate-
660 return qCeil(pathLength*5);
executed 236 times by 3 tests: return qCeil(pathLength*5);
Executed by:
  • tst_examples
  • tst_qquickpath
  • tst_qquickpathview
236
661}-
662-
663//derivative of the equation-
664static inline qreal slopeAt(qreal t, qreal a, qreal b, qreal c, qreal d)-
665{-
666 return 3*t*t*(d - 3*c + 3*b - a) + 6*t*(c - 2*b + a) + 3*(b - a);
executed 76 times by 2 tests: return 3*t*t*(d - 3*c + 3*b - a) + 6*t*(c - 2*b + a) + 3*(b - a);
Executed by:
  • tst_examples
  • tst_qquickanimations
76
667}-
668-
669void QQuickPath::createPointCache() const-
670{-
671 Q_D(const QQuickPath);-
672 qreal pathLength = d->pathLength;-
673 if (pathLength <= 0 || qt_is_nan(pathLength))
pathLength <= 0Description
TRUEevaluated 40 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 304 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
qt_is_nan(pathLength)Description
TRUEnever evaluated
FALSEevaluated 304 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
0-304
674 return;
executed 40 times by 1 test: return;
Executed by:
  • tst_qquickpathview
40
675-
676 const int segments = segmentCount(d->_path, pathLength);-
677 const int lastElement = d->_path.elementCount() - 1;-
678 d->_pointCache.resize(segments+1);-
679-
680 int currElement = -1;-
681 qreal bezLength = 0;-
682 QBezier currBez = nextBezier(d->_path, &currElement, &bezLength);-
683 qreal currLength = bezLength;-
684 qreal epc = currLength / pathLength;-
685-
686 for (int i = 0; i < d->_pointCache.size(); i++) {
i < d->_pointCache.size()Description
TRUEevaluated 824862 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 304 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
304-824862
687 //find which set we are in-
688 qreal prevPercent = 0;-
689 qreal prevOrigPercent = 0;-
690 for (int ii = 0; ii < d->_attributePoints.count(); ++ii) {
ii < d->_attri...Points.count()Description
TRUEevaluated 2264210 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEnever evaluated
0-2264210
691 qreal percent = qreal(i)/segments;-
692 const AttributePoint &point = d->_attributePoints.at(ii);-
693 if (percent < point.percent || ii == d->_attributePoints.count() - 1) { //### || is special case for very last item
percent < point.percentDescription
TRUEevaluated 824558 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 1439652 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
ii == d->_attr...ts.count() - 1Description
TRUEevaluated 304 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 1439348 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
304-1439652
694 qreal elementPercent = (percent - prevPercent);-
695-
696 qreal spc = prevOrigPercent + elementPercent * point.scale;-
697-
698 while (spc > epc) {
spc > epcDescription
TRUEevaluated 358 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpath
  • tst_qquickpathview
FALSEevaluated 824862 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
358-824862
699 if (currElement > lastElement)
currElement > lastElementDescription
TRUEnever evaluated
FALSEevaluated 358 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpath
  • tst_qquickpathview
0-358
700 break;
never executed: break;
0
701 currBez = nextBezier(d->_path, &currElement, &bezLength);-
702 if (bezLength == 0.0) {
bezLength == 0.0Description
TRUEnever evaluated
FALSEevaluated 358 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpath
  • tst_qquickpathview
0-358
703 currLength = pathLength;-
704 epc = 1.0;-
705 break;
never executed: break;
0
706 }-
707 currLength += bezLength;-
708 epc = currLength / pathLength;-
709 }
executed 358 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpath
  • tst_qquickpathview
358
710 qreal realT = (pathLength * spc - (currLength - bezLength)) / bezLength;-
711 d->_pointCache[i] = currBez.pointAt(qBound(qreal(0), realT, qreal(1)));-
712 break;
executed 824862 times by 4 tests: break;
Executed by:
  • tst_examples
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
824862
713 }-
714 prevOrigPercent = point.origpercent;-
715 prevPercent = point.percent;-
716 }
executed 1439348 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
1439348
717 }
executed 824862 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
824862
718}
executed 304 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
304
719-
720void QQuickPath::invalidateSequentialHistory() const-
721{-
722 Q_D(const QQuickPath);-
723 d->prevBez.isValid = false;-
724}
executed 24 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickanimations
24
725-
726QPointF QQuickPath::sequentialPointAt(qreal p, qreal *angle) const-
727{-
728 Q_D(const QQuickPath);-
729 return sequentialPointAt(d->_path, d->pathLength, d->_attributePoints, d->prevBez, p, angle);
executed 186 times by 2 tests: return sequentialPointAt(d->_path, d->pathLength, d->_attributePoints, d->prevBez, p, angle);
Executed by:
  • tst_examples
  • tst_qquickanimations
186
730}-
731-
732QPointF QQuickPath::sequentialPointAt(const QPainterPath &path, const qreal &pathLength, const QList<AttributePoint> &attributePoints, QQuickCachedBezier &prevBez, qreal p, qreal *angle)-
733{-
734 Q_ASSERT(p >= 0.0 && p <= 1.0);-
735-
736 if (!prevBez.isValid)
!prevBez.isValidDescription
TRUEevaluated 32 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
FALSEevaluated 281 times by 1 test
Evaluated by:
  • tst_qquickanimations
32-281
737 return p > .5 ? backwardsPointAt(path, pathLength, attributePoints, prevBez, p, angle) :
executed 32 times by 2 tests: return p > .5 ? backwardsPointAt(path, pathLength, attributePoints, prevBez, p, angle) : forwardsPointAt(path, pathLength, attributePoints, prevBez, p, angle);
Executed by:
  • tst_examples
  • tst_qquickanimations
32
738 forwardsPointAt(path, pathLength, attributePoints, prevBez, p, angle);
executed 32 times by 2 tests: return p > .5 ? backwardsPointAt(path, pathLength, attributePoints, prevBez, p, angle) : forwardsPointAt(path, pathLength, attributePoints, prevBez, p, angle);
Executed by:
  • tst_examples
  • tst_qquickanimations
32
739-
740 return p < prevBez.p ? backwardsPointAt(path, pathLength, attributePoints, prevBez, p, angle) :
executed 281 times by 1 test: return p < prevBez.p ? backwardsPointAt(path, pathLength, attributePoints, prevBez, p, angle) : forwardsPointAt(path, pathLength, attributePoints, prevBez, p, angle);
Executed by:
  • tst_qquickanimations
281
741 forwardsPointAt(path, pathLength, attributePoints, prevBez, p, angle);
executed 281 times by 1 test: return p < prevBez.p ? backwardsPointAt(path, pathLength, attributePoints, prevBez, p, angle) : forwardsPointAt(path, pathLength, attributePoints, prevBez, p, angle);
Executed by:
  • tst_qquickanimations
281
742}-
743-
744QPointF QQuickPath::forwardsPointAt(const QPainterPath &path, const qreal &pathLength, const QList<AttributePoint> &attributePoints, QQuickCachedBezier &prevBez, qreal p, qreal *angle)-
745{-
746 if (pathLength <= 0 || qt_is_nan(pathLength))
pathLength <= 0Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickanimations
FALSEevaluated 265 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
qt_is_nan(pathLength)Description
TRUEnever evaluated
FALSEevaluated 265 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
0-265
747 return path.pointAtPercent(0); //expensive?
executed 2 times by 1 test: return path.pointAtPercent(0);
Executed by:
  • tst_qquickanimations
2
748-
749 const int lastElement = path.elementCount() - 1;-
750 bool haveCachedBez = prevBez.isValid;-
751 int currElement = haveCachedBez ? prevBez.element : -1;
haveCachedBezDescription
TRUEevaluated 237 times by 1 test
Evaluated by:
  • tst_qquickanimations
FALSEevaluated 28 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
28-237
752 qreal bezLength = haveCachedBez ? prevBez.bezLength : 0;
haveCachedBezDescription
TRUEevaluated 237 times by 1 test
Evaluated by:
  • tst_qquickanimations
FALSEevaluated 28 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
28-237
753 QBezier currBez = haveCachedBez ? prevBez.bezier : nextBezier(path, &currElement, &bezLength);
haveCachedBezDescription
TRUEevaluated 237 times by 1 test
Evaluated by:
  • tst_qquickanimations
FALSEevaluated 28 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
28-237
754 qreal currLength = haveCachedBez ? prevBez.currLength : bezLength;
haveCachedBezDescription
TRUEevaluated 237 times by 1 test
Evaluated by:
  • tst_qquickanimations
FALSEevaluated 28 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
28-237
755 qreal epc = currLength / pathLength;-
756-
757 //find which set we are in-
758 qreal prevPercent = 0;-
759 qreal prevOrigPercent = 0;-
760 for (int ii = 0; ii < attributePoints.count(); ++ii) {
ii < attributePoints.count()Description
TRUEevaluated 696 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
FALSEnever evaluated
0-696
761 qreal percent = p;-
762 const AttributePoint &point = attributePoints.at(ii);-
763 if (percent < point.percent || ii == attributePoints.count() - 1) {
percent < point.percentDescription
TRUEevaluated 235 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
FALSEevaluated 461 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
ii == attribut...ts.count() - 1Description
TRUEevaluated 30 times by 1 test
Evaluated by:
  • tst_qquickanimations
FALSEevaluated 431 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
30-461
764 qreal elementPercent = (percent - prevPercent);-
765-
766 qreal spc = prevOrigPercent + elementPercent * point.scale;-
767-
768 while (spc > epc) {
spc > epcDescription
TRUEevaluated 18 times by 1 test
Evaluated by:
  • tst_qquickanimations
FALSEevaluated 265 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
18-265
769 Q_ASSERT(!(currElement > lastElement));-
770 Q_UNUSED(lastElement);-
771 currBez = nextBezier(path, &currElement, &bezLength);-
772 currLength += bezLength;-
773 epc = currLength / pathLength;-
774 }
executed 18 times by 1 test: end of block
Executed by:
  • tst_qquickanimations
18
775 prevBez.element = currElement;-
776 prevBez.bezLength = bezLength;-
777 prevBez.currLength = currLength;-
778 prevBez.bezier = currBez;-
779 prevBez.p = p;-
780 prevBez.isValid = true;-
781-
782 qreal realT = (pathLength * spc - (currLength - bezLength)) / bezLength;-
783-
784 if (angle) {
angleDescription
TRUEevaluated 32 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
FALSEevaluated 233 times by 1 test
Evaluated by:
  • tst_qquickanimations
32-233
785 qreal m1 = slopeAt(realT, currBez.x1, currBez.x2, currBez.x3, currBez.x4);-
786 qreal m2 = slopeAt(realT, currBez.y1, currBez.y2, currBez.y3, currBez.y4);-
787 *angle = QLineF(0, 0, m1, m2).angle();-
788 }
executed 32 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickanimations
32
789-
790 return currBez.pointAt(qBound(qreal(0), realT, qreal(1)));
executed 265 times by 2 tests: return currBez.pointAt(qBound(qreal(0), realT, qreal(1)));
Executed by:
  • tst_examples
  • tst_qquickanimations
265
791 }-
792 prevOrigPercent = point.origpercent;-
793 prevPercent = point.percent;-
794 }
executed 431 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickanimations
431
795-
796 return QPointF(0,0);
never executed: return QPointF(0,0);
0
797}-
798-
799//ideally this should be merged with forwardsPointAt-
800QPointF QQuickPath::backwardsPointAt(const QPainterPath &path, const qreal &pathLength, const QList<AttributePoint> &attributePoints, QQuickCachedBezier &prevBez, qreal p, qreal *angle)-
801{-
802 if (pathLength <= 0 || qt_is_nan(pathLength))
pathLength <= 0Description
TRUEnever evaluated
FALSEevaluated 46 times by 1 test
Evaluated by:
  • tst_qquickanimations
qt_is_nan(pathLength)Description
TRUEnever evaluated
FALSEevaluated 46 times by 1 test
Evaluated by:
  • tst_qquickanimations
0-46
803 return path.pointAtPercent(0);
never executed: return path.pointAtPercent(0);
0
804-
805 const int firstElement = 1; //element 0 is always a MoveTo, which we ignore-
806 bool haveCachedBez = prevBez.isValid;-
807 int currElement = haveCachedBez ? prevBez.element : path.elementCount();
haveCachedBezDescription
TRUEevaluated 44 times by 1 test
Evaluated by:
  • tst_qquickanimations
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickanimations
2-44
808 qreal bezLength = haveCachedBez ? prevBez.bezLength : 0;
haveCachedBezDescription
TRUEevaluated 44 times by 1 test
Evaluated by:
  • tst_qquickanimations
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickanimations
2-44
809 QBezier currBez = haveCachedBez ? prevBez.bezier : nextBezier(path, &currElement, &bezLength, true /*reverse*/);
haveCachedBezDescription
TRUEevaluated 44 times by 1 test
Evaluated by:
  • tst_qquickanimations
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickanimations
2-44
810 qreal currLength = haveCachedBez ? prevBez.currLength : pathLength;
haveCachedBezDescription
TRUEevaluated 44 times by 1 test
Evaluated by:
  • tst_qquickanimations
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickanimations
2-44
811 qreal prevLength = currLength - bezLength;-
812 qreal epc = prevLength / pathLength;-
813-
814 for (int ii = attributePoints.count() - 1; ii > 0; --ii) {
ii > 0Description
TRUEevaluated 112 times by 1 test
Evaluated by:
  • tst_qquickanimations
FALSEnever evaluated
0-112
815 qreal percent = p;-
816 const AttributePoint &point = attributePoints.at(ii);-
817 const AttributePoint &prevPoint = attributePoints.at(ii-1);-
818 if (percent > prevPoint.percent || ii == 1) {
percent > prevPoint.percentDescription
TRUEevaluated 38 times by 1 test
Evaluated by:
  • tst_qquickanimations
FALSEevaluated 74 times by 1 test
Evaluated by:
  • tst_qquickanimations
ii == 1Description
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickanimations
FALSEevaluated 66 times by 1 test
Evaluated by:
  • tst_qquickanimations
8-74
819 qreal elementPercent = (percent - prevPoint.percent);-
820-
821 qreal spc = prevPoint.origpercent + elementPercent * point.scale;-
822-
823 while (spc < epc) {
spc < epcDescription
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquickanimations
FALSEevaluated 46 times by 1 test
Evaluated by:
  • tst_qquickanimations
16-46
824 Q_ASSERT(!(currElement < firstElement));-
825 Q_UNUSED(firstElement);-
826 currBez = nextBezier(path, &currElement, &bezLength, true /*reverse*/);-
827 //special case for first element is to avoid floating point math-
828 //causing an epc that never hits 0.-
829 currLength = (currElement == firstElement) ? bezLength : prevLength;
(currElement == firstElement)Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickanimations
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquickanimations
6-10
830 prevLength = currLength - bezLength;-
831 epc = prevLength / pathLength;-
832 }
executed 16 times by 1 test: end of block
Executed by:
  • tst_qquickanimations
16
833 prevBez.element = currElement;-
834 prevBez.bezLength = bezLength;-
835 prevBez.currLength = currLength;-
836 prevBez.bezier = currBez;-
837 prevBez.p = p;-
838 prevBez.isValid = true;-
839-
840 qreal realT = (pathLength * spc - (currLength - bezLength)) / bezLength;-
841-
842 if (angle) {
angleDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickanimations
FALSEevaluated 40 times by 1 test
Evaluated by:
  • tst_qquickanimations
6-40
843 qreal m1 = slopeAt(realT, currBez.x1, currBez.x2, currBez.x3, currBez.x4);-
844 qreal m2 = slopeAt(realT, currBez.y1, currBez.y2, currBez.y3, currBez.y4);-
845 *angle = QLineF(0, 0, m1, m2).angle();-
846 }
executed 6 times by 1 test: end of block
Executed by:
  • tst_qquickanimations
6
847-
848 return currBez.pointAt(qBound(qreal(0), realT, qreal(1)));
executed 46 times by 1 test: return currBez.pointAt(qBound(qreal(0), realT, qreal(1)));
Executed by:
  • tst_qquickanimations
46
849 }-
850 }
executed 66 times by 1 test: end of block
Executed by:
  • tst_qquickanimations
66
851-
852 return QPointF(0,0);
never executed: return QPointF(0,0);
0
853}-
854-
855QPointF QQuickPath::pointAt(qreal p) const-
856{-
857 Q_D(const QQuickPath);-
858 if (d->_pointCache.isEmpty()) {
d->_pointCache.isEmpty()Description
TRUEevaluated 344 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 71609 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
344-71609
859 createPointCache();-
860 if (d->_pointCache.isEmpty())
d->_pointCache.isEmpty()Description
TRUEevaluated 40 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 304 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
40-304
861 return QPointF();
executed 40 times by 1 test: return QPointF();
Executed by:
  • tst_qquickpathview
40
862 }
executed 304 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
304
863-
864 const int segmentCount = d->_pointCache.size() - 1;-
865 qreal idxf = p*segmentCount;-
866 int idx1 = qFloor(idxf);-
867 qreal delta = idxf - idx1;-
868 if (idx1 > segmentCount)
idx1 > segmentCountDescription
TRUEnever evaluated
FALSEevaluated 71913 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
0-71913
869 idx1 = segmentCount;
never executed: idx1 = segmentCount;
0
870 else if (idx1 < 0)
idx1 < 0Description
TRUEnever evaluated
FALSEevaluated 71913 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
0-71913
871 idx1 = 0;
never executed: idx1 = 0;
0
872-
873 if (delta == 0.0)
delta == 0.0Description
TRUEevaluated 5011 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 66902 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
5011-66902
874 return d->_pointCache.at(idx1);
executed 5011 times by 4 tests: return d->_pointCache.at(idx1);
Executed by:
  • tst_examples
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
5011
875-
876 // interpolate between the two points.-
877 int idx2 = qCeil(idxf);-
878 if (idx2 > segmentCount)
idx2 > segmentCountDescription
TRUEnever evaluated
FALSEevaluated 66902 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
0-66902
879 idx2 = segmentCount;
never executed: idx2 = segmentCount;
0
880 else if (idx2 < 0)
idx2 < 0Description
TRUEnever evaluated
FALSEevaluated 66902 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
0-66902
881 idx2 = 0;
never executed: idx2 = 0;
0
882-
883 QPointF p1 = d->_pointCache.at(idx1);-
884 QPointF p2 = d->_pointCache.at(idx2);-
885 QPointF pos = p1 * (1.0-delta) + p2 * delta;-
886-
887 return pos;
executed 66902 times by 4 tests: return pos;
Executed by:
  • tst_examples
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
66902
888}-
889-
890qreal QQuickPath::attributeAt(const QString &name, qreal percent) const-
891{-
892 Q_D(const QQuickPath);-
893 if (percent < 0 || percent > 1)
percent < 0Description
TRUEnever evaluated
FALSEevaluated 5156 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
percent > 1Description
TRUEevaluated 244 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 4912 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
0-5156
894 return 0;
executed 244 times by 1 test: return 0;
Executed by:
  • tst_qquickpathview
244
895-
896 for (int ii = 0; ii < d->_attributePoints.count(); ++ii) {
ii < d->_attri...Points.count()Description
TRUEevaluated 11116 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
FALSEevaluated 24 times by 1 test
Evaluated by:
  • tst_qquickpathview
24-11116
897 const AttributePoint &point = d->_attributePoints.at(ii);-
898-
899 if (point.percent == percent) {
point.percent == percentDescription
TRUEevaluated 1452 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
FALSEevaluated 9664 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
1452-9664
900 return point.values.value(name);
executed 1452 times by 2 tests: return point.values.value(name);
Executed by:
  • tst_examples
  • tst_qquickpathview
1452
901 } else if (point.percent > percent) {
point.percent > percentDescription
TRUEevaluated 3436 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
FALSEevaluated 6228 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
3436-6228
902 qreal lastValue =-
903 ii?(d->_attributePoints.at(ii - 1).values.value(name)):0;
iiDescription
TRUEevaluated 3436 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
FALSEnever evaluated
0-3436
904 qreal lastPercent =-
905 ii?(d->_attributePoints.at(ii - 1).percent):0;
iiDescription
TRUEevaluated 3436 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
FALSEnever evaluated
0-3436
906 qreal curValue = point.values.value(name);-
907 qreal curPercent = point.percent;-
908-
909 return lastValue + (curValue - lastValue) * (percent - lastPercent) / (curPercent - lastPercent);
executed 3436 times by 2 tests: return lastValue + (curValue - lastValue) * (percent - lastPercent) / (curPercent - lastPercent);
Executed by:
  • tst_examples
  • tst_qquickpathview
3436
910 }-
911 }
executed 6228 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
6228
912-
913 return 0;
executed 24 times by 1 test: return 0;
Executed by:
  • tst_qquickpathview
24
914}-
915-
916/****************************************************************************/-
917-
918qreal QQuickCurve::x() const-
919{-
920 return _x.isNull ? 0 : _x.value;
executed 10344 times by 6 tests: return _x.isNull ? 0 : _x.value;
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickshape
  • tst_qquickvisualdatamodel
10344
921}-
922-
923void QQuickCurve::setX(qreal x)-
924{-
925 if (_x.isNull || _x != x) {
_x.isNullDescription
TRUEevaluated 10028 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickshape
  • tst_qquickvisualdatamodel
FALSEevaluated 24 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
_x != xDescription
TRUEevaluated 24 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
FALSEnever evaluated
0-10028
926 _x = x;-
927 emit xChanged();-
928 emit changed();-
929 }
executed 10052 times by 6 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickshape
  • tst_qquickvisualdatamodel
10052
930}
executed 10052 times by 6 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickshape
  • tst_qquickvisualdatamodel
10052
931-
932bool QQuickCurve::hasX()-
933{-
934 return _x.isValid();
executed 1504 times by 6 tests: return _x.isValid();
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickshape
  • tst_qquickvisualdatamodel
1504
935}-
936-
937qreal QQuickCurve::y() const-
938{-
939 return _y.isNull ? 0 : _y.value;
executed 10390 times by 6 tests: return _y.isNull ? 0 : _y.value;
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickshape
  • tst_qquickvisualdatamodel
10390
940}-
941-
942void QQuickCurve::setY(qreal y)-
943{-
944 if (_y.isNull || _y != y) {
_y.isNullDescription
TRUEevaluated 10056 times by 6 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickshape
  • tst_qquickvisualdatamodel
FALSEevaluated 48 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickshape
_y != yDescription
TRUEevaluated 48 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickshape
FALSEnever evaluated
0-10056
945 _y = y;-
946 emit yChanged();-
947 emit changed();-
948 }
executed 10104 times by 6 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickshape
  • tst_qquickvisualdatamodel
10104
949}
executed 10104 times by 6 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickshape
  • tst_qquickvisualdatamodel
10104
950-
951bool QQuickCurve::hasY()-
952{-
953 return _y.isValid();
executed 1524 times by 6 tests: return _y.isValid();
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickshape
  • tst_qquickvisualdatamodel
1524
954}-
955-
956qreal QQuickCurve::relativeX() const-
957{-
958 return _relativeX;
executed 74 times by 3 tests: return _relativeX;
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickshape
74
959}-
960-
961void QQuickCurve::setRelativeX(qreal x)-
962{-
963 if (_relativeX.isNull || _relativeX != x) {
_relativeX.isNullDescription
TRUEevaluated 54 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickshape
FALSEnever evaluated
_relativeX != xDescription
TRUEnever evaluated
FALSEnever evaluated
0-54
964 _relativeX = x;-
965 emit relativeXChanged();-
966 emit changed();-
967 }
executed 54 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickshape
54
968}
executed 54 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickshape
54
969-
970bool QQuickCurve::hasRelativeX()-
971{-
972 return _relativeX.isValid();
executed 10420 times by 6 tests: return _relativeX.isValid();
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickshape
  • tst_qquickvisualdatamodel
10420
973}-
974-
975qreal QQuickCurve::relativeY() const-
976{-
977 return _relativeY;
executed 28 times by 2 tests: return _relativeY;
Executed by:
  • tst_examples
  • tst_qquickpathview
28
978}-
979-
980void QQuickCurve::setRelativeY(qreal y)-
981{-
982 if (_relativeY.isNull || _relativeY != y) {
_relativeY.isNullDescription
TRUEevaluated 26 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
FALSEnever evaluated
_relativeY != yDescription
TRUEnever evaluated
FALSEnever evaluated
0-26
983 _relativeY = y;-
984 emit relativeYChanged();-
985 emit changed();-
986 }
executed 26 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
26
987}
executed 26 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
26
988-
989bool QQuickCurve::hasRelativeY()-
990{-
991 return _relativeY.isValid();
executed 10420 times by 6 tests: return _relativeY.isValid();
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickshape
  • tst_qquickvisualdatamodel
10420
992}-
993-
994/****************************************************************************/-
995-
996/*!-
997 \qmltype PathAttribute-
998 \instantiates QQuickPathAttribute-
999 \inqmlmodule QtQuick-
1000 \ingroup qtquick-animation-paths-
1001 \brief Specifies how to set an attribute at a given position in a Path.-
1002-
1003 The PathAttribute object allows attributes consisting of a name and-
1004 a value to be specified for various points along a path. The-
1005 attributes are exposed to the delegate as-
1006 \l{Attached Properties and Attached Signal Handlers} {Attached Properties}.-
1007 The value of an attribute at any particular point along the path is interpolated-
1008 from the PathAttributes bounding that point.-
1009-
1010 The example below shows a path with the items scaled to 30% with-
1011 opacity 50% at the top of the path and scaled 100% with opacity-
1012 100% at the bottom. Note the use of the PathView.iconScale and-
1013 PathView.iconOpacity attached properties to set the scale and opacity-
1014 of the delegate.-
1015-
1016 \table-
1017 \row-
1018 \li \image declarative-pathattribute.png-
1019 \li-
1020 \snippet qml/pathview/pathattributes.qml 0-
1021 (see the PathView documentation for the specification of ContactModel.qml-
1022 used for ContactModel above.)-
1023 \endtable-
1024-
1025-
1026 \sa Path-
1027*/-
1028-
1029/*!-
1030 \qmlproperty string QtQuick::PathAttribute::name-
1031 This property holds the name of the attribute to change.-
1032-
1033 This attribute will be available to the delegate as PathView.<name>-
1034-
1035 Note that using an existing Item property name such as "opacity" as an-
1036 attribute is allowed. This is because path attributes add a new-
1037 \l{Attached Properties and Attached Signal Handlers} {Attached Property}-
1038 which in no way clashes with existing properties.-
1039*/-
1040-
1041/*!-
1042 the name of the attribute to change.-
1043*/-
1044-
1045QString QQuickPathAttribute::name() const-
1046{-
1047 return _name;
executed 1764 times by 2 tests: return _name;
Executed by:
  • tst_examples
  • tst_qquickpathview
1764
1048}-
1049-
1050void QQuickPathAttribute::setName(const QString &name)-
1051{-
1052 if (_name == name)
_name == nameDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 546 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
2-546
1053 return;
executed 2 times by 1 test: return;
Executed by:
  • tst_qquickpathview
2
1054 _name = name;-
1055 emit nameChanged();-
1056}
executed 546 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
546
1057-
1058/*!-
1059 \qmlproperty real QtQuick::PathAttribute::value-
1060 This property holds the value for the attribute.-
1061-
1062 The value specified can be used to influence the visual appearance-
1063 of an item along the path. For example, the following Path specifies-
1064 an attribute named \e itemRotation, which has the value \e 0 at the-
1065 beginning of the path, and the value 90 at the end of the path.-
1066-
1067 \qml-
1068 Path {-
1069 startX: 0-
1070 startY: 0-
1071 PathAttribute { name: "itemRotation"; value: 0 }-
1072 PathLine { x: 100; y: 100 }-
1073 PathAttribute { name: "itemRotation"; value: 90 }-
1074 }-
1075 \endqml-
1076-
1077 In our delegate, we can then bind the \e rotation property to the-
1078 \l{Attached Properties and Attached Signal Handlers} {Attached Property}-
1079 \e PathView.itemRotation created for this attribute.-
1080-
1081 \qml-
1082 Rectangle {-
1083 width: 10; height: 10-
1084 rotation: PathView.itemRotation-
1085 }-
1086 \endqml-
1087-
1088 As each item is positioned along the path, it will be rotated accordingly:-
1089 an item at the beginning of the path with be not be rotated, an item at-
1090 the end of the path will be rotated 90 degrees, and an item mid-way along-
1091 the path will be rotated 45 degrees.-
1092*/-
1093-
1094/*!-
1095 the new value of the attribute.-
1096*/-
1097qreal QQuickPathAttribute::value() const-
1098{-
1099 return _value;
executed 1202 times by 2 tests: return _value;
Executed by:
  • tst_examples
  • tst_qquickpathview
1202
1100}-
1101-
1102void QQuickPathAttribute::setValue(qreal value)-
1103{-
1104 if (_value != value) {
_value != valueDescription
TRUEevaluated 440 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
FALSEevaluated 98 times by 1 test
Evaluated by:
  • tst_qquickpathview
98-440
1105 _value = value;-
1106 emit valueChanged();-
1107 emit changed();-
1108 }
executed 440 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
440
1109}
executed 538 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
538
1110-
1111/****************************************************************************/-
1112-
1113/*!-
1114 \qmltype PathLine-
1115 \instantiates QQuickPathLine-
1116 \inqmlmodule QtQuick-
1117 \ingroup qtquick-animation-paths-
1118 \brief Defines a straight line.-
1119-
1120 The example below creates a path consisting of a straight line from-
1121 0,100 to 200,100:-
1122-
1123 \qml-
1124 Path {-
1125 startX: 0; startY: 100-
1126 PathLine { x: 200; y: 100 }-
1127 }-
1128 \endqml-
1129-
1130 \sa Path, PathQuad, PathCubic, PathArc, PathAngleArc, PathCurve, PathSvg, PathMove-
1131*/-
1132-
1133/*!-
1134 \qmlproperty real QtQuick::PathLine::x-
1135 \qmlproperty real QtQuick::PathLine::y-
1136-
1137 Defines the end point of the line.-
1138-
1139 \sa relativeX, relativeY-
1140*/-
1141-
1142/*!-
1143 \qmlproperty real QtQuick::PathLine::relativeX-
1144 \qmlproperty real QtQuick::PathLine::relativeY-
1145-
1146 Defines the end point of the line relative to its start.-
1147-
1148 If both a relative and absolute end position are specified for a single axis, the relative-
1149 position will be used.-
1150-
1151 Relative and absolute positions can be mixed, for example it is valid to set a relative x-
1152 and an absolute y.-
1153-
1154 \sa x, y-
1155*/-
1156-
1157inline QPointF positionForCurve(const QQuickPathData &data, const QPointF &prevPoint)-
1158{-
1159 QQuickCurve *curve = data.curves.at(data.index);-
1160 bool isEnd = data.index == data.curves.size() - 1;-
1161 return QPointF(curve->hasRelativeX() ? prevPoint.x() + curve->relativeX() : !isEnd || curve->hasX() ? curve->x() : data.endPoint.x(),
executed 10420 times by 6 tests: return QPointF(curve->hasRelativeX() ? prevPoint.x() + curve->relativeX() : !isEnd || curve->hasX() ? curve->x() : data.endPoint.x(), curve->hasRelativeY() ? prevPoint.y() + curve->relativeY() : !isEnd || curve->hasY() ? curve->y() : data.endPoint.y());
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickshape
  • tst_qquickvisualdatamodel
10420
1162 curve->hasRelativeY() ? prevPoint.y() + curve->relativeY() : !isEnd || curve->hasY() ? curve->y() : data.endPoint.y());
executed 10420 times by 6 tests: return QPointF(curve->hasRelativeX() ? prevPoint.x() + curve->relativeX() : !isEnd || curve->hasX() ? curve->x() : data.endPoint.x(), curve->hasRelativeY() ? prevPoint.y() + curve->relativeY() : !isEnd || curve->hasY() ? curve->y() : data.endPoint.y());
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickshape
  • tst_qquickvisualdatamodel
10420
1163}-
1164-
1165void QQuickPathLine::addToPath(QPainterPath &path, const QQuickPathData &data)-
1166{-
1167 path.lineTo(positionForCurve(data, path.currentPosition()));-
1168}
executed 1062 times by 6 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
  • tst_qquickpathview
  • tst_qquickshape
  • tst_qquickvisualdatamodel
1062
1169-
1170/****************************************************************************/-
1171-
1172/*!-
1173 \qmltype PathMove-
1174 \instantiates QQuickPathMove-
1175 \inqmlmodule QtQuick-
1176 \ingroup qtquick-animation-paths-
1177 \brief Moves the Path's position.-
1178-
1179 The example below creates a path consisting of two horizontal lines with-
1180 some empty space between them. All three segments have a width of 100:-
1181-
1182 \qml-
1183 Path {-
1184 startX: 0; startY: 100-
1185 PathLine { relativeX: 100; y: 100 }-
1186 PathMove { relativeX: 100; y: 100 }-
1187 PathLine { relativeX: 100; y: 100 }-
1188 }-
1189 \endqml-
1190-
1191 \note PathMove should not be used in a Path associated with a PathView. Use-
1192 PathLine instead. For ShapePath however it is important to distinguish-
1193 between the operations of drawing a straight line and moving the path-
1194 position without drawing anything.-
1195-
1196 \sa Path, PathQuad, PathCubic, PathArc, PathAngleArc, PathCurve, PathSvg, PathLine-
1197*/-
1198-
1199/*!-
1200 \qmlproperty real QtQuick::PathMove::x-
1201 \qmlproperty real QtQuick::PathMove::y-
1202-
1203 Defines the position to move to.-
1204-
1205 \sa relativeX, relativeY-
1206*/-
1207-
1208/*!-
1209 \qmlproperty real QtQuick::PathMove::relativeX-
1210 \qmlproperty real QtQuick::PathMove::relativeY-
1211-
1212 Defines the position to move to relative to its start.-
1213-
1214 If both a relative and absolute end position are specified for a single axis, the relative-
1215 position will be used.-
1216-
1217 Relative and absolute positions can be mixed, for example it is valid to set a relative x-
1218 and an absolute y.-
1219-
1220 \sa x, y-
1221*/-
1222-
1223void QQuickPathMove::addToPath(QPainterPath &path, const QQuickPathData &data)-
1224{-
1225 path.moveTo(positionForCurve(data, path.currentPosition()));-
1226}
executed 972 times by 1 test: end of block
Executed by:
  • tst_examples
972
1227-
1228/****************************************************************************/-
1229-
1230/*!-
1231 \qmltype PathQuad-
1232 \instantiates QQuickPathQuad-
1233 \inqmlmodule QtQuick-
1234 \ingroup qtquick-animation-paths-
1235 \brief Defines a quadratic Bezier curve with a control point.-
1236-
1237 The following QML produces the path shown below:-
1238 \table-
1239 \row-
1240 \li \image declarative-pathquad.png-
1241 \li-
1242 \qml-
1243 Path {-
1244 startX: 0; startY: 0-
1245 PathQuad { x: 200; y: 0; controlX: 100; controlY: 150 }-
1246 }-
1247 \endqml-
1248 \endtable-
1249-
1250 \sa Path, PathCubic, PathLine, PathArc, PathAngleArc, PathCurve, PathSvg-
1251*/-
1252-
1253/*!-
1254 \qmlproperty real QtQuick::PathQuad::x-
1255 \qmlproperty real QtQuick::PathQuad::y-
1256-
1257 Defines the end point of the curve.-
1258-
1259 \sa relativeX, relativeY-
1260*/-
1261-
1262/*!-
1263 \qmlproperty real QtQuick::PathQuad::relativeX-
1264 \qmlproperty real QtQuick::PathQuad::relativeY-
1265-
1266 Defines the end point of the curve relative to its start.-
1267-
1268 If both a relative and absolute end position are specified for a single axis, the relative-
1269 position will be used.-
1270-
1271 Relative and absolute positions can be mixed, for example it is valid to set a relative x-
1272 and an absolute y.-
1273-
1274 \sa x, y-
1275*/-
1276-
1277/*!-
1278 \qmlproperty real QtQuick::PathQuad::controlX-
1279 \qmlproperty real QtQuick::PathQuad::controlY-
1280-
1281 Defines the position of the control point.-
1282*/-
1283-
1284/*!-
1285 the x position of the control point.-
1286*/-
1287qreal QQuickPathQuad::controlX() const-
1288{-
1289 return _controlX;
executed 188 times by 3 tests: return _controlX;
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickshape
188
1290}-
1291-
1292void QQuickPathQuad::setControlX(qreal x)-
1293{-
1294 if (_controlX != x) {
_controlX != xDescription
TRUEevaluated 162 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickshape
FALSEevaluated 16 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickshape
16-162
1295 _controlX = x;-
1296 emit controlXChanged();-
1297 emit changed();-
1298 }
executed 162 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickshape
162
1299}
executed 178 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickshape
178
1300-
1301-
1302/*!-
1303 the y position of the control point.-
1304*/-
1305qreal QQuickPathQuad::controlY() const-
1306{-
1307 return _controlY;
executed 188 times by 3 tests: return _controlY;
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickshape
188
1308}-
1309-
1310void QQuickPathQuad::setControlY(qreal y)-
1311{-
1312 if (_controlY != y) {
_controlY != yDescription
TRUEevaluated 174 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickshape
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_examples
4-174
1313 _controlY = y;-
1314 emit controlYChanged();-
1315 emit changed();-
1316 }
executed 174 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickshape
174
1317}
executed 178 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickshape
178
1318-
1319/*!-
1320 \qmlproperty real QtQuick::PathQuad::relativeControlX-
1321 \qmlproperty real QtQuick::PathQuad::relativeControlY-
1322-
1323 Defines the position of the control point relative to the curve's start.-
1324-
1325 If both a relative and absolute control position are specified for a single axis, the relative-
1326 position will be used.-
1327-
1328 Relative and absolute positions can be mixed, for example it is valid to set a relative control x-
1329 and an absolute control y.-
1330-
1331 \sa controlX, controlY-
1332*/-
1333-
1334qreal QQuickPathQuad::relativeControlX() const-
1335{-
1336 return _relativeControlX;
never executed: return _relativeControlX;
0
1337}-
1338-
1339void QQuickPathQuad::setRelativeControlX(qreal x)-
1340{-
1341 if (_relativeControlX.isNull || _relativeControlX != x) {
_relativeControlX.isNullDescription
TRUEnever evaluated
FALSEnever evaluated
_relativeControlX != xDescription
TRUEnever evaluated
FALSEnever evaluated
0
1342 _relativeControlX = x;-
1343 emit relativeControlXChanged();-
1344 emit changed();-
1345 }
never executed: end of block
0
1346}
never executed: end of block
0
1347-
1348bool QQuickPathQuad::hasRelativeControlX()-
1349{-
1350 return _relativeControlX.isValid();
executed 186 times by 3 tests: return _relativeControlX.isValid();
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickshape
186
1351}-
1352-
1353qreal QQuickPathQuad::relativeControlY() const-
1354{-
1355 return _relativeControlY;
never executed: return _relativeControlY;
0
1356}-
1357-
1358void QQuickPathQuad::setRelativeControlY(qreal y)-
1359{-
1360 if (_relativeControlY.isNull || _relativeControlY != y) {
_relativeControlY.isNullDescription
TRUEnever evaluated
FALSEnever evaluated
_relativeControlY != yDescription
TRUEnever evaluated
FALSEnever evaluated
0
1361 _relativeControlY = y;-
1362 emit relativeControlYChanged();-
1363 emit changed();-
1364 }
never executed: end of block
0
1365}
never executed: end of block
0
1366-
1367bool QQuickPathQuad::hasRelativeControlY()-
1368{-
1369 return _relativeControlY.isValid();
executed 186 times by 3 tests: return _relativeControlY.isValid();
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickshape
186
1370}-
1371-
1372void QQuickPathQuad::addToPath(QPainterPath &path, const QQuickPathData &data)-
1373{-
1374 const QPointF &prevPoint = path.currentPosition();-
1375 QPointF controlPoint(hasRelativeControlX() ? prevPoint.x() + relativeControlX() : controlX(),-
1376 hasRelativeControlY() ? prevPoint.y() + relativeControlY() : controlY());-
1377 path.quadTo(controlPoint, positionForCurve(data, path.currentPosition()));-
1378}
executed 186 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickshape
186
1379-
1380/****************************************************************************/-
1381-
1382/*!-
1383 \qmltype PathCubic-
1384 \instantiates QQuickPathCubic-
1385 \inqmlmodule QtQuick-
1386 \ingroup qtquick-animation-paths-
1387 \brief Defines a cubic Bezier curve with two control points.-
1388-
1389 The following QML produces the path shown below:-
1390 \table-
1391 \row-
1392 \li \image declarative-pathcubic.png-
1393 \li-
1394 \qml-
1395 Path {-
1396 startX: 20; startY: 0-
1397 PathCubic {-
1398 x: 180; y: 0-
1399 control1X: -10; control1Y: 90-
1400 control2X: 210; control2Y: 90-
1401 }-
1402 }-
1403 \endqml-
1404 \endtable-
1405-
1406 \sa Path, PathQuad, PathLine, PathArc, PathAngleArc, PathCurve, PathSvg-
1407*/-
1408-
1409/*!-
1410 \qmlproperty real QtQuick::PathCubic::x-
1411 \qmlproperty real QtQuick::PathCubic::y-
1412-
1413 Defines the end point of the curve.-
1414-
1415 \sa relativeX, relativeY-
1416*/-
1417-
1418/*!-
1419 \qmlproperty real QtQuick::PathCubic::relativeX-
1420 \qmlproperty real QtQuick::PathCubic::relativeY-
1421-
1422 Defines the end point of the curve relative to its start.-
1423-
1424 If both a relative and absolute end position are specified for a single axis, the relative-
1425 position will be used.-
1426-
1427 Relative and absolute positions can be mixed, for example it is valid to set a relative x-
1428 and an absolute y.-
1429-
1430 \sa x, y-
1431*/-
1432-
1433/*!-
1434 \qmlproperty real QtQuick::PathCubic::control1X-
1435 \qmlproperty real QtQuick::PathCubic::control1Y-
1436-
1437 Defines the position of the first control point.-
1438*/-
1439qreal QQuickPathCubic::control1X() const-
1440{-
1441 return _control1X;
executed 7910 times by 4 tests: return _control1X;
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpathview
  • tst_qquickshape
7910
1442}-
1443-
1444void QQuickPathCubic::setControl1X(qreal x)-
1445{-
1446 if (_control1X != x) {
_control1X != xDescription
TRUEevaluated 7894 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpathview
FALSEevaluated 6 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickshape
6-7894
1447 _control1X = x;-
1448 emit control1XChanged();-
1449 emit changed();-
1450 }
executed 7894 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpathview
7894
1451}
executed 7900 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpathview
  • tst_qquickshape
7900
1452-
1453qreal QQuickPathCubic::control1Y() const-
1454{-
1455 return _control1Y;
executed 7910 times by 4 tests: return _control1Y;
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpathview
  • tst_qquickshape
7910
1456}-
1457-
1458void QQuickPathCubic::setControl1Y(qreal y)-
1459{-
1460 if (_control1Y != y) {
_control1Y != yDescription
TRUEevaluated 7774 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpathview
  • tst_qquickshape
FALSEevaluated 126 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
126-7774
1461 _control1Y = y;-
1462 emit control1YChanged();-
1463 emit changed();-
1464 }
executed 7774 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpathview
  • tst_qquickshape
7774
1465}
executed 7900 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpathview
  • tst_qquickshape
7900
1466-
1467/*!-
1468 \qmlproperty real QtQuick::PathCubic::control2X-
1469 \qmlproperty real QtQuick::PathCubic::control2Y-
1470-
1471 Defines the position of the second control point.-
1472*/-
1473qreal QQuickPathCubic::control2X() const-
1474{-
1475 return _control2X;
executed 7910 times by 4 tests: return _control2X;
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpathview
  • tst_qquickshape
7910
1476}-
1477-
1478void QQuickPathCubic::setControl2X(qreal x)-
1479{-
1480 if (_control2X != x) {
_control2X != xDescription
TRUEevaluated 7898 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpathview
  • tst_qquickshape
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_examples
6-7898
1481 _control2X = x;-
1482 emit control2XChanged();-
1483 emit changed();-
1484 }
executed 7898 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpathview
  • tst_qquickshape
7898
1485}
executed 7904 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpathview
  • tst_qquickshape
7904
1486-
1487qreal QQuickPathCubic::control2Y() const-
1488{-
1489 return _control2Y;
executed 7910 times by 4 tests: return _control2Y;
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpathview
  • tst_qquickshape
7910
1490}-
1491-
1492void QQuickPathCubic::setControl2Y(qreal y)-
1493{-
1494 if (_control2Y != y) {
_control2Y != yDescription
TRUEevaluated 7776 times by 4 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpathview
  • tst_qquickshape
FALSEevaluated 124 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
124-7776
1495 _control2Y = y;-
1496 emit control2YChanged();-
1497 emit changed();-
1498 }
executed 7776 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpathview
  • tst_qquickshape
7776
1499}
executed 7900 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpathview
  • tst_qquickshape
7900
1500-
1501/*!-
1502 \qmlproperty real QtQuick::PathCubic::relativeControl1X-
1503 \qmlproperty real QtQuick::PathCubic::relativeControl1Y-
1504 \qmlproperty real QtQuick::PathCubic::relativeControl2X-
1505 \qmlproperty real QtQuick::PathCubic::relativeControl2Y-
1506-
1507 Defines the positions of the control points relative to the curve's start.-
1508-
1509 If both a relative and absolute control position are specified for a control point's axis, the relative-
1510 position will be used.-
1511-
1512 Relative and absolute positions can be mixed, for example it is valid to set a relative control1 x-
1513 and an absolute control1 y.-
1514-
1515 \sa control1X, control1Y, control2X, control2Y-
1516*/-
1517-
1518qreal QQuickPathCubic::relativeControl1X() const-
1519{-
1520 return _relativeControl1X;
never executed: return _relativeControl1X;
0
1521}-
1522-
1523void QQuickPathCubic::setRelativeControl1X(qreal x)-
1524{-
1525 if (_relativeControl1X.isNull || _relativeControl1X != x) {
_relativeControl1X.isNullDescription
TRUEnever evaluated
FALSEnever evaluated
_relativeControl1X != xDescription
TRUEnever evaluated
FALSEnever evaluated
0
1526 _relativeControl1X = x;-
1527 emit relativeControl1XChanged();-
1528 emit changed();-
1529 }
never executed: end of block
0
1530}
never executed: end of block
0
1531-
1532bool QQuickPathCubic::hasRelativeControl1X()-
1533{-
1534 return _relativeControl1X.isValid();
executed 7908 times by 4 tests: return _relativeControl1X.isValid();
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpathview
  • tst_qquickshape
7908
1535}-
1536-
1537qreal QQuickPathCubic::relativeControl1Y() const-
1538{-
1539 return _relativeControl1Y;
never executed: return _relativeControl1Y;
0
1540}-
1541-
1542void QQuickPathCubic::setRelativeControl1Y(qreal y)-
1543{-
1544 if (_relativeControl1Y.isNull || _relativeControl1Y != y) {
_relativeControl1Y.isNullDescription
TRUEnever evaluated
FALSEnever evaluated
_relativeControl1Y != yDescription
TRUEnever evaluated
FALSEnever evaluated
0
1545 _relativeControl1Y = y;-
1546 emit relativeControl1YChanged();-
1547 emit changed();-
1548 }
never executed: end of block
0
1549}
never executed: end of block
0
1550-
1551bool QQuickPathCubic::hasRelativeControl1Y()-
1552{-
1553 return _relativeControl1Y.isValid();
executed 7908 times by 4 tests: return _relativeControl1Y.isValid();
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpathview
  • tst_qquickshape
7908
1554}-
1555-
1556qreal QQuickPathCubic::relativeControl2X() const-
1557{-
1558 return _relativeControl2X;
never executed: return _relativeControl2X;
0
1559}-
1560-
1561void QQuickPathCubic::setRelativeControl2X(qreal x)-
1562{-
1563 if (_relativeControl2X.isNull || _relativeControl2X != x) {
_relativeControl2X.isNullDescription
TRUEnever evaluated
FALSEnever evaluated
_relativeControl2X != xDescription
TRUEnever evaluated
FALSEnever evaluated
0
1564 _relativeControl2X = x;-
1565 emit relativeControl2XChanged();-
1566 emit changed();-
1567 }
never executed: end of block
0
1568}
never executed: end of block
0
1569-
1570bool QQuickPathCubic::hasRelativeControl2X()-
1571{-
1572 return _relativeControl2X.isValid();
executed 7908 times by 4 tests: return _relativeControl2X.isValid();
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpathview
  • tst_qquickshape
7908
1573}-
1574-
1575qreal QQuickPathCubic::relativeControl2Y() const-
1576{-
1577 return _relativeControl2Y;
never executed: return _relativeControl2Y;
0
1578}-
1579-
1580void QQuickPathCubic::setRelativeControl2Y(qreal y)-
1581{-
1582 if (_relativeControl2Y.isNull || _relativeControl2Y != y) {
_relativeControl2Y.isNullDescription
TRUEnever evaluated
FALSEnever evaluated
_relativeControl2Y != yDescription
TRUEnever evaluated
FALSEnever evaluated
0
1583 _relativeControl2Y = y;-
1584 emit relativeControl2YChanged();-
1585 emit changed();-
1586 }
never executed: end of block
0
1587}
never executed: end of block
0
1588-
1589bool QQuickPathCubic::hasRelativeControl2Y()-
1590{-
1591 return _relativeControl2Y.isValid();
executed 7908 times by 4 tests: return _relativeControl2Y.isValid();
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpathview
  • tst_qquickshape
7908
1592}-
1593-
1594void QQuickPathCubic::addToPath(QPainterPath &path, const QQuickPathData &data)-
1595{-
1596 const QPointF &prevPoint = path.currentPosition();-
1597 QPointF controlPoint1(hasRelativeControl1X() ? prevPoint.x() + relativeControl1X() : control1X(),-
1598 hasRelativeControl1Y() ? prevPoint.y() + relativeControl1Y() : control1Y());-
1599 QPointF controlPoint2(hasRelativeControl2X() ? prevPoint.x() + relativeControl2X() : control2X(),-
1600 hasRelativeControl2Y() ? prevPoint.y() + relativeControl2Y() : control2Y());-
1601 path.cubicTo(controlPoint1, controlPoint2, positionForCurve(data, path.currentPosition()));-
1602}
executed 7908 times by 4 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpathview
  • tst_qquickshape
7908
1603-
1604/****************************************************************************/-
1605-
1606/*!-
1607 \qmltype PathCurve-
1608 \instantiates QQuickPathCatmullRomCurve-
1609 \inqmlmodule QtQuick-
1610 \ingroup qtquick-animation-paths-
1611 \brief Defines a point on a Catmull-Rom curve.-
1612-
1613 PathCurve provides an easy way to specify a curve passing directly through a set of points.-
1614 Typically multiple PathCurves are used in a series, as the following example demonstrates:-
1615-
1616 \snippet qml/path/basiccurve.qml 0-
1617-
1618 This example produces the following path (with the starting point and PathCurve points-
1619 highlighted in red):-
1620-
1621 \image declarative-pathcurve.png-
1622-
1623 \sa Path, PathLine, PathQuad, PathCubic, PathArc, PathSvg-
1624*/-
1625-
1626/*!-
1627 \qmlproperty real QtQuick::PathCurve::x-
1628 \qmlproperty real QtQuick::PathCurve::y-
1629-
1630 Defines the end point of the curve.-
1631-
1632 \sa relativeX, relativeY-
1633*/-
1634-
1635/*!-
1636 \qmlproperty real QtQuick::PathCurve::relativeX-
1637 \qmlproperty real QtQuick::PathCurve::relativeY-
1638-
1639 Defines the end point of the curve relative to its start.-
1640-
1641 If both a relative and absolute end position are specified for a single axis, the relative-
1642 position will be used.-
1643-
1644 Relative and absolute positions can be mixed, for example it is valid to set a relative x-
1645 and an absolute y.-
1646-
1647 \sa x, y-
1648*/-
1649-
1650inline QPointF previousPathPosition(const QPainterPath &path)-
1651{-
1652 int count = path.elementCount();-
1653 if (count < 1)
count < 1Description
TRUEnever evaluated
FALSEevaluated 30 times by 2 tests
Evaluated by:
  • tst_qquickanimations
  • tst_qquickpath
0-30
1654 return QPointF();
never executed: return QPointF();
0
1655-
1656 int index = path.elementAt(count-1).type == QPainterPath::CurveToDataElement ? count - 4 : count - 2;
path.elementAt...eToDataElementDescription
TRUEevaluated 30 times by 2 tests
Evaluated by:
  • tst_qquickanimations
  • tst_qquickpath
FALSEnever evaluated
0-30
1657 return index > -1 ? QPointF(path.elementAt(index)) : path.pointAtPercent(0);
executed 30 times by 2 tests: return index > -1 ? QPointF(path.elementAt(index)) : path.pointAtPercent(0);
Executed by:
  • tst_qquickanimations
  • tst_qquickpath
30
1658}-
1659-
1660void QQuickPathCatmullRomCurve::addToPath(QPainterPath &path, const QQuickPathData &data)-
1661{-
1662 //here we convert catmull-rom spline to bezier for use in QPainterPath.-
1663 //basic conversion algorithm:-
1664 // catmull-rom points * inverse bezier matrix * catmull-rom matrix = bezier points-
1665 //each point in the catmull-rom spline produces a bezier endpoint + 2 control points-
1666 //calculations for each point use a moving window of 4 points-
1667 // (previous 2 points + current point + next point)-
1668 QPointF prevFar, prev, point, next;-
1669-
1670 //get previous points-
1671 int index = data.index - 1;-
1672 QQuickCurve *curve = index == -1 ? 0 : data.curves.at(index);
index == -1Description
TRUEevaluated 12 times by 2 tests
Evaluated by:
  • tst_qquickanimations
  • tst_qquickpath
FALSEevaluated 30 times by 2 tests
Evaluated by:
  • tst_qquickanimations
  • tst_qquickpath
12-30
1673 if (qobject_cast<QQuickPathCatmullRomCurve*>(curve)) {
qobject_cast<Q...Curve*>(curve)Description
TRUEevaluated 30 times by 2 tests
Evaluated by:
  • tst_qquickanimations
  • tst_qquickpath
FALSEevaluated 12 times by 2 tests
Evaluated by:
  • tst_qquickanimations
  • tst_qquickpath
12-30
1674 prev = path.currentPosition();-
1675 prevFar = previousPathPosition(path);-
1676 } else {
executed 30 times by 2 tests: end of block
Executed by:
  • tst_qquickanimations
  • tst_qquickpath
30
1677 prev = path.currentPosition();-
1678 bool prevFarSet = false;-
1679 if (index == -1 && data.curves.count() > 1) {
index == -1Description
TRUEevaluated 12 times by 2 tests
Evaluated by:
  • tst_qquickanimations
  • tst_qquickpath
FALSEnever evaluated
data.curves.count() > 1Description
TRUEevaluated 12 times by 2 tests
Evaluated by:
  • tst_qquickanimations
  • tst_qquickpath
FALSEnever evaluated
0-12
1680 if (qobject_cast<QQuickPathCatmullRomCurve*>(data.curves.at(data.curves.count()-1))) {
qobject_cast<Q...es.count()-1))Description
TRUEevaluated 12 times by 2 tests
Evaluated by:
  • tst_qquickanimations
  • tst_qquickpath
FALSEnever evaluated
0-12
1681 //TODO: profile and optimize-
1682 QPointF pos = prev;-
1683 QQuickPathData loopData;-
1684 loopData.endPoint = data.endPoint;-
1685 loopData.curves = data.curves;-
1686 for (int i = data.index; i < data.curves.count(); ++i) {
i < data.curves.count()Description
TRUEevaluated 42 times by 2 tests
Evaluated by:
  • tst_qquickanimations
  • tst_qquickpath
FALSEevaluated 12 times by 2 tests
Evaluated by:
  • tst_qquickanimations
  • tst_qquickpath
12-42
1687 loopData.index = i;-
1688 pos = positionForCurve(loopData, pos);-
1689 if (i == data.curves.count()-2)
i == data.curves.count()-2Description
TRUEevaluated 12 times by 2 tests
Evaluated by:
  • tst_qquickanimations
  • tst_qquickpath
FALSEevaluated 30 times by 2 tests
Evaluated by:
  • tst_qquickanimations
  • tst_qquickpath
12-30
1690 prevFar = pos;
executed 12 times by 2 tests: prevFar = pos;
Executed by:
  • tst_qquickanimations
  • tst_qquickpath
12
1691 }
executed 42 times by 2 tests: end of block
Executed by:
  • tst_qquickanimations
  • tst_qquickpath
42
1692 if (pos == QPointF(path.elementAt(0))) {
pos == QPointF....elementAt(0))Description
TRUEevaluated 4 times by 2 tests
Evaluated by:
  • tst_qquickanimations
  • tst_qquickpath
FALSEevaluated 8 times by 2 tests
Evaluated by:
  • tst_qquickanimations
  • tst_qquickpath
4-8
1693 //this is a closed path starting and ending with catmull-rom segments.-
1694 //we try to smooth the join point-
1695 prevFarSet = true;-
1696 }
executed 4 times by 2 tests: end of block
Executed by:
  • tst_qquickanimations
  • tst_qquickpath
4
1697 }
executed 12 times by 2 tests: end of block
Executed by:
  • tst_qquickanimations
  • tst_qquickpath
12
1698 }
executed 12 times by 2 tests: end of block
Executed by:
  • tst_qquickanimations
  • tst_qquickpath
12
1699 if (!prevFarSet)
!prevFarSetDescription
TRUEevaluated 8 times by 2 tests
Evaluated by:
  • tst_qquickanimations
  • tst_qquickpath
FALSEevaluated 4 times by 2 tests
Evaluated by:
  • tst_qquickanimations
  • tst_qquickpath
4-8
1700 prevFar = prev;
executed 8 times by 2 tests: prevFar = prev;
Executed by:
  • tst_qquickanimations
  • tst_qquickpath
8
1701 }
executed 12 times by 2 tests: end of block
Executed by:
  • tst_qquickanimations
  • tst_qquickpath
12
1702-
1703 //get current point-
1704 point = positionForCurve(data, path.currentPosition());-
1705-
1706 //get next point-
1707 index = data.index + 1;-
1708 if (index < data.curves.count() && qobject_cast<QQuickPathCatmullRomCurve*>(data.curves.at(index))) {
index < data.curves.count()Description
TRUEevaluated 30 times by 2 tests
Evaluated by:
  • tst_qquickanimations
  • tst_qquickpath
FALSEevaluated 12 times by 2 tests
Evaluated by:
  • tst_qquickanimations
  • tst_qquickpath
qobject_cast<Q...ves.at(index))Description
TRUEevaluated 30 times by 2 tests
Evaluated by:
  • tst_qquickanimations
  • tst_qquickpath
FALSEnever evaluated
0-30
1709 QQuickPathData nextData;-
1710 nextData.index = index;-
1711 nextData.endPoint = data.endPoint;-
1712 nextData.curves = data.curves;-
1713 next = positionForCurve(nextData, point);-
1714 } else {
executed 30 times by 2 tests: end of block
Executed by:
  • tst_qquickanimations
  • tst_qquickpath
30
1715 if (point == QPointF(path.elementAt(0)) && qobject_cast<QQuickPathCatmullRomCurve*>(data.curves.at(0)) && path.elementCount() >= 3) {
point == QPoin....elementAt(0))Description
TRUEevaluated 4 times by 2 tests
Evaluated by:
  • tst_qquickanimations
  • tst_qquickpath
FALSEevaluated 8 times by 2 tests
Evaluated by:
  • tst_qquickanimations
  • tst_qquickpath
qobject_cast<Q....curves.at(0))Description
TRUEevaluated 4 times by 2 tests
Evaluated by:
  • tst_qquickanimations
  • tst_qquickpath
FALSEnever evaluated
path.elementCount() >= 3Description
TRUEevaluated 4 times by 2 tests
Evaluated by:
  • tst_qquickanimations
  • tst_qquickpath
FALSEnever evaluated
0-8
1716 //this is a closed path starting and ending with catmull-rom segments.-
1717 //we try to smooth the join point-
1718 next = QPointF(path.elementAt(3)); //the first catmull-rom point-
1719 } else
executed 4 times by 2 tests: end of block
Executed by:
  • tst_qquickanimations
  • tst_qquickpath
4
1720 next = point;
executed 8 times by 2 tests: next = point;
Executed by:
  • tst_qquickanimations
  • tst_qquickpath
8
1721 }-
1722-
1723 /*-
1724 full conversion matrix (inverse bezier * catmull-rom):-
1725 0.000, 1.000, 0.000, 0.000,-
1726 -0.167, 1.000, 0.167, 0.000,-
1727 0.000, 0.167, 1.000, -0.167,-
1728 0.000, 0.000, 1.000, 0.000-
1729-
1730 conversion doesn't require full matrix multiplication,-
1731 so below we simplify-
1732 */-
1733 QPointF control1(prevFar.x() * qreal(-0.167) +-
1734 prev.x() +-
1735 point.x() * qreal(0.167),-
1736 prevFar.y() * qreal(-0.167) +-
1737 prev.y() +-
1738 point.y() * qreal(0.167));-
1739-
1740 QPointF control2(prev.x() * qreal(0.167) +-
1741 point.x() +-
1742 next.x() * qreal(-0.167),-
1743 prev.y() * qreal(0.167) +-
1744 point.y() +-
1745 next.y() * qreal(-0.167));-
1746-
1747 path.cubicTo(control1, control2, point);-
1748}
executed 42 times by 2 tests: end of block
Executed by:
  • tst_qquickanimations
  • tst_qquickpath
42
1749-
1750/****************************************************************************/-
1751-
1752/*!-
1753 \qmltype PathArc-
1754 \instantiates QQuickPathArc-
1755 \inqmlmodule QtQuick-
1756 \ingroup qtquick-animation-paths-
1757 \brief Defines an arc with the given radius.-
1758-
1759 PathArc provides a simple way of specifying an arc that ends at a given position-
1760 and uses the specified radius. It is modeled after the SVG elliptical arc command.-
1761-
1762 The following QML produces the path shown below:-
1763 \table-
1764 \row-
1765 \li \image declarative-patharc.png-
1766 \li \snippet qml/path/basicarc.qml 0-
1767 \endtable-
1768-
1769 Note that a single PathArc cannot be used to specify a circle. Instead, you can-
1770 use two PathArc elements, each specifying half of the circle.-
1771-
1772 \sa Path, PathLine, PathQuad, PathCubic, PathAngleArc, PathCurve, PathSvg-
1773*/-
1774-
1775/*!-
1776 \qmlproperty real QtQuick::PathArc::x-
1777 \qmlproperty real QtQuick::PathArc::y-
1778-
1779 Defines the end point of the arc.-
1780-
1781 \sa relativeX, relativeY-
1782*/-
1783-
1784/*!-
1785 \qmlproperty real QtQuick::PathArc::relativeX-
1786 \qmlproperty real QtQuick::PathArc::relativeY-
1787-
1788 Defines the end point of the arc relative to its start.-
1789-
1790 If both a relative and absolute end position are specified for a single axis, the relative-
1791 position will be used.-
1792-
1793 Relative and absolute positions can be mixed, for example it is valid to set a relative x-
1794 and an absolute y.-
1795-
1796 \sa x, y-
1797*/-
1798-
1799/*!-
1800 \qmlproperty real QtQuick::PathArc::radiusX-
1801 \qmlproperty real QtQuick::PathArc::radiusY-
1802-
1803 Defines the radius of the arc.-
1804-
1805 The following QML demonstrates how different radius values can be used to change-
1806 the shape of the arc:-
1807 \table-
1808 \row-
1809 \li \image declarative-arcradius.png-
1810 \li \snippet qml/path/arcradius.qml 0-
1811 \endtable-
1812*/-
1813-
1814qreal QQuickPathArc::radiusX() const-
1815{-
1816 return _radiusX;
executed 2 times by 1 test: return _radiusX;
Executed by:
  • tst_qquickpath
2
1817}-
1818-
1819void QQuickPathArc::setRadiusX(qreal radius)-
1820{-
1821 if (_radiusX == radius)
_radiusX == radiusDescription
TRUEnever evaluated
FALSEevaluated 70 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpath
  • tst_qquickshape
0-70
1822 return;
never executed: return;
0
1823-
1824 _radiusX = radius;-
1825 emit radiusXChanged();-
1826 emit changed();-
1827}
executed 70 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpath
  • tst_qquickshape
70
1828-
1829qreal QQuickPathArc::radiusY() const-
1830{-
1831 return _radiusY;
executed 2 times by 1 test: return _radiusY;
Executed by:
  • tst_qquickpath
2
1832}-
1833-
1834void QQuickPathArc::setRadiusY(qreal radius)-
1835{-
1836 if (_radiusY == radius)
_radiusY == radiusDescription
TRUEnever evaluated
FALSEevaluated 70 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpath
  • tst_qquickshape
0-70
1837 return;
never executed: return;
0
1838-
1839 _radiusY = radius;-
1840 emit radiusYChanged();-
1841 emit changed();-
1842}
executed 70 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpath
  • tst_qquickshape
70
1843-
1844/*!-
1845 \qmlproperty bool QtQuick::PathArc::useLargeArc-
1846 Whether to use a large arc as defined by the arc points.-
1847-
1848 Given fixed start and end positions, radius, and direction,-
1849 there are two possible arcs that can fit the data. useLargeArc-
1850 is used to distinguish between these. For example, the following-
1851 QML can produce either of the two illustrated arcs below by-
1852 changing the value of useLargeArc.-
1853-
1854 \table-
1855 \row-
1856 \li \image declarative-largearc.png-
1857 \li \snippet qml/path/largearc.qml 0-
1858 \endtable-
1859-
1860 The default value is false.-
1861*/-
1862-
1863bool QQuickPathArc::useLargeArc() const-
1864{-
1865 return _useLargeArc;
executed 2 times by 1 test: return _useLargeArc;
Executed by:
  • tst_qquickpath
2
1866}-
1867-
1868void QQuickPathArc::setUseLargeArc(bool largeArc)-
1869{-
1870 if (_useLargeArc == largeArc)
_useLargeArc == largeArcDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_examples
FALSEevaluated 26 times by 1 test
Evaluated by:
  • tst_examples
2-26
1871 return;
executed 2 times by 1 test: return;
Executed by:
  • tst_examples
2
1872-
1873 _useLargeArc = largeArc;-
1874 emit useLargeArcChanged();-
1875 emit changed();-
1876}
executed 26 times by 1 test: end of block
Executed by:
  • tst_examples
26
1877-
1878/*!-
1879 \qmlproperty enumeration QtQuick::PathArc::direction-
1880-
1881 Defines the direction of the arc. Possible values are-
1882 PathArc.Clockwise (default) and PathArc.Counterclockwise.-
1883-
1884 The following QML can produce either of the two illustrated arcs below-
1885 by changing the value of direction.-
1886 \table-
1887 \row-
1888 \li \image declarative-arcdirection.png-
1889 \li \snippet qml/path/arcdirection.qml 0-
1890 \endtable-
1891-
1892 \sa useLargeArc-
1893*/-
1894-
1895QQuickPathArc::ArcDirection QQuickPathArc::direction() const-
1896{-
1897 return _direction;
executed 2 times by 1 test: return _direction;
Executed by:
  • tst_qquickpath
2
1898}-
1899-
1900void QQuickPathArc::setDirection(ArcDirection direction)-
1901{-
1902 if (_direction == direction)
_direction == directionDescription
TRUEevaluated 6 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpath
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_examples
6-8
1903 return;
executed 6 times by 2 tests: return;
Executed by:
  • tst_examples
  • tst_qquickpath
6
1904-
1905 _direction = direction;-
1906 emit directionChanged();-
1907 emit changed();-
1908}
executed 8 times by 1 test: end of block
Executed by:
  • tst_examples
8
1909-
1910/*!-
1911 \qmlproperty real QtQuick::PathArc::xAxisRotation-
1912-
1913 Defines the rotation of the arc, in degrees. The default value is 0.-
1914-
1915 An arc is a section of circles or ellipses. Given the radius and the start-
1916 and end points, there are two ellipses that connect the points. This-
1917 property defines the rotation of the X axis of these ellipses.-
1918-
1919 \note The value is only useful when the x and y radius differ, meaning the-
1920 arc is a section of ellipses.-
1921-
1922 The following QML demonstrates how different radius values can be used to change-
1923 the shape of the arc:-
1924 \table-
1925 \row-
1926 \li \image declarative-arcrotation.png-
1927 \li \snippet qml/path/arcrotation.qml 0-
1928 \endtable-
1929*/-
1930-
1931qreal QQuickPathArc::xAxisRotation() const-
1932{-
1933 return _xAxisRotation;
never executed: return _xAxisRotation;
0
1934}-
1935-
1936void QQuickPathArc::setXAxisRotation(qreal rotation)-
1937{-
1938 if (_xAxisRotation == rotation)
_xAxisRotation == rotationDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_examples
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_examples
4
1939 return;
executed 4 times by 1 test: return;
Executed by:
  • tst_examples
4
1940-
1941 _xAxisRotation = rotation;-
1942 emit xAxisRotationChanged();-
1943 emit changed();-
1944}
executed 4 times by 1 test: end of block
Executed by:
  • tst_examples
4
1945-
1946void QQuickPathArc::addToPath(QPainterPath &path, const QQuickPathData &data)-
1947{-
1948 const QPointF &startPoint = path.currentPosition();-
1949 const QPointF &endPoint = positionForCurve(data, startPoint);-
1950 QQuickSvgParser::pathArc(path,-
1951 _radiusX,-
1952 _radiusY,-
1953 _xAxisRotation,-
1954 _useLargeArc,-
1955 _direction == Clockwise ? 1 : 0,-
1956 endPoint.x(),-
1957 endPoint.y(),-
1958 startPoint.x(), startPoint.y());-
1959}
executed 178 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpath
  • tst_qquickshape
178
1960-
1961/****************************************************************************/-
1962-
1963/*!-
1964 \qmltype PathAngleArc-
1965 \instantiates QQuickPathAngleArc-
1966 \inqmlmodule QtQuick-
1967 \ingroup qtquick-animation-paths-
1968 \brief Defines an arc with the given radii and center.-
1969-
1970 PathAngleArc provides a simple way of specifying an arc. While PathArc is designed-
1971 to work as part of a larger path (specifying start and end), PathAngleArc is designed-
1972 to make a path where the arc is primary (such as a circular progress indicator) more intuitive.-
1973-
1974 \sa Path, PathLine, PathQuad, PathCubic, PathCurve, PathSvg, PathArc-
1975*/-
1976-
1977/*!-
1978 \qmlproperty real QtQuick::PathAngleArc::centerX-
1979 \qmlproperty real QtQuick::PathAngleArc::centerY-
1980-
1981 Defines the center of the arc.-
1982*/-
1983-
1984qreal QQuickPathAngleArc::centerX() const-
1985{-
1986 return _centerX;
executed 2 times by 1 test: return _centerX;
Executed by:
  • tst_qquickpath
2
1987}-
1988-
1989void QQuickPathAngleArc::setCenterX(qreal centerX)-
1990{-
1991 if (_centerX == centerX)
_centerX == centerXDescription
TRUEnever evaluated
FALSEevaluated 6 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpath
0-6
1992 return;
never executed: return;
0
1993-
1994 _centerX = centerX;-
1995 emit centerXChanged();-
1996 emit changed();-
1997}
executed 6 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpath
6
1998-
1999qreal QQuickPathAngleArc::centerY() const-
2000{-
2001 return _centerY;
executed 2 times by 1 test: return _centerY;
Executed by:
  • tst_qquickpath
2
2002}-
2003-
2004void QQuickPathAngleArc::setCenterY(qreal centerY)-
2005{-
2006 if (_centerY == centerY)
_centerY == centerYDescription
TRUEnever evaluated
FALSEevaluated 6 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpath
0-6
2007 return;
never executed: return;
0
2008-
2009 _centerY = centerY;-
2010 emit centerXChanged();-
2011 emit changed();-
2012}
executed 6 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpath
6
2013-
2014/*!-
2015 \qmlproperty real QtQuick::PathAngleArc::radiusX-
2016 \qmlproperty real QtQuick::PathAngleArc::radiusY-
2017-
2018 Defines the radii of the ellipse of which the arc is part.-
2019*/-
2020-
2021qreal QQuickPathAngleArc::radiusX() const-
2022{-
2023 return _radiusX;
executed 2 times by 1 test: return _radiusX;
Executed by:
  • tst_qquickpath
2
2024}-
2025-
2026void QQuickPathAngleArc::setRadiusX(qreal radius)-
2027{-
2028 if (_radiusX == radius)
_radiusX == radiusDescription
TRUEnever evaluated
FALSEevaluated 6 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpath
0-6
2029 return;
never executed: return;
0
2030-
2031 _radiusX = radius;-
2032 emit radiusXChanged();-
2033 emit changed();-
2034}
executed 6 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpath
6
2035-
2036qreal QQuickPathAngleArc::radiusY() const-
2037{-
2038 return _radiusY;
executed 2 times by 1 test: return _radiusY;
Executed by:
  • tst_qquickpath
2
2039}-
2040-
2041void QQuickPathAngleArc::setRadiusY(qreal radius)-
2042{-
2043 if (_radiusY == radius)
_radiusY == radiusDescription
TRUEnever evaluated
FALSEevaluated 6 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpath
0-6
2044 return;
never executed: return;
0
2045-
2046 _radiusY = radius;-
2047 emit radiusYChanged();-
2048 emit changed();-
2049}
executed 6 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpath
6
2050-
2051/*!-
2052 \qmlproperty real QtQuick::PathAngleArc::startAngle-
2053-
2054 Defines the start angle of the arc.-
2055-
2056 The start angle is reported clockwise, with zero degrees at the 3 o'clock position.-
2057*/-
2058-
2059qreal QQuickPathAngleArc::startAngle() const-
2060{-
2061 return _startAngle;
executed 2 times by 1 test: return _startAngle;
Executed by:
  • tst_qquickpath
2
2062}-
2063-
2064void QQuickPathAngleArc::setStartAngle(qreal angle)-
2065{-
2066 if (_startAngle == angle)
_startAngle == angleDescription
TRUEnever evaluated
FALSEevaluated 6 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpath
0-6
2067 return;
never executed: return;
0
2068-
2069 _startAngle = angle;-
2070 emit startAngleChanged();-
2071 emit changed();-
2072}
executed 6 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpath
6
2073-
2074/*!-
2075 \qmlproperty real QtQuick::PathAngleArc::sweepAngle-
2076-
2077 Defines the sweep angle of the arc.-
2078-
2079 The arc will begin at startAngle and continue sweepAngle degrees, with a value of 360-
2080 resulting in a full circle. Positive numbers are clockwise and negative numbers are counterclockwise.-
2081*/-
2082-
2083qreal QQuickPathAngleArc::sweepAngle() const-
2084{-
2085 return _sweepAngle;
executed 6 times by 2 tests: return _sweepAngle;
Executed by:
  • tst_examples
  • tst_qquickpath
6
2086}-
2087-
2088void QQuickPathAngleArc::setSweepAngle(qreal angle)-
2089{-
2090 if (_sweepAngle == angle)
_sweepAngle == angleDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_examples
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpath
2-4
2091 return;
executed 4 times by 1 test: return;
Executed by:
  • tst_examples
4
2092-
2093 _sweepAngle = angle;-
2094 emit sweepAngleChanged();-
2095 emit changed();-
2096}
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquickpath
2
2097-
2098/*!-
2099 \qmlproperty bool QtQuick::PathAngleArc::moveToStart-
2100-
2101 Whether this element should be disconnected from the previous Path element (or startX/Y).-
2102-
2103 The default value is true. If set to false, the previous element's end-point-
2104 (or startX/Y if PathAngleArc is the first element) will be connected to the arc's-
2105 start-point with a straight line.-
2106*/-
2107-
2108bool QQuickPathAngleArc::moveToStart() const-
2109{-
2110 return _moveToStart;
executed 2 times by 1 test: return _moveToStart;
Executed by:
  • tst_qquickpath
2
2111}-
2112-
2113void QQuickPathAngleArc::setMoveToStart(bool move)-
2114{-
2115 if (_moveToStart == move)
_moveToStart == moveDescription
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpath
0-2
2116 return;
never executed: return;
0
2117-
2118 _moveToStart = move;-
2119 emit moveToStartChanged();-
2120 emit changed();-
2121}
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquickpath
2
2122-
2123void QQuickPathAngleArc::addToPath(QPainterPath &path, const QQuickPathData &)-
2124{-
2125 qreal x = _centerX - _radiusX;-
2126 qreal y = _centerY - _radiusY;-
2127 qreal width = _radiusX * 2;-
2128 qreal height = _radiusY * 2;-
2129 if (_moveToStart)
_moveToStartDescription
TRUEevaluated 6 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpath
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpath
2-6
2130 path.arcMoveTo(x, y, width, height, -_startAngle);
executed 6 times by 2 tests: path.arcMoveTo(x, y, width, height, -_startAngle);
Executed by:
  • tst_examples
  • tst_qquickpath
6
2131 path.arcTo(x, y, width, height, -_startAngle, -_sweepAngle);-
2132}
executed 8 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpath
8
2133-
2134/****************************************************************************/-
2135-
2136/*!-
2137 \qmltype PathSvg-
2138 \instantiates QQuickPathSvg-
2139 \inqmlmodule QtQuick-
2140 \ingroup qtquick-animation-paths-
2141 \brief Defines a path using an SVG path data string.-
2142-
2143 The following QML produces the path shown below:-
2144 \table-
2145 \row-
2146 \li \image declarative-pathsvg.png-
2147 \li-
2148 \qml-
2149 Path {-
2150 startX: 50; startY: 50-
2151 PathSvg { path: "L 150 50 L 100 150 z" }-
2152 }-
2153 \endqml-
2154 \endtable-
2155-
2156 \note Mixing PathSvg with other type of elements is not always supported.-
2157 For example, when \l Shape is backed by \c{GL_NV_path_rendering}, a-
2158 ShapePath can contain one or more PathSvg elements, or one or more other-
2159 type of elements, but not both.-
2160-
2161 \sa Path, PathLine, PathQuad, PathCubic, PathArc, PathAngleArc, PathCurve-
2162*/-
2163-
2164/*!-
2165 \qmlproperty string QtQuick::PathSvg::path-
2166-
2167 The SVG path data string specifying the path.-
2168-
2169 See \l {http://www.w3.org/TR/SVG/paths.html#PathData}{W3C SVG Path Data}-
2170 for more details on this format.-
2171*/-
2172-
2173QString QQuickPathSvg::path() const-
2174{-
2175 return _path;
executed 2 times by 1 test: return _path;
Executed by:
  • tst_qquickpath
2
2176}-
2177-
2178void QQuickPathSvg::setPath(const QString &path)-
2179{-
2180 if (_path == path)
_path == pathDescription
TRUEnever evaluated
FALSEevaluated 8 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
0-8
2181 return;
never executed: return;
0
2182-
2183 _path = path;-
2184 emit pathChanged();-
2185 emit changed();-
2186}
executed 8 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
8
2187-
2188void QQuickPathSvg::addToPath(QPainterPath &path, const QQuickPathData &)-
2189{-
2190 QQuickSvgParser::parsePathDataFast(_path, path);-
2191}
executed 8 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickanimations
  • tst_qquickpath
8
2192-
2193/****************************************************************************/-
2194-
2195/*!-
2196 \qmltype PathPercent-
2197 \instantiates QQuickPathPercent-
2198 \inqmlmodule QtQuick-
2199 \ingroup qtquick-animation-paths-
2200 \brief Manipulates the way a path is interpreted.-
2201-
2202 PathPercent allows you to manipulate the spacing between items on a-
2203 PathView's path. You can use it to bunch together items on part of-
2204 the path, and spread them out on other parts of the path.-
2205-
2206 The examples below show the normal distribution of items along a path-
2207 compared to a distribution which places 50% of the items along the-
2208 PathLine section of the path.-
2209 \table-
2210 \row-
2211 \li \image declarative-nopercent.png-
2212 \li-
2213 \qml-
2214 PathView {-
2215 // ...-
2216 Path {-
2217 startX: 20; startY: 0-
2218 PathQuad { x: 50; y: 80; controlX: 0; controlY: 80 }-
2219 PathLine { x: 150; y: 80 }-
2220 PathQuad { x: 180; y: 0; controlX: 200; controlY: 80 }-
2221 }-
2222 }-
2223 \endqml-
2224 \row-
2225 \li \image declarative-percent.png-
2226 \li-
2227 \qml-
2228 PathView {-
2229 // ...-
2230 Path {-
2231 startX: 20; startY: 0-
2232 PathQuad { x: 50; y: 80; controlX: 0; controlY: 80 }-
2233 PathPercent { value: 0.25 }-
2234 PathLine { x: 150; y: 80 }-
2235 PathPercent { value: 0.75 }-
2236 PathQuad { x: 180; y: 0; controlX: 200; controlY: 80 }-
2237 PathPercent { value: 1 }-
2238 }-
2239 }-
2240 \endqml-
2241 \endtable-
2242-
2243 \sa Path-
2244*/-
2245-
2246/*!-
2247 \qmlproperty real QtQuick::PathPercent::value-
2248 The proportion of items that should be laid out up to this point.-
2249-
2250 This value should always be higher than the last value specified-
2251 by a PathPercent at a previous position in the Path.-
2252-
2253 In the following example we have a Path made up of three PathLines.-
2254 Normally, the items of the PathView would be laid out equally along-
2255 this path, with an equal number of items per line segment. PathPercent-
2256 allows us to specify that the first and third lines should each hold-
2257 10% of the laid out items, while the second line should hold the remaining-
2258 80%.-
2259-
2260 \qml-
2261 PathView {-
2262 // ...-
2263 Path {-
2264 startX: 0; startY: 0-
2265 PathLine { x:100; y: 0; }-
2266 PathPercent { value: 0.1 }-
2267 PathLine { x: 100; y: 100 }-
2268 PathPercent { value: 0.9 }-
2269 PathLine { x: 100; y: 0 }-
2270 PathPercent { value: 1 }-
2271 }-
2272 }-
2273 \endqml-
2274*/-
2275-
2276qreal QQuickPathPercent::value() const-
2277{-
2278 return _value;
executed 10 times by 1 test: return _value;
Executed by:
  • tst_qquickpathview
10
2279}-
2280-
2281void QQuickPathPercent::setValue(qreal value)-
2282{-
2283 if (_value != value) {
_value != valueDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEnever evaluated
0-4
2284 _value = value;-
2285 emit valueChanged();-
2286 emit changed();-
2287 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
4
2288}
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
4
2289QT_END_NAMESPACE-
2290-
2291#include "moc_qquickpath_p.cpp"-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.0