OpenCoverage

qquickpathview.cpp

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/items/qquickpathview.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 "qquickpathview_p.h"-
41#include "qquickpathview_p_p.h"-
42#include "qquickwindow.h"-
43#include "qquickflickablebehavior_p.h" //Contains flicking behavior defines-
44#include "qquicktext_p.h"-
45-
46#include <QtQuick/private/qquickstate_p.h>-
47#include <private/qqmlglobal_p.h>-
48#include <private/qqmlopenmetaobject_p.h>-
49#include <private/qqmlchangeset_p.h>-
50-
51#include <QtQml/qqmlinfo.h>-
52#include <QtGui/qevent.h>-
53#include <QtGui/qevent.h>-
54#include <QtGui/qguiapplication.h>-
55#include <QtGui/qstylehints.h>-
56#include <QtCore/qmath.h>-
57-
58#include <cmath>-
59-
60QT_BEGIN_NAMESPACE-
61-
62Q_DECLARE_LOGGING_CATEGORY(lcItemViewDelegateLifecycle)-
63-
64const qreal MinimumFlickVelocity = 75.0;-
65-
66static QQmlOpenMetaObjectType *qPathViewAttachedType = nullptr;-
67-
68QQuickPathViewAttached::QQuickPathViewAttached(QObject *parent)-
69: QObject(parent), m_percent(-1), m_view(nullptr), m_onPath(false), m_isCurrent(false)-
70{-
71 if (qPathViewAttachedType) {
qPathViewAttachedTypeDescription
TRUEevaluated 1888 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 1450 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
1450-1888
72 m_metaobject = new QQmlOpenMetaObject(this, qPathViewAttachedType);-
73 m_metaobject->setCached(true);-
74 } else {
executed 1888 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
1888
75 m_metaobject = new QQmlOpenMetaObject(this);-
76 }
executed 1450 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
1450
77}-
78-
79QQuickPathViewAttached::~QQuickPathViewAttached()-
80{-
81}-
82-
83QVariant QQuickPathViewAttached::value(const QByteArray &name) const-
84{-
85 return m_metaobject->value(name);
never executed: return m_metaobject->value(name);
0
86}-
87void QQuickPathViewAttached::setValue(const QByteArray &name, const QVariant &val)-
88{-
89 m_metaobject->setValue(name, val);-
90}
executed 5154 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
5154
91-
92QQuickPathViewPrivate::QQuickPathViewPrivate()-
93 : path(nullptr), currentIndex(0), currentItemOffset(0.0), startPc(0)-
94 , offset(0.0), offsetAdj(0.0), mappedRange(1.0), mappedCache(0.0)-
95 , stealMouse(false), ownModel(false), interactive(true), haveHighlightRange(true)-
96 , autoHighlight(true), highlightUp(false), layoutScheduled(false)-
97 , moving(false), flicking(false), dragging(false), inRequest(false), delegateValidated(false)-
98 , inRefill(false)-
99 , dragMargin(0), deceleration(100), maximumFlickVelocity(QML_FLICK_DEFAULTMAXVELOCITY)-
100 , moveOffset(this, &QQuickPathViewPrivate::setAdjustedOffset), flickDuration(0)-
101 , pathItems(-1), requestedIndex(-1), cacheSize(0), requestedZ(0)-
102 , moveReason(Other), movementDirection(QQuickPathView::Shortest), moveDirection(QQuickPathView::Shortest)-
103 , attType(nullptr), highlightComponent(nullptr), highlightItem(nullptr)-
104 , moveHighlight(this, &QQuickPathViewPrivate::setHighlightPosition)-
105 , highlightPosition(0)-
106 , highlightRangeStart(0), highlightRangeEnd(0)-
107 , highlightRangeMode(QQuickPathView::StrictlyEnforceRange)-
108 , highlightMoveDuration(300), modelCount(0), snapMode(QQuickPathView::NoSnap)-
109{-
110}
executed 282 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
282
111-
112void QQuickPathViewPrivate::init()-
113{-
114 Q_Q(QQuickPathView);-
115 offset = 0;-
116 q->setAcceptedMouseButtons(Qt::LeftButton);-
117 q->setFlag(QQuickItem::ItemIsFocusScope);-
118 q->setFiltersChildMouseEvents(true);-
119 qmlobject_connect(&tl, QQuickTimeLine, SIGNAL(updated()),
executed 6 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
executed 6 times by 3 tests: methodIdx = QQuickPathView::staticMetaObject.indexOfSlot(method+1);
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
never executed: methodIdx = QQuickPathView::staticMetaObject.indexOfSignal(method+1);
signalIdx < 0Description
TRUEevaluated 6 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 276 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
methodIdx < 0Description
TRUEevaluated 6 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 276 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
code == 1Description
TRUEevaluated 6 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEnever evaluated
0-276
120 q, QQuickPathView, SLOT(ticked()))-
121 timer.invalidate();-
122 qmlobject_connect(&tl, QQuickTimeLine, SIGNAL(completed()),
executed 6 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
executed 6 times by 3 tests: methodIdx = QQuickPathView::staticMetaObject.indexOfSlot(method+1);
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
never executed: methodIdx = QQuickPathView::staticMetaObject.indexOfSignal(method+1);
signalIdx < 0Description
TRUEevaluated 6 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 276 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
methodIdx < 0Description
TRUEevaluated 6 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 276 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
code == 1Description
TRUEevaluated 6 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEnever evaluated
0-276
123 q, QQuickPathView, SLOT(movementEnding()))-
124}
executed 282 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
282
125-
126QQuickItem *QQuickPathViewPrivate::getItem(int modelIndex, qreal z, bool async)-
127{-
128 Q_Q(QQuickPathView);-
129 requestedIndex = modelIndex;-
130 requestedZ = z;-
131 inRequest = true;-
132 QObject *object = model->object(modelIndex, async ? QQmlIncubator::Asynchronous : QQmlIncubator::AsynchronousIfNested);-
133 QQuickItem *item = qmlobject_cast<QQuickItem*>(object);-
134 if (!item) {
!itemDescription
TRUEevaluated 30 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 4393 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
30-4393
135 if (object) {
objectDescription
TRUEnever evaluated
FALSEevaluated 30 times by 1 test
Evaluated by:
  • tst_qquickpathview
0-30
136 model->release(object);-
137 if (!delegateValidated) {
!delegateValidatedDescription
TRUEnever evaluated
FALSEnever evaluated
0
138 delegateValidated = true;-
139 QObject* delegate = q->delegate();-
140 qmlWarning(delegate ? delegate : q) << QQuickPathView::tr("Delegate must be of Item type");-
141 }
never executed: end of block
0
142 }
never executed: end of block
0
143 } else {
executed 30 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
30
144 item->setParentItem(q);-
145 requestedIndex = -1;-
146 QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item);-
147 itemPrivate->addItemChangeListener(this, QQuickItemPrivate::Geometry);-
148 }
executed 4393 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
4393
149 inRequest = false;-
150 return item;
executed 4423 times by 3 tests: return item;
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
4423
151}-
152-
153void QQuickPathView::createdItem(int index, QObject *object)-
154{-
155 Q_D(QQuickPathView);-
156 QQuickItem *item = qmlobject_cast<QQuickItem*>(object);-
157 if (d->requestedIndex != index) {
d->requestedIndex != indexDescription
TRUEevaluated 86 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
FALSEevaluated 3264 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
86-3264
158 qPathViewAttachedType = d->attachedType();-
159 QQuickPathViewAttached *att = static_cast<QQuickPathViewAttached *>(qmlAttachedPropertiesObject<QQuickPathView>(item));-
160 qPathViewAttachedType = nullptr;-
161 if (att) {
attDescription
TRUEevaluated 86 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
FALSEnever evaluated
0-86
162 att->m_view = this;-
163 att->setOnPath(false);-
164 }
executed 86 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
86
165 item->setParentItem(this);-
166 d->updateItem(item, 1.0);-
167 } else {
executed 86 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
86
168 d->requestedIndex = -1;-
169 if (!d->inRequest)
!d->inRequestDescription
TRUEevaluated 30 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 3234 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
30-3234
170 refill();
executed 30 times by 1 test: refill();
Executed by:
  • tst_qquickpathview
30
171 }
executed 3264 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
3264
172}-
173-
174void QQuickPathView::initItem(int index, QObject *object)-
175{-
176 Q_D(QQuickPathView);-
177 QQuickItem *item = qmlobject_cast<QQuickItem*>(object);-
178 if (item && d->requestedIndex == index) {
itemDescription
TRUEevaluated 3350 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEnever evaluated
d->requestedIndex == indexDescription
TRUEevaluated 3264 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 86 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
0-3350
179 QQuickItemPrivate::get(item)->setCulled(true);-
180 item->setParentItem(this);-
181 qPathViewAttachedType = d->attachedType();-
182 QQuickPathViewAttached *att = static_cast<QQuickPathViewAttached *>(qmlAttachedPropertiesObject<QQuickPathView>(item));-
183 qPathViewAttachedType = nullptr;-
184 if (att) {
attDescription
TRUEevaluated 3264 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEnever evaluated
0-3264
185 att->m_view = this;-
186 qreal percent = d->positionOfIndex(index);-
187 if (percent < 1.0 && d->path) {
percent < 1.0Description
TRUEevaluated 3218 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 46 times by 1 test
Evaluated by:
  • tst_qquickpathview
d->pathDescription
TRUEevaluated 3216 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpathview
2-3218
188 const auto attributes = d->path->attributes();-
189 for (const QString &attr : attributes)-
190 att->setValue(attr.toUtf8(), d->path->attributeAt(attr, percent));
executed 1710 times by 2 tests: att->setValue(attr.toUtf8(), d->path->attributeAt(attr, percent));
Executed by:
  • tst_examples
  • tst_qquickpathview
1710
191 item->setZ(d->requestedZ);-
192 }
executed 3216 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
3216
193 att->setOnPath(percent < 1.0);-
194 }
executed 3264 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
3264
195 }
executed 3264 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
3264
196}
executed 3350 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
3350
197-
198void QQuickPathViewPrivate::releaseItem(QQuickItem *item)-
199{-
200 if (!item || !model)
!itemDescription
TRUEnever evaluated
FALSEevaluated 4381 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
!modelDescription
TRUEevaluated 48 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 4333 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
0-4381
201 return;
executed 48 times by 1 test: return;
Executed by:
  • tst_qquickpathview
48
202 qCDebug(lcItemViewDelegateLifecycle) << "release" << item;
never executed: QMessageLogger(__FILE__, 202, __PRETTY_FUNCTION__, lcItemViewDelegateLifecycle().categoryName()).debug() << "release" << item;
qt_category_enabledDescription
TRUEnever evaluated
FALSEevaluated 4333 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
0-4333
203 QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item);-
204 itemPrivate->removeItemChangeListener(this, QQuickItemPrivate::Geometry);-
205 QQmlInstanceModel::ReleaseFlags flags = model->release(item);-
206 if (!flags) {
!flagsDescription
TRUEevaluated 1979 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 2354 times by 1 test
Evaluated by:
  • tst_qquickpathview
1979-2354
207 // item was not destroyed, and we no longer reference it.-
208 if (QQuickPathViewAttached *att = attached(item))
QQuickPathView...attached(item)Description
TRUEevaluated 1979 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEnever evaluated
0-1979
209 att->setOnPath(false);
executed 1979 times by 3 tests: att->setOnPath(false);
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
1979
210 } else if (flags & QQmlInstanceModel::Destroyed) {
executed 1979 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
flags & QQmlIn...del::DestroyedDescription
TRUEevaluated 1483 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 871 times by 1 test
Evaluated by:
  • tst_qquickpathview
871-1979
211 // but we still reference it-
212 item->setParentItem(nullptr);-
213 }
executed 1483 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
1483
214}
executed 4333 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
4333
215-
216QQuickPathViewAttached *QQuickPathViewPrivate::attached(QQuickItem *item)-
217{-
218 return static_cast<QQuickPathViewAttached *>(qmlAttachedPropertiesObject<QQuickPathView>(item, false));
executed 53457 times by 3 tests: return static_cast<QQuickPathViewAttached *>(qmlAttachedPropertiesObject<QQuickPathView>(item, false));
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
53457
219}-
220-
221QQmlOpenMetaObjectType *QQuickPathViewPrivate::attachedType()-
222{-
223 Q_Q(QQuickPathView);-
224 if (!attType) {
!attTypeDescription
TRUEevaluated 280 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 3070 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
280-3070
225 // pre-create one metatype to share with all attached objects-
226 attType = new QQmlOpenMetaObjectType(&QQuickPathViewAttached::staticMetaObject, qmlEngine(q));-
227 if (path) {
pathDescription
TRUEevaluated 278 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpathview
2-278
228 const auto attributes = path->attributes();-
229 for (const QString &attr : attributes)-
230 attType->createProperty(attr.toUtf8());
executed 174 times by 2 tests: attType->createProperty(attr.toUtf8());
Executed by:
  • tst_examples
  • tst_qquickpathview
174
231 }
executed 278 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
278
232 }
executed 280 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
280
233-
234 return attType;
executed 3350 times by 3 tests: return attType;
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
3350
235}-
236-
237void QQuickPathViewPrivate::clear()-
238{-
239 if (currentItem) {
currentItemDescription
TRUEevaluated 392 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 452 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
392-452
240 releaseItem(currentItem);-
241 currentItem = nullptr;-
242 }
executed 392 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
392
243-
244 for (QQuickItem *p : qAsConst(items))-
245 releaseItem(p);
executed 1832 times by 3 tests: releaseItem(p);
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
1832
246-
247 for (QQuickItem *p : qAsConst(itemCache))-
248 releaseItem(p);
executed 787 times by 1 test: releaseItem(p);
Executed by:
  • tst_qquickpathview
787
249-
250 if (requestedIndex >= 0) {
requestedIndex >= 0Description
TRUEnever evaluated
FALSEevaluated 844 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
0-844
251 if (model)
modelDescription
TRUEnever evaluated
FALSEnever evaluated
0
252 model->cancel(requestedIndex);
never executed: model->cancel(requestedIndex);
0
253 requestedIndex = -1;-
254 }
never executed: end of block
0
255-
256 items.clear();-
257 itemCache.clear();-
258 tl.clear();-
259}
executed 844 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
844
260-
261void QQuickPathViewPrivate::updateMappedRange()-
262{-
263 if (model && pathItems != -1 && pathItems < modelCount) {
pathItems != -1Description
TRUEevaluated 308 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
FALSEevaluated 410 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
pathItems < modelCountDescription
TRUEevaluated 194 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
FALSEevaluated 114 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
114-410
264 mappedRange = qreal(modelCount)/pathItems;-
265 mappedCache = qreal(cacheSize)/pathItems/2; // Half of cache at each end-
266 } else {
executed 194 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
194
267 mappedRange = 1.0;-
268 mappedCache = 0.0;-
269 }
executed 528 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
528
270}-
271-
272qreal QQuickPathViewPrivate::positionOfIndex(qreal index) const-
273{-
274 qreal pos = -1.0;-
275-
276 if (model && index >= 0 && index < modelCount) {
index >= 0Description
TRUEevaluated 51273 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEnever evaluated
index < modelCountDescription
TRUEevaluated 51273 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEnever evaluated
0-51273
277 qreal start = 0.0;-
278 if (haveHighlightRange && (highlightRangeMode != QQuickPathView::NoHighlightRange
haveHighlightRangeDescription
TRUEevaluated 51151 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 122 times by 1 test
Evaluated by:
  • tst_qquickpathview
highlightRange...HighlightRangeDescription
TRUEevaluated 47747 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 3404 times by 1 test
Evaluated by:
  • tst_qquickpathview
122-51151
279 || snapMode != QQuickPathView::NoSnap))
snapMode != QQ...thView::NoSnapDescription
TRUEevaluated 762 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 2642 times by 1 test
Evaluated by:
  • tst_qquickpathview
762-2642
280 start = highlightRangeStart;
executed 48509 times by 3 tests: start = highlightRangeStart;
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
48509
281 qreal globalPos = index + offset;-
282 globalPos = std::fmod(globalPos, qreal(modelCount)) / modelCount;-
283 if (pathItems != -1 && pathItems < modelCount) {
pathItems != -1Description
TRUEevaluated 33188 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
FALSEevaluated 18085 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
pathItems < modelCountDescription
TRUEevaluated 32984 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
FALSEevaluated 204 times by 1 test
Evaluated by:
  • tst_qquickpathview
204-33188
284 globalPos += start / mappedRange;-
285 globalPos = std::fmod(globalPos, qreal(1.0));-
286 pos = globalPos * mappedRange;-
287 } else {
executed 32984 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
32984
288 pos = std::fmod(globalPos + start, qreal(1.0));-
289 }
executed 18289 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
18289
290 }-
291-
292 return pos;
executed 51273 times by 3 tests: return pos;
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
51273
293}-
294-
295// returns true if position is between lower and upper, taking into-
296// account the circular space.-
297bool QQuickPathViewPrivate::isInBound(qreal position, qreal lower, qreal upper) const-
298{-
299 if (lower == upper)
lower == upperDescription
TRUEevaluated 80 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 5522 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
80-5522
300 return true;
executed 80 times by 1 test: return true;
Executed by:
  • tst_qquickpathview
80
301 if (lower > upper) {
lower > upperDescription
TRUEevaluated 1932 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 3590 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
1932-3590
302 if (position > upper && position > lower)
position > upperDescription
TRUEevaluated 1313 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 619 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
position > lowerDescription
TRUEevaluated 18 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 1295 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
18-1313
303 position -= mappedRange;
executed 18 times by 1 test: position -= mappedRange;
Executed by:
  • tst_qquickpathview
18
304 lower -= mappedRange;-
305 }
executed 1932 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
1932
306 return position >= lower && position < upper;
executed 5522 times by 3 tests: return position >= lower && position < upper;
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
5522
307}-
308-
309void QQuickPathViewPrivate::createHighlight()-
310{-
311 Q_Q(QQuickPathView);-
312 if (!q->isComponentComplete())
!q->isComponentComplete()Description
TRUEevaluated 116 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
FALSEevaluated 282 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
116-282
313 return;
executed 116 times by 2 tests: return;
Executed by:
  • tst_examples
  • tst_qquickpathview
116
314-
315 bool changed = false;-
316 if (highlightItem) {
highlightItemDescription
TRUEnever evaluated
FALSEevaluated 282 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
0-282
317 highlightItem->setParentItem(nullptr);-
318 highlightItem->deleteLater();-
319 highlightItem = nullptr;-
320 changed = true;-
321 }
never executed: end of block
0
322-
323 QQuickItem *item = nullptr;-
324 if (highlightComponent) {
highlightComponentDescription
TRUEevaluated 116 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
FALSEevaluated 166 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
116-166
325 QQmlContext *creationContext = highlightComponent->creationContext();-
326 QQmlContext *highlightContext = new QQmlContext(-
327 creationContext ? creationContext : qmlContext(q));-
328 QObject *nobj = highlightComponent->create(highlightContext);-
329 if (nobj) {
nobjDescription
TRUEevaluated 116 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
FALSEnever evaluated
0-116
330 QQml_setParent_noEvent(highlightContext, nobj);-
331 item = qobject_cast<QQuickItem *>(nobj);-
332 if (!item)
!itemDescription
TRUEnever evaluated
FALSEevaluated 116 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
0-116
333 delete nobj;
never executed: delete nobj;
0
334 } else {
executed 116 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
116
335 delete highlightContext;-
336 }
never executed: end of block
0
337 } else {-
338 item = new QQuickItem;-
339 }
executed 166 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
166
340 if (item) {
itemDescription
TRUEevaluated 282 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEnever evaluated
0-282
341 QQml_setParent_noEvent(item, q);-
342 item->setParentItem(q);-
343 highlightItem = item;-
344 changed = true;-
345 }
executed 282 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
282
346 if (changed)
changedDescription
TRUEevaluated 282 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEnever evaluated
0-282
347 emit q->highlightItemChanged();
executed 282 times by 3 tests: q->highlightItemChanged();
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
282
348}
executed 282 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
282
349-
350void QQuickPathViewPrivate::updateHighlight()-
351{-
352 Q_Q(QQuickPathView);-
353 if (!q->isComponentComplete() || !isValid())
!q->isComponentComplete()Description
TRUEevaluated 116 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
FALSEevaluated 426 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
!isValid()Description
TRUEevaluated 16 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
FALSEevaluated 410 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
16-426
354 return;
executed 132 times by 2 tests: return;
Executed by:
  • tst_examples
  • tst_qquickpathview
132
355 if (highlightItem) {
highlightItemDescription
TRUEevaluated 410 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEnever evaluated
0-410
356 if (haveHighlightRange && highlightRangeMode == QQuickPathView::StrictlyEnforceRange) {
haveHighlightRangeDescription
TRUEevaluated 410 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEnever evaluated
highlightRange...lyEnforceRangeDescription
TRUEevaluated 334 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 76 times by 1 test
Evaluated by:
  • tst_qquickpathview
0-410
357 updateItem(highlightItem, highlightRangeStart);-
358 } else {
executed 334 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
334
359 qreal target = currentIndex;-
360-
361 offsetAdj = 0.0;-
362 tl.reset(moveHighlight);-
363 moveHighlight.setValue(highlightPosition);-
364-
365 const int duration = highlightMoveDuration;-
366-
367 if (target - highlightPosition > modelCount/2) {
target - highl...> modelCount/2Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 74 times by 1 test
Evaluated by:
  • tst_qquickpathview
2-74
368 highlightUp = false;-
369 qreal distance = modelCount - target + highlightPosition;-
370 tl.move(moveHighlight, 0.0, QEasingCurve(QEasingCurve::InQuad), int(duration * highlightPosition / distance));-
371 tl.set(moveHighlight, modelCount-0.01);-
372 tl.move(moveHighlight, target, QEasingCurve(QEasingCurve::OutQuad), int(duration * (modelCount-target) / distance));-
373 } else if (target - highlightPosition <= -modelCount/2) {
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
target - highl... -modelCount/2Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 72 times by 1 test
Evaluated by:
  • tst_qquickpathview
2-72
374 highlightUp = true;-
375 qreal distance = modelCount - highlightPosition + target;-
376 tl.move(moveHighlight, modelCount-0.01, QEasingCurve(QEasingCurve::InQuad), int(duration * (modelCount-highlightPosition) / distance));-
377 tl.set(moveHighlight, 0.0);-
378 tl.move(moveHighlight, target, QEasingCurve(QEasingCurve::OutQuad), int(duration * target / distance));-
379 } else {
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
2
380 highlightUp = highlightPosition - target < 0;-
381 tl.move(moveHighlight, target, QEasingCurve(QEasingCurve::InOutQuad), duration);-
382 }
executed 72 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
72
383 }-
384 }-
385}
executed 410 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
410
386-
387void QQuickPathViewPrivate::setHighlightPosition(qreal pos)-
388{-
389 if (pos != highlightPosition) {
pos != highlightPositionDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 76 times by 1 test
Evaluated by:
  • tst_qquickpathview
2-76
390 qreal start = 0.0;-
391 qreal end = 1.0;-
392 if (haveHighlightRange && highlightRangeMode != QQuickPathView::NoHighlightRange) {
haveHighlightRangeDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEnever evaluated
highlightRange...HighlightRangeDescription
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpathview
0-2
393 start = highlightRangeStart;-
394 end = highlightRangeEnd;-
395 }
never executed: end of block
0
396-
397 qreal range = qreal(modelCount);-
398 // calc normalized position of highlight relative to offset-
399 qreal relativeHighlight = std::fmod(pos + offset, range) / range;-
400-
401 if (!highlightUp && relativeHighlight > end / mappedRange) {
!highlightUpDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEnever evaluated
relativeHighli... / mappedRangeDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEnever evaluated
0-2
402 qreal diff = 1.0 - relativeHighlight;-
403 setOffset(offset + diff * range);-
404 } else if (highlightUp && relativeHighlight >= (end - start) / mappedRange) {
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
highlightUpDescription
TRUEnever evaluated
FALSEnever evaluated
relativeHighli... / mappedRangeDescription
TRUEnever evaluated
FALSEnever evaluated
0-2
405 qreal diff = relativeHighlight - (end - start) / mappedRange;-
406 setOffset(offset - diff * range - 0.00001);-
407 }
never executed: end of block
0
408-
409 highlightPosition = pos;-
410 qreal pathPos = positionOfIndex(pos);-
411 updateItem(highlightItem, pathPos);-
412 if (QQuickPathViewAttached *att = attached(highlightItem))
QQuickPathView...highlightItem)Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpathview
0-2
413 att->setOnPath(pathPos < 1.0);
never executed: att->setOnPath(pathPos < 1.0);
0
414 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
2
415}
executed 78 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
78
416-
417void QQuickPathView::pathUpdated()-
418{-
419 Q_D(QQuickPathView);-
420 for (QQuickItem *item : qAsConst(d->items)) {-
421 if (QQuickPathViewAttached *att = d->attached(item))
QQuickPathView...attached(item)Description
TRUEevaluated 100 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEnever evaluated
0-100
422 att->m_percent = -1;
executed 100 times by 1 test: att->m_percent = -1;
Executed by:
  • tst_qquickpathview
100
423 }
executed 100 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
100
424 refill();-
425}
executed 312 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
312
426-
427void QQuickPathViewPrivate::updateItem(QQuickItem *item, qreal percent)-
428{-
429 if (!path)
!pathDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 45324 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
2-45324
430 return;
executed 2 times by 1 test: return;
Executed by:
  • tst_qquickpathview
2
431 if (QQuickPathViewAttached *att = attached(item)) {
QQuickPathView...attached(item)Description
TRUEevaluated 41074 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 4250 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
4250-41074
432 if (qFuzzyCompare(att->m_percent, percent))
qFuzzyCompare(...cent, percent)Description
TRUEevaluated 309 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 40765 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
309-40765
433 return;
executed 309 times by 1 test: return;
Executed by:
  • tst_qquickpathview
309
434 att->m_percent = percent;-
435 const auto attributes = path->attributes();-
436 for (const QString &attr : attributes)-
437 att->setValue(attr.toUtf8(), path->attributeAt(attr, percent));
executed 3444 times by 2 tests: att->setValue(attr.toUtf8(), path->attributeAt(attr, percent));
Executed by:
  • tst_examples
  • tst_qquickpathview
3444
438 att->setOnPath(percent < 1.0);-
439 }
executed 40765 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
40765
440 QQuickItemPrivate::get(item)->setCulled(percent >= 1.0);-
441 QPointF pf = path->pointAt(qMin(percent, qreal(1.0)));-
442 item->setX(pf.x() - item->width()/2);-
443 item->setY(pf.y() - item->height()/2);-
444}
executed 45015 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
45015
445-
446void QQuickPathViewPrivate::regenerate()-
447{-
448 Q_Q(QQuickPathView);-
449 if (!q->isComponentComplete())
!q->isComponentComplete()Description
TRUEevaluated 542 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 430 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
430-542
450 return;
executed 542 times by 3 tests: return;
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
542
451-
452 clear();-
453-
454 if (!isValid())
!isValid()Description
TRUEevaluated 20 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
FALSEevaluated 410 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
20-410
455 return;
executed 20 times by 2 tests: return;
Executed by:
  • tst_examples
  • tst_qquickpathview
20
456-
457 updateMappedRange();-
458 q->refill();-
459}
executed 410 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
410
460-
461void QQuickPathViewPrivate::setDragging(bool d)-
462{-
463 Q_Q(QQuickPathView);-
464 if (dragging == d)
dragging == dDescription
TRUEevaluated 68 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 44 times by 1 test
Evaluated by:
  • tst_qquickpathview
44-68
465 return;
executed 68 times by 1 test: return;
Executed by:
  • tst_qquickpathview
68
466-
467 dragging = d;-
468 if (dragging)
draggingDescription
TRUEevaluated 22 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 22 times by 1 test
Evaluated by:
  • tst_qquickpathview
22
469 emit q->dragStarted();
executed 22 times by 1 test: q->dragStarted();
Executed by:
  • tst_qquickpathview
22
470 else-
471 emit q->dragEnded();
executed 22 times by 1 test: q->dragEnded();
Executed by:
  • tst_qquickpathview
22
472-
473 emit q->draggingChanged();-
474}
executed 44 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
44
475-
476/*!-
477 \qmltype PathView-
478 \instantiates QQuickPathView-
479 \inqmlmodule QtQuick-
480 \ingroup qtquick-paths-
481 \ingroup qtquick-views-
482 \inherits Item-
483 \brief Lays out model-provided items on a path.-
484-
485 A PathView displays data from models created from built-in QML types like ListModel-
486 and XmlListModel, or custom model classes defined in C++ that inherit from-
487 QAbstractListModel.-
488-
489 The view has a \l model, which defines the data to be displayed, and-
490 a \l delegate, which defines how the data should be displayed.-
491 The \l delegate is instantiated for each item on the \l path.-
492 The items may be flicked to move them along the path.-
493-
494 For example, if there is a simple list model defined in a file \c ContactModel.qml like this:-
495-
496 \snippet qml/pathview/ContactModel.qml 0-
497-
498 This data can be represented as a PathView, like this:-
499-
500 \snippet qml/pathview/pathview.qml 0-
501-
502 \image pathview.gif-
503-
504 (Note the above example uses PathAttribute to scale and modify the-
505 opacity of the items as they rotate. This additional code can be seen in the-
506 PathAttribute documentation.)-
507-
508 PathView does not automatically handle keyboard navigation. This is because-
509 the keys to use for navigation will depend upon the shape of the path. Navigation-
510 can be added quite simply by setting \c focus to \c true and calling-
511 \l decrementCurrentIndex() or \l incrementCurrentIndex(), for example to navigate-
512 using the left and right arrow keys:-
513-
514 \qml-
515 PathView {-
516 // ...-
517 focus: true-
518 Keys.onLeftPressed: decrementCurrentIndex()-
519 Keys.onRightPressed: incrementCurrentIndex()-
520 }-
521 \endqml-
522-
523 The path view itself is a focus scope (see \l{Keyboard Focus in Qt Quick} for more details).-
524-
525 Delegates are instantiated as needed and may be destroyed at any time.-
526 State should \e never be stored in a delegate.-
527-
528 PathView attaches a number of properties to the root item of the delegate, for example-
529 \c {PathView.isCurrentItem}. In the following example, the root delegate item can access-
530 this attached property directly as \c PathView.isCurrentItem, while the child-
531 \c nameText object must refer to this property as \c wrapper.PathView.isCurrentItem.-
532-
533 \snippet qml/pathview/pathview.qml 1-
534-
535 \b Note that views do not enable \e clip automatically. If the view-
536 is not clipped by another item or the screen, it will be necessary-
537 to set \e {clip: true} in order to have the out of view items clipped-
538 nicely.-
539-
540 \sa Path, {QML Data Models}, ListView, GridView, {Qt Quick Examples - Views}-
541*/-
542-
543QQuickPathView::QQuickPathView(QQuickItem *parent)-
544 : QQuickItem(*(new QQuickPathViewPrivate), parent)-
545{-
546 Q_D(QQuickPathView);-
547 d->init();-
548}
executed 282 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
282
549-
550QQuickPathView::~QQuickPathView()-
551{-
552 Q_D(QQuickPathView);-
553 d->clear();-
554 if (d->attType)
d->attTypeDescription
TRUEevaluated 276 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickpathview
6-276
555 d->attType->release();
executed 276 times by 3 tests: d->attType->release();
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
276
556 if (d->ownModel)
d->ownModelDescription
TRUEevaluated 260 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 22 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
22-260
557 delete d->model;
executed 260 times by 3 tests: delete d->model;
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
260
558}
executed 282 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
282
559-
560/*!-
561 \qmlattachedproperty PathView QtQuick::PathView::view-
562 This attached property holds the view that manages this delegate instance.-
563-
564 It is attached to each instance of the delegate.-
565*/-
566-
567/*!-
568 \qmlattachedproperty bool QtQuick::PathView::onPath-
569 This attached property holds whether the item is currently on the path.-
570-
571 If a pathItemCount has been set, it is possible that some items may-
572 be instantiated, but not considered to be currently on the path.-
573 Usually, these items would be set invisible, for example:-
574-
575 \qml-
576 Component {-
577 Rectangle {-
578 visible: PathView.onPath-
579 // ...-
580 }-
581 }-
582 \endqml-
583-
584 It is attached to each instance of the delegate.-
585*/-
586-
587/*!-
588 \qmlattachedproperty bool QtQuick::PathView::isCurrentItem-
589 This attached property is true if this delegate is the current item; otherwise false.-
590-
591 It is attached to each instance of the delegate.-
592-
593 This property may be used to adjust the appearance of the current item.-
594-
595 \snippet qml/pathview/pathview.qml 1-
596*/-
597-
598/*!-
599 \qmlproperty model QtQuick::PathView::model-
600 This property holds the model providing data for the view.-
601-
602 The model provides a set of data that is used to create the items for the view.-
603 For large or dynamic datasets the model is usually provided by a C++ model object.-
604 Models can also be created directly in QML, using the ListModel type.-
605-
606 \note changing the model will reset the offset and currentIndex to 0.-
607-
608 \sa {qml-data-models}{Data Models}-
609*/-
610QVariant QQuickPathView::model() const-
611{-
612 Q_D(const QQuickPathView);-
613 return d->modelVariant;
executed 22 times by 1 test: return d->modelVariant;
Executed by:
  • tst_qquickpathview
22
614}-
615-
616void QQuickPathView::setModel(const QVariant &m)-
617{-
618 Q_D(QQuickPathView);-
619 QVariant model = m;-
620 if (model.userType() == qMetaTypeId<QJSValue>())
model.userType...Id<QJSValue>()Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 282 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
6-282
621 model = model.value<QJSValue>().toVariant();
executed 6 times by 1 test: model = model.value<QJSValue>().toVariant();
Executed by:
  • tst_qquickpathview
6
622-
623 if (d->modelVariant == model)
d->modelVariant == modelDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 284 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
4-284
624 return;
executed 4 times by 1 test: return;
Executed by:
  • tst_qquickpathview
4
625-
626 if (d->model) {
d->modelDescription
TRUEevaluated 126 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 158 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
126-158
627 qmlobject_disconnect(d->model, QQmlInstanceModel, SIGNAL(modelUpdated(QQmlChangeSet,bool)),
executed 6 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
executed 6 times by 3 tests: methodIdx = QQuickPathView::staticMetaObject.indexOfSlot(method+1);
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
never executed: methodIdx = QQuickPathView::staticMetaObject.indexOfSignal(method+1);
signalIdx < 0Description
TRUEevaluated 6 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 120 times by 1 test
Evaluated by:
  • tst_qquickpathview
methodIdx < 0Description
TRUEevaluated 6 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 120 times by 1 test
Evaluated by:
  • tst_qquickpathview
code == 1Description
TRUEevaluated 6 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEnever evaluated
0-120
628 this, QQuickPathView, SLOT(modelUpdated(QQmlChangeSet,bool)));-
629 qmlobject_disconnect(d->model, QQmlInstanceModel, SIGNAL(createdItem(int,QObject*)),
executed 6 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
executed 6 times by 3 tests: methodIdx = QQuickPathView::staticMetaObject.indexOfSlot(method+1);
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
never executed: methodIdx = QQuickPathView::staticMetaObject.indexOfSignal(method+1);
signalIdx < 0Description
TRUEevaluated 6 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 120 times by 1 test
Evaluated by:
  • tst_qquickpathview
methodIdx < 0Description
TRUEevaluated 6 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 120 times by 1 test
Evaluated by:
  • tst_qquickpathview
code == 1Description
TRUEevaluated 6 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEnever evaluated
0-120
630 this, QQuickPathView, SLOT(createdItem(int,QObject*)));-
631 qmlobject_disconnect(d->model, QQmlInstanceModel, SIGNAL(initItem(int,QObject*)),
executed 6 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
executed 6 times by 3 tests: methodIdx = QQuickPathView::staticMetaObject.indexOfSlot(method+1);
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
never executed: methodIdx = QQuickPathView::staticMetaObject.indexOfSignal(method+1);
signalIdx < 0Description
TRUEevaluated 6 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 120 times by 1 test
Evaluated by:
  • tst_qquickpathview
methodIdx < 0Description
TRUEevaluated 6 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 120 times by 1 test
Evaluated by:
  • tst_qquickpathview
code == 1Description
TRUEevaluated 6 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEnever evaluated
0-120
632 this, QQuickPathView, SLOT(initItem(int,QObject*)));-
633 d->clear();-
634 }
executed 126 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
126
635-
636 d->modelVariant = model;-
637 QObject *object = qvariant_cast<QObject*>(model);-
638 QQmlInstanceModel *vim = nullptr;-
639 if (object && (vim = qobject_cast<QQmlInstanceModel *>(object))) {
objectDescription
TRUEevaluated 248 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 36 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
(vim = qobject...el *>(object))Description
TRUEevaluated 20 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
FALSEevaluated 228 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
20-248
640 if (d->ownModel) {
d->ownModelDescription
TRUEnever evaluated
FALSEevaluated 20 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
0-20
641 delete d->model;-
642 d->ownModel = false;-
643 }
never executed: end of block
0
644 d->model = vim;-
645 } else {
executed 20 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
20
646 if (!d->ownModel) {
!d->ownModelDescription
TRUEevaluated 138 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
FALSEevaluated 126 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
126-138
647 d->model = new QQmlDelegateModel(qmlContext(this));-
648 d->ownModel = true;-
649 if (isComponentComplete())
isComponentComplete()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 136 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
2-136
650 static_cast<QQmlDelegateModel *>(d->model.data())->componentComplete();
executed 2 times by 1 test: static_cast<QQmlDelegateModel *>(d->model.data())->componentComplete();
Executed by:
  • tst_qquickpathview
2
651 }
executed 138 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
138
652 if (QQmlDelegateModel *dataModel = qobject_cast<QQmlDelegateModel*>(d->model))
QQmlDelegateMo...el*>(d->model)Description
TRUEevaluated 264 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEnever evaluated
0-264
653 dataModel->setModel(model);
executed 264 times by 3 tests: dataModel->setModel(model);
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
264
654 }
executed 264 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
264
655 int oldModelCount = d->modelCount;-
656 d->modelCount = 0;-
657 if (d->model) {
d->modelDescription
TRUEevaluated 284 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEnever evaluated
0-284
658 qmlobject_connect(d->model, QQmlInstanceModel, SIGNAL(modelUpdated(QQmlChangeSet,bool)),
executed 6 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
executed 6 times by 3 tests: methodIdx = QQuickPathView::staticMetaObject.indexOfSlot(method+1);
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
never executed: methodIdx = QQuickPathView::staticMetaObject.indexOfSignal(method+1);
signalIdx < 0Description
TRUEevaluated 6 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 278 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
methodIdx < 0Description
TRUEevaluated 6 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 278 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
code == 1Description
TRUEevaluated 6 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEnever evaluated
0-278
659 this, QQuickPathView, SLOT(modelUpdated(QQmlChangeSet,bool)));-
660 qmlobject_connect(d->model, QQmlInstanceModel, SIGNAL(createdItem(int,QObject*)),
executed 6 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
executed 6 times by 3 tests: methodIdx = QQuickPathView::staticMetaObject.indexOfSlot(method+1);
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
never executed: methodIdx = QQuickPathView::staticMetaObject.indexOfSignal(method+1);
signalIdx < 0Description
TRUEevaluated 6 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 278 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
methodIdx < 0Description
TRUEevaluated 6 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 278 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
code == 1Description
TRUEevaluated 6 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEnever evaluated
0-278
661 this, QQuickPathView, SLOT(createdItem(int,QObject*)));-
662 qmlobject_connect(d->model, QQmlInstanceModel, SIGNAL(initItem(int,QObject*)),
executed 6 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
executed 6 times by 3 tests: methodIdx = QQuickPathView::staticMetaObject.indexOfSlot(method+1);
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
never executed: methodIdx = QQuickPathView::staticMetaObject.indexOfSignal(method+1);
signalIdx < 0Description
TRUEevaluated 6 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 278 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
methodIdx < 0Description
TRUEevaluated 6 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 278 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
code == 1Description
TRUEevaluated 6 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEnever evaluated
0-278
663 this, QQuickPathView, SLOT(initItem(int,QObject*)));-
664 d->modelCount = d->model->count();-
665 }
executed 284 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
284
666 if (isComponentComplete()) {
isComponentComplete()Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 278 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
6-278
667 if (d->currentIndex != 0) {
d->currentIndex != 0Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickpathview
2-4
668 d->currentIndex = 0;-
669 emit currentIndexChanged();-
670 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
2
671 if (d->offset != 0.0) {
d->offset != 0.0Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickpathview
2-4
672 d->offset = 0;-
673 emit offsetChanged();-
674 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
2
675 }
executed 6 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
6
676 d->regenerate();-
677 if (d->modelCount != oldModelCount)
d->modelCount != oldModelCountDescription
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 270 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
14-270
678 emit countChanged();
executed 14 times by 1 test: countChanged();
Executed by:
  • tst_qquickpathview
14
679 emit modelChanged();-
680}
executed 284 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
284
681-
682/*!-
683 \qmlproperty int QtQuick::PathView::count-
684 This property holds the number of items in the model.-
685*/-
686int QQuickPathView::count() const-
687{-
688 Q_D(const QQuickPathView);-
689 return d->model ? d->modelCount : 0;
executed 358 times by 1 test: return d->model ? d->modelCount : 0;
Executed by:
  • tst_qquickpathview
358
690}-
691-
692/*!-
693 \qmlproperty Path QtQuick::PathView::path-
694 This property holds the path used to lay out the items.-
695 For more information see the \l Path documentation.-
696*/-
697QQuickPath *QQuickPathView::path() const-
698{-
699 Q_D(const QQuickPathView);-
700 return d->path;
executed 58 times by 1 test: return d->path;
Executed by:
  • tst_qquickpathview
58
701}-
702-
703void QQuickPathView::setPath(QQuickPath *path)-
704{-
705 Q_D(QQuickPathView);-
706 if (d->path == path)
d->path == pathDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 280 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
2-280
707 return;
executed 2 times by 1 test: return;
Executed by:
  • tst_qquickpathview
2
708 if (d->path)
d->pathDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 276 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
4-276
709 qmlobject_disconnect(d->path, QQuickPath, SIGNAL(changed()),
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
executed 2 times by 1 test: methodIdx = QQuickPathView::staticMetaObject.indexOfSlot(method+1);
Executed by:
  • tst_qquickpathview
never executed: methodIdx = QQuickPathView::staticMetaObject.indexOfSignal(method+1);
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
signalIdx < 0Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpathview
methodIdx < 0Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpathview
code == 1Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEnever evaluated
0-4
710 this, QQuickPathView, SLOT(pathUpdated()));-
711 d->path = path;-
712-
713 if (path) {
pathDescription
TRUEevaluated 278 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpathview
2-278
714 qmlobject_connect(d->path, QQuickPath, SIGNAL(changed()),
executed 6 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
executed 6 times by 3 tests: methodIdx = QQuickPathView::staticMetaObject.indexOfSlot(method+1);
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
never executed: methodIdx = QQuickPathView::staticMetaObject.indexOfSignal(method+1);
signalIdx < 0Description
TRUEevaluated 6 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 272 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
methodIdx < 0Description
TRUEevaluated 6 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 272 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
code == 1Description
TRUEevaluated 6 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEnever evaluated
0-272
715 this, QQuickPathView, SLOT(pathUpdated()));-
716 }
executed 278 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
278
717-
718 if (isComponentComplete()) {
isComponentComplete()Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 274 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
6-274
719 d->clear();-
720 if (d->isValid()) {
d->isValid()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpathview
2-4
721 if (d->attType) {
d->attTypeDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEnever evaluated
0-4
722 d->attType->release();-
723 d->attType = nullptr;-
724 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
4
725 d->regenerate();-
726 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
4
727 }
executed 6 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
6
728-
729 emit pathChanged();-
730}
executed 280 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
280
731-
732/*!-
733 \qmlproperty int QtQuick::PathView::currentIndex-
734 This property holds the index of the current item.-
735*/-
736int QQuickPathView::currentIndex() const-
737{-
738 Q_D(const QQuickPathView);-
739 return d->currentIndex;
executed 845 times by 2 tests: return d->currentIndex;
Executed by:
  • tst_examples
  • tst_qquickpathview
845
740}-
741-
742void QQuickPathView::setCurrentIndex(int idx)-
743{-
744 Q_D(QQuickPathView);-
745 if (!isComponentComplete()) {
!isComponentComplete()Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 146 times by 1 test
Evaluated by:
  • tst_qquickpathview
6-146
746 if (idx != d->currentIndex) {
idx != d->currentIndexDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEnever evaluated
0-6
747 d->currentIndex = idx;-
748 emit currentIndexChanged();-
749 }
executed 6 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
6
750 return;
executed 6 times by 1 test: return;
Executed by:
  • tst_qquickpathview
6
751 }-
752-
753 idx = d->modelCount
d->modelCountDescription
TRUEevaluated 146 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEnever evaluated
0-146
754 ? ((idx % d->modelCount) + d->modelCount) % d->modelCount-
755 : 0;-
756 if (d->model && (idx != d->currentIndex || !d->currentItem)) {
idx != d->currentIndexDescription
TRUEevaluated 144 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpathview
!d->currentItemDescription
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpathview
0-144
757 if (d->currentItem) {
d->currentItemDescription
TRUEevaluated 144 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEnever evaluated
0-144
758 if (QQuickPathViewAttached *att = d->attached(d->currentItem))
QQuickPathView...->currentItem)Description
TRUEevaluated 144 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEnever evaluated
0-144
759 att->setIsCurrentItem(false);
executed 144 times by 1 test: att->setIsCurrentItem(false);
Executed by:
  • tst_qquickpathview
144
760 d->releaseItem(d->currentItem);-
761 }
executed 144 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
144
762 int oldCurrentIdx = d->currentIndex;-
763 QQuickItem *oldCurrentItem = d->currentItem;-
764 d->currentItem = nullptr;-
765 d->moveReason = QQuickPathViewPrivate::SetIndex;-
766 d->currentIndex = idx;-
767 if (d->modelCount) {
d->modelCountDescription
TRUEevaluated 144 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEnever evaluated
0-144
768 d->createCurrentItem();-
769 if (d->haveHighlightRange && d->highlightRangeMode == QQuickPathView::StrictlyEnforceRange)
d->haveHighlightRangeDescription
TRUEevaluated 144 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEnever evaluated
d->highlightRa...lyEnforceRangeDescription
TRUEevaluated 76 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 68 times by 1 test
Evaluated by:
  • tst_qquickpathview
0-144
770 d->snapToIndex(d->currentIndex, QQuickPathViewPrivate::SetIndex);
executed 76 times by 1 test: d->snapToIndex(d->currentIndex, QQuickPathViewPrivate::SetIndex);
Executed by:
  • tst_qquickpathview
76
771 d->currentItemOffset = d->positionOfIndex(d->currentIndex);-
772 d->updateHighlight();-
773 }
executed 144 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
144
774 if (oldCurrentIdx != d->currentIndex)
oldCurrentIdx ...->currentIndexDescription
TRUEevaluated 144 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEnever evaluated
0-144
775 emit currentIndexChanged();
executed 144 times by 1 test: currentIndexChanged();
Executed by:
  • tst_qquickpathview
144
776 if (oldCurrentItem != d->currentItem)
oldCurrentItem...d->currentItemDescription
TRUEevaluated 144 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEnever evaluated
0-144
777 emit currentItemChanged();
executed 144 times by 1 test: currentItemChanged();
Executed by:
  • tst_qquickpathview
144
778 }
executed 144 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
144
779}
executed 146 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
146
780-
781/*!-
782 \qmlproperty Item QtQuick::PathView::currentItem-
783 This property holds the current item in the view.-
784*/-
785QQuickItem *QQuickPathView::currentItem() const-
786{-
787 Q_D(const QQuickPathView);-
788 return d->currentItem;
executed 44 times by 1 test: return d->currentItem;
Executed by:
  • tst_qquickpathview
44
789}-
790-
791/*!-
792 \qmlmethod QtQuick::PathView::incrementCurrentIndex()-
793-
794 Increments the current index.-
795-
796 \b Note: methods should only be called after the Component has completed.-
797*/-
798void QQuickPathView::incrementCurrentIndex()-
799{-
800 Q_D(QQuickPathView);-
801 d->moveDirection = QQuickPathView::Positive;-
802 setCurrentIndex(currentIndex()+1);-
803}
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
4
804-
805/*!-
806 \qmlmethod QtQuick::PathView::decrementCurrentIndex()-
807-
808 Decrements the current index.-
809-
810 \b Note: methods should only be called after the Component has completed.-
811*/-
812void QQuickPathView::decrementCurrentIndex()-
813{-
814 Q_D(QQuickPathView);-
815 d->moveDirection = QQuickPathView::Negative;-
816 setCurrentIndex(currentIndex()-1);-
817}
executed 12 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
12
818-
819/*!-
820 \qmlproperty real QtQuick::PathView::offset-
821-
822 The offset specifies how far along the path the items are from their initial positions.-
823 This is a real number that ranges from 0.0 to the count of items in the model.-
824*/-
825qreal QQuickPathView::offset() const-
826{-
827 Q_D(const QQuickPathView);-
828 return d->offset;
executed 1706 times by 1 test: return d->offset;
Executed by:
  • tst_qquickpathview
1706
829}-
830-
831void QQuickPathView::setOffset(qreal offset)-
832{-
833 Q_D(QQuickPathView);-
834 d->moveReason = QQuickPathViewPrivate::Other;-
835 d->setOffset(offset);-
836 d->updateCurrent();-
837}
executed 328 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
328
838-
839void QQuickPathViewPrivate::setOffset(qreal o)-
840{-
841 Q_Q(QQuickPathView);-
842 if (offset != o) {
offset != oDescription
TRUEevaluated 3491 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 124 times by 1 test
Evaluated by:
  • tst_qquickpathview
124-3491
843 if (isValid() && q->isComponentComplete()) {
isValid()Description
TRUEevaluated 3417 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 74 times by 1 test
Evaluated by:
  • tst_qquickpathview
q->isComponentComplete()Description
TRUEevaluated 3417 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEnever evaluated
0-3417
844 qreal oldOffset = offset;-
845 offset = std::fmod(o, qreal(modelCount));-
846 if (offset < 0)
offset < 0Description
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 3401 times by 1 test
Evaluated by:
  • tst_qquickpathview
16-3401
847 offset += qreal(modelCount);
executed 16 times by 1 test: offset += qreal(modelCount);
Executed by:
  • tst_qquickpathview
16
848 qCDebug(lcItemViewDelegateLifecycle) << o << "was" << oldOffset << "now" << offset;
never executed: QMessageLogger(__FILE__, 848, __PRETTY_FUNCTION__, lcItemViewDelegateLifecycle().categoryName()).debug() << o << "was" << oldOffset << "now" << offset;
qt_category_enabledDescription
TRUEnever evaluated
FALSEevaluated 3417 times by 1 test
Evaluated by:
  • tst_qquickpathview
0-3417
849 q->refill();-
850 } else {
executed 3417 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
3417
851 offset = o;-
852 }
executed 74 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
74
853 emit q->offsetChanged();-
854 }
executed 3491 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
3491
855}
executed 3615 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
3615
856-
857void QQuickPathViewPrivate::setAdjustedOffset(qreal o)-
858{-
859 setOffset(o+offsetAdj);-
860}
executed 3285 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
3285
861-
862/*!-
863 \qmlproperty Component QtQuick::PathView::highlight-
864 This property holds the component to use as the highlight.-
865-
866 An instance of the highlight component will be created for each view.-
867 The geometry of the resultant component instance will be managed by the view-
868 so as to stay with the current item.-
869-
870 The below example demonstrates how to make a simple highlight. Note the use-
871 of the \l{PathView::onPath}{PathView.onPath} attached property to ensure that-
872 the highlight is hidden when flicked away from the path.-
873-
874 \qml-
875 Component {-
876 Rectangle {-
877 visible: PathView.onPath-
878 // ...-
879 }-
880 }-
881 \endqml-
882-
883 \sa highlightItem, highlightRangeMode-
884*/-
885-
886QQmlComponent *QQuickPathView::highlight() const-
887{-
888 Q_D(const QQuickPathView);-
889 return d->highlightComponent;
never executed: return d->highlightComponent;
0
890}-
891-
892void QQuickPathView::setHighlight(QQmlComponent *highlight)-
893{-
894 Q_D(QQuickPathView);-
895 if (highlight != d->highlightComponent) {
highlight != d...lightComponentDescription
TRUEevaluated 116 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
FALSEnever evaluated
0-116
896 d->highlightComponent = highlight;-
897 d->createHighlight();-
898 d->updateHighlight();-
899 emit highlightChanged();-
900 }
executed 116 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
116
901}
executed 116 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
116
902-
903/*!-
904 \qmlproperty Item QtQuick::PathView::highlightItem-
905-
906 \c highlightItem holds the highlight item, which was created-
907 from the \l highlight component.-
908-
909 \sa highlight-
910*/-
911QQuickItem *QQuickPathView::highlightItem() const-
912{-
913 Q_D(const QQuickPathView);-
914 return d->highlightItem;
executed 10 times by 1 test: return d->highlightItem;
Executed by:
  • tst_qquickpathview
10
915}-
916/*!-
917 \qmlproperty real QtQuick::PathView::preferredHighlightBegin-
918 \qmlproperty real QtQuick::PathView::preferredHighlightEnd-
919 \qmlproperty enumeration QtQuick::PathView::highlightRangeMode-
920-
921 These properties set the preferred range of the highlight (current item)-
922 within the view. The preferred values must be in the range 0.0-1.0.-
923-
924 Valid values for \c highlightRangeMode are:-
925-
926 \list-
927 \li \e PathView.NoHighlightRange - no range is applied and the-
928 highlight will move freely within the view.-
929 \li \e PathView.ApplyRange - the view will attempt to maintain-
930 the highlight within the range, however the highlight can-
931 move outside of the range at the ends of the path or due to-
932 a mouse interaction.-
933 \li \e PathView.StrictlyEnforceRange - the highlight will never-
934 move outside of the range. This means that the current item-
935 will change if a keyboard or mouse action would cause the-
936 highlight to move outside of the range.-
937 \endlist-
938-
939 The default value is \e PathView.StrictlyEnforceRange.-
940-
941 Defining a highlight range is the correct way to influence where the-
942 current item ends up when the view moves. For example, if you want the-
943 currently selected item to be in the middle of the path, then set the-
944 highlight range to be 0.5,0.5 and highlightRangeMode to \e PathView.StrictlyEnforceRange.-
945 Then, when the path scrolls,-
946 the currently selected item will be the item at that position. This also applies to-
947 when the currently selected item changes - it will scroll to within the preferred-
948 highlight range. Furthermore, the behaviour of the current item index will occur-
949 whether or not a highlight exists.-
950-
951 \note A valid range requires \c preferredHighlightEnd to be greater-
952 than or equal to \c preferredHighlightBegin.-
953*/-
954qreal QQuickPathView::preferredHighlightBegin() const-
955{-
956 Q_D(const QQuickPathView);-
957 return d->highlightRangeStart;
executed 12 times by 1 test: return d->highlightRangeStart;
Executed by:
  • tst_qquickpathview
12
958}-
959-
960void QQuickPathView::setPreferredHighlightBegin(qreal start)-
961{-
962 Q_D(QQuickPathView);-
963 if (d->highlightRangeStart == start || start < 0 || start > 1.0)
d->highlightRa...Start == startDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 120 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
start < 0Description
TRUEnever evaluated
FALSEevaluated 120 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
start > 1.0Description
TRUEnever evaluated
FALSEevaluated 120 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
0-120
964 return;
executed 4 times by 1 test: return;
Executed by:
  • tst_qquickpathview
4
965 d->highlightRangeStart = start;-
966 d->haveHighlightRange = d->highlightRangeStart <= d->highlightRangeEnd;-
967 refill();-
968 emit preferredHighlightBeginChanged();-
969}
executed 120 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
120
970-
971qreal QQuickPathView::preferredHighlightEnd() const-
972{-
973 Q_D(const QQuickPathView);-
974 return d->highlightRangeEnd;
executed 2 times by 1 test: return d->highlightRangeEnd;
Executed by:
  • tst_qquickpathview
2
975}-
976-
977void QQuickPathView::setPreferredHighlightEnd(qreal end)-
978{-
979 Q_D(QQuickPathView);-
980 if (d->highlightRangeEnd == end || end < 0 || end > 1.0)
d->highlightRangeEnd == endDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 120 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
end < 0Description
TRUEnever evaluated
FALSEevaluated 120 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
end > 1.0Description
TRUEnever evaluated
FALSEevaluated 120 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
0-120
981 return;
executed 4 times by 1 test: return;
Executed by:
  • tst_qquickpathview
4
982 d->highlightRangeEnd = end;-
983 d->haveHighlightRange = d->highlightRangeStart <= d->highlightRangeEnd;-
984 refill();-
985 emit preferredHighlightEndChanged();-
986}
executed 120 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
120
987-
988QQuickPathView::HighlightRangeMode QQuickPathView::highlightRangeMode() const-
989{-
990 Q_D(const QQuickPathView);-
991 return d->highlightRangeMode;
never executed: return d->highlightRangeMode;
0
992}-
993-
994void QQuickPathView::setHighlightRangeMode(HighlightRangeMode mode)-
995{-
996 Q_D(QQuickPathView);-
997 if (d->highlightRangeMode == mode)
d->highlightRangeMode == modeDescription
TRUEevaluated 122 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 92 times by 1 test
Evaluated by:
  • tst_qquickpathview
92-122
998 return;
executed 122 times by 1 test: return;
Executed by:
  • tst_qquickpathview
122
999 d->highlightRangeMode = mode;-
1000 d->haveHighlightRange = d->highlightRangeStart <= d->highlightRangeEnd;-
1001 if (d->haveHighlightRange) {
d->haveHighlightRangeDescription
TRUEevaluated 92 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEnever evaluated
0-92
1002 d->regenerate();-
1003 int index = d->highlightRangeMode != NoHighlightRange ? d->currentIndex : d->calcCurrentIndex();
d->highlightRa...HighlightRangeDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 86 times by 1 test
Evaluated by:
  • tst_qquickpathview
6-86
1004 if (index >= 0)
index >= 0Description
TRUEevaluated 92 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEnever evaluated
0-92
1005 d->snapToIndex(index, QQuickPathViewPrivate::Other);
executed 92 times by 1 test: d->snapToIndex(index, QQuickPathViewPrivate::Other);
Executed by:
  • tst_qquickpathview
92
1006 }
executed 92 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
92
1007 emit highlightRangeModeChanged();-
1008}
executed 92 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
92
1009-
1010/*!-
1011 \qmlproperty int QtQuick::PathView::highlightMoveDuration-
1012 This property holds the move animation duration of the highlight delegate.-
1013-
1014 If the highlightRangeMode is StrictlyEnforceRange then this property-
1015 determines the speed that the items move along the path.-
1016-
1017 The default value for the duration is 300ms.-
1018*/-
1019int QQuickPathView::highlightMoveDuration() const-
1020{-
1021 Q_D(const QQuickPathView);-
1022 return d->highlightMoveDuration;
never executed: return d->highlightMoveDuration;
0
1023}-
1024-
1025void QQuickPathView::setHighlightMoveDuration(int duration)-
1026{-
1027 Q_D(QQuickPathView);-
1028 if (d->highlightMoveDuration == duration)
d->highlightMo...on == durationDescription
TRUEnever evaluated
FALSEevaluated 18 times by 1 test
Evaluated by:
  • tst_qquickpathview
0-18
1029 return;
never executed: return;
0
1030 d->highlightMoveDuration = duration;-
1031 emit highlightMoveDurationChanged();-
1032}
executed 18 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
18
1033-
1034/*!-
1035 \qmlproperty real QtQuick::PathView::dragMargin-
1036 This property holds the maximum distance from the path that initiates mouse dragging.-
1037-
1038 By default the path can only be dragged by clicking on an item. If-
1039 dragMargin is greater than zero, a drag can be initiated by clicking-
1040 within dragMargin pixels of the path.-
1041*/-
1042qreal QQuickPathView::dragMargin() const-
1043{-
1044 Q_D(const QQuickPathView);-
1045 return d->dragMargin;
executed 12 times by 1 test: return d->dragMargin;
Executed by:
  • tst_qquickpathview
12
1046}-
1047-
1048void QQuickPathView::setDragMargin(qreal dragMargin)-
1049{-
1050 Q_D(QQuickPathView);-
1051 if (d->dragMargin == dragMargin)
d->dragMargin == dragMarginDescription
TRUEevaluated 4 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
FALSEevaluated 100 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
4-100
1052 return;
executed 4 times by 2 tests: return;
Executed by:
  • tst_examples
  • tst_qquickpathview
4
1053 d->dragMargin = dragMargin;-
1054 emit dragMarginChanged();-
1055}
executed 100 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
100
1056-
1057/*!-
1058 \qmlproperty real QtQuick::PathView::flickDeceleration-
1059 This property holds the rate at which a flick will decelerate.-
1060-
1061 The default is 100.-
1062*/-
1063qreal QQuickPathView::flickDeceleration() const-
1064{-
1065 Q_D(const QQuickPathView);-
1066 return d->deceleration;
never executed: return d->deceleration;
0
1067}-
1068-
1069void QQuickPathView::setFlickDeceleration(qreal dec)-
1070{-
1071 Q_D(QQuickPathView);-
1072 if (d->deceleration == dec)
d->deceleration == decDescription
TRUEnever evaluated
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickpathview
0-8
1073 return;
never executed: return;
0
1074 d->deceleration = dec;-
1075 emit flickDecelerationChanged();-
1076}
executed 8 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
8
1077-
1078/*!-
1079 \qmlproperty real QtQuick::PathView::maximumFlickVelocity-
1080 This property holds the approximate maximum velocity that the user can flick the view in pixels/second.-
1081-
1082 The default value is platform dependent.-
1083*/-
1084qreal QQuickPathView::maximumFlickVelocity() const-
1085{-
1086 Q_D(const QQuickPathView);-
1087 return d->maximumFlickVelocity;
never executed: return d->maximumFlickVelocity;
0
1088}-
1089-
1090void QQuickPathView::setMaximumFlickVelocity(qreal vel)-
1091{-
1092 Q_D(QQuickPathView);-
1093 if (vel == d->maximumFlickVelocity)
vel == d->maximumFlickVelocityDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickpathview
2-8
1094 return;
executed 2 times by 1 test: return;
Executed by:
  • tst_qquickpathview
2
1095 d->maximumFlickVelocity = vel;-
1096 emit maximumFlickVelocityChanged();-
1097}
executed 8 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
8
1098-
1099-
1100/*!-
1101 \qmlproperty bool QtQuick::PathView::interactive-
1102-
1103 A user cannot drag or flick a PathView that is not interactive.-
1104-
1105 This property is useful for temporarily disabling flicking. This allows-
1106 special interaction with PathView's children.-
1107*/-
1108bool QQuickPathView::isInteractive() const-
1109{-
1110 Q_D(const QQuickPathView);-
1111 return d->interactive;
never executed: return d->interactive;
0
1112}-
1113-
1114void QQuickPathView::setInteractive(bool interactive)-
1115{-
1116 Q_D(QQuickPathView);-
1117 if (interactive != d->interactive) {
interactive != d->interactiveDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEnever evaluated
0-2
1118 d->interactive = interactive;-
1119 if (!interactive)
!interactiveDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEnever evaluated
0-2
1120 d->tl.clear();
executed 2 times by 1 test: d->tl.clear();
Executed by:
  • tst_qquickpathview
2
1121 emit interactiveChanged();-
1122 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
2
1123}
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
2
1124-
1125/*!-
1126 \qmlproperty bool QtQuick::PathView::moving-
1127-
1128 This property holds whether the view is currently moving-
1129 due to the user either dragging or flicking the view.-
1130*/-
1131bool QQuickPathView::isMoving() const-
1132{-
1133 Q_D(const QQuickPathView);-
1134 return d->moving;
executed 582 times by 1 test: return d->moving;
Executed by:
  • tst_qquickpathview
582
1135}-
1136-
1137/*!-
1138 \qmlproperty bool QtQuick::PathView::flicking-
1139-
1140 This property holds whether the view is currently moving-
1141 due to the user flicking the view.-
1142*/-
1143bool QQuickPathView::isFlicking() const-
1144{-
1145 Q_D(const QQuickPathView);-
1146 return d->flicking;
executed 6 times by 1 test: return d->flicking;
Executed by:
  • tst_qquickpathview
6
1147}-
1148-
1149/*!-
1150 \qmlproperty bool QtQuick::PathView::dragging-
1151-
1152 This property holds whether the view is currently moving-
1153 due to the user dragging the view.-
1154*/-
1155bool QQuickPathView::isDragging() const-
1156{-
1157 Q_D(const QQuickPathView);-
1158 return d->dragging;
executed 12 times by 1 test: return d->dragging;
Executed by:
  • tst_qquickpathview
12
1159}-
1160-
1161/*!-
1162 \qmlsignal QtQuick::PathView::movementStarted()-
1163-
1164 This signal is emitted when the view begins moving due to user-
1165 interaction.-
1166-
1167 The corresponding handler is \c onMovementStarted.-
1168*/-
1169-
1170/*!-
1171 \qmlsignal QtQuick::PathView::movementEnded()-
1172-
1173 This signal is emitted when the view stops moving due to user-
1174 interaction. If a flick was generated, this signal will-
1175 be emitted once the flick stops. If a flick was not-
1176 generated, this signal will be emitted when the-
1177 user stops dragging - i.e. a mouse or touch release.-
1178-
1179 The corresponding handler is \c onMovementEnded.-
1180*/-
1181-
1182/*!-
1183 \qmlsignal QtQuick::PathView::flickStarted()-
1184-
1185 This signal is emitted when the view is flicked. A flick-
1186 starts from the point that the mouse or touch is released,-
1187 while still in motion.-
1188-
1189 The corresponding handler is \c onFlickStarted.-
1190*/-
1191-
1192/*!-
1193 \qmlsignal QtQuick::PathView::flickEnded()-
1194-
1195 This signal is emitted when the view stops moving due to a flick.-
1196-
1197 The corresponding handler is \c onFlickEnded.-
1198*/-
1199-
1200/*!-
1201 \qmlsignal QtQuick::PathView::dragStarted()-
1202-
1203 This signal is emitted when the view starts to be dragged due to user-
1204 interaction.-
1205-
1206 The corresponding handler is \c onDragStarted.-
1207*/-
1208-
1209/*!-
1210 \qmlsignal QtQuick::PathView::dragEnded()-
1211-
1212 This signal is emitted when the user stops dragging the view.-
1213-
1214 If the velocity of the drag is suffient at the time the-
1215 touch/mouse button is released then a flick will start.-
1216-
1217 The corresponding handler is \c onDragEnded.-
1218*/-
1219-
1220/*!-
1221 \qmlproperty Component QtQuick::PathView::delegate-
1222-
1223 The delegate provides a template defining each item instantiated by the view.-
1224 The index is exposed as an accessible \c index property. Properties of the-
1225 model are also available depending upon the type of \l {qml-data-models}{Data Model}.-
1226-
1227 The number of objects and bindings in the delegate has a direct effect on the-
1228 flicking performance of the view when pathItemCount is specified. If at all possible, place functionality-
1229 that is not needed for the normal display of the delegate in a \l Loader which-
1230 can load additional components when needed.-
1231-
1232 Note that the PathView will layout the items based on the size of the root-
1233 item in the delegate.-
1234-
1235 Here is an example delegate:-
1236 \snippet qml/pathview/pathview.qml 1-
1237*/-
1238QQmlComponent *QQuickPathView::delegate() const-
1239{-
1240 Q_D(const QQuickPathView);-
1241 if (d->model) {
d->modelDescription
TRUEevaluated 146 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
FALSEevaluated 124 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
124-146
1242 if (QQmlDelegateModel *dataModel = qobject_cast<QQmlDelegateModel*>(d->model))
QQmlDelegateMo...el*>(d->model)Description
TRUEevaluated 146 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
FALSEnever evaluated
0-146
1243 return dataModel->delegate();
executed 146 times by 2 tests: return dataModel->delegate();
Executed by:
  • tst_examples
  • tst_qquickpathview
146
1244 }
never executed: end of block
0
1245-
1246 return nullptr;
executed 124 times by 3 tests: return nullptr;
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
124
1247}-
1248-
1249void QQuickPathView::setDelegate(QQmlComponent *delegate)-
1250{-
1251 Q_D(QQuickPathView);-
1252 if (delegate == this->delegate())
delegate == this->delegate()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 258 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
2-258
1253 return;
executed 2 times by 1 test: return;
Executed by:
  • tst_qquickpathview
2
1254 if (!d->ownModel) {
!d->ownModelDescription
TRUEevaluated 122 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 136 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
122-136
1255 d->model = new QQmlDelegateModel(qmlContext(this));-
1256 d->ownModel = true;-
1257 if (isComponentComplete())
isComponentComplete()Description
TRUEnever evaluated
FALSEevaluated 122 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
0-122
1258 static_cast<QQmlDelegateModel *>(d->model.data())->componentComplete();
never executed: static_cast<QQmlDelegateModel *>(d->model.data())->componentComplete();
0
1259 }
executed 122 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
122
1260 if (QQmlDelegateModel *dataModel = qobject_cast<QQmlDelegateModel*>(d->model)) {
QQmlDelegateMo...el*>(d->model)Description
TRUEevaluated 258 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEnever evaluated
0-258
1261 int oldCount = dataModel->count();-
1262 dataModel->setDelegate(delegate);-
1263 d->modelCount = dataModel->count();-
1264 d->regenerate();-
1265 if (oldCount != dataModel->count())
oldCount != dataModel->count()Description
TRUEnever evaluated
FALSEevaluated 258 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
0-258
1266 emit countChanged();
never executed: countChanged();
0
1267 emit delegateChanged();-
1268 d->delegateValidated = false;-
1269 }
executed 258 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
258
1270}
executed 258 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
258
1271-
1272/*!-
1273 \qmlproperty int QtQuick::PathView::pathItemCount-
1274 This property holds the number of items visible on the path at any one time.-
1275-
1276 Setting pathItemCount to undefined will show all items on the path.-
1277*/-
1278int QQuickPathView::pathItemCount() const-
1279{-
1280 Q_D(const QQuickPathView);-
1281 return d->pathItems;
executed 24 times by 2 tests: return d->pathItems;
Executed by:
  • tst_examples
  • tst_qquickpathview
24
1282}-
1283-
1284void QQuickPathView::setPathItemCount(int i)-
1285{-
1286 Q_D(QQuickPathView);-
1287 if (i == d->pathItems)
i == d->pathItemsDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 136 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
2-136
1288 return;
executed 2 times by 1 test: return;
Executed by:
  • tst_qquickpathview
2
1289 if (i < 1)
i < 1Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_examples
FALSEevaluated 134 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
2-134
1290 i = 1;
executed 2 times by 1 test: i = 1;
Executed by:
  • tst_examples
2
1291 d->pathItems = i;-
1292 d->updateMappedRange();-
1293 if (d->isValid() && isComponentComplete()) {
d->isValid()Description
TRUEevaluated 32 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
FALSEevaluated 104 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
isComponentComplete()Description
TRUEevaluated 32 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
FALSEnever evaluated
0-104
1294 d->regenerate();-
1295 }
executed 32 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
32
1296 emit pathItemCountChanged();-
1297}
executed 136 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
136
1298-
1299void QQuickPathView::resetPathItemCount()-
1300{-
1301 Q_D(QQuickPathView);-
1302 if (-1 == d->pathItems)
-1 == d->pathItemsDescription
TRUEnever evaluated
FALSEevaluated 18 times by 1 test
Evaluated by:
  • tst_qquickpathview
0-18
1303 return;
never executed: return;
0
1304 d->pathItems = -1;-
1305 d->updateMappedRange();-
1306 if (d->isValid() && isComponentComplete())
d->isValid()Description
TRUEevaluated 18 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEnever evaluated
isComponentComplete()Description
TRUEevaluated 18 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEnever evaluated
0-18
1307 d->regenerate();
executed 18 times by 1 test: d->regenerate();
Executed by:
  • tst_qquickpathview
18
1308 emit pathItemCountChanged();-
1309}
executed 18 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
18
1310-
1311/*!-
1312 \qmlproperty int QtQuick::PathView::cacheItemCount-
1313 This property holds the maximum number of items to cache off the path.-
1314-
1315 For example, a PathView with a model containing 20 items, a pathItemCount-
1316 of 10, and an cacheItemCount of 4 will create up to 14 items, with 10 visible-
1317 on the path and 4 invisible cached items.-
1318-
1319 The cached delegates are created asynchronously,-
1320 allowing creation to occur across multiple frames and reducing the-
1321 likelihood of skipping frames.-
1322-
1323 \note Setting this property is not a replacement for creating efficient delegates.-
1324 It can improve the smoothness of scrolling behavior at the expense of additional-
1325 memory usage. The fewer objects and bindings in a delegate, the faster a-
1326 view can be scrolled. It is important to realize that setting cacheItemCount-
1327 will only postpone issues caused by slow-loading delegates, it is not a-
1328 solution for this scenario.-
1329-
1330 \sa pathItemCount-
1331*/-
1332int QQuickPathView::cacheItemCount() const-
1333{-
1334 Q_D(const QQuickPathView);-
1335 return d->cacheSize;
executed 4 times by 1 test: return d->cacheSize;
Executed by:
  • tst_qquickpathview
4
1336}-
1337-
1338void QQuickPathView::setCacheItemCount(int i)-
1339{-
1340 Q_D(QQuickPathView);-
1341 if (i == d->cacheSize || i < 0)
i == d->cacheSizeDescription
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickpathview
i < 0Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickpathview
0-4
1342 return;
never executed: return;
0
1343-
1344 d->cacheSize = i;-
1345 d->updateMappedRange();-
1346 refill();-
1347 emit cacheItemCountChanged();-
1348}
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
4
1349-
1350/*!-
1351 \qmlproperty enumeration QtQuick::PathView::snapMode-
1352-
1353 This property determines how the items will settle following a drag or flick.-
1354 The possible values are:-
1355-
1356 \list-
1357 \li PathView.NoSnap (default) - the items stop anywhere along the path.-
1358 \li PathView.SnapToItem - the items settle with an item aligned with the \l preferredHighlightBegin.-
1359 \li PathView.SnapOneItem - the items settle no more than one item away from the item nearest-
1360 \l preferredHighlightBegin at the time the press is released. This mode is particularly-
1361 useful for moving one page at a time.-
1362 \endlist-
1363-
1364 \c snapMode does not affect the \l currentIndex. To update the-
1365 \l currentIndex as the view is moved, set \l highlightRangeMode-
1366 to \c PathView.StrictlyEnforceRange (default for PathView).-
1367-
1368 \sa highlightRangeMode-
1369*/-
1370QQuickPathView::SnapMode QQuickPathView::snapMode() const-
1371{-
1372 Q_D(const QQuickPathView);-
1373 return d->snapMode;
never executed: return d->snapMode;
0
1374}-
1375-
1376void QQuickPathView::setSnapMode(SnapMode mode)-
1377{-
1378 Q_D(QQuickPathView);-
1379 if (mode == d->snapMode)
mode == d->snapModeDescription
TRUEnever evaluated
FALSEevaluated 22 times by 1 test
Evaluated by:
  • tst_qquickpathview
0-22
1380 return;
never executed: return;
0
1381 d->snapMode = mode;-
1382 emit snapModeChanged();-
1383}
executed 22 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
22
1384-
1385/*!-
1386 \qmlproperty enumeration QtQuick::PathView::movementDirection-
1387 \since 5.7-
1388-
1389 This property determines the direction in which items move when setting the current index.-
1390 The possible values are:-
1391-
1392 \list-
1393 \li PathView.Shortest (default) - the items move in the direction that requires the least-
1394 movement, which could be either \c Negative or \c Positive.-
1395 \li PathView.Negative - the items move backwards towards their destination.-
1396 \li PathView.Positive - the items move forwards towards their destination.-
1397 \endlist-
1398-
1399 For example, suppose that there are 5 items in the model, and \l currentIndex is \c 0.-
1400 If currentIndex is set to \c 2,-
1401-
1402 \list-
1403 \li a \c Positive movement direction will result in the following order: 0, 1, 2-
1404 \li a \c Negative movement direction will result in the following order: 0, 5, 4, 3, 2-
1405 \li a \c Shortest movement direction will result in same order with \c Positive .-
1406 \endlist-
1407-
1408 \note this property doesn't affect the movement of \l incrementCurrentIndex() and \l decrementCurrentIndex().-
1409*/-
1410QQuickPathView::MovementDirection QQuickPathView::movementDirection() const-
1411{-
1412 Q_D(const QQuickPathView);-
1413 return d->movementDirection;
executed 6 times by 1 test: return d->movementDirection;
Executed by:
  • tst_qquickpathview
6
1414}-
1415-
1416void QQuickPathView::setMovementDirection(QQuickPathView::MovementDirection dir)-
1417{-
1418 Q_D(QQuickPathView);-
1419 if (dir == d->movementDirection)
dir == d->movementDirectionDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickpathview
2-6
1420 return;
executed 2 times by 1 test: return;
Executed by:
  • tst_qquickpathview
2
1421 d->movementDirection = dir;-
1422 if (!d->tl.isActive())
!d->tl.isActive()Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEnever evaluated
0-6
1423 d->moveDirection = d->movementDirection;
executed 6 times by 1 test: d->moveDirection = d->movementDirection;
Executed by:
  • tst_qquickpathview
6
1424 emit movementDirectionChanged();-
1425}
executed 6 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
6
1426-
1427/*!-
1428 \qmlmethod QtQuick::PathView::positionViewAtIndex(int index, PositionMode mode)-
1429-
1430 Positions the view such that the \a index is at the position specified by-
1431 \a mode:-
1432-
1433 \list-
1434 \li PathView.Beginning - position item at the beginning of the path.-
1435 \li PathView.Center - position item in the center of the path.-
1436 \li PathView.End - position item at the end of the path.-
1437 \li PathView.Contain - ensure the item is positioned on the path.-
1438 \li PathView.SnapPosition - position the item at \l preferredHighlightBegin. This mode-
1439 is only valid if \l highlightRangeMode is StrictlyEnforceRange or snapping is enabled-
1440 via \l snapMode.-
1441 \endlist-
1442-
1443 \b Note: methods should only be called after the Component has completed. To position-
1444 the view at startup, this method should be called by Component.onCompleted. For-
1445 example, to position the view at the end:-
1446-
1447 \code-
1448 Component.onCompleted: positionViewAtIndex(count - 1, PathView.End)-
1449 \endcode-
1450*/-
1451void QQuickPathView::positionViewAtIndex(int index, int mode)-
1452{-
1453 Q_D(QQuickPathView);-
1454 if (!d->isValid())
!d->isValid()Description
TRUEnever evaluated
FALSEevaluated 44 times by 1 test
Evaluated by:
  • tst_qquickpathview
0-44
1455 return;
never executed: return;
0
1456 if (mode < QQuickPathView::Beginning || mode > QQuickPathView::SnapPosition || mode == 3) // 3 is unused in PathView
mode < QQuickP...iew::BeginningDescription
TRUEnever evaluated
FALSEevaluated 44 times by 1 test
Evaluated by:
  • tst_qquickpathview
mode > QQuickP...::SnapPositionDescription
TRUEnever evaluated
FALSEevaluated 44 times by 1 test
Evaluated by:
  • tst_qquickpathview
mode == 3Description
TRUEnever evaluated
FALSEevaluated 44 times by 1 test
Evaluated by:
  • tst_qquickpathview
0-44
1457 return;
never executed: return;
0
1458-
1459 if (mode == QQuickPathView::Contain && (d->pathItems < 0 || d->modelCount <= d->pathItems))
mode == QQuick...hView::ContainDescription
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 28 times by 1 test
Evaluated by:
  • tst_qquickpathview
d->pathItems < 0Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquickpathview
d->modelCount <= d->pathItemsDescription
TRUEnever evaluated
FALSEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquickpathview
0-28
1460 return;
executed 4 times by 1 test: return;
Executed by:
  • tst_qquickpathview
4
1461-
1462 int count = d->pathItems == -1 ? d->modelCount : qMin(d->pathItems, d->modelCount);
d->pathItems == -1Description
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 26 times by 1 test
Evaluated by:
  • tst_qquickpathview
14-26
1463 int idx = (index+d->modelCount) % d->modelCount;-
1464 bool snap = d->haveHighlightRange && (d->highlightRangeMode != QQuickPathView::NoHighlightRange
d->haveHighlightRangeDescription
TRUEevaluated 40 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEnever evaluated
d->highlightRa...HighlightRangeDescription
TRUEevaluated 22 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 18 times by 1 test
Evaluated by:
  • tst_qquickpathview
0-40
1465 || d->snapMode != QQuickPathView::NoSnap);
d->snapMode !=...thView::NoSnapDescription
TRUEnever evaluated
FALSEevaluated 18 times by 1 test
Evaluated by:
  • tst_qquickpathview
0-18
1466-
1467 qreal beginOffset;-
1468 qreal endOffset;-
1469 if (snap) {
snapDescription
TRUEevaluated 22 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 18 times by 1 test
Evaluated by:
  • tst_qquickpathview
18-22
1470 beginOffset = d->modelCount - idx - qFloor(count * d->highlightRangeStart);-
1471 endOffset = beginOffset + count - 1;-
1472 } else {
executed 22 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
22
1473 beginOffset = d->modelCount - idx;-
1474 // Small offset since the last point coincides with the first and-
1475 // this the only "end" position that gives the expected visual result.-
1476 qreal adj = sizeof(qreal) == sizeof(float) ? 0.00001f : 0.000000000001;
sizeof(qreal) == sizeof(float)Description
TRUEnever evaluated
FALSEevaluated 18 times by 1 test
Evaluated by:
  • tst_qquickpathview
0-18
1477 endOffset = std::fmod(beginOffset + count, qreal(d->modelCount)) - adj;-
1478 }
executed 18 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
18
1479 qreal offset = d->offset;-
1480 switch (mode) {-
1481 case Beginning:
executed 8 times by 1 test: case Beginning:
Executed by:
  • tst_qquickpathview
8
1482 offset = beginOffset;-
1483 break;
executed 8 times by 1 test: break;
Executed by:
  • tst_qquickpathview
8
1484 case End:
executed 8 times by 1 test: case End:
Executed by:
  • tst_qquickpathview
8
1485 offset = endOffset;-
1486 break;
executed 8 times by 1 test: break;
Executed by:
  • tst_qquickpathview
8
1487 case Center:
executed 8 times by 1 test: case Center:
Executed by:
  • tst_qquickpathview
8
1488 if (beginOffset < endOffset)
beginOffset < endOffsetDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickpathview
4
1489 offset = (beginOffset + endOffset)/2;
executed 4 times by 1 test: offset = (beginOffset + endOffset)/2;
Executed by:
  • tst_qquickpathview
4
1490 else-
1491 offset = (beginOffset + (endOffset + d->modelCount))/2;
executed 4 times by 1 test: offset = (beginOffset + (endOffset + d->modelCount))/2;
Executed by:
  • tst_qquickpathview
4
1492 if (snap)
snapDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickpathview
4
1493 offset = qRound(offset);
executed 4 times by 1 test: offset = qRound(offset);
Executed by:
  • tst_qquickpathview
4
1494 break;
executed 8 times by 1 test: break;
Executed by:
  • tst_qquickpathview
8
1495 case Contain:
executed 12 times by 1 test: case Contain:
Executed by:
  • tst_qquickpathview
12
1496 if ((beginOffset < endOffset && (d->offset < beginOffset || d->offset > endOffset))
beginOffset < endOffsetDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickpathview
d->offset < beginOffsetDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEnever evaluated
d->offset > endOffsetDescription
TRUEnever evaluated
FALSEnever evaluated
0-6
1497 || (d->offset < beginOffset && d->offset > endOffset)) {
d->offset < beginOffsetDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEnever evaluated
d->offset > endOffsetDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpathview
0-6
1498 qreal diff1 = std::fmod(beginOffset - d->offset + d->modelCount, qreal(d->modelCount));-
1499 qreal diff2 = std::fmod(d->offset - endOffset + d->modelCount, qreal(d->modelCount));-
1500 if (diff1 < diff2)
diff1 < diff2Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickpathview
4-6
1501 offset = beginOffset;
executed 4 times by 1 test: offset = beginOffset;
Executed by:
  • tst_qquickpathview
4
1502 else-
1503 offset = endOffset;
executed 6 times by 1 test: offset = endOffset;
Executed by:
  • tst_qquickpathview
6
1504 }-
1505 break;
executed 12 times by 1 test: break;
Executed by:
  • tst_qquickpathview
12
1506 case SnapPosition:
executed 4 times by 1 test: case SnapPosition:
Executed by:
  • tst_qquickpathview
4
1507 offset = d->modelCount - idx;-
1508 break;
executed 4 times by 1 test: break;
Executed by:
  • tst_qquickpathview
4
1509 }-
1510-
1511 d->tl.clear();-
1512 setOffset(offset);-
1513}
executed 40 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
40
1514-
1515/*!-
1516 \qmlmethod int QtQuick::PathView::indexAt(real x, real y)-
1517-
1518 Returns the index of the item containing the point \a x, \a y in content-
1519 coordinates. If there is no item at the point specified, -1 is returned.-
1520-
1521 \b Note: methods should only be called after the Component has completed.-
1522*/-
1523int QQuickPathView::indexAt(qreal x, qreal y) const-
1524{-
1525 Q_D(const QQuickPathView);-
1526 QQuickItem *item = itemAt(x, y);-
1527 return item ? d->model->indexOf(item, nullptr) : -1;
executed 10 times by 1 test: return item ? d->model->indexOf(item, nullptr) : -1;
Executed by:
  • tst_qquickpathview
10
1528}-
1529-
1530/*!-
1531 \qmlmethod Item QtQuick::PathView::itemAt(real x, real y)-
1532-
1533 Returns the item containing the point \a x, \a y in content-
1534 coordinates. If there is no item at the point specified, null is returned.-
1535-
1536 \b Note: methods should only be called after the Component has completed.-
1537*/-
1538QQuickItem *QQuickPathView::itemAt(qreal x, qreal y) const-
1539{-
1540 Q_D(const QQuickPathView);-
1541 if (!d->isValid())
!d->isValid()Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • tst_qquickpathview
0-20
1542 return nullptr;
never executed: return nullptr;
0
1543-
1544 for (QQuickItem *item : d->items) {-
1545 QPointF p = item->mapFromItem(this, QPointF(x, y));-
1546 if (item->contains(p))
item->contains(p)Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 64 times by 1 test
Evaluated by:
  • tst_qquickpathview
12-64
1547 return item;
executed 12 times by 1 test: return item;
Executed by:
  • tst_qquickpathview
12
1548 }
executed 64 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
64
1549-
1550 return nullptr;
executed 8 times by 1 test: return nullptr;
Executed by:
  • tst_qquickpathview
8
1551}-
1552-
1553QPointF QQuickPathViewPrivate::pointNear(const QPointF &point, qreal *nearPercent) const-
1554{-
1555 const auto pathLength = path->path().length();-
1556 qreal samples = qMin(pathLength / 5, qreal(500.0));-
1557 qreal res = pathLength / samples;-
1558-
1559 qreal mindist = 1e10; // big number-
1560 QPointF nearPoint = path->pointAt(0);-
1561 qreal nearPc = 0;-
1562-
1563 // get rough pos-
1564 for (qreal i=1; i < samples; i++) {
i < samplesDescription
TRUEevaluated 22836 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 156 times by 1 test
Evaluated by:
  • tst_qquickpathview
156-22836
1565 QPointF pt = path->pointAt(i/samples);-
1566 QPointF diff = pt - point;-
1567 qreal dist = diff.x()*diff.x() + diff.y()*diff.y();-
1568 if (dist < mindist) {
dist < mindistDescription
TRUEevaluated 8382 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 14454 times by 1 test
Evaluated by:
  • tst_qquickpathview
8382-14454
1569 nearPoint = pt;-
1570 nearPc = i;-
1571 mindist = dist;-
1572 }
executed 8382 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
8382
1573 }
executed 22836 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
22836
1574-
1575 // now refine-
1576 qreal approxPc = nearPc;-
1577 for (qreal i = approxPc-1.0; i < approxPc+1.0; i += 1/(2*res)) {
i < approxPc+1.0Description
TRUEevaluated 3204 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 156 times by 1 test
Evaluated by:
  • tst_qquickpathview
156-3204
1578 QPointF pt = path->pointAt(i/samples);-
1579 QPointF diff = pt - point;-
1580 qreal dist = diff.x()*diff.x() + diff.y()*diff.y();-
1581 if (dist < mindist) {
dist < mindistDescription
TRUEevaluated 252 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 2952 times by 1 test
Evaluated by:
  • tst_qquickpathview
252-2952
1582 nearPoint = pt;-
1583 nearPc = i;-
1584 mindist = dist;-
1585 }
executed 252 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
252
1586 }
executed 3204 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
3204
1587-
1588 if (nearPercent)
nearPercentDescription
TRUEevaluated 156 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEnever evaluated
0-156
1589 *nearPercent = nearPc / samples;
executed 156 times by 1 test: *nearPercent = nearPc / samples;
Executed by:
  • tst_qquickpathview
156
1590-
1591 return nearPoint;
executed 156 times by 1 test: return nearPoint;
Executed by:
  • tst_qquickpathview
156
1592}-
1593-
1594void QQuickPathViewPrivate::addVelocitySample(qreal v)-
1595{-
1596 velocityBuffer.append(v);-
1597 if (velocityBuffer.count() > QML_FLICK_SAMPLEBUFFER)
velocityBuffer.count() > 3Description
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 52 times by 1 test
Evaluated by:
  • tst_qquickpathview
16-52
1598 velocityBuffer.remove(0);
executed 16 times by 1 test: velocityBuffer.remove(0);
Executed by:
  • tst_qquickpathview
16
1599}
executed 68 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
68
1600-
1601qreal QQuickPathViewPrivate::calcVelocity() const-
1602{-
1603 qreal velocity = 0;-
1604 if (velocityBuffer.count() > QML_FLICK_DISCARDSAMPLES) {
velocityBuffer.count() > 0Description
TRUEevaluated 18 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpathview
2-18
1605 int count = velocityBuffer.count()-QML_FLICK_DISCARDSAMPLES;-
1606 for (int i = 0; i < count; ++i) {
i < countDescription
TRUEevaluated 50 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 18 times by 1 test
Evaluated by:
  • tst_qquickpathview
18-50
1607 qreal v = velocityBuffer.at(i);-
1608 velocity += v;-
1609 }
executed 50 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
50
1610 velocity /= count;-
1611 }
executed 18 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
18
1612 return velocity;
executed 20 times by 1 test: return velocity;
Executed by:
  • tst_qquickpathview
20
1613}-
1614-
1615qint64 QQuickPathViewPrivate::computeCurrentTime(QInputEvent *event) const-
1616{-
1617 if (0 != event->timestamp())
0 != event->timestamp()Description
TRUEevaluated 152 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickpathview
4-152
1618 return event->timestamp();
executed 152 times by 1 test: return event->timestamp();
Executed by:
  • tst_qquickpathview
152
1619 return timer.elapsed();
executed 4 times by 1 test: return timer.elapsed();
Executed by:
  • tst_qquickpathview
4
1620}-
1621-
1622void QQuickPathView::mousePressEvent(QMouseEvent *event)-
1623{-
1624 Q_D(QQuickPathView);-
1625 if (d->interactive) {
d->interactiveDescription
TRUEevaluated 20 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEnever evaluated
0-20
1626 d->handleMousePressEvent(event);-
1627 event->accept();-
1628 } else {
executed 20 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
20
1629 QQuickItem::mousePressEvent(event);-
1630 }
never executed: end of block
0
1631}-
1632-
1633void QQuickPathViewPrivate::handleMousePressEvent(QMouseEvent *event)-
1634{-
1635 if (!interactive || !items.count() || !model || !modelCount)
!interactiveDescription
TRUEnever evaluated
FALSEevaluated 26 times by 1 test
Evaluated by:
  • tst_qquickpathview
!items.count()Description
TRUEnever evaluated
FALSEevaluated 26 times by 1 test
Evaluated by:
  • tst_qquickpathview
!modelDescription
TRUEnever evaluated
FALSEevaluated 26 times by 1 test
Evaluated by:
  • tst_qquickpathview
!modelCountDescription
TRUEnever evaluated
FALSEevaluated 26 times by 1 test
Evaluated by:
  • tst_qquickpathview
0-26
1636 return;
never executed: return;
0
1637 velocityBuffer.clear();-
1638 int idx = 0;-
1639 for (; idx < items.count(); ++idx) {
idx < items.count()Description
TRUEevaluated 232 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquickpathview
10-232
1640 QQuickItem *item = items.at(idx);-
1641 if (item->contains(item->mapFromScene(event->windowPos())))
item->contains...>windowPos()))Description
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 216 times by 1 test
Evaluated by:
  • tst_qquickpathview
16-216
1642 break;
executed 16 times by 1 test: break;
Executed by:
  • tst_qquickpathview
16
1643 }
executed 216 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
216
1644 if (idx == items.count() && dragMargin == 0.) // didn't click on an item
idx == items.count()Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquickpathview
dragMargin == 0.Description
TRUEnever evaluated
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquickpathview
0-16
1645 return;
never executed: return;
0
1646-
1647 startPoint = pointNear(event->localPos(), &startPc);-
1648 startPos = event->localPos();-
1649 if (idx == items.count()) {
idx == items.count()Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquickpathview
10-16
1650 qreal distance = qAbs(event->localPos().x() - startPoint.x()) + qAbs(event->localPos().y() - startPoint.y());-
1651 if (distance > dragMargin)
distance > dragMarginDescription
TRUEnever evaluated
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquickpathview
0-10
1652 return;
never executed: return;
0
1653 }
executed 10 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
10
1654-
1655-
1656 if (tl.isActive() && flicking && flickDuration && qreal(tl.time())/flickDuration < 0.8)
tl.isActive()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 22 times by 1 test
Evaluated by:
  • tst_qquickpathview
flickingDescription
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickpathview
flickDurationDescription
TRUEnever evaluated
FALSEnever evaluated
qreal(tl.time(...Duration < 0.8Description
TRUEnever evaluated
FALSEnever evaluated
0-22
1657 stealMouse = true; // If we've been flicked then steal the click.
never executed: stealMouse = true;
0
1658 else-
1659 stealMouse = false;
executed 26 times by 1 test: stealMouse = false;
Executed by:
  • tst_qquickpathview
26
1660-
1661 timer.start();-
1662 lastPosTime = computeCurrentTime(event);-
1663 tl.clear();-
1664}
executed 26 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
26
1665-
1666void QQuickPathView::mouseMoveEvent(QMouseEvent *event)-
1667{-
1668 Q_D(QQuickPathView);-
1669 if (d->interactive) {
d->interactiveDescription
TRUEevaluated 106 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEnever evaluated
0-106
1670 d->handleMouseMoveEvent(event);-
1671 event->accept();-
1672 } else {
executed 106 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
106
1673 QQuickItem::mouseMoveEvent(event);-
1674 }
never executed: end of block
0
1675}-
1676-
1677void QQuickPathViewPrivate::handleMouseMoveEvent(QMouseEvent *event)-
1678{-
1679 Q_Q(QQuickPathView);-
1680 if (!interactive || !timer.isValid() || !model || !modelCount)
!interactiveDescription
TRUEnever evaluated
FALSEevaluated 132 times by 1 test
Evaluated by:
  • tst_qquickpathview
!timer.isValid()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 130 times by 1 test
Evaluated by:
  • tst_qquickpathview
!modelDescription
TRUEnever evaluated
FALSEevaluated 130 times by 1 test
Evaluated by:
  • tst_qquickpathview
!modelCountDescription
TRUEnever evaluated
FALSEevaluated 130 times by 1 test
Evaluated by:
  • tst_qquickpathview
0-132
1681 return;
executed 2 times by 1 test: return;
Executed by:
  • tst_qquickpathview
2
1682-
1683 qint64 currentTimestamp = computeCurrentTime(event);-
1684 qreal newPc;-
1685 QPointF pathPoint = pointNear(event->localPos(), &newPc);-
1686 if (!stealMouse) {
!stealMouseDescription
TRUEevaluated 42 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 88 times by 1 test
Evaluated by:
  • tst_qquickpathview
42-88
1687 QPointF posDelta = event->localPos() - startPos;-
1688 if (QQuickWindowPrivate::dragOverThreshold(posDelta.y(), Qt::YAxis, event) || QQuickWindowPrivate::dragOverThreshold(posDelta.x(), Qt::XAxis, event)) {
QQuickWindowPr...:YAxis, event)Description
TRUEnever evaluated
FALSEevaluated 42 times by 1 test
Evaluated by:
  • tst_qquickpathview
QQuickWindowPr...:XAxis, event)Description
TRUEevaluated 26 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquickpathview
0-42
1689 // The touch has exceeded the threshold. If the movement along the path is close to the drag threshold-
1690 // then we'll assume that this gesture targets the PathView. This ensures PathView gesture grabbing-
1691 // is in sync with other items.-
1692 QPointF pathDelta = pathPoint - startPoint;-
1693 const int startDragDistance = QGuiApplication::styleHints()->startDragDistance();-
1694 if (qAbs(pathDelta.x()) > startDragDistance * 0.8
qAbs(pathDelta...Distance * 0.8Description
TRUEevaluated 26 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEnever evaluated
0-26
1695 || qAbs(pathDelta.y()) > startDragDistance * 0.8) {
qAbs(pathDelta...Distance * 0.8Description
TRUEnever evaluated
FALSEnever evaluated
0
1696 stealMouse = true;-
1697 q->setKeepMouseGrab(true);-
1698 }
executed 26 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
26
1699 }
executed 26 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
26
1700 } else {
executed 42 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
42
1701 moveReason = QQuickPathViewPrivate::Mouse;-
1702 int count = pathItems == -1 ? modelCount : qMin(pathItems, modelCount);
pathItems == -1Description
TRUEevaluated 50 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 38 times by 1 test
Evaluated by:
  • tst_qquickpathview
38-50
1703 qreal diff = (newPc - startPc)*count;-
1704 if (diff) {
diffDescription
TRUEevaluated 72 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquickpathview
16-72
1705 q->setOffset(offset + diff);-
1706-
1707 if (diff > modelCount/2)
diff > modelCount/2Description
TRUEnever evaluated
FALSEevaluated 72 times by 1 test
Evaluated by:
  • tst_qquickpathview
0-72
1708 diff -= modelCount;
never executed: diff -= modelCount;
0
1709 else if (diff < -modelCount/2)
diff < -modelCount/2Description
TRUEnever evaluated
FALSEevaluated 72 times by 1 test
Evaluated by:
  • tst_qquickpathview
0-72
1710 diff += modelCount;
never executed: diff += modelCount;
0
1711-
1712 qint64 elapsed = currentTimestamp - lastPosTime;-
1713 if (elapsed > 0)
elapsed > 0Description
TRUEevaluated 68 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickpathview
4-68
1714 addVelocitySample(diff / (qreal(elapsed) / 1000.));
executed 68 times by 1 test: addVelocitySample(diff / (qreal(elapsed) / 1000.));
Executed by:
  • tst_qquickpathview
68
1715 }
executed 72 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
72
1716 if (!moving) {
!movingDescription
TRUEevaluated 22 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 66 times by 1 test
Evaluated by:
  • tst_qquickpathview
22-66
1717 moving = true;-
1718 emit q->movingChanged();-
1719 emit q->movementStarted();-
1720 }
executed 22 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
22
1721 setDragging(true);-
1722 }
executed 88 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
88
1723 startPc = newPc;-
1724 lastPosTime = currentTimestamp;-
1725}
executed 130 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
130
1726-
1727void QQuickPathView::mouseReleaseEvent(QMouseEvent *event)-
1728{-
1729 Q_D(QQuickPathView);-
1730 if (d->interactive) {
d->interactiveDescription
TRUEevaluated 20 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEnever evaluated
0-20
1731 d->handleMouseReleaseEvent(event);-
1732 event->accept();-
1733 ungrabMouse();-
1734 } else {
executed 20 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
20
1735 QQuickItem::mouseReleaseEvent(event);-
1736 }
never executed: end of block
0
1737}-
1738-
1739void QQuickPathViewPrivate::handleMouseReleaseEvent(QMouseEvent *)-
1740{-
1741 Q_Q(QQuickPathView);-
1742 stealMouse = false;-
1743 q->setKeepMouseGrab(false);-
1744 setDragging(false);-
1745 if (!interactive || !timer.isValid() || !model || !modelCount) {
!interactiveDescription
TRUEnever evaluated
FALSEevaluated 22 times by 1 test
Evaluated by:
  • tst_qquickpathview
!timer.isValid()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 20 times by 1 test
Evaluated by:
  • tst_qquickpathview
!modelDescription
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • tst_qquickpathview
!modelCountDescription
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • tst_qquickpathview
0-22
1746 timer.invalidate();-
1747 if (!tl.isActive())
!tl.isActive()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEnever evaluated
0-2
1748 q->movementEnding();
executed 2 times by 1 test: q->movementEnding();
Executed by:
  • tst_qquickpathview
2
1749 return;
executed 2 times by 1 test: return;
Executed by:
  • tst_qquickpathview
2
1750 }-
1751-
1752 qreal velocity = calcVelocity();-
1753 qreal count = pathItems == -1 ? modelCount : qMin(pathItems, modelCount);
pathItems == -1Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquickpathview
10
1754 const auto averageItemLength = path->path().length() / count;-
1755 qreal pixelVelocity = averageItemLength * velocity;-
1756 if (qAbs(pixelVelocity) > MinimumFlickVelocity) {
qAbs(pixelVelo...mFlickVelocityDescription
TRUEevaluated 18 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpathview
2-18
1757 if (qAbs(pixelVelocity) > maximumFlickVelocity || snapMode == QQuickPathView::SnapOneItem) {
qAbs(pixelVelo...mFlickVelocityDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquickpathview
snapMode == QQ...w::SnapOneItemDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickpathview
4-10
1758 // limit velocity-
1759 qreal maxVel = velocity < 0 ? -maximumFlickVelocity : maximumFlickVelocity;
velocity < 0Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpathview
2-10
1760 velocity = maxVel / averageItemLength;-
1761 }
executed 12 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
12
1762 // Calculate the distance to be travelled-
1763 qreal v2 = velocity*velocity;-
1764 qreal accel = deceleration/10;-
1765 qreal dist = 0;-
1766 if (haveHighlightRange && (highlightRangeMode == QQuickPathView::StrictlyEnforceRange
haveHighlightRangeDescription
TRUEevaluated 18 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEnever evaluated
highlightRange...lyEnforceRangeDescription
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickpathview
0-18
1767 || snapMode != QQuickPathView::NoSnap)) {
snapMode != QQ...thView::NoSnapDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEnever evaluated
0-4
1768 if (snapMode == QQuickPathView::SnapOneItem) {
snapMode == QQ...w::SnapOneItemDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 14 times by 1 test
Evaluated by:
  • tst_qquickpathview
4-14
1769 // encourage snapping one item in direction of motion-
1770 if (velocity > 0.)
velocity > 0.Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickpathview
0-4
1771 dist = qRound(0.5 + offset) - offset;
never executed: dist = qRound(0.5 + offset) - offset;
0
1772 else-
1773 dist = qRound(0.5 - offset) + offset;
executed 4 times by 1 test: dist = qRound(0.5 - offset) + offset;
Executed by:
  • tst_qquickpathview
4
1774 } else {-
1775 // + 0.25 to encourage moving at least one item in the flick direction-
1776 dist = qMin(qreal(modelCount-1), qreal(v2 / (accel * 2.0) + 0.25));-
1777-
1778 // round to nearest item.-
1779 if (velocity > 0.)
velocity > 0.Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquickpathview
4-10
1780 dist = qRound(dist + offset) - offset;
executed 4 times by 1 test: dist = qRound(dist + offset) - offset;
Executed by:
  • tst_qquickpathview
4
1781 else-
1782 dist = qRound(dist - offset) + offset;
executed 10 times by 1 test: dist = qRound(dist - offset) + offset;
Executed by:
  • tst_qquickpathview
10
1783 }-
1784 // Calculate accel required to stop on item boundary-
1785 if (dist <= 0.) {
dist <= 0.Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquickpathview
2-16
1786 dist = 0.;-
1787 accel = 0.;-
1788 } else {
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
2
1789 accel = v2 / (2.0f * qAbs(dist));-
1790 }
executed 16 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
16
1791 } else {-
1792 dist = qMin(qreal(modelCount-1), qreal(v2 / (accel * 2.0)));-
1793 }
never executed: end of block
0
1794 flickDuration = static_cast<int>(1000 * qAbs(velocity) / accel);-
1795 offsetAdj = 0.0;-
1796 moveOffset.setValue(offset);-
1797 tl.accel(moveOffset, velocity, accel, dist);-
1798 tl.callback(QQuickTimeLineCallback(&moveOffset, fixOffsetCallback, this));-
1799 if (!flicking) {
!flickingDescription
TRUEevaluated 18 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEnever evaluated
0-18
1800 flicking = true;-
1801 emit q->flickingChanged();-
1802 emit q->flickStarted();-
1803 }
executed 18 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
18
1804 } else {
executed 18 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
18
1805 fixOffset();-
1806 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
2
1807-
1808 timer.invalidate();-
1809 if (!tl.isActive())
!tl.isActive()Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • tst_qquickpathview
0-20
1810 q->movementEnding();
never executed: q->movementEnding();
0
1811}
executed 20 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
20
1812-
1813bool QQuickPathView::sendMouseEvent(QMouseEvent *event)-
1814{-
1815 Q_D(QQuickPathView);-
1816 QPointF localPos = mapFromScene(event->windowPos());-
1817-
1818 QQuickWindow *c = window();-
1819 QQuickItem *grabber = c ? c->mouseGrabberItem() : nullptr;
cDescription
TRUEevaluated 48 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEnever evaluated
0-48
1820 if (grabber == this && d->stealMouse) {
grabber == thisDescription
TRUEnever evaluated
FALSEevaluated 48 times by 1 test
Evaluated by:
  • tst_qquickpathview
d->stealMouseDescription
TRUEnever evaluated
FALSEnever evaluated
0-48
1821 // we are already the grabber and we do want the mouse event to ourselves.-
1822 return true;
never executed: return true;
0
1823 }-
1824-
1825 bool grabberDisabled = grabber && !grabber->isEnabled();
grabberDescription
TRUEevaluated 42 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickpathview
!grabber->isEnabled()Description
TRUEnever evaluated
FALSEevaluated 42 times by 1 test
Evaluated by:
  • tst_qquickpathview
0-42
1826 bool stealThisEvent = d->stealMouse;-
1827 if ((stealThisEvent || contains(localPos)) && (!grabber || !grabber->keepMouseGrab() || grabberDisabled)) {
stealThisEventDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 42 times by 1 test
Evaluated by:
  • tst_qquickpathview
contains(localPos)Description
TRUEevaluated 42 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEnever evaluated
!grabberDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 42 times by 1 test
Evaluated by:
  • tst_qquickpathview
!grabber->keepMouseGrab()Description
TRUEevaluated 28 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 14 times by 1 test
Evaluated by:
  • tst_qquickpathview
grabberDisabledDescription
TRUEnever evaluated
FALSEevaluated 14 times by 1 test
Evaluated by:
  • tst_qquickpathview
0-42
1828 QScopedPointer<QMouseEvent> mouseEvent(QQuickWindowPrivate::cloneMouseEvent(event, &localPos));-
1829 mouseEvent->setAccepted(false);-
1830-
1831 switch (mouseEvent->type()) {-
1832 case QEvent::MouseMove:
executed 26 times by 1 test: case QEvent::MouseMove:
Executed by:
  • tst_qquickpathview
26
1833 d->handleMouseMoveEvent(mouseEvent.data());-
1834 break;
executed 26 times by 1 test: break;
Executed by:
  • tst_qquickpathview
26
1835 case QEvent::MouseButtonPress:
executed 6 times by 1 test: case QEvent::MouseButtonPress:
Executed by:
  • tst_qquickpathview
6
1836 d->handleMousePressEvent(mouseEvent.data());-
1837 stealThisEvent = d->stealMouse; // Update stealThisEvent in case changed by function call above-
1838 break;
executed 6 times by 1 test: break;
Executed by:
  • tst_qquickpathview
6
1839 case QEvent::MouseButtonRelease:
executed 2 times by 1 test: case QEvent::MouseButtonRelease:
Executed by:
  • tst_qquickpathview
2
1840 d->handleMouseReleaseEvent(mouseEvent.data());-
1841 break;
executed 2 times by 1 test: break;
Executed by:
  • tst_qquickpathview
2
1842 default:
never executed: default:
0
1843 break;
never executed: break;
0
1844 }-
1845 grabber = c ? c->mouseGrabberItem() : nullptr;
cDescription
TRUEevaluated 34 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEnever evaluated
0-34
1846 if ((grabber && stealThisEvent && !grabber->keepMouseGrab() && grabber != this) || grabberDisabled) {
grabberDescription
TRUEevaluated 28 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickpathview
stealThisEventDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 26 times by 1 test
Evaluated by:
  • tst_qquickpathview
!grabber->keepMouseGrab()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEnever evaluated
grabber != thisDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEnever evaluated
grabberDisabledDescription
TRUEnever evaluated
FALSEevaluated 32 times by 1 test
Evaluated by:
  • tst_qquickpathview
0-32
1847 grabMouse();-
1848 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
2
1849-
1850 const bool filtered = stealThisEvent || grabberDisabled;
stealThisEventDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 32 times by 1 test
Evaluated by:
  • tst_qquickpathview
grabberDisabledDescription
TRUEnever evaluated
FALSEevaluated 32 times by 1 test
Evaluated by:
  • tst_qquickpathview
0-32
1851 if (filtered) {
filteredDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 32 times by 1 test
Evaluated by:
  • tst_qquickpathview
2-32
1852 event->setAccepted(false);-
1853 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
2
1854 return filtered;
executed 34 times by 1 test: return filtered;
Executed by:
  • tst_qquickpathview
34
1855 } else if (d->timer.isValid()) {
d->timer.isValid()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquickpathview
4-10
1856 d->timer.invalidate();-
1857 d->fixOffset();-
1858 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
4
1859 if (event->type() == QEvent::MouseButtonRelease || (grabber && grabber->keepMouseGrab() && !grabberDisabled)) {
event->type() ...eButtonReleaseDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquickpathview
grabberDescription
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEnever evaluated
grabber->keepMouseGrab()Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEnever evaluated
!grabberDisabledDescription
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEnever evaluated
0-10
1860 d->stealMouse = false;-
1861 }
executed 14 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
14
1862 return false;
executed 14 times by 1 test: return false;
Executed by:
  • tst_qquickpathview
14
1863}-
1864-
1865bool QQuickPathView::childMouseEventFilter(QQuickItem *i, QEvent *e)-
1866{-
1867 Q_D(QQuickPathView);-
1868 if (!isVisible() || !d->interactive)
!isVisible()Description
TRUEnever evaluated
FALSEevaluated 58 times by 1 test
Evaluated by:
  • tst_qquickpathview
!d->interactiveDescription
TRUEnever evaluated
FALSEevaluated 58 times by 1 test
Evaluated by:
  • tst_qquickpathview
0-58
1869 return QQuickItem::childMouseEventFilter(i, e);
never executed: return QQuickItem::childMouseEventFilter(i, e);
0
1870-
1871 switch (e->type()) {-
1872 case QEvent::MouseButtonPress:
executed 6 times by 1 test: case QEvent::MouseButtonPress:
Executed by:
  • tst_qquickpathview
6
1873 case QEvent::MouseMove:
executed 36 times by 1 test: case QEvent::MouseMove:
Executed by:
  • tst_qquickpathview
36
1874 case QEvent::MouseButtonRelease:
executed 6 times by 1 test: case QEvent::MouseButtonRelease:
Executed by:
  • tst_qquickpathview
6
1875 return sendMouseEvent(static_cast<QMouseEvent *>(e));
executed 48 times by 1 test: return sendMouseEvent(static_cast<QMouseEvent *>(e));
Executed by:
  • tst_qquickpathview
48
1876 default:
executed 10 times by 1 test: default:
Executed by:
  • tst_qquickpathview
10
1877 break;
executed 10 times by 1 test: break;
Executed by:
  • tst_qquickpathview
10
1878 }-
1879-
1880 return QQuickItem::childMouseEventFilter(i, e);
executed 10 times by 1 test: return QQuickItem::childMouseEventFilter(i, e);
Executed by:
  • tst_qquickpathview
10
1881}-
1882-
1883void QQuickPathView::mouseUngrabEvent()-
1884{-
1885 Q_D(QQuickPathView);-
1886 if (d->stealMouse) {
d->stealMouseDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 20 times by 1 test
Evaluated by:
  • tst_qquickpathview
2-20
1887 // if our mouse grab has been removed (probably by a Flickable),-
1888 // fix our state-
1889 d->stealMouse = false;-
1890 setKeepMouseGrab(false);-
1891 d->timer.invalidate();-
1892 d->fixOffset();-
1893 d->setDragging(false);-
1894 if (!d->tl.isActive())
!d->tl.isActive()Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpathview
0-2
1895 movementEnding();
never executed: movementEnding();
0
1896 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
2
1897}
executed 22 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
22
1898-
1899void QQuickPathView::updatePolish()-
1900{-
1901 QQuickItem::updatePolish();-
1902 refill();-
1903}
executed 37 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
37
1904-
1905static inline int currentIndexRemainder(int currentIndex, int modelCount) Q_DECL_NOTHROW-
1906{-
1907 if (currentIndex < 0)
currentIndex < 0Description
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickpathview
0-6
1908 return modelCount + currentIndex % modelCount;
never executed: return modelCount + currentIndex % modelCount;
0
1909 else-
1910 return currentIndex % modelCount;
executed 6 times by 1 test: return currentIndex % modelCount;
Executed by:
  • tst_qquickpathview
6
1911}-
1912-
1913void QQuickPathView::componentComplete()-
1914{-
1915 Q_D(QQuickPathView);-
1916 if (d->model && d->ownModel)
d->ownModelDescription
TRUEevaluated 258 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 20 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
20-258
1917 static_cast<QQmlDelegateModel *>(d->model.data())->componentComplete();
executed 258 times by 3 tests: static_cast<QQmlDelegateModel *>(d->model.data())->componentComplete();
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
258
1918-
1919 QQuickItem::componentComplete();-
1920-
1921 if (d->model) {
d->modelDescription
TRUEevaluated 278 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickpathview
4-278
1922 d->modelCount = d->model->count();-
1923 if (d->modelCount && d->currentIndex != 0) // an initial value has been provided for currentIndex
d->modelCountDescription
TRUEevaluated 268 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 10 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
d->currentIndex != 0Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 262 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
6-268
1924 d->offset = std::fmod(qreal(d->modelCount - currentIndexRemainder(d->currentIndex, d->modelCount)), qreal(d->modelCount));
executed 6 times by 1 test: d->offset = std::fmod(qreal(d->modelCount - currentIndexRemainder(d->currentIndex, d->modelCount)), qreal(d->modelCount));
Executed by:
  • tst_qquickpathview
6
1925 }
executed 278 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
278
1926-
1927 d->createHighlight();-
1928 d->regenerate();-
1929 d->updateHighlight();-
1930 d->updateCurrent();-
1931-
1932 if (d->modelCount)
d->modelCountDescription
TRUEevaluated 268 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 14 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
14-268
1933 emit countChanged();
executed 268 times by 3 tests: countChanged();
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
268
1934}
executed 282 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
282
1935-
1936void QQuickPathView::refill()-
1937{-
1938 Q_D(QQuickPathView);-
1939-
1940 if (d->inRefill) {
d->inRefillDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 4448 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
2-4448
1941 d->scheduleLayout();-
1942 return;
executed 2 times by 1 test: return;
Executed by:
  • tst_qquickpathview
2
1943 }-
1944-
1945 d->layoutScheduled = false;-
1946-
1947 if (!d->isValid() || !isComponentComplete())
!d->isValid()Description
TRUEevaluated 500 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 3948 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
!isComponentComplete()Description
TRUEevaluated 12 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 3936 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
12-3948
1948 return;
executed 512 times by 3 tests: return;
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
512
1949-
1950 d->inRefill = true;-
1951-
1952 bool currentVisible = false;-
1953 int count = d->pathItems == -1 ? d->modelCount : qMin(d->pathItems, d->modelCount);
d->pathItems == -1Description
TRUEevaluated 2381 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 1555 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
1555-2381
1954-
1955 // first move existing items and remove items off path-
1956 qCDebug(lcItemViewDelegateLifecycle) << "currentIndex" << d->currentIndex << "offset" << d->offset;
never executed: QMessageLogger(__FILE__, 1956, __PRETTY_FUNCTION__, lcItemViewDelegateLifecycle().categoryName()).debug() << "currentIndex" << d->currentIndex << "offset" << d->offset;
qt_category_enabledDescription
TRUEnever evaluated
FALSEevaluated 3936 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
0-3936
1957 QList<QQuickItem*>::iterator it = d->items.begin();-
1958 while (it != d->items.end()) {
it != d->items.end()Description
TRUEevaluated 37500 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 3936 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
3936-37500
1959 QQuickItem *item = *it;-
1960 int idx = d->model->indexOf(item, nullptr);-
1961 qreal pos = d->positionOfIndex(idx);-
1962 if (lcItemViewDelegateLifecycle().isDebugEnabled()) {
lcItemViewDele...DebugEnabled()Description
TRUEnever evaluated
FALSEevaluated 37500 times by 1 test
Evaluated by:
  • tst_qquickpathview
0-37500
1963 QQuickText *text = qmlobject_cast<QQuickText*>(item);-
1964 if (text)
textDescription
TRUEnever evaluated
FALSEnever evaluated
0
1965 qCDebug(lcItemViewDelegateLifecycle) << "idx" << idx << "@" << pos << ": QQuickText" << text->objectName() << text->text().leftRef(40);
never executed: QMessageLogger(__FILE__, 1965, __PRETTY_FUNCTION__, lcItemViewDelegateLifecycle().categoryName()).debug() << "idx" << idx << "@" << pos << ": QQuickText" << text->objectName() << text->text().leftRef(40);
qt_category_enabledDescription
TRUEnever evaluated
FALSEnever evaluated
0
1966 else-
1967 qCDebug(lcItemViewDelegateLifecycle) << "idx" << idx << "@" << pos << ":" << item;
never executed: QMessageLogger(__FILE__, 1967, __PRETTY_FUNCTION__, lcItemViewDelegateLifecycle().categoryName()).debug() << "idx" << idx << "@" << pos << ":" << item;
qt_category_enabledDescription
TRUEnever evaluated
FALSEnever evaluated
0
1968 }
never executed: end of block
0
1969 if (pos < 1.0) {
pos < 1.0Description
TRUEevaluated 36906 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 594 times by 1 test
Evaluated by:
  • tst_qquickpathview
594-36906
1970 d->updateItem(item, pos);-
1971 if (idx == d->currentIndex) {
idx == d->currentIndexDescription
TRUEevaluated 3361 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 33545 times by 1 test
Evaluated by:
  • tst_qquickpathview
3361-33545
1972 currentVisible = true;-
1973 d->currentItemOffset = pos;-
1974 }
executed 3361 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
3361
1975 ++it;-
1976 } else {
executed 36906 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
36906
1977 d->updateItem(item, pos);-
1978 if (QQuickPathViewAttached *att = d->attached(item))
QQuickPathView...attached(item)Description
TRUEevaluated 594 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEnever evaluated
0-594
1979 att->setOnPath(pos < 1.0);
executed 594 times by 1 test: att->setOnPath(pos < 1.0);
Executed by:
  • tst_qquickpathview
594
1980 if (!d->isInBound(pos, d->mappedRange - d->mappedCache, 1.0 + d->mappedCache)) {
!d->isInBound(...->mappedCache)Description
TRUEevaluated 554 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 40 times by 1 test
Evaluated by:
  • tst_qquickpathview
40-554
1981 qCDebug(lcItemViewDelegateLifecycle) << "release" << idx << "@" << pos << ", !isInBound: lower" << (d->mappedRange - d->mappedCache) << "upper" << (1.0 + d->mappedCache);
never executed: QMessageLogger(__FILE__, 1981, __PRETTY_FUNCTION__, lcItemViewDelegateLifecycle().categoryName()).debug() << "release" << idx << "@" << pos << ", !isInBound: lower" << (d->mappedRange - d->mappedCache) << "upper" << (1.0 + d->mappedCache);
qt_category_enabledDescription
TRUEnever evaluated
FALSEevaluated 554 times by 1 test
Evaluated by:
  • tst_qquickpathview
0-554
1982 d->releaseItem(item);-
1983 it = d->items.erase(it);-
1984 } else {
executed 554 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
554
1985 ++it;-
1986 }
executed 40 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
40
1987 }-
1988 }-
1989-
1990 bool waiting = false;-
1991 if (d->modelCount) {
d->modelCountDescription
TRUEevaluated 3918 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 18 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
18-3918
1992 // add items as needed-
1993 if (d->items.count() < count+d->cacheSize) {
d->items.count...t+d->cacheSizeDescription
TRUEevaluated 805 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 3113 times by 1 test
Evaluated by:
  • tst_qquickpathview
805-3113
1994 int endIdx = 0;-
1995 qreal endPos;-
1996 int startIdx = 0;-
1997 qreal startPos = 0.0;-
1998 const bool wasEmpty = d->items.isEmpty();-
1999 if (!wasEmpty) {
!wasEmptyDescription
TRUEevaluated 350 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 455 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
350-455
2000 //Find the beginning and end, items may not be in sorted order-
2001 endPos = -1.0;-
2002 startPos = 2.0;-
2003-
2004 for (QQuickItem * item : qAsConst(d->items)) {-
2005 int idx = d->model->indexOf(item, nullptr);-
2006 qreal curPos = d->positionOfIndex(idx);-
2007 if (curPos > endPos) {
curPos > endPosDescription
TRUEevaluated 4838 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 44 times by 1 test
Evaluated by:
  • tst_qquickpathview
44-4838
2008 endPos = curPos;-
2009 endIdx = idx;-
2010 }
executed 4838 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
4838
2011-
2012 if (curPos < startPos) {
curPos < startPosDescription
TRUEevaluated 356 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 4526 times by 1 test
Evaluated by:
  • tst_qquickpathview
356-4526
2013 startPos = curPos;-
2014 startIdx = idx;-
2015 }
executed 356 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
356
2016 }
executed 4882 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
4882
2017 } else {
executed 350 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
350
2018 if (d->haveHighlightRange
d->haveHighlightRangeDescription
TRUEevaluated 455 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEnever evaluated
0-455
2019 && (d->highlightRangeMode != QQuickPathView::NoHighlightRange
d->highlightRa...HighlightRangeDescription
TRUEevaluated 341 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 114 times by 1 test
Evaluated by:
  • tst_qquickpathview
114-341
2020 || d->snapMode != QQuickPathView::NoSnap))
d->snapMode !=...thView::NoSnapDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 106 times by 1 test
Evaluated by:
  • tst_qquickpathview
8-106
2021 startPos = d->highlightRangeStart;
executed 349 times by 3 tests: startPos = d->highlightRangeStart;
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
349
2022 // With no items, then "end" is just off the top so we populate via append-
2023 endIdx = (qRound(d->modelCount - d->offset) - 1) % d->modelCount;-
2024 endPos = d->positionOfIndex(endIdx);-
2025 }
executed 455 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
455
2026 //Append-
2027 int idx = endIdx + 1;-
2028 if (idx >= d->modelCount)
idx >= d->modelCountDescription
TRUEevaluated 300 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 505 times by 1 test
Evaluated by:
  • tst_qquickpathview
300-505
2029 idx = 0;
executed 300 times by 3 tests: idx = 0;
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
300
2030 qreal nextPos = d->positionOfIndex(idx);-
2031 while ((d->isInBound(nextPos, endPos, 1.0 + d->mappedCache) || !d->items.count())
d->isInBound(n...->mappedCache)Description
TRUEevaluated 2615 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 1023 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
!d->items.count()Description
TRUEevaluated 250 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 773 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
250-2615
2032 && d->items.count() < count+d->cacheSize) {
d->items.count...t+d->cacheSizeDescription
TRUEevaluated 2857 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickpathview
8-2857
2033 qCDebug(lcItemViewDelegateLifecycle) << "append" << idx << "@" << nextPos << (d->currentIndex == idx ? "current" : "") << "items count was" << d->items.count();
never executed: QMessageLogger(__FILE__, 2033, __PRETTY_FUNCTION__, lcItemViewDelegateLifecycle().categoryName()).debug() << "append" << idx << "@" << nextPos << (d->currentIndex == idx ? "current" : "") << "items count was" << d->items.count();
qt_category_enabledDescription
TRUEnever evaluated
FALSEevaluated 2857 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
0-2857
2034 QQuickItem *item = d->getItem(idx, idx+1, nextPos >= 1.0);-
2035 if (!item) {
!itemDescription
TRUEevaluated 18 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 2839 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
18-2839
2036 waiting = true;-
2037 break;
executed 18 times by 1 test: break;
Executed by:
  • tst_qquickpathview
18
2038 }-
2039 if (d->items.contains(item)) {
d->items.contains(item)Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 2833 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
6-2833
2040 d->releaseItem(item);-
2041 break; //Otherwise we'd "re-add" it, and get confused
executed 6 times by 1 test: break;
Executed by:
  • tst_qquickpathview
6
2042 }-
2043 if (d->currentIndex == idx) {
d->currentIndex == idxDescription
TRUEevaluated 441 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 2392 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
441-2392
2044 currentVisible = true;-
2045 d->currentItemOffset = nextPos;-
2046 }
executed 441 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
441
2047 d->items.append(item);-
2048 d->updateItem(item, nextPos);-
2049 endIdx = idx;-
2050 endPos = nextPos;-
2051 ++idx;-
2052 if (idx >= d->modelCount)
idx >= d->modelCountDescription
TRUEevaluated 395 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 2438 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
395-2438
2053 idx = 0;
executed 395 times by 3 tests: idx = 0;
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
395
2054 nextPos = d->positionOfIndex(idx);-
2055 }
executed 2833 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
2833
2056-
2057 //Prepend-
2058 idx = (wasEmpty ? d->calcCurrentIndex() : startIdx) - 1;
wasEmptyDescription
TRUEevaluated 455 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 350 times by 1 test
Evaluated by:
  • tst_qquickpathview
350-455
2059-
2060 if (idx < 0)
idx < 0Description
TRUEevaluated 323 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 482 times by 1 test
Evaluated by:
  • tst_qquickpathview
323-482
2061 idx = d->modelCount - 1;
executed 323 times by 3 tests: idx = d->modelCount - 1;
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
323
2062 nextPos = d->positionOfIndex(idx);-
2063 while (!waiting && d->isInBound(nextPos, d->mappedRange - d->mappedCache, startPos)
!waitingDescription
TRUEevaluated 1318 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 18 times by 1 test
Evaluated by:
  • tst_qquickpathview
d->isInBound(n...che, startPos)Description
TRUEevaluated 545 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
FALSEevaluated 773 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
18-1318
2064 && d->items.count() < count+d->cacheSize) {
d->items.count...t+d->cacheSizeDescription
TRUEevaluated 545 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
FALSEnever evaluated
0-545
2065 qCDebug(lcItemViewDelegateLifecycle) << "prepend" << idx << "@" << nextPos << (d->currentIndex == idx ? "current" : "") << "items count was" << d->items.count();
never executed: QMessageLogger(__FILE__, 2065, __PRETTY_FUNCTION__, lcItemViewDelegateLifecycle().categoryName()).debug() << "prepend" << idx << "@" << nextPos << (d->currentIndex == idx ? "current" : "") << "items count was" << d->items.count();
qt_category_enabledDescription
TRUEnever evaluated
FALSEevaluated 545 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
0-545
2066 QQuickItem *item = d->getItem(idx, idx+1, nextPos >= 1.0);-
2067 if (!item) {
!itemDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 537 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
8-537
2068 waiting = true;-
2069 break;
executed 8 times by 1 test: break;
Executed by:
  • tst_qquickpathview
8
2070 }-
2071 if (d->items.contains(item)) {
d->items.contains(item)Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 531 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
6-531
2072 d->releaseItem(item);-
2073 break; //Otherwise we'd "re-add" it, and get confused
executed 6 times by 1 test: break;
Executed by:
  • tst_qquickpathview
6
2074 }-
2075 if (d->currentIndex == idx) {
d->currentIndex == idxDescription
TRUEevaluated 22 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 509 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
22-509
2076 currentVisible = true;-
2077 d->currentItemOffset = nextPos;-
2078 }
executed 22 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
22
2079 d->items.prepend(item);-
2080 d->updateItem(item, nextPos);-
2081 startIdx = idx;-
2082 startPos = nextPos;-
2083 --idx;-
2084 if (idx < 0)
idx < 0Description
TRUEevaluated 5 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 526 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
5-526
2085 idx = d->modelCount - 1;
executed 5 times by 1 test: idx = d->modelCount - 1;
Executed by:
  • tst_qquickpathview
5
2086 nextPos = d->positionOfIndex(idx);-
2087 }
executed 531 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
531
2088-
2089 // In rare cases, when jumping around with pathCount close to modelCount,-
2090 // new items appear in the middle. This more generic addition iteration handles this-
2091 // Since this is the rare case, we try append/prepend first and only do this if-
2092 // there are gaps still left to fill.-
2093 if (!waiting && d->items.count() < count+d->cacheSize) {
!waitingDescription
TRUEevaluated 779 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 26 times by 1 test
Evaluated by:
  • tst_qquickpathview
d->items.count...t+d->cacheSizeDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 773 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
6-779
2094 qCDebug(lcItemViewDelegateLifecycle) << "Checking for pathview middle inserts, items count was" << d->items.count();
never executed: QMessageLogger(__FILE__, 2094, __PRETTY_FUNCTION__, lcItemViewDelegateLifecycle().categoryName()).debug() << "Checking for pathview middle inserts, items count was" << d->items.count();
qt_category_enabledDescription
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickpathview
0-6
2095 idx = startIdx;-
2096 QQuickItem *lastItem = d->items.at(0);-
2097 while (idx != endIdx) {
idx != endIdxDescription
TRUEevaluated 52 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpathview
2-52
2098 nextPos = d->positionOfIndex(idx);-
2099 if (d->isInBound(nextPos, d->mappedRange - d->mappedCache, 1.0 + d->mappedCache)) {
d->isInBound(n...->mappedCache)Description
TRUEevaluated 52 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEnever evaluated
0-52
2100 //This gets the reference from the delegate model, and will not re-create-
2101 QQuickItem *item = d->getItem(idx, idx+1, nextPos >= 1.0);-
2102 if (!item) {
!itemDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 48 times by 1 test
Evaluated by:
  • tst_qquickpathview
4-48
2103 waiting = true;-
2104 break;
executed 4 times by 1 test: break;
Executed by:
  • tst_qquickpathview
4
2105 }-
2106-
2107 if (!d->items.contains(item)) { //We found a hole
!d->items.contains(item)Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 44 times by 1 test
Evaluated by:
  • tst_qquickpathview
4-44
2108 qCDebug(lcItemViewDelegateLifecycle) << "middle insert" << idx << "@" << nextPos
never executed: QMessageLogger(__FILE__, 2108, __PRETTY_FUNCTION__, lcItemViewDelegateLifecycle().categoryName()).debug() << "middle insert" << idx << "@" << nextPos << (d->currentIndex == idx ? "current" : "") << "items count was" << d->items.count();
qt_category_enabledDescription
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickpathview
0-4
2109 << (d->currentIndex == idx ? "current" : "")
never executed: QMessageLogger(__FILE__, 2108, __PRETTY_FUNCTION__, lcItemViewDelegateLifecycle().categoryName()).debug() << "middle insert" << idx << "@" << nextPos << (d->currentIndex == idx ? "current" : "") << "items count was" << d->items.count();
0
2110 << "items count was" << d->items.count();
never executed: QMessageLogger(__FILE__, 2108, __PRETTY_FUNCTION__, lcItemViewDelegateLifecycle().categoryName()).debug() << "middle insert" << idx << "@" << nextPos << (d->currentIndex == idx ? "current" : "") << "items count was" << d->items.count();
0
2111 if (d->currentIndex == idx) {
d->currentIndex == idxDescription
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickpathview
0-4
2112 currentVisible = true;-
2113 d->currentItemOffset = nextPos;-
2114 }
never executed: end of block
0
2115 int lastListIdx = d->items.indexOf(lastItem);-
2116 d->items.insert(lastListIdx + 1, item);-
2117 d->updateItem(item, nextPos);-
2118 } else {
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
4
2119 d->releaseItem(item);-
2120 }
executed 44 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
44
2121-
2122 lastItem = item;-
2123 }
executed 48 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
48
2124-
2125 ++idx;-
2126 if (idx >= d->modelCount)
idx >= d->modelCountDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 42 times by 1 test
Evaluated by:
  • tst_qquickpathview
6-42
2127 idx = 0;
executed 6 times by 1 test: idx = 0;
Executed by:
  • tst_qquickpathview
6
2128 }
executed 48 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
48
2129 }
executed 6 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
6
2130 }
executed 805 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
805
2131 }
executed 3918 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
3918
2132-
2133 bool currentChanged = false;-
2134 if (!currentVisible) {
!currentVisibleDescription
TRUEevaluated 112 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
FALSEevaluated 3824 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
112-3824
2135 d->currentItemOffset = 1.0;-
2136 if (d->currentItem) {
d->currentItemDescription
TRUEevaluated 92 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 20 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
20-92
2137 d->updateItem(d->currentItem, 1.0);-
2138 } else if (!waiting && d->currentIndex >= 0 && d->currentIndex < d->modelCount) {
executed 92 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
!waitingDescription
TRUEevaluated 18 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpathview
d->currentIndex >= 0Description
TRUEevaluated 18 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
FALSEnever evaluated
d->currentInde... d->modelCountDescription
TRUEnever evaluated
FALSEevaluated 18 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
0-92
2139 if ((d->currentItem = d->getItem(d->currentIndex, d->currentIndex))) {
(d->currentIte...currentIndex))Description
TRUEnever evaluated
FALSEnever evaluated
0
2140 currentChanged = true;-
2141 d->updateItem(d->currentItem, 1.0);-
2142 if (QQuickPathViewAttached *att = d->attached(d->currentItem))
QQuickPathView...->currentItem)Description
TRUEnever evaluated
FALSEnever evaluated
0
2143 att->setIsCurrentItem(true);
never executed: att->setIsCurrentItem(true);
0
2144 }
never executed: end of block
0
2145 }
never executed: end of block
0
2146 } else if (!waiting && !d->currentItem) {
executed 112 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
!waitingDescription
TRUEevaluated 3798 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 26 times by 1 test
Evaluated by:
  • tst_qquickpathview
!d->currentItemDescription
TRUEevaluated 420 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 3378 times by 1 test
Evaluated by:
  • tst_qquickpathview
26-3798
2147 if ((d->currentItem = d->getItem(d->currentIndex, d->currentIndex))) {
(d->currentIte...currentIndex))Description
TRUEevaluated 420 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEnever evaluated
0-420
2148 currentChanged = true;-
2149 d->currentItem->setFocus(true);-
2150 if (QQuickPathViewAttached *att = d->attached(d->currentItem))
QQuickPathView...->currentItem)Description
TRUEevaluated 420 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEnever evaluated
0-420
2151 att->setIsCurrentItem(true);
executed 420 times by 3 tests: att->setIsCurrentItem(true);
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
420
2152 }
executed 420 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
420
2153 }
executed 420 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
420
2154-
2155 if (d->highlightItem && d->haveHighlightRange && d->highlightRangeMode == QQuickPathView::StrictlyEnforceRange) {
d->highlightItemDescription
TRUEevaluated 3918 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 18 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
d->haveHighlightRangeDescription
TRUEevaluated 3914 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickpathview
d->highlightRa...lyEnforceRangeDescription
TRUEevaluated 3476 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 438 times by 1 test
Evaluated by:
  • tst_qquickpathview
4-3918
2156 d->updateItem(d->highlightItem, d->highlightRangeStart);-
2157 if (QQuickPathViewAttached *att = d->attached(d->highlightItem))
QQuickPathView...highlightItem)Description
TRUEnever evaluated
FALSEevaluated 3476 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
0-3476
2158 att->setOnPath(true);
never executed: att->setOnPath(true);
0
2159 } else if (d->highlightItem && d->moveReason != QQuickPathViewPrivate::SetIndex) {
executed 3476 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
d->highlightItemDescription
TRUEevaluated 442 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 18 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
d->moveReason ...vate::SetIndexDescription
TRUEevaluated 438 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickpathview
4-3476
2160 d->updateItem(d->highlightItem, d->currentItemOffset);-
2161 if (QQuickPathViewAttached *att = d->attached(d->highlightItem))
QQuickPathView...highlightItem)Description
TRUEnever evaluated
FALSEevaluated 438 times by 1 test
Evaluated by:
  • tst_qquickpathview
0-438
2162 att->setOnPath(currentVisible);
never executed: att->setOnPath(currentVisible);
0
2163 }
executed 438 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
438
2164 for (QQuickItem *item : qAsConst(d->itemCache))-
2165 d->releaseItem(item);
executed 141 times by 1 test: d->releaseItem(item);
Executed by:
  • tst_qquickpathview
141
2166 d->itemCache.clear();-
2167-
2168 d->inRefill = false;-
2169 if (currentChanged)
currentChangedDescription
TRUEevaluated 420 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 3516 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
420-3516
2170 emit currentItemChanged();
executed 420 times by 3 tests: currentItemChanged();
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
420
2171}
executed 3936 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
3936
2172-
2173void QQuickPathView::modelUpdated(const QQmlChangeSet &changeSet, bool reset)-
2174{-
2175 Q_D(QQuickPathView);-
2176 if (!d->model || !d->model->isValid() || !d->path || !isComponentComplete())
!d->modelDescription
TRUEnever evaluated
FALSEevaluated 690 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
!d->model->isValid()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 686 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
!d->pathDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 682 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
!isComponentComplete()Description
TRUEevaluated 516 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 166 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
0-690
2177 return;
executed 524 times by 3 tests: return;
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
524
2178-
2179 if (reset) {
resetDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 164 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
2-164
2180 d->modelCount = d->model->count();-
2181 d->regenerate();-
2182 emit countChanged();-
2183 return;
executed 2 times by 1 test: return;
Executed by:
  • tst_qquickpathview
2
2184 }-
2185-
2186 if (changeSet.removes().isEmpty() && changeSet.inserts().isEmpty())
changeSet.removes().isEmpty()Description
TRUEevaluated 66 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
FALSEevaluated 98 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
changeSet.inserts().isEmpty()Description
TRUEnever evaluated
FALSEevaluated 66 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
0-98
2187 return;
never executed: return;
0
2188-
2189 const int modelCount = d->modelCount;-
2190 int moveId = -1;-
2191 int moveOffset = 0;-
2192 bool currentChanged = false;-
2193 bool changedOffset = false;-
2194 for (const QQmlChangeSet::Change &r : changeSet.removes()) {-
2195 if (moveId == -1 && d->currentIndex >= r.index + r.count) {
moveId == -1Description
TRUEevaluated 98 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
FALSEnever evaluated
d->currentInde...ndex + r.countDescription
TRUEevaluated 36 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 62 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
0-98
2196 d->currentIndex -= r.count;-
2197 currentChanged = true;-
2198 } else if (moveId == -1 && d->currentIndex >= r.index && d->currentIndex < r.index + r.count) {
executed 36 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
moveId == -1Description
TRUEevaluated 62 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
FALSEnever evaluated
d->currentIndex >= r.indexDescription
TRUEevaluated 28 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
FALSEevaluated 34 times by 1 test
Evaluated by:
  • tst_qquickpathview
d->currentInde...ndex + r.countDescription
TRUEevaluated 28 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
FALSEnever evaluated
0-62
2199 // current item has been removed.-
2200 if (r.isMove()) {
r.isMove()Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 18 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
10-18
2201 moveId = r.moveId;-
2202 moveOffset = d->currentIndex - r.index;-
2203 } else if (d->currentItem) {
executed 10 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
d->currentItemDescription
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_examples
2-16
2204 if (QQuickPathViewAttached *att = d->attached(d->currentItem))
QQuickPathView...->currentItem)Description
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEnever evaluated
0-16
2205 att->setIsCurrentItem(true);
executed 16 times by 1 test: att->setIsCurrentItem(true);
Executed by:
  • tst_qquickpathview
16
2206 d->releaseItem(d->currentItem);-
2207 d->currentItem = nullptr;-
2208 }
executed 16 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
16
2209 d->currentIndex = qMin(r.index, d->modelCount - r.count - 1);-
2210 currentChanged = true;-
2211 }
executed 28 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
28
2212-
2213 if (r.index > d->currentIndex) {
r.index > d->currentIndexDescription
TRUEevaluated 50 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
FALSEevaluated 48 times by 1 test
Evaluated by:
  • tst_qquickpathview
48-50
2214 changedOffset = true;-
2215 d->offset -= r.count;-
2216 d->offsetAdj -= r.count;-
2217 }
executed 50 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
50
2218 d->modelCount -= r.count;-
2219 }
executed 98 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
98
2220 for (const QQmlChangeSet::Change &i : changeSet.inserts()) {-
2221 if (d->modelCount) {
d->modelCountDescription
TRUEevaluated 96 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 14 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
14-96
2222 if (moveId == -1 && i.index <= d->currentIndex) {
moveId == -1Description
TRUEevaluated 86 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquickpathview
i.index <= d->currentIndexDescription
TRUEevaluated 38 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 48 times by 1 test
Evaluated by:
  • tst_qquickpathview
10-86
2223 d->currentIndex += i.count;-
2224 currentChanged = true;-
2225 } else {
executed 38 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
38
2226 if (moveId != -1 && moveId == i.moveId) {
moveId != -1Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 48 times by 1 test
Evaluated by:
  • tst_qquickpathview
moveId == i.moveIdDescription
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEnever evaluated
0-48
2227 d->currentIndex = i.index + moveOffset;-
2228 currentChanged = true;-
2229 }
executed 10 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
10
2230 if (i.index > d->currentIndex) {
i.index > d->currentIndexDescription
TRUEevaluated 48 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_qquickpathview
10-48
2231 d->offset += i.count;-
2232 d->offsetAdj += i.count;-
2233 changedOffset = true;-
2234 }
executed 48 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
48
2235 }
executed 58 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
58
2236 }-
2237 d->modelCount += i.count;-
2238 }
executed 110 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
110
2239-
2240 d->offset = std::fmod(d->offset, qreal(d->modelCount));-
2241 if (d->offset < 0)
d->offset < 0Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 162 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
2-162
2242 d->offset += d->modelCount;
executed 2 times by 1 test: d->offset += d->modelCount;
Executed by:
  • tst_qquickpathview
2
2243 if (d->currentIndex == -1)
d->currentIndex == -1Description
TRUEevaluated 12 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
FALSEevaluated 152 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
12-152
2244 d->currentIndex = d->calcCurrentIndex();
executed 12 times by 2 tests: d->currentIndex = d->calcCurrentIndex();
Executed by:
  • tst_examples
  • tst_qquickpathview
12
2245-
2246 d->itemCache += d->items;-
2247 d->items.clear();-
2248-
2249 if (!d->modelCount) {
!d->modelCountDescription
TRUEevaluated 10 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
FALSEevaluated 154 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
10-154
2250 for (QQuickItem * item : qAsConst(d->itemCache))-
2251 d->releaseItem(item);
executed 54 times by 1 test: d->releaseItem(item);
Executed by:
  • tst_qquickpathview
54
2252 d->itemCache.clear();-
2253 d->offset = 0;-
2254 changedOffset = true;-
2255 d->tl.reset(d->moveOffset);-
2256 } else {
executed 10 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
10
2257 if (!d->flicking && !d->moving && d->haveHighlightRange && d->highlightRangeMode == QQuickPathView::StrictlyEnforceRange) {
!d->flickingDescription
TRUEevaluated 154 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
FALSEnever evaluated
!d->movingDescription
TRUEevaluated 154 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
FALSEnever evaluated
d->haveHighlightRangeDescription
TRUEevaluated 154 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
FALSEnever evaluated
d->highlightRa...lyEnforceRangeDescription
TRUEevaluated 88 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
FALSEevaluated 66 times by 1 test
Evaluated by:
  • tst_qquickpathview
0-154
2258 d->offset = std::fmod(qreal(d->modelCount - d->currentIndex), qreal(d->modelCount));-
2259 changedOffset = true;-
2260 }
executed 88 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
88
2261 d->updateMappedRange();-
2262 d->scheduleLayout();-
2263 }
executed 154 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
154
2264 if (changedOffset)
changedOffsetDescription
TRUEevaluated 128 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
FALSEevaluated 36 times by 1 test
Evaluated by:
  • tst_qquickpathview
36-128
2265 emit offsetChanged();
executed 128 times by 2 tests: offsetChanged();
Executed by:
  • tst_examples
  • tst_qquickpathview
128
2266 if (currentChanged)
currentChangedDescription
TRUEevaluated 94 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
FALSEevaluated 70 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
70-94
2267 emit currentIndexChanged();
executed 94 times by 2 tests: currentIndexChanged();
Executed by:
  • tst_examples
  • tst_qquickpathview
94
2268 if (d->modelCount != modelCount)
d->modelCount != modelCountDescription
TRUEevaluated 120 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
FALSEevaluated 44 times by 1 test
Evaluated by:
  • tst_qquickpathview
44-120
2269 emit countChanged();
executed 120 times by 2 tests: countChanged();
Executed by:
  • tst_examples
  • tst_qquickpathview
120
2270}
executed 164 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
164
2271-
2272void QQuickPathView::destroyingItem(QObject *item)-
2273{-
2274 Q_UNUSED(item);-
2275}
never executed: end of block
0
2276-
2277void QQuickPathView::ticked()-
2278{-
2279 Q_D(QQuickPathView);-
2280 d->updateCurrent();-
2281}
executed 3334 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
3334
2282-
2283void QQuickPathView::movementEnding()-
2284{-
2285 Q_D(QQuickPathView);-
2286 if (d->flicking) {
d->flickingDescription
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 98 times by 1 test
Evaluated by:
  • tst_qquickpathview
16-98
2287 d->flicking = false;-
2288 emit flickingChanged();-
2289 emit flickEnded();-
2290 }
executed 16 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
16
2291 if (d->moving && !d->stealMouse) {
d->movingDescription
TRUEevaluated 20 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 94 times by 1 test
Evaluated by:
  • tst_qquickpathview
!d->stealMouseDescription
TRUEevaluated 20 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEnever evaluated
0-94
2292 d->moving = false;-
2293 emit movingChanged();-
2294 emit movementEnded();-
2295 }
executed 20 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
20
2296 d->moveDirection = d->movementDirection;-
2297}
executed 114 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
114
2298-
2299// find the item closest to the snap position-
2300int QQuickPathViewPrivate::calcCurrentIndex()-
2301{-
2302 int current = 0;-
2303 if (modelCount && model && items.count()) {
modelCountDescription
TRUEevaluated 2435 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 10 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
items.count()Description
TRUEevaluated 2421 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
FALSEevaluated 14 times by 1 test
Evaluated by:
  • tst_qquickpathview
10-2435
2304 offset = std::fmod(offset, qreal(modelCount));-
2305 if (offset < 0)
offset < 0Description
TRUEnever evaluated
FALSEevaluated 2421 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
0-2421
2306 offset += modelCount;
never executed: offset += modelCount;
0
2307 current = qRound(qAbs(std::fmod(modelCount - offset, qreal(modelCount))));-
2308 current = current % modelCount;-
2309 }
executed 2421 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
2421
2310-
2311 return current;
executed 2445 times by 3 tests: return current;
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
2445
2312}-
2313-
2314void QQuickPathViewPrivate::createCurrentItem()-
2315{-
2316 if (requestedIndex != -1)
requestedIndex != -1Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 549 times by 1 test
Evaluated by:
  • tst_qquickpathview
6-549
2317 return;
executed 6 times by 1 test: return;
Executed by:
  • tst_qquickpathview
6
2318-
2319 bool inItems = false;-
2320 for (QQuickItem *item : qAsConst(items)) {-
2321 if (model->indexOf(item, nullptr) == currentIndex) {
model->indexOf...= currentIndexDescription
TRUEevaluated 519 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 3277 times by 1 test
Evaluated by:
  • tst_qquickpathview
519-3277
2322 inItems = true;-
2323 break;
executed 519 times by 1 test: break;
Executed by:
  • tst_qquickpathview
519
2324 }-
2325 }
executed 3277 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
3277
2326-
2327 if (inItems) {
inItemsDescription
TRUEevaluated 519 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 30 times by 1 test
Evaluated by:
  • tst_qquickpathview
30-519
2328 if ((currentItem = getItem(currentIndex, currentIndex))) {
(currentItem =...currentIndex))Description
TRUEevaluated 519 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEnever evaluated
0-519
2329 currentItem->setFocus(true);-
2330 if (QQuickPathViewAttached *att = attached(currentItem))
QQuickPathView...d(currentItem)Description
TRUEevaluated 519 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEnever evaluated
0-519
2331 att->setIsCurrentItem(true);
executed 519 times by 1 test: att->setIsCurrentItem(true);
Executed by:
  • tst_qquickpathview
519
2332 }
executed 519 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
519
2333 } else if (currentIndex >= 0 && currentIndex < modelCount) {
executed 519 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
currentIndex >= 0Description
TRUEevaluated 30 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEnever evaluated
currentIndex < modelCountDescription
TRUEevaluated 30 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEnever evaluated
0-519
2334 if ((currentItem = getItem(currentIndex, currentIndex))) {
(currentItem =...currentIndex))Description
TRUEevaluated 30 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEnever evaluated
0-30
2335 updateItem(currentItem, 1.0);-
2336 if (QQuickPathViewAttached *att = attached(currentItem))
QQuickPathView...d(currentItem)Description
TRUEevaluated 30 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEnever evaluated
0-30
2337 att->setIsCurrentItem(true);
executed 30 times by 1 test: att->setIsCurrentItem(true);
Executed by:
  • tst_qquickpathview
30
2338 }
executed 30 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
30
2339 }
executed 30 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
30
2340}
executed 549 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
549
2341-
2342void QQuickPathViewPrivate::updateCurrent()-
2343{-
2344 Q_Q(QQuickPathView);-
2345 if (moveReason == SetIndex)
moveReason == SetIndexDescription
TRUEevaluated 1646 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 2298 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
1646-2298
2346 return;
executed 1646 times by 1 test: return;
Executed by:
  • tst_qquickpathview
1646
2347 if (!modelCount || !haveHighlightRange || highlightRangeMode != QQuickPathView::StrictlyEnforceRange)
!modelCountDescription
TRUEevaluated 88 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
FALSEevaluated 2210 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
!haveHighlightRangeDescription
TRUEnever evaluated
FALSEevaluated 2210 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
highlightRange...lyEnforceRangeDescription
TRUEevaluated 344 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 1866 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
0-2210
2348 return;
executed 432 times by 2 tests: return;
Executed by:
  • tst_examples
  • tst_qquickpathview
432
2349-
2350 int idx = calcCurrentIndex();-
2351 if (model && (idx != currentIndex || !currentItem)) {
idx != currentIndexDescription
TRUEevaluated 405 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 1461 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
!currentItemDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 1455 times by 3 tests
Evaluated by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
6-1461
2352 if (currentItem) {
currentItemDescription
TRUEevaluated 405 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickpathview
6-405
2353 if (QQuickPathViewAttached *att = attached(currentItem))
QQuickPathView...d(currentItem)Description
TRUEevaluated 405 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEnever evaluated
0-405
2354 att->setIsCurrentItem(false);
executed 405 times by 1 test: att->setIsCurrentItem(false);
Executed by:
  • tst_qquickpathview
405
2355 releaseItem(currentItem);-
2356 }
executed 405 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
405
2357 int oldCurrentIndex = currentIndex;-
2358 currentIndex = idx;-
2359 currentItem = nullptr;-
2360 createCurrentItem();-
2361 if (oldCurrentIndex != currentIndex)
oldCurrentInde...= currentIndexDescription
TRUEevaluated 405 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickpathview
6-405
2362 emit q->currentIndexChanged();
executed 405 times by 1 test: q->currentIndexChanged();
Executed by:
  • tst_qquickpathview
405
2363 emit q->currentItemChanged();-
2364 }
executed 411 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
411
2365}
executed 1866 times by 3 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
1866
2366-
2367void QQuickPathViewPrivate::fixOffsetCallback(void *d)-
2368{-
2369 ((QQuickPathViewPrivate *)d)->fixOffset();-
2370}
executed 18 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
18
2371-
2372void QQuickPathViewPrivate::fixOffset()-
2373{-
2374 Q_Q(QQuickPathView);-
2375 if (model && items.count()) {
items.count()Description
TRUEevaluated 26 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEnever evaluated
0-26
2376 if (haveHighlightRange && (highlightRangeMode == QQuickPathView::StrictlyEnforceRange
haveHighlightRangeDescription
TRUEevaluated 26 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEnever evaluated
highlightRange...lyEnforceRangeDescription
TRUEevaluated 22 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickpathview
0-26
2377 || snapMode != QQuickPathView::NoSnap)) {
snapMode != QQ...thView::NoSnapDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEnever evaluated
0-4
2378 int curr = calcCurrentIndex();-
2379 if (curr != currentIndex && highlightRangeMode == QQuickPathView::StrictlyEnforceRange)
curr != currentIndexDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 22 times by 1 test
Evaluated by:
  • tst_qquickpathview
highlightRange...lyEnforceRangeDescription
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickpathview
0-22
2380 q->setCurrentIndex(curr);
never executed: q->setCurrentIndex(curr);
0
2381 else-
2382 snapToIndex(curr, Other);
executed 26 times by 1 test: snapToIndex(curr, Other);
Executed by:
  • tst_qquickpathview
26
2383 }-
2384 }
executed 26 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
26
2385}
executed 26 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
26
2386-
2387void QQuickPathViewPrivate::snapToIndex(int index, MovementReason reason)-
2388{-
2389 if (!model || modelCount <= 0)
!modelDescription
TRUEnever evaluated
FALSEevaluated 194 times by 1 test
Evaluated by:
  • tst_qquickpathview
modelCount <= 0Description
TRUEnever evaluated
FALSEevaluated 194 times by 1 test
Evaluated by:
  • tst_qquickpathview
0-194
2390 return;
never executed: return;
0
2391-
2392 qreal targetOffset = std::fmod(qreal(modelCount - index), qreal(modelCount));-
2393-
2394 if (offset == targetOffset)
offset == targetOffsetDescription
TRUEevaluated 96 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 98 times by 1 test
Evaluated by:
  • tst_qquickpathview
96-98
2395 return;
executed 96 times by 1 test: return;
Executed by:
  • tst_qquickpathview
96
2396-
2397 moveReason = reason;-
2398 offsetAdj = 0.0;-
2399 tl.reset(moveOffset);-
2400 moveOffset.setValue(offset);-
2401-
2402 const int duration = highlightMoveDuration;-
2403-
2404 if (!duration) {
!durationDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 92 times by 1 test
Evaluated by:
  • tst_qquickpathview
6-92
2405 tl.set(moveOffset, targetOffset);-
2406 } else if (moveDirection == QQuickPathView::Positive || (moveDirection == QQuickPathView::Shortest && targetOffset - offset > modelCount/2.0)) {
executed 6 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
moveDirection ...View::PositiveDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 84 times by 1 test
Evaluated by:
  • tst_qquickpathview
moveDirection ...View::ShortestDescription
TRUEevaluated 76 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickpathview
targetOffset -...modelCount/2.0Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 72 times by 1 test
Evaluated by:
  • tst_qquickpathview
4-84
2407 qreal distance = modelCount - targetOffset + offset;-
2408 if (targetOffset > moveOffset) {
targetOffset > moveOffsetDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_qquickpathview
4-8
2409 tl.move(moveOffset, 0.0, QEasingCurve(QEasingCurve::InQuad), int(duration * offset / distance));-
2410 tl.set(moveOffset, modelCount);-
2411 tl.move(moveOffset, targetOffset, QEasingCurve(offset == 0.0 ? QEasingCurve::InOutQuad : QEasingCurve::OutQuad), int(duration * (modelCount-targetOffset) / distance));-
2412 } else {
executed 8 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
8
2413 tl.move(moveOffset, targetOffset, QEasingCurve(QEasingCurve::InOutQuad), duration);-
2414 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
4
2415 } else if (moveDirection == QQuickPathView::Negative || targetOffset - offset <= -modelCount/2.0) {
moveDirection ...View::NegativeDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 72 times by 1 test
Evaluated by:
  • tst_qquickpathview
targetOffset -...modelCount/2.0Description
TRUEnever evaluated
FALSEevaluated 72 times by 1 test
Evaluated by:
  • tst_qquickpathview
0-72
2416 qreal distance = modelCount - offset + targetOffset;-
2417 if (targetOffset < moveOffset) {
targetOffset < moveOffsetDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickpathview
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_qquickpathview
2-6
2418 tl.move(moveOffset, modelCount, QEasingCurve(targetOffset == 0 ? QEasingCurve::InOutQuad : QEasingCurve::InQuad), int(duration * (modelCount-offset) / distance));-
2419 tl.set(moveOffset, 0.0);-
2420 tl.move(moveOffset, targetOffset, QEasingCurve(QEasingCurve::OutQuad), int(duration * targetOffset / distance));-
2421 } else {
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
2
2422 tl.move(moveOffset, targetOffset, QEasingCurve(QEasingCurve::InOutQuad), duration);-
2423 }
executed 6 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
6
2424 } else {-
2425 tl.move(moveOffset, targetOffset, QEasingCurve(QEasingCurve::InOutQuad), duration);-
2426 }
executed 72 times by 1 test: end of block
Executed by:
  • tst_qquickpathview
72
2427}-
2428-
2429QQuickPathViewAttached *QQuickPathView::qmlAttachedProperties(QObject *obj)-
2430{-
2431 return new QQuickPathViewAttached(obj);
executed 3338 times by 3 tests: return new QQuickPathViewAttached(obj);
Executed by:
  • tst_examples
  • tst_qquickpathview
  • tst_qquickvisualdatamodel
3338
2432}-
2433-
2434QT_END_NAMESPACE-
2435-
2436#include "moc_qquickpathview_p.cpp"-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.0