Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/items/qquickpathview.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||||||||||||||
2 | - | |||||||||||||||||||||||||||||||
3 | - | |||||||||||||||||||||||||||||||
4 | - | |||||||||||||||||||||||||||||||
5 | - | |||||||||||||||||||||||||||||||
6 | - | |||||||||||||||||||||||||||||||
7 | - | |||||||||||||||||||||||||||||||
8 | extern const QLoggingCategory &lcItemViewDelegateLifecycle(); | - | ||||||||||||||||||||||||||||||
9 | - | |||||||||||||||||||||||||||||||
10 | const qreal MinimumFlickVelocity = 75.0; | - | ||||||||||||||||||||||||||||||
11 | - | |||||||||||||||||||||||||||||||
12 | static QQmlOpenMetaObjectType *qPathViewAttachedType = nullptr; | - | ||||||||||||||||||||||||||||||
13 | - | |||||||||||||||||||||||||||||||
14 | QQuickPathViewAttached::QQuickPathViewAttached(QObject *parent) | - | ||||||||||||||||||||||||||||||
15 | : QObject(parent), m_percent(-1), m_view(nullptr), m_onPath(false), m_isCurrent(false) | - | ||||||||||||||||||||||||||||||
16 | { | - | ||||||||||||||||||||||||||||||
17 | if (qPathViewAttachedType
| 1450-1888 | ||||||||||||||||||||||||||||||
18 | m_metaobject = new QQmlOpenMetaObject(this, qPathViewAttachedType); | - | ||||||||||||||||||||||||||||||
19 | m_metaobject->setCached(true); | - | ||||||||||||||||||||||||||||||
20 | } executed 1888 times by 3 tests: else {end of block Executed by:
| 1888 | ||||||||||||||||||||||||||||||
21 | m_metaobject = new QQmlOpenMetaObject(this); | - | ||||||||||||||||||||||||||||||
22 | } executed 1450 times by 2 tests: end of block Executed by:
| 1450 | ||||||||||||||||||||||||||||||
23 | } | - | ||||||||||||||||||||||||||||||
24 | - | |||||||||||||||||||||||||||||||
25 | QQuickPathViewAttached::~QQuickPathViewAttached() | - | ||||||||||||||||||||||||||||||
26 | { | - | ||||||||||||||||||||||||||||||
27 | } | - | ||||||||||||||||||||||||||||||
28 | - | |||||||||||||||||||||||||||||||
29 | QVariant QQuickPathViewAttached::value(const QByteArray &name) const | - | ||||||||||||||||||||||||||||||
30 | { | - | ||||||||||||||||||||||||||||||
31 | return never executed: m_metaobject->value(name);return m_metaobject->value(name); never executed: return m_metaobject->value(name); | 0 | ||||||||||||||||||||||||||||||
32 | } | - | ||||||||||||||||||||||||||||||
33 | void QQuickPathViewAttached::setValue(const QByteArray &name, const QVariant &val) | - | ||||||||||||||||||||||||||||||
34 | { | - | ||||||||||||||||||||||||||||||
35 | m_metaobject->setValue(name, val); | - | ||||||||||||||||||||||||||||||
36 | } executed 5154 times by 2 tests: end of block Executed by:
| 5154 | ||||||||||||||||||||||||||||||
37 | - | |||||||||||||||||||||||||||||||
38 | QQuickPathViewPrivate::QQuickPathViewPrivate() | - | ||||||||||||||||||||||||||||||
39 | : path(nullptr), currentIndex(0), currentItemOffset(0.0), startPc(0) | - | ||||||||||||||||||||||||||||||
40 | , offset(0.0), offsetAdj(0.0), mappedRange(1.0), mappedCache(0.0) | - | ||||||||||||||||||||||||||||||
41 | , stealMouse(false), ownModel(false), interactive(true), haveHighlightRange(true) | - | ||||||||||||||||||||||||||||||
42 | , autoHighlight(true), highlightUp(false), layoutScheduled(false) | - | ||||||||||||||||||||||||||||||
43 | , moving(false), flicking(false), dragging(false), inRequest(false), delegateValidated(false) | - | ||||||||||||||||||||||||||||||
44 | , inRefill(false) | - | ||||||||||||||||||||||||||||||
45 | , dragMargin(0), deceleration(100), maximumFlickVelocity(2500) | - | ||||||||||||||||||||||||||||||
46 | , moveOffset(this, &QQuickPathViewPrivate::setAdjustedOffset), flickDuration(0) | - | ||||||||||||||||||||||||||||||
47 | , pathItems(-1), requestedIndex(-1), cacheSize(0), requestedZ(0) | - | ||||||||||||||||||||||||||||||
48 | , moveReason(Other), movementDirection(QQuickPathView::Shortest), moveDirection(QQuickPathView::Shortest) | - | ||||||||||||||||||||||||||||||
49 | , attType(nullptr), highlightComponent(nullptr), highlightItem(nullptr) | - | ||||||||||||||||||||||||||||||
50 | , moveHighlight(this, &QQuickPathViewPrivate::setHighlightPosition) | - | ||||||||||||||||||||||||||||||
51 | , highlightPosition(0) | - | ||||||||||||||||||||||||||||||
52 | , highlightRangeStart(0), highlightRangeEnd(0) | - | ||||||||||||||||||||||||||||||
53 | , highlightRangeMode(QQuickPathView::StrictlyEnforceRange) | - | ||||||||||||||||||||||||||||||
54 | , highlightMoveDuration(300), modelCount(0), snapMode(QQuickPathView::NoSnap) | - | ||||||||||||||||||||||||||||||
55 | { | - | ||||||||||||||||||||||||||||||
56 | } executed 282 times by 3 tests: end of block Executed by:
| 282 | ||||||||||||||||||||||||||||||
57 | - | |||||||||||||||||||||||||||||||
58 | void QQuickPathViewPrivate::init() | - | ||||||||||||||||||||||||||||||
59 | { | - | ||||||||||||||||||||||||||||||
60 | QQuickPathView * const q = q_func(); | - | ||||||||||||||||||||||||||||||
61 | offset = 0; | - | ||||||||||||||||||||||||||||||
62 | q->setAcceptedMouseButtons(Qt::LeftButton); | - | ||||||||||||||||||||||||||||||
63 | q->setFlag(QQuickItem::ItemIsFocusScope); | - | ||||||||||||||||||||||||||||||
64 | q->setFiltersChildMouseEvents(true); | - | ||||||||||||||||||||||||||||||
65 | { QQuickTimeLine *sender = (&tl); QQuickPathView *receiver = (q); const char *signal = (qFlagLocation("2""updated()" "\0" __FILE__ ":" "120")); const char *method = (qFlagLocation("1""ticked()" "\0" __FILE__ ":" "120")); static int signalIdx = -1; static int methodIdx = -1; if (signalIdx < 0
| 6-276 | ||||||||||||||||||||||||||||||
66 | __FILE__ | - | ||||||||||||||||||||||||||||||
67 | , | - | ||||||||||||||||||||||||||||||
68 | 120 | - | ||||||||||||||||||||||||||||||
69 | )); signalIdx = QQuickTimeLine::staticMetaObject.indexOfSignal(signal+1); } executed 6 times by 3 tests: if (methodIdx < 0end of block Executed by:
| 6-276 | ||||||||||||||||||||||||||||||
70 | __FILE__ | - | ||||||||||||||||||||||||||||||
71 | , | - | ||||||||||||||||||||||||||||||
72 | 120 | - | ||||||||||||||||||||||||||||||
73 | )); if (code == 1
executed 6 times by 3 tests: else methodIdx = QQuickPathView::staticMetaObject.indexOfSignal(method+1);methodIdx = QQuickPathView::staticMetaObject.indexOfSlot(method+1); Executed by:
never executed: } ((signalIdx != -1 && methodIdx != -1) ? static_cast<void>(0) : qt_assert("signalIdx != -1 && methodIdx != -1",methodIdx = QQuickPathView::staticMetaObject.indexOfSignal(method+1); | 0-6 | ||||||||||||||||||||||||||||||
74 | __FILE__ | - | ||||||||||||||||||||||||||||||
75 | , | - | ||||||||||||||||||||||||||||||
76 | 120 | - | ||||||||||||||||||||||||||||||
77 | )); QMetaObject::connect(sender, signalIdx, receiver, methodIdx, Qt::DirectConnection); } | - | ||||||||||||||||||||||||||||||
78 | - | |||||||||||||||||||||||||||||||
79 | timer.invalidate(); | - | ||||||||||||||||||||||||||||||
80 | { QQuickTimeLine *sender = (&tl); QQuickPathView *receiver = (q); const char *signal = (qFlagLocation("2""completed()" "\0" __FILE__ ":" "123")); const char *method = (qFlagLocation("1""movementEnding()" "\0" __FILE__ ":" "123")); static int signalIdx = -1; static int methodIdx = -1; if (signalIdx < 0
| 6-276 | ||||||||||||||||||||||||||||||
81 | __FILE__ | - | ||||||||||||||||||||||||||||||
82 | , | - | ||||||||||||||||||||||||||||||
83 | 123 | - | ||||||||||||||||||||||||||||||
84 | )); signalIdx = QQuickTimeLine::staticMetaObject.indexOfSignal(signal+1); } executed 6 times by 3 tests: if (methodIdx < 0end of block Executed by:
| 6-276 | ||||||||||||||||||||||||||||||
85 | __FILE__ | - | ||||||||||||||||||||||||||||||
86 | , | - | ||||||||||||||||||||||||||||||
87 | 123 | - | ||||||||||||||||||||||||||||||
88 | )); if (code == 1
executed 6 times by 3 tests: else methodIdx = QQuickPathView::staticMetaObject.indexOfSignal(method+1);methodIdx = QQuickPathView::staticMetaObject.indexOfSlot(method+1); Executed by:
never executed: } ((signalIdx != -1 && methodIdx != -1) ? static_cast<void>(0) : qt_assert("signalIdx != -1 && methodIdx != -1",methodIdx = QQuickPathView::staticMetaObject.indexOfSignal(method+1); | 0-6 | ||||||||||||||||||||||||||||||
89 | __FILE__ | - | ||||||||||||||||||||||||||||||
90 | , | - | ||||||||||||||||||||||||||||||
91 | 123 | - | ||||||||||||||||||||||||||||||
92 | )); QMetaObject::connect(sender, signalIdx, receiver, methodIdx, Qt::DirectConnection); } | - | ||||||||||||||||||||||||||||||
93 | - | |||||||||||||||||||||||||||||||
94 | } executed 282 times by 3 tests: end of block Executed by:
| 282 | ||||||||||||||||||||||||||||||
95 | - | |||||||||||||||||||||||||||||||
96 | QQuickItem *QQuickPathViewPrivate::getItem(int modelIndex, qreal z, bool async) | - | ||||||||||||||||||||||||||||||
97 | { | - | ||||||||||||||||||||||||||||||
98 | QQuickPathView * const q = q_func(); | - | ||||||||||||||||||||||||||||||
99 | requestedIndex = modelIndex; | - | ||||||||||||||||||||||||||||||
100 | requestedZ = z; | - | ||||||||||||||||||||||||||||||
101 | inRequest = true; | - | ||||||||||||||||||||||||||||||
102 | QObject *object = model->object(modelIndex, async ? QQmlIncubator::Asynchronous : QQmlIncubator::AsynchronousIfNested); | - | ||||||||||||||||||||||||||||||
103 | QQuickItem *item = qmlobject_cast<QQuickItem*>(object); | - | ||||||||||||||||||||||||||||||
104 | if (!item
| 30-4393 | ||||||||||||||||||||||||||||||
105 | if (object
| 0-30 | ||||||||||||||||||||||||||||||
106 | model->release(object); | - | ||||||||||||||||||||||||||||||
107 | if (!delegateValidated
| 0 | ||||||||||||||||||||||||||||||
108 | delegateValidated = true; | - | ||||||||||||||||||||||||||||||
109 | QObject* delegate = q->delegate(); | - | ||||||||||||||||||||||||||||||
110 | qmlWarning(delegate ? delegate : q) << QQuickPathView::tr("Delegate must be of Item type"); | - | ||||||||||||||||||||||||||||||
111 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
112 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
113 | } executed 30 times by 1 test: else {end of block Executed by:
| 30 | ||||||||||||||||||||||||||||||
114 | item->setParentItem(q); | - | ||||||||||||||||||||||||||||||
115 | requestedIndex = -1; | - | ||||||||||||||||||||||||||||||
116 | QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item); | - | ||||||||||||||||||||||||||||||
117 | itemPrivate->addItemChangeListener(this, QQuickItemPrivate::Geometry); | - | ||||||||||||||||||||||||||||||
118 | } executed 4393 times by 3 tests: end of block Executed by:
| 4393 | ||||||||||||||||||||||||||||||
119 | inRequest = false; | - | ||||||||||||||||||||||||||||||
120 | return executed 4423 times by 3 tests: item;return item; Executed by:
executed 4423 times by 3 tests: return item; Executed by:
| 4423 | ||||||||||||||||||||||||||||||
121 | } | - | ||||||||||||||||||||||||||||||
122 | - | |||||||||||||||||||||||||||||||
123 | void QQuickPathView::createdItem(int index, QObject *object) | - | ||||||||||||||||||||||||||||||
124 | { | - | ||||||||||||||||||||||||||||||
125 | QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
126 | QQuickItem *item = qmlobject_cast<QQuickItem*>(object); | - | ||||||||||||||||||||||||||||||
127 | if (d->requestedIndex != index
| 86-3264 | ||||||||||||||||||||||||||||||
128 | qPathViewAttachedType = d->attachedType(); | - | ||||||||||||||||||||||||||||||
129 | QQuickPathViewAttached *att = static_cast<QQuickPathViewAttached *>(qmlAttachedPropertiesObject<QQuickPathView>(item)); | - | ||||||||||||||||||||||||||||||
130 | qPathViewAttachedType = nullptr; | - | ||||||||||||||||||||||||||||||
131 | if (att
| 0-86 | ||||||||||||||||||||||||||||||
132 | att->m_view = this; | - | ||||||||||||||||||||||||||||||
133 | att->setOnPath(false); | - | ||||||||||||||||||||||||||||||
134 | } executed 86 times by 2 tests: end of block Executed by:
| 86 | ||||||||||||||||||||||||||||||
135 | item->setParentItem(this); | - | ||||||||||||||||||||||||||||||
136 | d->updateItem(item, 1.0); | - | ||||||||||||||||||||||||||||||
137 | } executed 86 times by 2 tests: else {end of block Executed by:
| 86 | ||||||||||||||||||||||||||||||
138 | d->requestedIndex = -1; | - | ||||||||||||||||||||||||||||||
139 | if (!d->inRequest
| 30-3234 | ||||||||||||||||||||||||||||||
140 | refill(); executed 30 times by 1 test: refill(); Executed by:
| 30 | ||||||||||||||||||||||||||||||
141 | } executed 3264 times by 3 tests: end of block Executed by:
| 3264 | ||||||||||||||||||||||||||||||
142 | } | - | ||||||||||||||||||||||||||||||
143 | - | |||||||||||||||||||||||||||||||
144 | void QQuickPathView::initItem(int index, QObject *object) | - | ||||||||||||||||||||||||||||||
145 | { | - | ||||||||||||||||||||||||||||||
146 | QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
147 | QQuickItem *item = qmlobject_cast<QQuickItem*>(object); | - | ||||||||||||||||||||||||||||||
148 | if (item
| 0-3350 | ||||||||||||||||||||||||||||||
149 | QQuickItemPrivate::get(item)->setCulled(true); | - | ||||||||||||||||||||||||||||||
150 | item->setParentItem(this); | - | ||||||||||||||||||||||||||||||
151 | qPathViewAttachedType = d->attachedType(); | - | ||||||||||||||||||||||||||||||
152 | QQuickPathViewAttached *att = static_cast<QQuickPathViewAttached *>(qmlAttachedPropertiesObject<QQuickPathView>(item)); | - | ||||||||||||||||||||||||||||||
153 | qPathViewAttachedType = nullptr; | - | ||||||||||||||||||||||||||||||
154 | if (att
| 0-3264 | ||||||||||||||||||||||||||||||
155 | att->m_view = this; | - | ||||||||||||||||||||||||||||||
156 | qreal percent = d->positionOfIndex(index); | - | ||||||||||||||||||||||||||||||
157 | if (percent < 1.0
| 2-3218 | ||||||||||||||||||||||||||||||
158 | const auto attributes = d->path->attributes(); | - | ||||||||||||||||||||||||||||||
159 | for (const QString &attr : attributes) | - | ||||||||||||||||||||||||||||||
160 | 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:
| 1710 | ||||||||||||||||||||||||||||||
161 | item->setZ(d->requestedZ); | - | ||||||||||||||||||||||||||||||
162 | } executed 3216 times by 3 tests: end of block Executed by:
| 3216 | ||||||||||||||||||||||||||||||
163 | att->setOnPath(percent < 1.0); | - | ||||||||||||||||||||||||||||||
164 | } executed 3264 times by 3 tests: end of block Executed by:
| 3264 | ||||||||||||||||||||||||||||||
165 | } executed 3264 times by 3 tests: end of block Executed by:
| 3264 | ||||||||||||||||||||||||||||||
166 | } executed 3350 times by 3 tests: end of block Executed by:
| 3350 | ||||||||||||||||||||||||||||||
167 | - | |||||||||||||||||||||||||||||||
168 | void QQuickPathViewPrivate::releaseItem(QQuickItem *item) | - | ||||||||||||||||||||||||||||||
169 | { | - | ||||||||||||||||||||||||||||||
170 | if (!item
| 0-4381 | ||||||||||||||||||||||||||||||
171 | return; executed 48 times by 1 test: return; Executed by:
| 48 | ||||||||||||||||||||||||||||||
172 | for (bool qt_category_enabled = lcItemViewDelegateLifecycle().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 202, __PRETTY_FUNCTION__, lcItemViewDelegateLifecycle().categoryName()).debug() << "release" << item; | 0-4333 | ||||||||||||||||||||||||||||||
173 | QQuickItemPrivate *itemPrivate = QQuickItemPrivate::get(item); | - | ||||||||||||||||||||||||||||||
174 | itemPrivate->removeItemChangeListener(this, QQuickItemPrivate::Geometry); | - | ||||||||||||||||||||||||||||||
175 | QQmlInstanceModel::ReleaseFlags flags = model->release(item); | - | ||||||||||||||||||||||||||||||
176 | if (!flags
| 1979-2354 | ||||||||||||||||||||||||||||||
177 | - | |||||||||||||||||||||||||||||||
178 | if (QQuickPathViewAttached *att = attached(item)
| 0-1979 | ||||||||||||||||||||||||||||||
179 | att->setOnPath(false); executed 1979 times by 3 tests: att->setOnPath(false); Executed by:
| 1979 | ||||||||||||||||||||||||||||||
180 | } executed 1979 times by 3 tests: else if (flags & QQmlInstanceModel::Destroyedend of block Executed by:
| 871-1979 | ||||||||||||||||||||||||||||||
181 | - | |||||||||||||||||||||||||||||||
182 | item->setParentItem(nullptr); | - | ||||||||||||||||||||||||||||||
183 | } executed 1483 times by 1 test: end of block Executed by:
| 1483 | ||||||||||||||||||||||||||||||
184 | } executed 4333 times by 3 tests: end of block Executed by:
| 4333 | ||||||||||||||||||||||||||||||
185 | - | |||||||||||||||||||||||||||||||
186 | QQuickPathViewAttached *QQuickPathViewPrivate::attached(QQuickItem *item) | - | ||||||||||||||||||||||||||||||
187 | { | - | ||||||||||||||||||||||||||||||
188 | return executed 53457 times by 3 tests: static_cast<QQuickPathViewAttached *>(qmlAttachedPropertiesObject<QQuickPathView>(item, false));return static_cast<QQuickPathViewAttached *>(qmlAttachedPropertiesObject<QQuickPathView>(item, false)); Executed by:
executed 53457 times by 3 tests: return static_cast<QQuickPathViewAttached *>(qmlAttachedPropertiesObject<QQuickPathView>(item, false)); Executed by:
| 53457 | ||||||||||||||||||||||||||||||
189 | } | - | ||||||||||||||||||||||||||||||
190 | - | |||||||||||||||||||||||||||||||
191 | QQmlOpenMetaObjectType *QQuickPathViewPrivate::attachedType() | - | ||||||||||||||||||||||||||||||
192 | { | - | ||||||||||||||||||||||||||||||
193 | QQuickPathView * const q = q_func(); | - | ||||||||||||||||||||||||||||||
194 | if (!attType
| 280-3070 | ||||||||||||||||||||||||||||||
195 | - | |||||||||||||||||||||||||||||||
196 | attType = new QQmlOpenMetaObjectType(&QQuickPathViewAttached::staticMetaObject, qmlEngine(q)); | - | ||||||||||||||||||||||||||||||
197 | if (path
| 2-278 | ||||||||||||||||||||||||||||||
198 | const auto attributes = path->attributes(); | - | ||||||||||||||||||||||||||||||
199 | for (const QString &attr : attributes) | - | ||||||||||||||||||||||||||||||
200 | attType->createProperty(attr.toUtf8()); executed 174 times by 2 tests: attType->createProperty(attr.toUtf8()); Executed by:
| 174 | ||||||||||||||||||||||||||||||
201 | } executed 278 times by 3 tests: end of block Executed by:
| 278 | ||||||||||||||||||||||||||||||
202 | } executed 280 times by 3 tests: end of block Executed by:
| 280 | ||||||||||||||||||||||||||||||
203 | - | |||||||||||||||||||||||||||||||
204 | return executed 3350 times by 3 tests: attType;return attType; Executed by:
executed 3350 times by 3 tests: return attType; Executed by:
| 3350 | ||||||||||||||||||||||||||||||
205 | } | - | ||||||||||||||||||||||||||||||
206 | - | |||||||||||||||||||||||||||||||
207 | void QQuickPathViewPrivate::clear() | - | ||||||||||||||||||||||||||||||
208 | { | - | ||||||||||||||||||||||||||||||
209 | if (currentItem
| 392-452 | ||||||||||||||||||||||||||||||
210 | releaseItem(currentItem); | - | ||||||||||||||||||||||||||||||
211 | currentItem = nullptr; | - | ||||||||||||||||||||||||||||||
212 | } executed 392 times by 3 tests: end of block Executed by:
| 392 | ||||||||||||||||||||||||||||||
213 | - | |||||||||||||||||||||||||||||||
214 | for (QQuickItem *p : qAsConst(items)) | - | ||||||||||||||||||||||||||||||
215 | releaseItem(p); executed 1832 times by 3 tests: releaseItem(p); Executed by:
| 1832 | ||||||||||||||||||||||||||||||
216 | - | |||||||||||||||||||||||||||||||
217 | for (QQuickItem *p : qAsConst(itemCache)) | - | ||||||||||||||||||||||||||||||
218 | releaseItem(p); executed 787 times by 1 test: releaseItem(p); Executed by:
| 787 | ||||||||||||||||||||||||||||||
219 | - | |||||||||||||||||||||||||||||||
220 | if (requestedIndex >= 0
| 0-844 | ||||||||||||||||||||||||||||||
221 | if (model
| 0 | ||||||||||||||||||||||||||||||
222 | model->cancel(requestedIndex); never executed: model->cancel(requestedIndex); | 0 | ||||||||||||||||||||||||||||||
223 | requestedIndex = -1; | - | ||||||||||||||||||||||||||||||
224 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
225 | - | |||||||||||||||||||||||||||||||
226 | items.clear(); | - | ||||||||||||||||||||||||||||||
227 | itemCache.clear(); | - | ||||||||||||||||||||||||||||||
228 | tl.clear(); | - | ||||||||||||||||||||||||||||||
229 | } executed 844 times by 3 tests: end of block Executed by:
| 844 | ||||||||||||||||||||||||||||||
230 | - | |||||||||||||||||||||||||||||||
231 | void QQuickPathViewPrivate::updateMappedRange() | - | ||||||||||||||||||||||||||||||
232 | { | - | ||||||||||||||||||||||||||||||
233 | if (model && pathItems != -1
| 114-410 | ||||||||||||||||||||||||||||||
234 | mappedRange = qreal(modelCount)/pathItems; | - | ||||||||||||||||||||||||||||||
235 | mappedCache = qreal(cacheSize)/pathItems/2; | - | ||||||||||||||||||||||||||||||
236 | } executed 194 times by 2 tests: else {end of block Executed by:
| 194 | ||||||||||||||||||||||||||||||
237 | mappedRange = 1.0; | - | ||||||||||||||||||||||||||||||
238 | mappedCache = 0.0; | - | ||||||||||||||||||||||||||||||
239 | } executed 528 times by 3 tests: end of block Executed by:
| 528 | ||||||||||||||||||||||||||||||
240 | } | - | ||||||||||||||||||||||||||||||
241 | - | |||||||||||||||||||||||||||||||
242 | qreal QQuickPathViewPrivate::positionOfIndex(qreal index) const | - | ||||||||||||||||||||||||||||||
243 | { | - | ||||||||||||||||||||||||||||||
244 | qreal pos = -1.0; | - | ||||||||||||||||||||||||||||||
245 | - | |||||||||||||||||||||||||||||||
246 | if (model && index >= 0
| 0-51273 | ||||||||||||||||||||||||||||||
247 | qreal start = 0.0; | - | ||||||||||||||||||||||||||||||
248 | if (haveHighlightRange
| 122-51151 | ||||||||||||||||||||||||||||||
249 | || snapMode != QQuickPathView::NoSnap
| 762-2642 | ||||||||||||||||||||||||||||||
250 | start = highlightRangeStart; executed 48509 times by 3 tests: start = highlightRangeStart; Executed by:
| 48509 | ||||||||||||||||||||||||||||||
251 | qreal globalPos = index + offset; | - | ||||||||||||||||||||||||||||||
252 | globalPos = std::fmod(globalPos, qreal(modelCount)) / modelCount; | - | ||||||||||||||||||||||||||||||
253 | if (pathItems != -1
| 204-33188 | ||||||||||||||||||||||||||||||
254 | globalPos += start / mappedRange; | - | ||||||||||||||||||||||||||||||
255 | globalPos = std::fmod(globalPos, qreal(1.0)); | - | ||||||||||||||||||||||||||||||
256 | pos = globalPos * mappedRange; | - | ||||||||||||||||||||||||||||||
257 | } executed 32984 times by 2 tests: else {end of block Executed by:
| 32984 | ||||||||||||||||||||||||||||||
258 | pos = std::fmod(globalPos + start, qreal(1.0)); | - | ||||||||||||||||||||||||||||||
259 | } executed 18289 times by 3 tests: end of block Executed by:
| 18289 | ||||||||||||||||||||||||||||||
260 | } | - | ||||||||||||||||||||||||||||||
261 | - | |||||||||||||||||||||||||||||||
262 | return executed 51273 times by 3 tests: pos;return pos; Executed by:
executed 51273 times by 3 tests: return pos; Executed by:
| 51273 | ||||||||||||||||||||||||||||||
263 | } | - | ||||||||||||||||||||||||||||||
264 | - | |||||||||||||||||||||||||||||||
265 | - | |||||||||||||||||||||||||||||||
266 | - | |||||||||||||||||||||||||||||||
267 | bool QQuickPathViewPrivate::isInBound(qreal position, qreal lower, qreal upper) const | - | ||||||||||||||||||||||||||||||
268 | { | - | ||||||||||||||||||||||||||||||
269 | if (lower == upper
| 80-5522 | ||||||||||||||||||||||||||||||
270 | return executed 80 times by 1 test: true;return true; Executed by:
executed 80 times by 1 test: return true; Executed by:
| 80 | ||||||||||||||||||||||||||||||
271 | if (lower > upper
| 1932-3590 | ||||||||||||||||||||||||||||||
272 | if (position > upper
| 18-1313 | ||||||||||||||||||||||||||||||
273 | position -= mappedRange; executed 18 times by 1 test: position -= mappedRange; Executed by:
| 18 | ||||||||||||||||||||||||||||||
274 | lower -= mappedRange; | - | ||||||||||||||||||||||||||||||
275 | } executed 1932 times by 3 tests: end of block Executed by:
| 1932 | ||||||||||||||||||||||||||||||
276 | return executed 5522 times by 3 tests: position >= lower && position < upper;return position >= lower && position < upper; Executed by:
executed 5522 times by 3 tests: return position >= lower && position < upper; Executed by:
| 5522 | ||||||||||||||||||||||||||||||
277 | } | - | ||||||||||||||||||||||||||||||
278 | - | |||||||||||||||||||||||||||||||
279 | void QQuickPathViewPrivate::createHighlight() | - | ||||||||||||||||||||||||||||||
280 | { | - | ||||||||||||||||||||||||||||||
281 | QQuickPathView * const q = q_func(); | - | ||||||||||||||||||||||||||||||
282 | if (!q->isComponentComplete()
| 116-282 | ||||||||||||||||||||||||||||||
283 | return; executed 116 times by 2 tests: return; Executed by:
| 116 | ||||||||||||||||||||||||||||||
284 | - | |||||||||||||||||||||||||||||||
285 | bool changed = false; | - | ||||||||||||||||||||||||||||||
286 | if (highlightItem
| 0-282 | ||||||||||||||||||||||||||||||
287 | highlightItem->setParentItem(nullptr); | - | ||||||||||||||||||||||||||||||
288 | highlightItem->deleteLater(); | - | ||||||||||||||||||||||||||||||
289 | highlightItem = nullptr; | - | ||||||||||||||||||||||||||||||
290 | changed = true; | - | ||||||||||||||||||||||||||||||
291 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
292 | - | |||||||||||||||||||||||||||||||
293 | QQuickItem *item = nullptr; | - | ||||||||||||||||||||||||||||||
294 | if (highlightComponent
| 116-166 | ||||||||||||||||||||||||||||||
295 | QQmlContext *creationContext = highlightComponent->creationContext(); | - | ||||||||||||||||||||||||||||||
296 | QQmlContext *highlightContext = new QQmlContext( | - | ||||||||||||||||||||||||||||||
297 | creationContext ? creationContext : qmlContext(q)); | - | ||||||||||||||||||||||||||||||
298 | QObject *nobj = highlightComponent->create(highlightContext); | - | ||||||||||||||||||||||||||||||
299 | if (nobj
| 0-116 | ||||||||||||||||||||||||||||||
300 | QQml_setParent_noEvent(highlightContext, nobj); | - | ||||||||||||||||||||||||||||||
301 | item = qobject_cast<QQuickItem *>(nobj); | - | ||||||||||||||||||||||||||||||
302 | if (!item
| 0-116 | ||||||||||||||||||||||||||||||
303 | delete nobj; never executed: delete nobj; | 0 | ||||||||||||||||||||||||||||||
304 | } executed 116 times by 2 tests: else {end of block Executed by:
| 116 | ||||||||||||||||||||||||||||||
305 | delete highlightContext; | - | ||||||||||||||||||||||||||||||
306 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
307 | } else { | - | ||||||||||||||||||||||||||||||
308 | item = new QQuickItem; | - | ||||||||||||||||||||||||||||||
309 | } executed 166 times by 3 tests: end of block Executed by:
| 166 | ||||||||||||||||||||||||||||||
310 | if (item
| 0-282 | ||||||||||||||||||||||||||||||
311 | QQml_setParent_noEvent(item, q); | - | ||||||||||||||||||||||||||||||
312 | item->setParentItem(q); | - | ||||||||||||||||||||||||||||||
313 | highlightItem = item; | - | ||||||||||||||||||||||||||||||
314 | changed = true; | - | ||||||||||||||||||||||||||||||
315 | } executed 282 times by 3 tests: end of block Executed by:
| 282 | ||||||||||||||||||||||||||||||
316 | if (changed
| 0-282 | ||||||||||||||||||||||||||||||
317 | q->highlightItemChanged(); executed 282 times by 3 tests: q->highlightItemChanged(); Executed by:
| 282 | ||||||||||||||||||||||||||||||
318 | } executed 282 times by 3 tests: end of block Executed by:
| 282 | ||||||||||||||||||||||||||||||
319 | - | |||||||||||||||||||||||||||||||
320 | void QQuickPathViewPrivate::updateHighlight() | - | ||||||||||||||||||||||||||||||
321 | { | - | ||||||||||||||||||||||||||||||
322 | QQuickPathView * const q = q_func(); | - | ||||||||||||||||||||||||||||||
323 | if (!q->isComponentComplete()
| 16-426 | ||||||||||||||||||||||||||||||
324 | return; executed 132 times by 2 tests: return; Executed by:
| 132 | ||||||||||||||||||||||||||||||
325 | if (highlightItem
| 0-410 | ||||||||||||||||||||||||||||||
326 | if (haveHighlightRange
| 0-410 | ||||||||||||||||||||||||||||||
327 | updateItem(highlightItem, highlightRangeStart); | - | ||||||||||||||||||||||||||||||
328 | } executed 334 times by 3 tests: else {end of block Executed by:
| 334 | ||||||||||||||||||||||||||||||
329 | qreal target = currentIndex; | - | ||||||||||||||||||||||||||||||
330 | - | |||||||||||||||||||||||||||||||
331 | offsetAdj = 0.0; | - | ||||||||||||||||||||||||||||||
332 | tl.reset(moveHighlight); | - | ||||||||||||||||||||||||||||||
333 | moveHighlight.setValue(highlightPosition); | - | ||||||||||||||||||||||||||||||
334 | - | |||||||||||||||||||||||||||||||
335 | const int duration = highlightMoveDuration; | - | ||||||||||||||||||||||||||||||
336 | - | |||||||||||||||||||||||||||||||
337 | if (target - highlightPosition > modelCount/2
| 2-74 | ||||||||||||||||||||||||||||||
338 | highlightUp = false; | - | ||||||||||||||||||||||||||||||
339 | qreal distance = modelCount - target + highlightPosition; | - | ||||||||||||||||||||||||||||||
340 | tl.move(moveHighlight, 0.0, QEasingCurve(QEasingCurve::InQuad), int(duration * highlightPosition / distance)); | - | ||||||||||||||||||||||||||||||
341 | tl.set(moveHighlight, modelCount-0.01); | - | ||||||||||||||||||||||||||||||
342 | tl.move(moveHighlight, target, QEasingCurve(QEasingCurve::OutQuad), int(duration * (modelCount-target) / distance)); | - | ||||||||||||||||||||||||||||||
343 | } executed 2 times by 1 test: else if (target - highlightPosition <= -modelCount/2end of block Executed by:
| 2-72 | ||||||||||||||||||||||||||||||
344 | highlightUp = true; | - | ||||||||||||||||||||||||||||||
345 | qreal distance = modelCount - highlightPosition + target; | - | ||||||||||||||||||||||||||||||
346 | tl.move(moveHighlight, modelCount-0.01, QEasingCurve(QEasingCurve::InQuad), int(duration * (modelCount-highlightPosition) / distance)); | - | ||||||||||||||||||||||||||||||
347 | tl.set(moveHighlight, 0.0); | - | ||||||||||||||||||||||||||||||
348 | tl.move(moveHighlight, target, QEasingCurve(QEasingCurve::OutQuad), int(duration * target / distance)); | - | ||||||||||||||||||||||||||||||
349 | } executed 2 times by 1 test: else {end of block Executed by:
| 2 | ||||||||||||||||||||||||||||||
350 | highlightUp = highlightPosition - target < 0; | - | ||||||||||||||||||||||||||||||
351 | tl.move(moveHighlight, target, QEasingCurve(QEasingCurve::InOutQuad), duration); | - | ||||||||||||||||||||||||||||||
352 | } executed 72 times by 1 test: end of block Executed by:
| 72 | ||||||||||||||||||||||||||||||
353 | } | - | ||||||||||||||||||||||||||||||
354 | } | - | ||||||||||||||||||||||||||||||
355 | } executed 410 times by 3 tests: end of block Executed by:
| 410 | ||||||||||||||||||||||||||||||
356 | - | |||||||||||||||||||||||||||||||
357 | void QQuickPathViewPrivate::setHighlightPosition(qreal pos) | - | ||||||||||||||||||||||||||||||
358 | { | - | ||||||||||||||||||||||||||||||
359 | if (pos != highlightPosition
| 2-76 | ||||||||||||||||||||||||||||||
360 | qreal start = 0.0; | - | ||||||||||||||||||||||||||||||
361 | qreal end = 1.0; | - | ||||||||||||||||||||||||||||||
362 | if (haveHighlightRange
| 0-2 | ||||||||||||||||||||||||||||||
363 | start = highlightRangeStart; | - | ||||||||||||||||||||||||||||||
364 | end = highlightRangeEnd; | - | ||||||||||||||||||||||||||||||
365 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
366 | - | |||||||||||||||||||||||||||||||
367 | qreal range = qreal(modelCount); | - | ||||||||||||||||||||||||||||||
368 | - | |||||||||||||||||||||||||||||||
369 | qreal relativeHighlight = std::fmod(pos + offset, range) / range; | - | ||||||||||||||||||||||||||||||
370 | - | |||||||||||||||||||||||||||||||
371 | if (!highlightUp
| 0-2 | ||||||||||||||||||||||||||||||
372 | qreal diff = 1.0 - relativeHighlight; | - | ||||||||||||||||||||||||||||||
373 | setOffset(offset + diff * range); | - | ||||||||||||||||||||||||||||||
374 | } executed 2 times by 1 test: else if (highlightUpend of block Executed by:
| 0-2 | ||||||||||||||||||||||||||||||
375 | qreal diff = relativeHighlight - (end - start) / mappedRange; | - | ||||||||||||||||||||||||||||||
376 | setOffset(offset - diff * range - 0.00001); | - | ||||||||||||||||||||||||||||||
377 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
378 | - | |||||||||||||||||||||||||||||||
379 | highlightPosition = pos; | - | ||||||||||||||||||||||||||||||
380 | qreal pathPos = positionOfIndex(pos); | - | ||||||||||||||||||||||||||||||
381 | updateItem(highlightItem, pathPos); | - | ||||||||||||||||||||||||||||||
382 | if (QQuickPathViewAttached *att = attached(highlightItem)
| 0-2 | ||||||||||||||||||||||||||||||
383 | att->setOnPath(pathPos < 1.0); never executed: att->setOnPath(pathPos < 1.0); | 0 | ||||||||||||||||||||||||||||||
384 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||||||||||||||
385 | } executed 78 times by 1 test: end of block Executed by:
| 78 | ||||||||||||||||||||||||||||||
386 | - | |||||||||||||||||||||||||||||||
387 | void QQuickPathView::pathUpdated() | - | ||||||||||||||||||||||||||||||
388 | { | - | ||||||||||||||||||||||||||||||
389 | QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
390 | for (QQuickItem *item : qAsConst(d->items)) { | - | ||||||||||||||||||||||||||||||
391 | if (QQuickPathViewAttached *att = d->attached(item)
| 0-100 | ||||||||||||||||||||||||||||||
392 | att->m_percent = -1; executed 100 times by 1 test: att->m_percent = -1; Executed by:
| 100 | ||||||||||||||||||||||||||||||
393 | } executed 100 times by 1 test: end of block Executed by:
| 100 | ||||||||||||||||||||||||||||||
394 | refill(); | - | ||||||||||||||||||||||||||||||
395 | } executed 312 times by 3 tests: end of block Executed by:
| 312 | ||||||||||||||||||||||||||||||
396 | - | |||||||||||||||||||||||||||||||
397 | void QQuickPathViewPrivate::updateItem(QQuickItem *item, qreal percent) | - | ||||||||||||||||||||||||||||||
398 | { | - | ||||||||||||||||||||||||||||||
399 | if (!path
| 2-45324 | ||||||||||||||||||||||||||||||
400 | return; executed 2 times by 1 test: return; Executed by:
| 2 | ||||||||||||||||||||||||||||||
401 | if (QQuickPathViewAttached *att = attached(item)
| 4250-41074 | ||||||||||||||||||||||||||||||
402 | if (qFuzzyCompare(att->m_percent, percent)
| 309-40765 | ||||||||||||||||||||||||||||||
403 | return; executed 309 times by 1 test: return; Executed by:
| 309 | ||||||||||||||||||||||||||||||
404 | att->m_percent = percent; | - | ||||||||||||||||||||||||||||||
405 | const auto attributes = path->attributes(); | - | ||||||||||||||||||||||||||||||
406 | for (const QString &attr : attributes) | - | ||||||||||||||||||||||||||||||
407 | att->setValue(attr.toUtf8(), path->attributeAt(attr, percent)); executed 3444 times by 2 tests: att->setValue(attr.toUtf8(), path->attributeAt(attr, percent)); Executed by:
| 3444 | ||||||||||||||||||||||||||||||
408 | att->setOnPath(percent < 1.0); | - | ||||||||||||||||||||||||||||||
409 | } executed 40765 times by 3 tests: end of block Executed by:
| 40765 | ||||||||||||||||||||||||||||||
410 | QQuickItemPrivate::get(item)->setCulled(percent >= 1.0); | - | ||||||||||||||||||||||||||||||
411 | QPointF pf = path->pointAt(qMin(percent, qreal(1.0))); | - | ||||||||||||||||||||||||||||||
412 | item->setX(pf.x() - item->width()/2); | - | ||||||||||||||||||||||||||||||
413 | item->setY(pf.y() - item->height()/2); | - | ||||||||||||||||||||||||||||||
414 | } executed 45015 times by 3 tests: end of block Executed by:
| 45015 | ||||||||||||||||||||||||||||||
415 | - | |||||||||||||||||||||||||||||||
416 | void QQuickPathViewPrivate::regenerate() | - | ||||||||||||||||||||||||||||||
417 | { | - | ||||||||||||||||||||||||||||||
418 | QQuickPathView * const q = q_func(); | - | ||||||||||||||||||||||||||||||
419 | if (!q->isComponentComplete()
| 430-542 | ||||||||||||||||||||||||||||||
420 | return; executed 542 times by 3 tests: return; Executed by:
| 542 | ||||||||||||||||||||||||||||||
421 | - | |||||||||||||||||||||||||||||||
422 | clear(); | - | ||||||||||||||||||||||||||||||
423 | - | |||||||||||||||||||||||||||||||
424 | if (!isValid()
| 20-410 | ||||||||||||||||||||||||||||||
425 | return; executed 20 times by 2 tests: return; Executed by:
| 20 | ||||||||||||||||||||||||||||||
426 | - | |||||||||||||||||||||||||||||||
427 | updateMappedRange(); | - | ||||||||||||||||||||||||||||||
428 | q->refill(); | - | ||||||||||||||||||||||||||||||
429 | } executed 410 times by 3 tests: end of block Executed by:
| 410 | ||||||||||||||||||||||||||||||
430 | - | |||||||||||||||||||||||||||||||
431 | void QQuickPathViewPrivate::setDragging(bool d) | - | ||||||||||||||||||||||||||||||
432 | { | - | ||||||||||||||||||||||||||||||
433 | QQuickPathView * const q = q_func(); | - | ||||||||||||||||||||||||||||||
434 | if (dragging == d
| 44-68 | ||||||||||||||||||||||||||||||
435 | return; executed 68 times by 1 test: return; Executed by:
| 68 | ||||||||||||||||||||||||||||||
436 | - | |||||||||||||||||||||||||||||||
437 | dragging = d; | - | ||||||||||||||||||||||||||||||
438 | if (dragging
| 22 | ||||||||||||||||||||||||||||||
439 | q->dragStarted(); executed 22 times by 1 test: q->dragStarted(); Executed by:
| 22 | ||||||||||||||||||||||||||||||
440 | else | - | ||||||||||||||||||||||||||||||
441 | q->dragEnded(); executed 22 times by 1 test: q->dragEnded(); Executed by:
| 22 | ||||||||||||||||||||||||||||||
442 | - | |||||||||||||||||||||||||||||||
443 | q->draggingChanged(); | - | ||||||||||||||||||||||||||||||
444 | } executed 44 times by 1 test: end of block Executed by:
| 44 | ||||||||||||||||||||||||||||||
445 | QQuickPathView::QQuickPathView(QQuickItem *parent) | - | ||||||||||||||||||||||||||||||
446 | : QQuickItem(*(new QQuickPathViewPrivate), parent) | - | ||||||||||||||||||||||||||||||
447 | { | - | ||||||||||||||||||||||||||||||
448 | QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
449 | d->init(); | - | ||||||||||||||||||||||||||||||
450 | } executed 282 times by 3 tests: end of block Executed by:
| 282 | ||||||||||||||||||||||||||||||
451 | - | |||||||||||||||||||||||||||||||
452 | QQuickPathView::~QQuickPathView() | - | ||||||||||||||||||||||||||||||
453 | { | - | ||||||||||||||||||||||||||||||
454 | QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
455 | d->clear(); | - | ||||||||||||||||||||||||||||||
456 | if (d->attType
| 6-276 | ||||||||||||||||||||||||||||||
457 | d->attType->release(); executed 276 times by 3 tests: d->attType->release(); Executed by:
| 276 | ||||||||||||||||||||||||||||||
458 | if (d->ownModel
| 22-260 | ||||||||||||||||||||||||||||||
459 | delete d->model; executed 260 times by 3 tests: delete d->model; Executed by:
| 260 | ||||||||||||||||||||||||||||||
460 | } executed 282 times by 3 tests: end of block Executed by:
| 282 | ||||||||||||||||||||||||||||||
461 | QVariant QQuickPathView::model() const | - | ||||||||||||||||||||||||||||||
462 | { | - | ||||||||||||||||||||||||||||||
463 | const QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
464 | return executed 22 times by 1 test: d->modelVariant;return d->modelVariant; Executed by:
executed 22 times by 1 test: return d->modelVariant; Executed by:
| 22 | ||||||||||||||||||||||||||||||
465 | } | - | ||||||||||||||||||||||||||||||
466 | - | |||||||||||||||||||||||||||||||
467 | void QQuickPathView::setModel(const QVariant &m) | - | ||||||||||||||||||||||||||||||
468 | { | - | ||||||||||||||||||||||||||||||
469 | QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
470 | QVariant model = m; | - | ||||||||||||||||||||||||||||||
471 | if (model.userType() == qMetaTypeId<QJSValue>()
| 6-282 | ||||||||||||||||||||||||||||||
472 | model = model.value<QJSValue>().toVariant(); executed 6 times by 1 test: model = model.value<QJSValue>().toVariant(); Executed by:
| 6 | ||||||||||||||||||||||||||||||
473 | - | |||||||||||||||||||||||||||||||
474 | if (d->modelVariant == model
| 4-284 | ||||||||||||||||||||||||||||||
475 | return; executed 4 times by 1 test: return; Executed by:
| 4 | ||||||||||||||||||||||||||||||
476 | - | |||||||||||||||||||||||||||||||
477 | if (d->model
| 126-158 | ||||||||||||||||||||||||||||||
478 | { QQmlInstanceModel *sender = (d->model); QQuickPathView *receiver = (this); const char *signal = (qFlagLocation("2""modelUpdated(QQmlChangeSet,bool)" "\0" __FILE__ ":" "628")); const char *method = (qFlagLocation("1""modelUpdated(QQmlChangeSet,bool)" "\0" __FILE__ ":" "628")); static int signalIdx = -1; static int methodIdx = -1; if (signalIdx < 0
| 6-120 | ||||||||||||||||||||||||||||||
479 | __FILE__ | - | ||||||||||||||||||||||||||||||
480 | , | - | ||||||||||||||||||||||||||||||
481 | 628 | - | ||||||||||||||||||||||||||||||
482 | )); signalIdx = QQmlInstanceModel::staticMetaObject.indexOfSignal(signal+1); } executed 6 times by 3 tests: if (methodIdx < 0end of block Executed by:
| 6-120 | ||||||||||||||||||||||||||||||
483 | __FILE__ | - | ||||||||||||||||||||||||||||||
484 | , | - | ||||||||||||||||||||||||||||||
485 | 628 | - | ||||||||||||||||||||||||||||||
486 | )); if (code == 1
executed 6 times by 3 tests: else methodIdx = QQuickPathView::staticMetaObject.indexOfSignal(method+1);methodIdx = QQuickPathView::staticMetaObject.indexOfSlot(method+1); Executed by:
never executed: } ((signalIdx != -1 && methodIdx != -1) ? static_cast<void>(0) : qt_assert("signalIdx != -1 && methodIdx != -1",methodIdx = QQuickPathView::staticMetaObject.indexOfSignal(method+1); | 0-6 | ||||||||||||||||||||||||||||||
487 | __FILE__ | - | ||||||||||||||||||||||||||||||
488 | , | - | ||||||||||||||||||||||||||||||
489 | 628 | - | ||||||||||||||||||||||||||||||
490 | )); QMetaObject::disconnect(sender, signalIdx, receiver, methodIdx); } | - | ||||||||||||||||||||||||||||||
491 | ; | - | ||||||||||||||||||||||||||||||
492 | { QQmlInstanceModel *sender = (d->model); QQuickPathView *receiver = (this); const char *signal = (qFlagLocation("2""createdItem(int,QObject*)" "\0" __FILE__ ":" "630")); const char *method = (qFlagLocation("1""createdItem(int,QObject*)" "\0" __FILE__ ":" "630")); static int signalIdx = -1; static int methodIdx = -1; if (signalIdx < 0
| 6-120 | ||||||||||||||||||||||||||||||
493 | __FILE__ | - | ||||||||||||||||||||||||||||||
494 | , | - | ||||||||||||||||||||||||||||||
495 | 630 | - | ||||||||||||||||||||||||||||||
496 | )); signalIdx = QQmlInstanceModel::staticMetaObject.indexOfSignal(signal+1); } executed 6 times by 3 tests: if (methodIdx < 0end of block Executed by:
| 6-120 | ||||||||||||||||||||||||||||||
497 | __FILE__ | - | ||||||||||||||||||||||||||||||
498 | , | - | ||||||||||||||||||||||||||||||
499 | 630 | - | ||||||||||||||||||||||||||||||
500 | )); if (code == 1
executed 6 times by 3 tests: else methodIdx = QQuickPathView::staticMetaObject.indexOfSignal(method+1);methodIdx = QQuickPathView::staticMetaObject.indexOfSlot(method+1); Executed by:
never executed: } ((signalIdx != -1 && methodIdx != -1) ? static_cast<void>(0) : qt_assert("signalIdx != -1 && methodIdx != -1",methodIdx = QQuickPathView::staticMetaObject.indexOfSignal(method+1); | 0-6 | ||||||||||||||||||||||||||||||
501 | __FILE__ | - | ||||||||||||||||||||||||||||||
502 | , | - | ||||||||||||||||||||||||||||||
503 | 630 | - | ||||||||||||||||||||||||||||||
504 | )); QMetaObject::disconnect(sender, signalIdx, receiver, methodIdx); } | - | ||||||||||||||||||||||||||||||
505 | ; | - | ||||||||||||||||||||||||||||||
506 | { QQmlInstanceModel *sender = (d->model); QQuickPathView *receiver = (this); const char *signal = (qFlagLocation("2""initItem(int,QObject*)" "\0" __FILE__ ":" "632")); const char *method = (qFlagLocation("1""initItem(int,QObject*)" "\0" __FILE__ ":" "632")); static int signalIdx = -1; static int methodIdx = -1; if (signalIdx < 0
| 6-120 | ||||||||||||||||||||||||||||||
507 | __FILE__ | - | ||||||||||||||||||||||||||||||
508 | , | - | ||||||||||||||||||||||||||||||
509 | 632 | - | ||||||||||||||||||||||||||||||
510 | )); signalIdx = QQmlInstanceModel::staticMetaObject.indexOfSignal(signal+1); } executed 6 times by 3 tests: if (methodIdx < 0end of block Executed by:
| 6-120 | ||||||||||||||||||||||||||||||
511 | __FILE__ | - | ||||||||||||||||||||||||||||||
512 | , | - | ||||||||||||||||||||||||||||||
513 | 632 | - | ||||||||||||||||||||||||||||||
514 | )); if (code == 1
executed 6 times by 3 tests: else methodIdx = QQuickPathView::staticMetaObject.indexOfSignal(method+1);methodIdx = QQuickPathView::staticMetaObject.indexOfSlot(method+1); Executed by:
never executed: } ((signalIdx != -1 && methodIdx != -1) ? static_cast<void>(0) : qt_assert("signalIdx != -1 && methodIdx != -1",methodIdx = QQuickPathView::staticMetaObject.indexOfSignal(method+1); | 0-6 | ||||||||||||||||||||||||||||||
515 | __FILE__ | - | ||||||||||||||||||||||||||||||
516 | , | - | ||||||||||||||||||||||||||||||
517 | 632 | - | ||||||||||||||||||||||||||||||
518 | )); QMetaObject::disconnect(sender, signalIdx, receiver, methodIdx); } | - | ||||||||||||||||||||||||||||||
519 | ; | - | ||||||||||||||||||||||||||||||
520 | d->clear(); | - | ||||||||||||||||||||||||||||||
521 | } executed 126 times by 3 tests: end of block Executed by:
| 126 | ||||||||||||||||||||||||||||||
522 | - | |||||||||||||||||||||||||||||||
523 | d->modelVariant = model; | - | ||||||||||||||||||||||||||||||
524 | QObject *object = qvariant_cast<QObject*>(model); | - | ||||||||||||||||||||||||||||||
525 | QQmlInstanceModel *vim = nullptr; | - | ||||||||||||||||||||||||||||||
526 | if (object
| 20-248 | ||||||||||||||||||||||||||||||
527 | if (d->ownModel
| 0-20 | ||||||||||||||||||||||||||||||
528 | delete d->model; | - | ||||||||||||||||||||||||||||||
529 | d->ownModel = false; | - | ||||||||||||||||||||||||||||||
530 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
531 | d->model = vim; | - | ||||||||||||||||||||||||||||||
532 | } executed 20 times by 2 tests: else {end of block Executed by:
| 20 | ||||||||||||||||||||||||||||||
533 | if (!d->ownModel
| 126-138 | ||||||||||||||||||||||||||||||
534 | d->model = new QQmlDelegateModel(qmlContext(this)); | - | ||||||||||||||||||||||||||||||
535 | d->ownModel = true; | - | ||||||||||||||||||||||||||||||
536 | if (isComponentComplete()
| 2-136 | ||||||||||||||||||||||||||||||
537 | static_cast< executed 2 times by 1 test: QQmlDelegateModel *>(d->model.data())->componentComplete();static_cast<QQmlDelegateModel *>(d->model.data())->componentComplete(); Executed by:
executed 2 times by 1 test: static_cast<QQmlDelegateModel *>(d->model.data())->componentComplete(); Executed by:
| 2 | ||||||||||||||||||||||||||||||
538 | } executed 138 times by 2 tests: end of block Executed by:
| 138 | ||||||||||||||||||||||||||||||
539 | if (QQmlDelegateModel *dataModel = qobject_cast<QQmlDelegateModel*>(d->model)
| 0-264 | ||||||||||||||||||||||||||||||
540 | dataModel->setModel(model); executed 264 times by 3 tests: dataModel->setModel(model); Executed by:
| 264 | ||||||||||||||||||||||||||||||
541 | } executed 264 times by 3 tests: end of block Executed by:
| 264 | ||||||||||||||||||||||||||||||
542 | int oldModelCount = d->modelCount; | - | ||||||||||||||||||||||||||||||
543 | d->modelCount = 0; | - | ||||||||||||||||||||||||||||||
544 | if (d->model
| 0-284 | ||||||||||||||||||||||||||||||
545 | { QQmlInstanceModel *sender = (d->model); QQuickPathView *receiver = (this); const char *signal = (qFlagLocation("2""modelUpdated(QQmlChangeSet,bool)" "\0" __FILE__ ":" "659")); const char *method = (qFlagLocation("1""modelUpdated(QQmlChangeSet,bool)" "\0" __FILE__ ":" "659")); static int signalIdx = -1; static int methodIdx = -1; if (signalIdx < 0
| 6-278 | ||||||||||||||||||||||||||||||
546 | __FILE__ | - | ||||||||||||||||||||||||||||||
547 | , | - | ||||||||||||||||||||||||||||||
548 | 659 | - | ||||||||||||||||||||||||||||||
549 | )); signalIdx = QQmlInstanceModel::staticMetaObject.indexOfSignal(signal+1); } executed 6 times by 3 tests: if (methodIdx < 0end of block Executed by:
| 6-278 | ||||||||||||||||||||||||||||||
550 | __FILE__ | - | ||||||||||||||||||||||||||||||
551 | , | - | ||||||||||||||||||||||||||||||
552 | 659 | - | ||||||||||||||||||||||||||||||
553 | )); if (code == 1
executed 6 times by 3 tests: else methodIdx = QQuickPathView::staticMetaObject.indexOfSignal(method+1);methodIdx = QQuickPathView::staticMetaObject.indexOfSlot(method+1); Executed by:
never executed: } ((signalIdx != -1 && methodIdx != -1) ? static_cast<void>(0) : qt_assert("signalIdx != -1 && methodIdx != -1",methodIdx = QQuickPathView::staticMetaObject.indexOfSignal(method+1); | 0-6 | ||||||||||||||||||||||||||||||
554 | __FILE__ | - | ||||||||||||||||||||||||||||||
555 | , | - | ||||||||||||||||||||||||||||||
556 | 659 | - | ||||||||||||||||||||||||||||||
557 | )); QMetaObject::connect(sender, signalIdx, receiver, methodIdx, Qt::DirectConnection); } | - | ||||||||||||||||||||||||||||||
558 | ; | - | ||||||||||||||||||||||||||||||
559 | { QQmlInstanceModel *sender = (d->model); QQuickPathView *receiver = (this); const char *signal = (qFlagLocation("2""createdItem(int,QObject*)" "\0" __FILE__ ":" "661")); const char *method = (qFlagLocation("1""createdItem(int,QObject*)" "\0" __FILE__ ":" "661")); static int signalIdx = -1; static int methodIdx = -1; if (signalIdx < 0
| 6-278 | ||||||||||||||||||||||||||||||
560 | __FILE__ | - | ||||||||||||||||||||||||||||||
561 | , | - | ||||||||||||||||||||||||||||||
562 | 661 | - | ||||||||||||||||||||||||||||||
563 | )); signalIdx = QQmlInstanceModel::staticMetaObject.indexOfSignal(signal+1); } executed 6 times by 3 tests: if (methodIdx < 0end of block Executed by:
| 6-278 | ||||||||||||||||||||||||||||||
564 | __FILE__ | - | ||||||||||||||||||||||||||||||
565 | , | - | ||||||||||||||||||||||||||||||
566 | 661 | - | ||||||||||||||||||||||||||||||
567 | )); if (code == 1
executed 6 times by 3 tests: else methodIdx = QQuickPathView::staticMetaObject.indexOfSignal(method+1);methodIdx = QQuickPathView::staticMetaObject.indexOfSlot(method+1); Executed by:
never executed: } ((signalIdx != -1 && methodIdx != -1) ? static_cast<void>(0) : qt_assert("signalIdx != -1 && methodIdx != -1",methodIdx = QQuickPathView::staticMetaObject.indexOfSignal(method+1); | 0-6 | ||||||||||||||||||||||||||||||
568 | __FILE__ | - | ||||||||||||||||||||||||||||||
569 | , | - | ||||||||||||||||||||||||||||||
570 | 661 | - | ||||||||||||||||||||||||||||||
571 | )); QMetaObject::connect(sender, signalIdx, receiver, methodIdx, Qt::DirectConnection); } | - | ||||||||||||||||||||||||||||||
572 | ; | - | ||||||||||||||||||||||||||||||
573 | { QQmlInstanceModel *sender = (d->model); QQuickPathView *receiver = (this); const char *signal = (qFlagLocation("2""initItem(int,QObject*)" "\0" __FILE__ ":" "663")); const char *method = (qFlagLocation("1""initItem(int,QObject*)" "\0" __FILE__ ":" "663")); static int signalIdx = -1; static int methodIdx = -1; if (signalIdx < 0
| 6-278 | ||||||||||||||||||||||||||||||
574 | __FILE__ | - | ||||||||||||||||||||||||||||||
575 | , | - | ||||||||||||||||||||||||||||||
576 | 663 | - | ||||||||||||||||||||||||||||||
577 | )); signalIdx = QQmlInstanceModel::staticMetaObject.indexOfSignal(signal+1); } executed 6 times by 3 tests: if (methodIdx < 0end of block Executed by:
| 6-278 | ||||||||||||||||||||||||||||||
578 | __FILE__ | - | ||||||||||||||||||||||||||||||
579 | , | - | ||||||||||||||||||||||||||||||
580 | 663 | - | ||||||||||||||||||||||||||||||
581 | )); if (code == 1
executed 6 times by 3 tests: else methodIdx = QQuickPathView::staticMetaObject.indexOfSignal(method+1);methodIdx = QQuickPathView::staticMetaObject.indexOfSlot(method+1); Executed by:
never executed: } ((signalIdx != -1 && methodIdx != -1) ? static_cast<void>(0) : qt_assert("signalIdx != -1 && methodIdx != -1",methodIdx = QQuickPathView::staticMetaObject.indexOfSignal(method+1); | 0-6 | ||||||||||||||||||||||||||||||
582 | __FILE__ | - | ||||||||||||||||||||||||||||||
583 | , | - | ||||||||||||||||||||||||||||||
584 | 663 | - | ||||||||||||||||||||||||||||||
585 | )); QMetaObject::connect(sender, signalIdx, receiver, methodIdx, Qt::DirectConnection); } | - | ||||||||||||||||||||||||||||||
586 | ; | - | ||||||||||||||||||||||||||||||
587 | d->modelCount = d->model->count(); | - | ||||||||||||||||||||||||||||||
588 | } executed 284 times by 3 tests: end of block Executed by:
| 284 | ||||||||||||||||||||||||||||||
589 | if (isComponentComplete()
| 6-278 | ||||||||||||||||||||||||||||||
590 | if (d->currentIndex != 0
| 2-4 | ||||||||||||||||||||||||||||||
591 | d->currentIndex = 0; | - | ||||||||||||||||||||||||||||||
592 | currentIndexChanged(); | - | ||||||||||||||||||||||||||||||
593 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||||||||||||||
594 | if (d->offset != 0.0
| 2-4 | ||||||||||||||||||||||||||||||
595 | d->offset = 0; | - | ||||||||||||||||||||||||||||||
596 | offsetChanged(); | - | ||||||||||||||||||||||||||||||
597 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||||||||||||||
598 | } executed 6 times by 1 test: end of block Executed by:
| 6 | ||||||||||||||||||||||||||||||
599 | d->regenerate(); | - | ||||||||||||||||||||||||||||||
600 | if (d->modelCount != oldModelCount
| 14-270 | ||||||||||||||||||||||||||||||
601 | countChanged(); executed 14 times by 1 test: countChanged(); Executed by:
| 14 | ||||||||||||||||||||||||||||||
602 | modelChanged(); | - | ||||||||||||||||||||||||||||||
603 | } executed 284 times by 3 tests: end of block Executed by:
| 284 | ||||||||||||||||||||||||||||||
604 | - | |||||||||||||||||||||||||||||||
605 | - | |||||||||||||||||||||||||||||||
606 | - | |||||||||||||||||||||||||||||||
607 | - | |||||||||||||||||||||||||||||||
608 | - | |||||||||||||||||||||||||||||||
609 | int QQuickPathView::count() const | - | ||||||||||||||||||||||||||||||
610 | { | - | ||||||||||||||||||||||||||||||
611 | const QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
612 | return executed 358 times by 1 test: d->model ? d->modelCount : 0;return d->model ? d->modelCount : 0; Executed by:
executed 358 times by 1 test: return d->model ? d->modelCount : 0; Executed by:
| 358 | ||||||||||||||||||||||||||||||
613 | } | - | ||||||||||||||||||||||||||||||
614 | - | |||||||||||||||||||||||||||||||
615 | - | |||||||||||||||||||||||||||||||
616 | - | |||||||||||||||||||||||||||||||
617 | - | |||||||||||||||||||||||||||||||
618 | - | |||||||||||||||||||||||||||||||
619 | - | |||||||||||||||||||||||||||||||
620 | QQuickPath *QQuickPathView::path() const | - | ||||||||||||||||||||||||||||||
621 | { | - | ||||||||||||||||||||||||||||||
622 | const QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
623 | return executed 58 times by 1 test: d->path;return d->path; Executed by:
executed 58 times by 1 test: return d->path; Executed by:
| 58 | ||||||||||||||||||||||||||||||
624 | } | - | ||||||||||||||||||||||||||||||
625 | - | |||||||||||||||||||||||||||||||
626 | void QQuickPathView::setPath(QQuickPath *path) | - | ||||||||||||||||||||||||||||||
627 | { | - | ||||||||||||||||||||||||||||||
628 | QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
629 | if (d->path == path
| 2-280 | ||||||||||||||||||||||||||||||
630 | return; executed 2 times by 1 test: return; Executed by:
| 2 | ||||||||||||||||||||||||||||||
631 | if (d->path
| 4-276 | ||||||||||||||||||||||||||||||
632 | { QQuickPath *sender = (d->path); QQuickPathView *receiver = (this); const char *signal = (qFlagLocation("2""changed()" "\0" __FILE__ ":" "710")); const char *method = (qFlagLocation("1""pathUpdated()" "\0" __FILE__ ":" "710")); static int signalIdx = -1; static int methodIdx = -1; if (signalIdx < 0
| 2 | ||||||||||||||||||||||||||||||
633 | __FILE__ | - | ||||||||||||||||||||||||||||||
634 | , | - | ||||||||||||||||||||||||||||||
635 | 710 | - | ||||||||||||||||||||||||||||||
636 | )); signalIdx = QQuickPath::staticMetaObject.indexOfSignal(signal+1); } executed 2 times by 1 test: if (methodIdx < 0end of block Executed by:
| 2 | ||||||||||||||||||||||||||||||
637 | __FILE__ | - | ||||||||||||||||||||||||||||||
638 | , | - | ||||||||||||||||||||||||||||||
639 | 710 | - | ||||||||||||||||||||||||||||||
640 | )); if (code == 1
executed 2 times by 1 test: else methodIdx = QQuickPathView::staticMetaObject.indexOfSignal(method+1);methodIdx = QQuickPathView::staticMetaObject.indexOfSlot(method+1); Executed by:
never executed: } ((signalIdx != -1 && methodIdx != -1) ? static_cast<void>(0) : qt_assert("signalIdx != -1 && methodIdx != -1",methodIdx = QQuickPathView::staticMetaObject.indexOfSignal(method+1); | 0-2 | ||||||||||||||||||||||||||||||
641 | __FILE__ | - | ||||||||||||||||||||||||||||||
642 | , | - | ||||||||||||||||||||||||||||||
643 | 710 | - | ||||||||||||||||||||||||||||||
644 | )); QMetaObject::disconnect(sender, signalIdx, receiver, methodIdx); } executed 4 times by 1 test: end of block Executed by:
| 4 | ||||||||||||||||||||||||||||||
645 | ; | - | ||||||||||||||||||||||||||||||
646 | d->path = path; | - | ||||||||||||||||||||||||||||||
647 | - | |||||||||||||||||||||||||||||||
648 | if (path
| 2-278 | ||||||||||||||||||||||||||||||
649 | { QQuickPath *sender = (d->path); QQuickPathView *receiver = (this); const char *signal = (qFlagLocation("2""changed()" "\0" __FILE__ ":" "715")); const char *method = (qFlagLocation("1""pathUpdated()" "\0" __FILE__ ":" "715")); static int signalIdx = -1; static int methodIdx = -1; if (signalIdx < 0
| 6-272 | ||||||||||||||||||||||||||||||
650 | __FILE__ | - | ||||||||||||||||||||||||||||||
651 | , | - | ||||||||||||||||||||||||||||||
652 | 715 | - | ||||||||||||||||||||||||||||||
653 | )); signalIdx = QQuickPath::staticMetaObject.indexOfSignal(signal+1); } executed 6 times by 3 tests: if (methodIdx < 0end of block Executed by:
| 6-272 | ||||||||||||||||||||||||||||||
654 | __FILE__ | - | ||||||||||||||||||||||||||||||
655 | , | - | ||||||||||||||||||||||||||||||
656 | 715 | - | ||||||||||||||||||||||||||||||
657 | )); if (code == 1
executed 6 times by 3 tests: else methodIdx = QQuickPathView::staticMetaObject.indexOfSignal(method+1);methodIdx = QQuickPathView::staticMetaObject.indexOfSlot(method+1); Executed by:
never executed: } ((signalIdx != -1 && methodIdx != -1) ? static_cast<void>(0) : qt_assert("signalIdx != -1 && methodIdx != -1",methodIdx = QQuickPathView::staticMetaObject.indexOfSignal(method+1); | 0-6 | ||||||||||||||||||||||||||||||
658 | __FILE__ | - | ||||||||||||||||||||||||||||||
659 | , | - | ||||||||||||||||||||||||||||||
660 | 715 | - | ||||||||||||||||||||||||||||||
661 | )); QMetaObject::connect(sender, signalIdx, receiver, methodIdx, Qt::DirectConnection); } | - | ||||||||||||||||||||||||||||||
662 | ; | - | ||||||||||||||||||||||||||||||
663 | } executed 278 times by 3 tests: end of block Executed by:
| 278 | ||||||||||||||||||||||||||||||
664 | - | |||||||||||||||||||||||||||||||
665 | if (isComponentComplete()
| 6-274 | ||||||||||||||||||||||||||||||
666 | d->clear(); | - | ||||||||||||||||||||||||||||||
667 | if (d->isValid()
| 2-4 | ||||||||||||||||||||||||||||||
668 | if (d->attType
| 0-4 | ||||||||||||||||||||||||||||||
669 | d->attType->release(); | - | ||||||||||||||||||||||||||||||
670 | d->attType = nullptr; | - | ||||||||||||||||||||||||||||||
671 | } executed 4 times by 1 test: end of block Executed by:
| 4 | ||||||||||||||||||||||||||||||
672 | d->regenerate(); | - | ||||||||||||||||||||||||||||||
673 | } executed 4 times by 1 test: end of block Executed by:
| 4 | ||||||||||||||||||||||||||||||
674 | } executed 6 times by 1 test: end of block Executed by:
| 6 | ||||||||||||||||||||||||||||||
675 | - | |||||||||||||||||||||||||||||||
676 | pathChanged(); | - | ||||||||||||||||||||||||||||||
677 | } executed 280 times by 3 tests: end of block Executed by:
| 280 | ||||||||||||||||||||||||||||||
678 | - | |||||||||||||||||||||||||||||||
679 | - | |||||||||||||||||||||||||||||||
680 | - | |||||||||||||||||||||||||||||||
681 | - | |||||||||||||||||||||||||||||||
682 | - | |||||||||||||||||||||||||||||||
683 | int QQuickPathView::currentIndex() const | - | ||||||||||||||||||||||||||||||
684 | { | - | ||||||||||||||||||||||||||||||
685 | const QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
686 | return executed 845 times by 2 tests: d->currentIndex;return d->currentIndex; Executed by:
executed 845 times by 2 tests: return d->currentIndex; Executed by:
| 845 | ||||||||||||||||||||||||||||||
687 | } | - | ||||||||||||||||||||||||||||||
688 | - | |||||||||||||||||||||||||||||||
689 | void QQuickPathView::setCurrentIndex(int idx) | - | ||||||||||||||||||||||||||||||
690 | { | - | ||||||||||||||||||||||||||||||
691 | QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
692 | if (!isComponentComplete()
| 6-146 | ||||||||||||||||||||||||||||||
693 | if (idx != d->currentIndex
| 0-6 | ||||||||||||||||||||||||||||||
694 | d->currentIndex = idx; | - | ||||||||||||||||||||||||||||||
695 | currentIndexChanged(); | - | ||||||||||||||||||||||||||||||
696 | } executed 6 times by 1 test: end of block Executed by:
| 6 | ||||||||||||||||||||||||||||||
697 | return; executed 6 times by 1 test: return; Executed by:
| 6 | ||||||||||||||||||||||||||||||
698 | } | - | ||||||||||||||||||||||||||||||
699 | - | |||||||||||||||||||||||||||||||
700 | idx = d->modelCount
| 0-146 | ||||||||||||||||||||||||||||||
701 | ? ((idx % d->modelCount) + d->modelCount) % d->modelCount | - | ||||||||||||||||||||||||||||||
702 | : 0; | - | ||||||||||||||||||||||||||||||
703 | if (d->model && (idx != d->currentIndex
| 0-144 | ||||||||||||||||||||||||||||||
704 | if (d->currentItem
| 0-144 | ||||||||||||||||||||||||||||||
705 | if (QQuickPathViewAttached *att = d->attached(d->currentItem)
| 0-144 | ||||||||||||||||||||||||||||||
706 | att->setIsCurrentItem(false); executed 144 times by 1 test: att->setIsCurrentItem(false); Executed by:
| 144 | ||||||||||||||||||||||||||||||
707 | d->releaseItem(d->currentItem); | - | ||||||||||||||||||||||||||||||
708 | } executed 144 times by 1 test: end of block Executed by:
| 144 | ||||||||||||||||||||||||||||||
709 | int oldCurrentIdx = d->currentIndex; | - | ||||||||||||||||||||||||||||||
710 | QQuickItem *oldCurrentItem = d->currentItem; | - | ||||||||||||||||||||||||||||||
711 | d->currentItem = nullptr; | - | ||||||||||||||||||||||||||||||
712 | d->moveReason = QQuickPathViewPrivate::SetIndex; | - | ||||||||||||||||||||||||||||||
713 | d->currentIndex = idx; | - | ||||||||||||||||||||||||||||||
714 | if (d->modelCount
| 0-144 | ||||||||||||||||||||||||||||||
715 | d->createCurrentItem(); | - | ||||||||||||||||||||||||||||||
716 | if (d->haveHighlightRange
| 0-144 | ||||||||||||||||||||||||||||||
717 | d->snapToIndex(d->currentIndex, QQuickPathViewPrivate::SetIndex); executed 76 times by 1 test: d->snapToIndex(d->currentIndex, QQuickPathViewPrivate::SetIndex); Executed by:
| 76 | ||||||||||||||||||||||||||||||
718 | d->currentItemOffset = d->positionOfIndex(d->currentIndex); | - | ||||||||||||||||||||||||||||||
719 | d->updateHighlight(); | - | ||||||||||||||||||||||||||||||
720 | } executed 144 times by 1 test: end of block Executed by:
| 144 | ||||||||||||||||||||||||||||||
721 | if (oldCurrentIdx != d->currentIndex
| 0-144 | ||||||||||||||||||||||||||||||
722 | currentIndexChanged(); executed 144 times by 1 test: currentIndexChanged(); Executed by:
| 144 | ||||||||||||||||||||||||||||||
723 | if (oldCurrentItem != d->currentItem
| 0-144 | ||||||||||||||||||||||||||||||
724 | currentItemChanged(); executed 144 times by 1 test: currentItemChanged(); Executed by:
| 144 | ||||||||||||||||||||||||||||||
725 | } executed 144 times by 1 test: end of block Executed by:
| 144 | ||||||||||||||||||||||||||||||
726 | } executed 146 times by 1 test: end of block Executed by:
| 146 | ||||||||||||||||||||||||||||||
727 | - | |||||||||||||||||||||||||||||||
728 | - | |||||||||||||||||||||||||||||||
729 | - | |||||||||||||||||||||||||||||||
730 | - | |||||||||||||||||||||||||||||||
731 | - | |||||||||||||||||||||||||||||||
732 | QQuickItem *QQuickPathView::currentItem() const | - | ||||||||||||||||||||||||||||||
733 | { | - | ||||||||||||||||||||||||||||||
734 | const QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
735 | return executed 44 times by 1 test: d->currentItem;return d->currentItem; Executed by:
executed 44 times by 1 test: return d->currentItem; Executed by:
| 44 | ||||||||||||||||||||||||||||||
736 | } | - | ||||||||||||||||||||||||||||||
737 | void QQuickPathView::incrementCurrentIndex() | - | ||||||||||||||||||||||||||||||
738 | { | - | ||||||||||||||||||||||||||||||
739 | QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
740 | d->moveDirection = QQuickPathView::Positive; | - | ||||||||||||||||||||||||||||||
741 | setCurrentIndex(currentIndex()+1); | - | ||||||||||||||||||||||||||||||
742 | } executed 4 times by 1 test: end of block Executed by:
| 4 | ||||||||||||||||||||||||||||||
743 | void QQuickPathView::decrementCurrentIndex() | - | ||||||||||||||||||||||||||||||
744 | { | - | ||||||||||||||||||||||||||||||
745 | QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
746 | d->moveDirection = QQuickPathView::Negative; | - | ||||||||||||||||||||||||||||||
747 | setCurrentIndex(currentIndex()-1); | - | ||||||||||||||||||||||||||||||
748 | } executed 12 times by 1 test: end of block Executed by:
| 12 | ||||||||||||||||||||||||||||||
749 | - | |||||||||||||||||||||||||||||||
750 | - | |||||||||||||||||||||||||||||||
751 | - | |||||||||||||||||||||||||||||||
752 | - | |||||||||||||||||||||||||||||||
753 | - | |||||||||||||||||||||||||||||||
754 | - | |||||||||||||||||||||||||||||||
755 | - | |||||||||||||||||||||||||||||||
756 | qreal QQuickPathView::offset() const | - | ||||||||||||||||||||||||||||||
757 | { | - | ||||||||||||||||||||||||||||||
758 | const QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
759 | return executed 1706 times by 1 test: d->offset;return d->offset; Executed by:
executed 1706 times by 1 test: return d->offset; Executed by:
| 1706 | ||||||||||||||||||||||||||||||
760 | } | - | ||||||||||||||||||||||||||||||
761 | - | |||||||||||||||||||||||||||||||
762 | void QQuickPathView::setOffset(qreal offset) | - | ||||||||||||||||||||||||||||||
763 | { | - | ||||||||||||||||||||||||||||||
764 | QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
765 | d->moveReason = QQuickPathViewPrivate::Other; | - | ||||||||||||||||||||||||||||||
766 | d->setOffset(offset); | - | ||||||||||||||||||||||||||||||
767 | d->updateCurrent(); | - | ||||||||||||||||||||||||||||||
768 | } executed 328 times by 1 test: end of block Executed by:
| 328 | ||||||||||||||||||||||||||||||
769 | - | |||||||||||||||||||||||||||||||
770 | void QQuickPathViewPrivate::setOffset(qreal o) | - | ||||||||||||||||||||||||||||||
771 | { | - | ||||||||||||||||||||||||||||||
772 | QQuickPathView * const q = q_func(); | - | ||||||||||||||||||||||||||||||
773 | if (offset != o
| 124-3491 | ||||||||||||||||||||||||||||||
774 | if (isValid()
| 0-3417 | ||||||||||||||||||||||||||||||
775 | qreal oldOffset = offset; | - | ||||||||||||||||||||||||||||||
776 | offset = std::fmod(o, qreal(modelCount)); | - | ||||||||||||||||||||||||||||||
777 | if (offset < 0
| 16-3401 | ||||||||||||||||||||||||||||||
778 | offset += qreal(modelCount); executed 16 times by 1 test: offset += qreal(modelCount); Executed by:
| 16 | ||||||||||||||||||||||||||||||
779 | for (bool qt_category_enabled = lcItemViewDelegateLifecycle().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 848, __PRETTY_FUNCTION__, lcItemViewDelegateLifecycle().categoryName()).debug() << o << "was" << oldOffset << "now" << offset; | 0-3417 | ||||||||||||||||||||||||||||||
780 | q->refill(); | - | ||||||||||||||||||||||||||||||
781 | } executed 3417 times by 1 test: else {end of block Executed by:
| 3417 | ||||||||||||||||||||||||||||||
782 | offset = o; | - | ||||||||||||||||||||||||||||||
783 | } executed 74 times by 1 test: end of block Executed by:
| 74 | ||||||||||||||||||||||||||||||
784 | q->offsetChanged(); | - | ||||||||||||||||||||||||||||||
785 | } executed 3491 times by 1 test: end of block Executed by:
| 3491 | ||||||||||||||||||||||||||||||
786 | } executed 3615 times by 1 test: end of block Executed by:
| 3615 | ||||||||||||||||||||||||||||||
787 | - | |||||||||||||||||||||||||||||||
788 | void QQuickPathViewPrivate::setAdjustedOffset(qreal o) | - | ||||||||||||||||||||||||||||||
789 | { | - | ||||||||||||||||||||||||||||||
790 | setOffset(o+offsetAdj); | - | ||||||||||||||||||||||||||||||
791 | } executed 3285 times by 1 test: end of block Executed by:
| 3285 | ||||||||||||||||||||||||||||||
792 | QQmlComponent *QQuickPathView::highlight() const | - | ||||||||||||||||||||||||||||||
793 | { | - | ||||||||||||||||||||||||||||||
794 | const QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
795 | return never executed: d->highlightComponent;return d->highlightComponent; never executed: return d->highlightComponent; | 0 | ||||||||||||||||||||||||||||||
796 | } | - | ||||||||||||||||||||||||||||||
797 | - | |||||||||||||||||||||||||||||||
798 | void QQuickPathView::setHighlight(QQmlComponent *highlight) | - | ||||||||||||||||||||||||||||||
799 | { | - | ||||||||||||||||||||||||||||||
800 | QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
801 | if (highlight != d->highlightComponent
| 0-116 | ||||||||||||||||||||||||||||||
802 | d->highlightComponent = highlight; | - | ||||||||||||||||||||||||||||||
803 | d->createHighlight(); | - | ||||||||||||||||||||||||||||||
804 | d->updateHighlight(); | - | ||||||||||||||||||||||||||||||
805 | highlightChanged(); | - | ||||||||||||||||||||||||||||||
806 | } executed 116 times by 2 tests: end of block Executed by:
| 116 | ||||||||||||||||||||||||||||||
807 | } executed 116 times by 2 tests: end of block Executed by:
| 116 | ||||||||||||||||||||||||||||||
808 | QQuickItem *QQuickPathView::highlightItem() const | - | ||||||||||||||||||||||||||||||
809 | { | - | ||||||||||||||||||||||||||||||
810 | const QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
811 | return executed 10 times by 1 test: d->highlightItem;return d->highlightItem; Executed by:
executed 10 times by 1 test: return d->highlightItem; Executed by:
| 10 | ||||||||||||||||||||||||||||||
812 | } | - | ||||||||||||||||||||||||||||||
813 | qreal QQuickPathView::preferredHighlightBegin() const | - | ||||||||||||||||||||||||||||||
814 | { | - | ||||||||||||||||||||||||||||||
815 | const QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
816 | return executed 12 times by 1 test: d->highlightRangeStart;return d->highlightRangeStart; Executed by:
executed 12 times by 1 test: return d->highlightRangeStart; Executed by:
| 12 | ||||||||||||||||||||||||||||||
817 | } | - | ||||||||||||||||||||||||||||||
818 | - | |||||||||||||||||||||||||||||||
819 | void QQuickPathView::setPreferredHighlightBegin(qreal start) | - | ||||||||||||||||||||||||||||||
820 | { | - | ||||||||||||||||||||||||||||||
821 | QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
822 | if (d->highlightRangeStart == start
| 0-120 | ||||||||||||||||||||||||||||||
823 | return; executed 4 times by 1 test: return; Executed by:
| 4 | ||||||||||||||||||||||||||||||
824 | d->highlightRangeStart = start; | - | ||||||||||||||||||||||||||||||
825 | d->haveHighlightRange = d->highlightRangeStart <= d->highlightRangeEnd; | - | ||||||||||||||||||||||||||||||
826 | refill(); | - | ||||||||||||||||||||||||||||||
827 | preferredHighlightBeginChanged(); | - | ||||||||||||||||||||||||||||||
828 | } executed 120 times by 2 tests: end of block Executed by:
| 120 | ||||||||||||||||||||||||||||||
829 | - | |||||||||||||||||||||||||||||||
830 | qreal QQuickPathView::preferredHighlightEnd() const | - | ||||||||||||||||||||||||||||||
831 | { | - | ||||||||||||||||||||||||||||||
832 | const QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
833 | return executed 2 times by 1 test: d->highlightRangeEnd;return d->highlightRangeEnd; Executed by:
executed 2 times by 1 test: return d->highlightRangeEnd; Executed by:
| 2 | ||||||||||||||||||||||||||||||
834 | } | - | ||||||||||||||||||||||||||||||
835 | - | |||||||||||||||||||||||||||||||
836 | void QQuickPathView::setPreferredHighlightEnd(qreal end) | - | ||||||||||||||||||||||||||||||
837 | { | - | ||||||||||||||||||||||||||||||
838 | QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
839 | if (d->highlightRangeEnd == end
| 0-120 | ||||||||||||||||||||||||||||||
840 | return; executed 4 times by 1 test: return; Executed by:
| 4 | ||||||||||||||||||||||||||||||
841 | d->highlightRangeEnd = end; | - | ||||||||||||||||||||||||||||||
842 | d->haveHighlightRange = d->highlightRangeStart <= d->highlightRangeEnd; | - | ||||||||||||||||||||||||||||||
843 | refill(); | - | ||||||||||||||||||||||||||||||
844 | preferredHighlightEndChanged(); | - | ||||||||||||||||||||||||||||||
845 | } executed 120 times by 2 tests: end of block Executed by:
| 120 | ||||||||||||||||||||||||||||||
846 | - | |||||||||||||||||||||||||||||||
847 | QQuickPathView::HighlightRangeMode QQuickPathView::highlightRangeMode() const | - | ||||||||||||||||||||||||||||||
848 | { | - | ||||||||||||||||||||||||||||||
849 | const QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
850 | return never executed: d->highlightRangeMode;return d->highlightRangeMode; never executed: return d->highlightRangeMode; | 0 | ||||||||||||||||||||||||||||||
851 | } | - | ||||||||||||||||||||||||||||||
852 | - | |||||||||||||||||||||||||||||||
853 | void QQuickPathView::setHighlightRangeMode(HighlightRangeMode mode) | - | ||||||||||||||||||||||||||||||
854 | { | - | ||||||||||||||||||||||||||||||
855 | QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
856 | if (d->highlightRangeMode == mode
| 92-122 | ||||||||||||||||||||||||||||||
857 | return; executed 122 times by 1 test: return; Executed by:
| 122 | ||||||||||||||||||||||||||||||
858 | d->highlightRangeMode = mode; | - | ||||||||||||||||||||||||||||||
859 | d->haveHighlightRange = d->highlightRangeStart <= d->highlightRangeEnd; | - | ||||||||||||||||||||||||||||||
860 | if (d->haveHighlightRange
| 0-92 | ||||||||||||||||||||||||||||||
861 | d->regenerate(); | - | ||||||||||||||||||||||||||||||
862 | int index = d->highlightRangeMode != NoHighlightRange
| 6-86 | ||||||||||||||||||||||||||||||
863 | if (index >= 0
| 0-92 | ||||||||||||||||||||||||||||||
864 | d->snapToIndex(index, QQuickPathViewPrivate::Other); executed 92 times by 1 test: d->snapToIndex(index, QQuickPathViewPrivate::Other); Executed by:
| 92 | ||||||||||||||||||||||||||||||
865 | } executed 92 times by 1 test: end of block Executed by:
| 92 | ||||||||||||||||||||||||||||||
866 | highlightRangeModeChanged(); | - | ||||||||||||||||||||||||||||||
867 | } executed 92 times by 1 test: end of block Executed by:
| 92 | ||||||||||||||||||||||||||||||
868 | int QQuickPathView::highlightMoveDuration() const | - | ||||||||||||||||||||||||||||||
869 | { | - | ||||||||||||||||||||||||||||||
870 | const QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
871 | return never executed: d->highlightMoveDuration;return d->highlightMoveDuration; never executed: return d->highlightMoveDuration; | 0 | ||||||||||||||||||||||||||||||
872 | } | - | ||||||||||||||||||||||||||||||
873 | - | |||||||||||||||||||||||||||||||
874 | void QQuickPathView::setHighlightMoveDuration(int duration) | - | ||||||||||||||||||||||||||||||
875 | { | - | ||||||||||||||||||||||||||||||
876 | QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
877 | if (d->highlightMoveDuration == duration
| 0-18 | ||||||||||||||||||||||||||||||
878 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
879 | d->highlightMoveDuration = duration; | - | ||||||||||||||||||||||||||||||
880 | highlightMoveDurationChanged(); | - | ||||||||||||||||||||||||||||||
881 | } executed 18 times by 1 test: end of block Executed by:
| 18 | ||||||||||||||||||||||||||||||
882 | qreal QQuickPathView::dragMargin() const | - | ||||||||||||||||||||||||||||||
883 | { | - | ||||||||||||||||||||||||||||||
884 | const QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
885 | return executed 12 times by 1 test: d->dragMargin;return d->dragMargin; Executed by:
executed 12 times by 1 test: return d->dragMargin; Executed by:
| 12 | ||||||||||||||||||||||||||||||
886 | } | - | ||||||||||||||||||||||||||||||
887 | - | |||||||||||||||||||||||||||||||
888 | void QQuickPathView::setDragMargin(qreal dragMargin) | - | ||||||||||||||||||||||||||||||
889 | { | - | ||||||||||||||||||||||||||||||
890 | QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
891 | if (d->dragMargin == dragMargin
| 4-100 | ||||||||||||||||||||||||||||||
892 | return; executed 4 times by 2 tests: return; Executed by:
| 4 | ||||||||||||||||||||||||||||||
893 | d->dragMargin = dragMargin; | - | ||||||||||||||||||||||||||||||
894 | dragMarginChanged(); | - | ||||||||||||||||||||||||||||||
895 | } executed 100 times by 2 tests: end of block Executed by:
| 100 | ||||||||||||||||||||||||||||||
896 | - | |||||||||||||||||||||||||||||||
897 | - | |||||||||||||||||||||||||||||||
898 | - | |||||||||||||||||||||||||||||||
899 | - | |||||||||||||||||||||||||||||||
900 | - | |||||||||||||||||||||||||||||||
901 | - | |||||||||||||||||||||||||||||||
902 | - | |||||||||||||||||||||||||||||||
903 | qreal QQuickPathView::flickDeceleration() const | - | ||||||||||||||||||||||||||||||
904 | { | - | ||||||||||||||||||||||||||||||
905 | const QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
906 | return never executed: d->deceleration;return d->deceleration; never executed: return d->deceleration; | 0 | ||||||||||||||||||||||||||||||
907 | } | - | ||||||||||||||||||||||||||||||
908 | - | |||||||||||||||||||||||||||||||
909 | void QQuickPathView::setFlickDeceleration(qreal dec) | - | ||||||||||||||||||||||||||||||
910 | { | - | ||||||||||||||||||||||||||||||
911 | QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
912 | if (d->deceleration == dec
| 0-8 | ||||||||||||||||||||||||||||||
913 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
914 | d->deceleration = dec; | - | ||||||||||||||||||||||||||||||
915 | flickDecelerationChanged(); | - | ||||||||||||||||||||||||||||||
916 | } executed 8 times by 1 test: end of block Executed by:
| 8 | ||||||||||||||||||||||||||||||
917 | - | |||||||||||||||||||||||||||||||
918 | - | |||||||||||||||||||||||||||||||
919 | - | |||||||||||||||||||||||||||||||
920 | - | |||||||||||||||||||||||||||||||
921 | - | |||||||||||||||||||||||||||||||
922 | - | |||||||||||||||||||||||||||||||
923 | - | |||||||||||||||||||||||||||||||
924 | qreal QQuickPathView::maximumFlickVelocity() const | - | ||||||||||||||||||||||||||||||
925 | { | - | ||||||||||||||||||||||||||||||
926 | const QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
927 | return never executed: d->maximumFlickVelocity;return d->maximumFlickVelocity; never executed: return d->maximumFlickVelocity; | 0 | ||||||||||||||||||||||||||||||
928 | } | - | ||||||||||||||||||||||||||||||
929 | - | |||||||||||||||||||||||||||||||
930 | void QQuickPathView::setMaximumFlickVelocity(qreal vel) | - | ||||||||||||||||||||||||||||||
931 | { | - | ||||||||||||||||||||||||||||||
932 | QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
933 | if (vel == d->maximumFlickVelocity
| 2-8 | ||||||||||||||||||||||||||||||
934 | return; executed 2 times by 1 test: return; Executed by:
| 2 | ||||||||||||||||||||||||||||||
935 | d->maximumFlickVelocity = vel; | - | ||||||||||||||||||||||||||||||
936 | maximumFlickVelocityChanged(); | - | ||||||||||||||||||||||||||||||
937 | } executed 8 times by 1 test: end of block Executed by:
| 8 | ||||||||||||||||||||||||||||||
938 | bool QQuickPathView::isInteractive() const | - | ||||||||||||||||||||||||||||||
939 | { | - | ||||||||||||||||||||||||||||||
940 | const QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
941 | return never executed: d->interactive;return d->interactive; never executed: return d->interactive; | 0 | ||||||||||||||||||||||||||||||
942 | } | - | ||||||||||||||||||||||||||||||
943 | - | |||||||||||||||||||||||||||||||
944 | void QQuickPathView::setInteractive(bool interactive) | - | ||||||||||||||||||||||||||||||
945 | { | - | ||||||||||||||||||||||||||||||
946 | QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
947 | if (interactive != d->interactive
| 0-2 | ||||||||||||||||||||||||||||||
948 | d->interactive = interactive; | - | ||||||||||||||||||||||||||||||
949 | if (!interactive
| 0-2 | ||||||||||||||||||||||||||||||
950 | d->tl.clear(); executed 2 times by 1 test: d->tl.clear(); Executed by:
| 2 | ||||||||||||||||||||||||||||||
951 | interactiveChanged(); | - | ||||||||||||||||||||||||||||||
952 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||||||||||||||
953 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||||||||||||||
954 | - | |||||||||||||||||||||||||||||||
955 | - | |||||||||||||||||||||||||||||||
956 | - | |||||||||||||||||||||||||||||||
957 | - | |||||||||||||||||||||||||||||||
958 | - | |||||||||||||||||||||||||||||||
959 | - | |||||||||||||||||||||||||||||||
960 | - | |||||||||||||||||||||||||||||||
961 | bool QQuickPathView::isMoving() const | - | ||||||||||||||||||||||||||||||
962 | { | - | ||||||||||||||||||||||||||||||
963 | const QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
964 | return executed 582 times by 1 test: d->moving;return d->moving; Executed by:
executed 582 times by 1 test: return d->moving; Executed by:
| 582 | ||||||||||||||||||||||||||||||
965 | } | - | ||||||||||||||||||||||||||||||
966 | - | |||||||||||||||||||||||||||||||
967 | - | |||||||||||||||||||||||||||||||
968 | - | |||||||||||||||||||||||||||||||
969 | - | |||||||||||||||||||||||||||||||
970 | - | |||||||||||||||||||||||||||||||
971 | - | |||||||||||||||||||||||||||||||
972 | - | |||||||||||||||||||||||||||||||
973 | bool QQuickPathView::isFlicking() const | - | ||||||||||||||||||||||||||||||
974 | { | - | ||||||||||||||||||||||||||||||
975 | const QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
976 | return executed 6 times by 1 test: d->flicking;return d->flicking; Executed by:
executed 6 times by 1 test: return d->flicking; Executed by:
| 6 | ||||||||||||||||||||||||||||||
977 | } | - | ||||||||||||||||||||||||||||||
978 | - | |||||||||||||||||||||||||||||||
979 | - | |||||||||||||||||||||||||||||||
980 | - | |||||||||||||||||||||||||||||||
981 | - | |||||||||||||||||||||||||||||||
982 | - | |||||||||||||||||||||||||||||||
983 | - | |||||||||||||||||||||||||||||||
984 | - | |||||||||||||||||||||||||||||||
985 | bool QQuickPathView::isDragging() const | - | ||||||||||||||||||||||||||||||
986 | { | - | ||||||||||||||||||||||||||||||
987 | const QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
988 | return executed 12 times by 1 test: d->dragging;return d->dragging; Executed by:
executed 12 times by 1 test: return d->dragging; Executed by:
| 12 | ||||||||||||||||||||||||||||||
989 | } | - | ||||||||||||||||||||||||||||||
990 | QQmlComponent *QQuickPathView::delegate() const | - | ||||||||||||||||||||||||||||||
991 | { | - | ||||||||||||||||||||||||||||||
992 | const QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
993 | if (d->model
| 124-146 | ||||||||||||||||||||||||||||||
994 | if (QQmlDelegateModel *dataModel = qobject_cast<QQmlDelegateModel*>(d->model)
| 0-146 | ||||||||||||||||||||||||||||||
995 | return executed 146 times by 2 tests: dataModel->delegate();return dataModel->delegate(); Executed by:
executed 146 times by 2 tests: return dataModel->delegate(); Executed by:
| 146 | ||||||||||||||||||||||||||||||
996 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
997 | - | |||||||||||||||||||||||||||||||
998 | return executed 124 times by 3 tests: nullptr;return nullptr; Executed by:
executed 124 times by 3 tests: return nullptr; Executed by:
| 124 | ||||||||||||||||||||||||||||||
999 | } | - | ||||||||||||||||||||||||||||||
1000 | - | |||||||||||||||||||||||||||||||
1001 | void QQuickPathView::setDelegate(QQmlComponent *delegate) | - | ||||||||||||||||||||||||||||||
1002 | { | - | ||||||||||||||||||||||||||||||
1003 | QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
1004 | if (delegate
| 2-258 | ||||||||||||||||||||||||||||||
1005 | return; executed 2 times by 1 test: return; Executed by:
| 2 | ||||||||||||||||||||||||||||||
1006 | if (!d->ownModel
| 122-136 | ||||||||||||||||||||||||||||||
1007 | d->model = new QQmlDelegateModel(qmlContext(this)); | - | ||||||||||||||||||||||||||||||
1008 | d->ownModel = true; | - | ||||||||||||||||||||||||||||||
1009 | if (isComponentComplete()
| 0-122 | ||||||||||||||||||||||||||||||
1010 | static_cast< never executed: QQmlDelegateModel *>(d->model.data())->componentComplete();static_cast<QQmlDelegateModel *>(d->model.data())->componentComplete(); never executed: static_cast<QQmlDelegateModel *>(d->model.data())->componentComplete(); | 0 | ||||||||||||||||||||||||||||||
1011 | } executed 122 times by 3 tests: end of block Executed by:
| 122 | ||||||||||||||||||||||||||||||
1012 | if (QQmlDelegateModel *dataModel = qobject_cast<QQmlDelegateModel*>(d->model)
| 0-258 | ||||||||||||||||||||||||||||||
1013 | int oldCount = dataModel->count(); | - | ||||||||||||||||||||||||||||||
1014 | dataModel->setDelegate(delegate); | - | ||||||||||||||||||||||||||||||
1015 | d->modelCount = dataModel->count(); | - | ||||||||||||||||||||||||||||||
1016 | d->regenerate(); | - | ||||||||||||||||||||||||||||||
1017 | if (oldCount != dataModel->count()
| 0-258 | ||||||||||||||||||||||||||||||
1018 | countChanged(); never executed: countChanged(); | 0 | ||||||||||||||||||||||||||||||
1019 | delegateChanged(); | - | ||||||||||||||||||||||||||||||
1020 | d->delegateValidated = false; | - | ||||||||||||||||||||||||||||||
1021 | } executed 258 times by 3 tests: end of block Executed by:
| 258 | ||||||||||||||||||||||||||||||
1022 | } executed 258 times by 3 tests: end of block Executed by:
| 258 | ||||||||||||||||||||||||||||||
1023 | - | |||||||||||||||||||||||||||||||
1024 | - | |||||||||||||||||||||||||||||||
1025 | - | |||||||||||||||||||||||||||||||
1026 | - | |||||||||||||||||||||||||||||||
1027 | - | |||||||||||||||||||||||||||||||
1028 | - | |||||||||||||||||||||||||||||||
1029 | - | |||||||||||||||||||||||||||||||
1030 | int QQuickPathView::pathItemCount() const | - | ||||||||||||||||||||||||||||||
1031 | { | - | ||||||||||||||||||||||||||||||
1032 | const QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
1033 | return executed 24 times by 2 tests: d->pathItems;return d->pathItems; Executed by:
executed 24 times by 2 tests: return d->pathItems; Executed by:
| 24 | ||||||||||||||||||||||||||||||
1034 | } | - | ||||||||||||||||||||||||||||||
1035 | - | |||||||||||||||||||||||||||||||
1036 | void QQuickPathView::setPathItemCount(int i) | - | ||||||||||||||||||||||||||||||
1037 | { | - | ||||||||||||||||||||||||||||||
1038 | QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
1039 | if (i == d->pathItems
| 2-136 | ||||||||||||||||||||||||||||||
1040 | return; executed 2 times by 1 test: return; Executed by:
| 2 | ||||||||||||||||||||||||||||||
1041 | if (i < 1
| 2-134 | ||||||||||||||||||||||||||||||
1042 | i = 1; executed 2 times by 1 test: i = 1; Executed by:
| 2 | ||||||||||||||||||||||||||||||
1043 | d->pathItems = i; | - | ||||||||||||||||||||||||||||||
1044 | d->updateMappedRange(); | - | ||||||||||||||||||||||||||||||
1045 | if (d->isValid()
| 0-104 | ||||||||||||||||||||||||||||||
1046 | d->regenerate(); | - | ||||||||||||||||||||||||||||||
1047 | } executed 32 times by 2 tests: end of block Executed by:
| 32 | ||||||||||||||||||||||||||||||
1048 | pathItemCountChanged(); | - | ||||||||||||||||||||||||||||||
1049 | } executed 136 times by 2 tests: end of block Executed by:
| 136 | ||||||||||||||||||||||||||||||
1050 | - | |||||||||||||||||||||||||||||||
1051 | void QQuickPathView::resetPathItemCount() | - | ||||||||||||||||||||||||||||||
1052 | { | - | ||||||||||||||||||||||||||||||
1053 | QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
1054 | if (-
| 0-18 | ||||||||||||||||||||||||||||||
1055 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
1056 | d->pathItems = -1; | - | ||||||||||||||||||||||||||||||
1057 | d->updateMappedRange(); | - | ||||||||||||||||||||||||||||||
1058 | if (d->isValid()
| 0-18 | ||||||||||||||||||||||||||||||
1059 | d->regenerate(); executed 18 times by 1 test: d->regenerate(); Executed by:
| 18 | ||||||||||||||||||||||||||||||
1060 | pathItemCountChanged(); | - | ||||||||||||||||||||||||||||||
1061 | } executed 18 times by 1 test: end of block Executed by:
| 18 | ||||||||||||||||||||||||||||||
1062 | int QQuickPathView::cacheItemCount() const | - | ||||||||||||||||||||||||||||||
1063 | { | - | ||||||||||||||||||||||||||||||
1064 | const QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
1065 | return executed 4 times by 1 test: d->cacheSize;return d->cacheSize; Executed by:
executed 4 times by 1 test: return d->cacheSize; Executed by:
| 4 | ||||||||||||||||||||||||||||||
1066 | } | - | ||||||||||||||||||||||||||||||
1067 | - | |||||||||||||||||||||||||||||||
1068 | void QQuickPathView::setCacheItemCount(int i) | - | ||||||||||||||||||||||||||||||
1069 | { | - | ||||||||||||||||||||||||||||||
1070 | QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
1071 | if (i == d->cacheSize
| 0-4 | ||||||||||||||||||||||||||||||
1072 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
1073 | - | |||||||||||||||||||||||||||||||
1074 | d->cacheSize = i; | - | ||||||||||||||||||||||||||||||
1075 | d->updateMappedRange(); | - | ||||||||||||||||||||||||||||||
1076 | refill(); | - | ||||||||||||||||||||||||||||||
1077 | cacheItemCountChanged(); | - | ||||||||||||||||||||||||||||||
1078 | } executed 4 times by 1 test: end of block Executed by:
| 4 | ||||||||||||||||||||||||||||||
1079 | QQuickPathView::SnapMode QQuickPathView::snapMode() const | - | ||||||||||||||||||||||||||||||
1080 | { | - | ||||||||||||||||||||||||||||||
1081 | const QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
1082 | return never executed: d->snapMode;return d->snapMode; never executed: return d->snapMode; | 0 | ||||||||||||||||||||||||||||||
1083 | } | - | ||||||||||||||||||||||||||||||
1084 | - | |||||||||||||||||||||||||||||||
1085 | void QQuickPathView::setSnapMode(SnapMode mode) | - | ||||||||||||||||||||||||||||||
1086 | { | - | ||||||||||||||||||||||||||||||
1087 | QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
1088 | if (mode == d->snapMode
| 0-22 | ||||||||||||||||||||||||||||||
1089 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
1090 | d->snapMode = mode; | - | ||||||||||||||||||||||||||||||
1091 | snapModeChanged(); | - | ||||||||||||||||||||||||||||||
1092 | } executed 22 times by 1 test: end of block Executed by:
| 22 | ||||||||||||||||||||||||||||||
1093 | QQuickPathView::MovementDirection QQuickPathView::movementDirection() const | - | ||||||||||||||||||||||||||||||
1094 | { | - | ||||||||||||||||||||||||||||||
1095 | const QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
1096 | return executed 6 times by 1 test: d->movementDirection;return d->movementDirection; Executed by:
executed 6 times by 1 test: return d->movementDirection; Executed by:
| 6 | ||||||||||||||||||||||||||||||
1097 | } | - | ||||||||||||||||||||||||||||||
1098 | - | |||||||||||||||||||||||||||||||
1099 | void QQuickPathView::setMovementDirection(QQuickPathView::MovementDirection dir) | - | ||||||||||||||||||||||||||||||
1100 | { | - | ||||||||||||||||||||||||||||||
1101 | QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
1102 | if (dir == d->movementDirection
| 2-6 | ||||||||||||||||||||||||||||||
1103 | return; executed 2 times by 1 test: return; Executed by:
| 2 | ||||||||||||||||||||||||||||||
1104 | d->movementDirection = dir; | - | ||||||||||||||||||||||||||||||
1105 | if (!d->tl.isActive()
| 0-6 | ||||||||||||||||||||||||||||||
1106 | d->moveDirection = d->movementDirection; executed 6 times by 1 test: d->moveDirection = d->movementDirection; Executed by:
| 6 | ||||||||||||||||||||||||||||||
1107 | movementDirectionChanged(); | - | ||||||||||||||||||||||||||||||
1108 | } executed 6 times by 1 test: end of block Executed by:
| 6 | ||||||||||||||||||||||||||||||
1109 | void QQuickPathView::positionViewAtIndex(int index, int mode) | - | ||||||||||||||||||||||||||||||
1110 | { | - | ||||||||||||||||||||||||||||||
1111 | QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
1112 | if (!d->isValid()
| 0-44 | ||||||||||||||||||||||||||||||
1113 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
1114 | if (mode < QQuickPathView::Beginning
| 0-44 | ||||||||||||||||||||||||||||||
1115 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
1116 | - | |||||||||||||||||||||||||||||||
1117 | if (mode == QQuickPathView::Contain
| 0-28 | ||||||||||||||||||||||||||||||
1118 | return; executed 4 times by 1 test: return; Executed by:
| 4 | ||||||||||||||||||||||||||||||
1119 | - | |||||||||||||||||||||||||||||||
1120 | int count = d->pathItems == -1
| 14-26 | ||||||||||||||||||||||||||||||
1121 | int idx = (index+d->modelCount) % d->modelCount; | - | ||||||||||||||||||||||||||||||
1122 | bool snap = d->haveHighlightRange
| 0-40 | ||||||||||||||||||||||||||||||
1123 | || d->snapMode != QQuickPathView::NoSnap
| 0-18 | ||||||||||||||||||||||||||||||
1124 | - | |||||||||||||||||||||||||||||||
1125 | qreal beginOffset; | - | ||||||||||||||||||||||||||||||
1126 | qreal endOffset; | - | ||||||||||||||||||||||||||||||
1127 | if (snap
| 18-22 | ||||||||||||||||||||||||||||||
1128 | beginOffset = d->modelCount - idx - qFloor(count * d->highlightRangeStart); | - | ||||||||||||||||||||||||||||||
1129 | endOffset = beginOffset + count - 1; | - | ||||||||||||||||||||||||||||||
1130 | } executed 22 times by 1 test: else {end of block Executed by:
| 22 | ||||||||||||||||||||||||||||||
1131 | beginOffset = d->modelCount - idx; | - | ||||||||||||||||||||||||||||||
1132 | - | |||||||||||||||||||||||||||||||
1133 | - | |||||||||||||||||||||||||||||||
1134 | qreal adj = sizeof(qreal) == sizeof(float)
| 0-18 | ||||||||||||||||||||||||||||||
1135 | endOffset = std::fmod(beginOffset + count, qreal(d->modelCount)) - adj; | - | ||||||||||||||||||||||||||||||
1136 | } executed 18 times by 1 test: end of block Executed by:
| 18 | ||||||||||||||||||||||||||||||
1137 | qreal offset = d->offset; | - | ||||||||||||||||||||||||||||||
1138 | switch (mode) { | - | ||||||||||||||||||||||||||||||
1139 | case executed 8 times by 1 test: Beginning:case Beginning: Executed by:
executed 8 times by 1 test: case Beginning: Executed by:
| 8 | ||||||||||||||||||||||||||||||
1140 | offset = beginOffset; | - | ||||||||||||||||||||||||||||||
1141 | break; executed 8 times by 1 test: break; Executed by:
| 8 | ||||||||||||||||||||||||||||||
1142 | case executed 8 times by 1 test: End:case End: Executed by:
executed 8 times by 1 test: case End: Executed by:
| 8 | ||||||||||||||||||||||||||||||
1143 | offset = endOffset; | - | ||||||||||||||||||||||||||||||
1144 | break; executed 8 times by 1 test: break; Executed by:
| 8 | ||||||||||||||||||||||||||||||
1145 | case executed 8 times by 1 test: Center:case Center: Executed by:
executed 8 times by 1 test: case Center: Executed by:
| 8 | ||||||||||||||||||||||||||||||
1146 | if (beginOffset < endOffset
| 4 | ||||||||||||||||||||||||||||||
1147 | offset = (beginOffset + endOffset)/2; executed 4 times by 1 test: offset = (beginOffset + endOffset)/2; Executed by:
| 4 | ||||||||||||||||||||||||||||||
1148 | else | - | ||||||||||||||||||||||||||||||
1149 | offset = (beginOffset + (endOffset + d->modelCount))/2; executed 4 times by 1 test: offset = (beginOffset + (endOffset + d->modelCount))/2; Executed by:
| 4 | ||||||||||||||||||||||||||||||
1150 | if (snap
| 4 | ||||||||||||||||||||||||||||||
1151 | offset = qRound(offset); executed 4 times by 1 test: offset = qRound(offset); Executed by:
| 4 | ||||||||||||||||||||||||||||||
1152 | break; executed 8 times by 1 test: break; Executed by:
| 8 | ||||||||||||||||||||||||||||||
1153 | case executed 12 times by 1 test: Contain:case Contain: Executed by:
executed 12 times by 1 test: case Contain: Executed by:
| 12 | ||||||||||||||||||||||||||||||
1154 | if ((beginOffset < endOffset
| 0-6 | ||||||||||||||||||||||||||||||
1155 | || (d->offset < beginOffset
| 0-6 | ||||||||||||||||||||||||||||||
1156 | qreal diff1 = std::fmod(beginOffset - d->offset + d->modelCount, qreal(d->modelCount)); | - | ||||||||||||||||||||||||||||||
1157 | qreal diff2 = std::fmod(d->offset - endOffset + d->modelCount, qreal(d->modelCount)); | - | ||||||||||||||||||||||||||||||
1158 | if (diff1 < diff2
| 4-6 | ||||||||||||||||||||||||||||||
1159 | offset = beginOffset; executed 4 times by 1 test: offset = beginOffset; Executed by:
| 4 | ||||||||||||||||||||||||||||||
1160 | else | - | ||||||||||||||||||||||||||||||
1161 | offset = endOffset; executed 6 times by 1 test: offset = endOffset; Executed by:
| 6 | ||||||||||||||||||||||||||||||
1162 | } | - | ||||||||||||||||||||||||||||||
1163 | break; executed 12 times by 1 test: break; Executed by:
| 12 | ||||||||||||||||||||||||||||||
1164 | case executed 4 times by 1 test: SnapPosition:case SnapPosition: Executed by:
executed 4 times by 1 test: case SnapPosition: Executed by:
| 4 | ||||||||||||||||||||||||||||||
1165 | offset = d->modelCount - idx; | - | ||||||||||||||||||||||||||||||
1166 | break; executed 4 times by 1 test: break; Executed by:
| 4 | ||||||||||||||||||||||||||||||
1167 | } | - | ||||||||||||||||||||||||||||||
1168 | - | |||||||||||||||||||||||||||||||
1169 | d->tl.clear(); | - | ||||||||||||||||||||||||||||||
1170 | setOffset(offset); | - | ||||||||||||||||||||||||||||||
1171 | } executed 40 times by 1 test: end of block Executed by:
| 40 | ||||||||||||||||||||||||||||||
1172 | int QQuickPathView::indexAt(qreal x, qreal y) const | - | ||||||||||||||||||||||||||||||
1173 | { | - | ||||||||||||||||||||||||||||||
1174 | const QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
1175 | QQuickItem *item = itemAt(x, y); | - | ||||||||||||||||||||||||||||||
1176 | return executed 10 times by 1 test: item ? d->model->indexOf(item, nullptr) : -1;return item ? d->model->indexOf(item, nullptr) : -1; Executed by:
executed 10 times by 1 test: return item ? d->model->indexOf(item, nullptr) : -1; Executed by:
| 10 | ||||||||||||||||||||||||||||||
1177 | } | - | ||||||||||||||||||||||||||||||
1178 | QQuickItem *QQuickPathView::itemAt(qreal x, qreal y) const | - | ||||||||||||||||||||||||||||||
1179 | { | - | ||||||||||||||||||||||||||||||
1180 | const QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
1181 | if (!d->isValid()
| 0-20 | ||||||||||||||||||||||||||||||
1182 | return never executed: nullptr;return nullptr; never executed: return nullptr; | 0 | ||||||||||||||||||||||||||||||
1183 | - | |||||||||||||||||||||||||||||||
1184 | for (QQuickItem *item : d->items) { | - | ||||||||||||||||||||||||||||||
1185 | QPointF p = item->mapFromItem(this, QPointF(x, y)); | - | ||||||||||||||||||||||||||||||
1186 | if (item->contains(p)
| 12-64 | ||||||||||||||||||||||||||||||
1187 | return executed 12 times by 1 test: item;return item; Executed by:
executed 12 times by 1 test: return item; Executed by:
| 12 | ||||||||||||||||||||||||||||||
1188 | } executed 64 times by 1 test: end of block Executed by:
| 64 | ||||||||||||||||||||||||||||||
1189 | - | |||||||||||||||||||||||||||||||
1190 | return executed 8 times by 1 test: nullptr;return nullptr; Executed by:
executed 8 times by 1 test: return nullptr; Executed by:
| 8 | ||||||||||||||||||||||||||||||
1191 | } | - | ||||||||||||||||||||||||||||||
1192 | - | |||||||||||||||||||||||||||||||
1193 | QPointF QQuickPathViewPrivate::pointNear(const QPointF &point, qreal *nearPercent) const | - | ||||||||||||||||||||||||||||||
1194 | { | - | ||||||||||||||||||||||||||||||
1195 | const auto pathLength = path->path().length(); | - | ||||||||||||||||||||||||||||||
1196 | qreal samples = qMin(pathLength / 5, qreal(500.0)); | - | ||||||||||||||||||||||||||||||
1197 | qreal res = pathLength / samples; | - | ||||||||||||||||||||||||||||||
1198 | - | |||||||||||||||||||||||||||||||
1199 | qreal mindist = 1e10; | - | ||||||||||||||||||||||||||||||
1200 | QPointF nearPoint = path->pointAt(0); | - | ||||||||||||||||||||||||||||||
1201 | qreal nearPc = 0; | - | ||||||||||||||||||||||||||||||
1202 | - | |||||||||||||||||||||||||||||||
1203 | - | |||||||||||||||||||||||||||||||
1204 | for (qreal i=1; i < samples
| 156-22836 | ||||||||||||||||||||||||||||||
1205 | QPointF pt = path->pointAt(i/samples); | - | ||||||||||||||||||||||||||||||
1206 | QPointF diff = pt - point; | - | ||||||||||||||||||||||||||||||
1207 | qreal dist = diff.x()*diff.x() + diff.y()*diff.y(); | - | ||||||||||||||||||||||||||||||
1208 | if (dist < mindist
| 8382-14454 | ||||||||||||||||||||||||||||||
1209 | nearPoint = pt; | - | ||||||||||||||||||||||||||||||
1210 | nearPc = i; | - | ||||||||||||||||||||||||||||||
1211 | mindist = dist; | - | ||||||||||||||||||||||||||||||
1212 | } executed 8382 times by 1 test: end of block Executed by:
| 8382 | ||||||||||||||||||||||||||||||
1213 | } executed 22836 times by 1 test: end of block Executed by:
| 22836 | ||||||||||||||||||||||||||||||
1214 | - | |||||||||||||||||||||||||||||||
1215 | - | |||||||||||||||||||||||||||||||
1216 | qreal approxPc = nearPc; | - | ||||||||||||||||||||||||||||||
1217 | for (qreal i = approxPc-1.0; i < approxPc+1.0
| 156-3204 | ||||||||||||||||||||||||||||||
1218 | QPointF pt = path->pointAt(i/samples); | - | ||||||||||||||||||||||||||||||
1219 | QPointF diff = pt - point; | - | ||||||||||||||||||||||||||||||
1220 | qreal dist = diff.x()*diff.x() + diff.y()*diff.y(); | - | ||||||||||||||||||||||||||||||
1221 | if (dist < mindist
| 252-2952 | ||||||||||||||||||||||||||||||
1222 | nearPoint = pt; | - | ||||||||||||||||||||||||||||||
1223 | nearPc = i; | - | ||||||||||||||||||||||||||||||
1224 | mindist = dist; | - | ||||||||||||||||||||||||||||||
1225 | } executed 252 times by 1 test: end of block Executed by:
| 252 | ||||||||||||||||||||||||||||||
1226 | } executed 3204 times by 1 test: end of block Executed by:
| 3204 | ||||||||||||||||||||||||||||||
1227 | - | |||||||||||||||||||||||||||||||
1228 | if (nearPercent
| 0-156 | ||||||||||||||||||||||||||||||
1229 | * executed 156 times by 1 test: nearPercent = nearPc / samples;*nearPercent = nearPc / samples; Executed by:
executed 156 times by 1 test: *nearPercent = nearPc / samples; Executed by:
| 156 | ||||||||||||||||||||||||||||||
1230 | - | |||||||||||||||||||||||||||||||
1231 | return executed 156 times by 1 test: nearPoint;return nearPoint; Executed by:
executed 156 times by 1 test: return nearPoint; Executed by:
| 156 | ||||||||||||||||||||||||||||||
1232 | } | - | ||||||||||||||||||||||||||||||
1233 | - | |||||||||||||||||||||||||||||||
1234 | void QQuickPathViewPrivate::addVelocitySample(qreal v) | - | ||||||||||||||||||||||||||||||
1235 | { | - | ||||||||||||||||||||||||||||||
1236 | velocityBuffer.append(v); | - | ||||||||||||||||||||||||||||||
1237 | if (velocityBuffer.count() > 3
| 16-52 | ||||||||||||||||||||||||||||||
1238 | velocityBuffer.remove(0); executed 16 times by 1 test: velocityBuffer.remove(0); Executed by:
| 16 | ||||||||||||||||||||||||||||||
1239 | } executed 68 times by 1 test: end of block Executed by:
| 68 | ||||||||||||||||||||||||||||||
1240 | - | |||||||||||||||||||||||||||||||
1241 | qreal QQuickPathViewPrivate::calcVelocity() const | - | ||||||||||||||||||||||||||||||
1242 | { | - | ||||||||||||||||||||||||||||||
1243 | qreal velocity = 0; | - | ||||||||||||||||||||||||||||||
1244 | if (velocityBuffer.count() > 0
| 2-18 | ||||||||||||||||||||||||||||||
1245 | int count = velocityBuffer.count()-0; | - | ||||||||||||||||||||||||||||||
1246 | for (int i = 0; i < count
| 18-50 | ||||||||||||||||||||||||||||||
1247 | qreal v = velocityBuffer.at(i); | - | ||||||||||||||||||||||||||||||
1248 | velocity += v; | - | ||||||||||||||||||||||||||||||
1249 | } executed 50 times by 1 test: end of block Executed by:
| 50 | ||||||||||||||||||||||||||||||
1250 | velocity /= count; | - | ||||||||||||||||||||||||||||||
1251 | } executed 18 times by 1 test: end of block Executed by:
| 18 | ||||||||||||||||||||||||||||||
1252 | return executed 20 times by 1 test: velocity;return velocity; Executed by:
executed 20 times by 1 test: return velocity; Executed by:
| 20 | ||||||||||||||||||||||||||||||
1253 | } | - | ||||||||||||||||||||||||||||||
1254 | - | |||||||||||||||||||||||||||||||
1255 | qint64 QQuickPathViewPrivate::computeCurrentTime(QInputEvent *event) const | - | ||||||||||||||||||||||||||||||
1256 | { | - | ||||||||||||||||||||||||||||||
1257 | if (0 != event->timestamp()
| 4-152 | ||||||||||||||||||||||||||||||
1258 | return executed 152 times by 1 test: event->timestamp();return event->timestamp(); Executed by:
executed 152 times by 1 test: return event->timestamp(); Executed by:
| 152 | ||||||||||||||||||||||||||||||
1259 | return executed 4 times by 1 test: timer.elapsed();return timer.elapsed(); Executed by:
executed 4 times by 1 test: return timer.elapsed(); Executed by:
| 4 | ||||||||||||||||||||||||||||||
1260 | } | - | ||||||||||||||||||||||||||||||
1261 | - | |||||||||||||||||||||||||||||||
1262 | void QQuickPathView::mousePressEvent(QMouseEvent *event) | - | ||||||||||||||||||||||||||||||
1263 | { | - | ||||||||||||||||||||||||||||||
1264 | QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
1265 | if (d->interactive
| 0-20 | ||||||||||||||||||||||||||||||
1266 | d->handleMousePressEvent(event); | - | ||||||||||||||||||||||||||||||
1267 | event->accept(); | - | ||||||||||||||||||||||||||||||
1268 | } executed 20 times by 1 test: else {end of block Executed by:
| 20 | ||||||||||||||||||||||||||||||
1269 | QQuickItem::mousePressEvent(event); | - | ||||||||||||||||||||||||||||||
1270 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1271 | } | - | ||||||||||||||||||||||||||||||
1272 | - | |||||||||||||||||||||||||||||||
1273 | void QQuickPathViewPrivate::handleMousePressEvent(QMouseEvent *event) | - | ||||||||||||||||||||||||||||||
1274 | { | - | ||||||||||||||||||||||||||||||
1275 | if (!interactive
| 0-26 | ||||||||||||||||||||||||||||||
1276 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
1277 | velocityBuffer.clear(); | - | ||||||||||||||||||||||||||||||
1278 | int idx = 0; | - | ||||||||||||||||||||||||||||||
1279 | for (; idx < items.count()
| 10-232 | ||||||||||||||||||||||||||||||
1280 | QQuickItem *item = items.at(idx); | - | ||||||||||||||||||||||||||||||
1281 | if (item->contains(item->mapFromScene(event->windowPos()))
| 16-216 | ||||||||||||||||||||||||||||||
1282 | break; executed 16 times by 1 test: break; Executed by:
| 16 | ||||||||||||||||||||||||||||||
1283 | } executed 216 times by 1 test: end of block Executed by:
| 216 | ||||||||||||||||||||||||||||||
1284 | if (idx == items.count()
| 0-16 | ||||||||||||||||||||||||||||||
1285 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
1286 | - | |||||||||||||||||||||||||||||||
1287 | startPoint = pointNear(event->localPos(), &startPc); | - | ||||||||||||||||||||||||||||||
1288 | startPos = event->localPos(); | - | ||||||||||||||||||||||||||||||
1289 | if (idx == items.count()
| 10-16 | ||||||||||||||||||||||||||||||
1290 | qreal distance = qAbs(event->localPos().x() - startPoint.x()) + qAbs(event->localPos().y() - startPoint.y()); | - | ||||||||||||||||||||||||||||||
1291 | if (distance > dragMargin
| 0-10 | ||||||||||||||||||||||||||||||
1292 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
1293 | } executed 10 times by 1 test: end of block Executed by:
| 10 | ||||||||||||||||||||||||||||||
1294 | - | |||||||||||||||||||||||||||||||
1295 | - | |||||||||||||||||||||||||||||||
1296 | if (tl.isActive()
| 0-22 | ||||||||||||||||||||||||||||||
1297 | stealMouse = true; never executed: stealMouse = true; | 0 | ||||||||||||||||||||||||||||||
1298 | else | - | ||||||||||||||||||||||||||||||
1299 | stealMouse = false; executed 26 times by 1 test: stealMouse = false; Executed by:
| 26 | ||||||||||||||||||||||||||||||
1300 | - | |||||||||||||||||||||||||||||||
1301 | timer.start(); | - | ||||||||||||||||||||||||||||||
1302 | lastPosTime = computeCurrentTime(event); | - | ||||||||||||||||||||||||||||||
1303 | tl.clear(); | - | ||||||||||||||||||||||||||||||
1304 | } executed 26 times by 1 test: end of block Executed by:
| 26 | ||||||||||||||||||||||||||||||
1305 | - | |||||||||||||||||||||||||||||||
1306 | void QQuickPathView::mouseMoveEvent(QMouseEvent *event) | - | ||||||||||||||||||||||||||||||
1307 | { | - | ||||||||||||||||||||||||||||||
1308 | QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
1309 | if (d->interactive
| 0-106 | ||||||||||||||||||||||||||||||
1310 | d->handleMouseMoveEvent(event); | - | ||||||||||||||||||||||||||||||
1311 | event->accept(); | - | ||||||||||||||||||||||||||||||
1312 | } executed 106 times by 1 test: else {end of block Executed by:
| 106 | ||||||||||||||||||||||||||||||
1313 | QQuickItem::mouseMoveEvent(event); | - | ||||||||||||||||||||||||||||||
1314 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1315 | } | - | ||||||||||||||||||||||||||||||
1316 | - | |||||||||||||||||||||||||||||||
1317 | void QQuickPathViewPrivate::handleMouseMoveEvent(QMouseEvent *event) | - | ||||||||||||||||||||||||||||||
1318 | { | - | ||||||||||||||||||||||||||||||
1319 | QQuickPathView * const q = q_func(); | - | ||||||||||||||||||||||||||||||
1320 | if (!interactive
| 0-132 | ||||||||||||||||||||||||||||||
1321 | return; executed 2 times by 1 test: return; Executed by:
| 2 | ||||||||||||||||||||||||||||||
1322 | - | |||||||||||||||||||||||||||||||
1323 | qint64 currentTimestamp = computeCurrentTime(event); | - | ||||||||||||||||||||||||||||||
1324 | qreal newPc; | - | ||||||||||||||||||||||||||||||
1325 | QPointF pathPoint = pointNear(event->localPos(), &newPc); | - | ||||||||||||||||||||||||||||||
1326 | if (!stealMouse
| 42-88 | ||||||||||||||||||||||||||||||
1327 | QPointF posDelta = event->localPos() - startPos; | - | ||||||||||||||||||||||||||||||
1328 | if (QQuickWindowPrivate::dragOverThreshold(posDelta.y(), Qt::YAxis, event)
| 0-42 | ||||||||||||||||||||||||||||||
1329 | - | |||||||||||||||||||||||||||||||
1330 | - | |||||||||||||||||||||||||||||||
1331 | - | |||||||||||||||||||||||||||||||
1332 | QPointF pathDelta = pathPoint - startPoint; | - | ||||||||||||||||||||||||||||||
1333 | const int startDragDistance = QGuiApplication::styleHints()->startDragDistance(); | - | ||||||||||||||||||||||||||||||
1334 | if (qAbs(pathDelta.x()) > startDragDistance * 0.8
| 0-26 | ||||||||||||||||||||||||||||||
1335 | || qAbs(pathDelta.y()) > startDragDistance * 0.8
| 0 | ||||||||||||||||||||||||||||||
1336 | stealMouse = true; | - | ||||||||||||||||||||||||||||||
1337 | q->setKeepMouseGrab(true); | - | ||||||||||||||||||||||||||||||
1338 | } executed 26 times by 1 test: end of block Executed by:
| 26 | ||||||||||||||||||||||||||||||
1339 | } executed 26 times by 1 test: end of block Executed by:
| 26 | ||||||||||||||||||||||||||||||
1340 | } executed 42 times by 1 test: else {end of block Executed by:
| 42 | ||||||||||||||||||||||||||||||
1341 | moveReason = QQuickPathViewPrivate::Mouse; | - | ||||||||||||||||||||||||||||||
1342 | int count = pathItems == -1
| 38-50 | ||||||||||||||||||||||||||||||
1343 | qreal diff = (newPc - startPc)*count; | - | ||||||||||||||||||||||||||||||
1344 | if (diff
| 16-72 | ||||||||||||||||||||||||||||||
1345 | q->setOffset(offset + diff); | - | ||||||||||||||||||||||||||||||
1346 | - | |||||||||||||||||||||||||||||||
1347 | if (diff > modelCount/2
| 0-72 | ||||||||||||||||||||||||||||||
1348 | diff -= modelCount; never executed: diff -= modelCount; | 0 | ||||||||||||||||||||||||||||||
1349 | else if (diff < -modelCount/2
| 0-72 | ||||||||||||||||||||||||||||||
1350 | diff += modelCount; never executed: diff += modelCount; | 0 | ||||||||||||||||||||||||||||||
1351 | - | |||||||||||||||||||||||||||||||
1352 | qint64 elapsed = currentTimestamp - lastPosTime; | - | ||||||||||||||||||||||||||||||
1353 | if (elapsed > 0
| 4-68 | ||||||||||||||||||||||||||||||
1354 | addVelocitySample(diff / (qreal(elapsed) / 1000.)); executed 68 times by 1 test: addVelocitySample(diff / (qreal(elapsed) / 1000.)); Executed by:
| 68 | ||||||||||||||||||||||||||||||
1355 | } executed 72 times by 1 test: end of block Executed by:
| 72 | ||||||||||||||||||||||||||||||
1356 | if (!moving
| 22-66 | ||||||||||||||||||||||||||||||
1357 | moving = true; | - | ||||||||||||||||||||||||||||||
1358 | q->movingChanged(); | - | ||||||||||||||||||||||||||||||
1359 | q->movementStarted(); | - | ||||||||||||||||||||||||||||||
1360 | } executed 22 times by 1 test: end of block Executed by:
| 22 | ||||||||||||||||||||||||||||||
1361 | setDragging(true); | - | ||||||||||||||||||||||||||||||
1362 | } executed 88 times by 1 test: end of block Executed by:
| 88 | ||||||||||||||||||||||||||||||
1363 | startPc = newPc; | - | ||||||||||||||||||||||||||||||
1364 | lastPosTime = currentTimestamp; | - | ||||||||||||||||||||||||||||||
1365 | } executed 130 times by 1 test: end of block Executed by:
| 130 | ||||||||||||||||||||||||||||||
1366 | - | |||||||||||||||||||||||||||||||
1367 | void QQuickPathView::mouseReleaseEvent(QMouseEvent *event) | - | ||||||||||||||||||||||||||||||
1368 | { | - | ||||||||||||||||||||||||||||||
1369 | QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
1370 | if (d->interactive
| 0-20 | ||||||||||||||||||||||||||||||
1371 | d->handleMouseReleaseEvent(event); | - | ||||||||||||||||||||||||||||||
1372 | event->accept(); | - | ||||||||||||||||||||||||||||||
1373 | ungrabMouse(); | - | ||||||||||||||||||||||||||||||
1374 | } executed 20 times by 1 test: else {end of block Executed by:
| 20 | ||||||||||||||||||||||||||||||
1375 | QQuickItem::mouseReleaseEvent(event); | - | ||||||||||||||||||||||||||||||
1376 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1377 | } | - | ||||||||||||||||||||||||||||||
1378 | - | |||||||||||||||||||||||||||||||
1379 | void QQuickPathViewPrivate::handleMouseReleaseEvent(QMouseEvent *) | - | ||||||||||||||||||||||||||||||
1380 | { | - | ||||||||||||||||||||||||||||||
1381 | QQuickPathView * const q = q_func(); | - | ||||||||||||||||||||||||||||||
1382 | stealMouse = false; | - | ||||||||||||||||||||||||||||||
1383 | q->setKeepMouseGrab(false); | - | ||||||||||||||||||||||||||||||
1384 | setDragging(false); | - | ||||||||||||||||||||||||||||||
1385 | if (!interactive
| 0-22 | ||||||||||||||||||||||||||||||
1386 | timer.invalidate(); | - | ||||||||||||||||||||||||||||||
1387 | if (!tl.isActive()
| 0-2 | ||||||||||||||||||||||||||||||
1388 | q->movementEnding(); executed 2 times by 1 test: q->movementEnding(); Executed by:
| 2 | ||||||||||||||||||||||||||||||
1389 | return; executed 2 times by 1 test: return; Executed by:
| 2 | ||||||||||||||||||||||||||||||
1390 | } | - | ||||||||||||||||||||||||||||||
1391 | - | |||||||||||||||||||||||||||||||
1392 | qreal velocity = calcVelocity(); | - | ||||||||||||||||||||||||||||||
1393 | qreal count = pathItems == -1
| 10 | ||||||||||||||||||||||||||||||
1394 | const auto averageItemLength = path->path().length() / count; | - | ||||||||||||||||||||||||||||||
1395 | qreal pixelVelocity = averageItemLength * velocity; | - | ||||||||||||||||||||||||||||||
1396 | if (qAbs(pixelVelocity) > MinimumFlickVelocity
| 2-18 | ||||||||||||||||||||||||||||||
1397 | if (qAbs(pixelVelocity) > maximumFlickVelocity
| 4-10 | ||||||||||||||||||||||||||||||
1398 | - | |||||||||||||||||||||||||||||||
1399 | qreal maxVel = velocity < 0
| 2-10 | ||||||||||||||||||||||||||||||
1400 | velocity = maxVel / averageItemLength; | - | ||||||||||||||||||||||||||||||
1401 | } executed 12 times by 1 test: end of block Executed by:
| 12 | ||||||||||||||||||||||||||||||
1402 | - | |||||||||||||||||||||||||||||||
1403 | qreal v2 = velocity*velocity; | - | ||||||||||||||||||||||||||||||
1404 | qreal accel = deceleration/10; | - | ||||||||||||||||||||||||||||||
1405 | qreal dist = 0; | - | ||||||||||||||||||||||||||||||
1406 | if (haveHighlightRange
| 0-18 | ||||||||||||||||||||||||||||||
1407 | || snapMode != QQuickPathView::NoSnap
| 0-4 | ||||||||||||||||||||||||||||||
1408 | if (snapMode == QQuickPathView::SnapOneItem
| 4-14 | ||||||||||||||||||||||||||||||
1409 | - | |||||||||||||||||||||||||||||||
1410 | if (velocity > 0.
| 0-4 | ||||||||||||||||||||||||||||||
1411 | dist = qRound(0.5 + offset) - offset; never executed: dist = qRound(0.5 + offset) - offset; | 0 | ||||||||||||||||||||||||||||||
1412 | else | - | ||||||||||||||||||||||||||||||
1413 | dist = qRound(0.5 - offset) + offset; executed 4 times by 1 test: dist = qRound(0.5 - offset) + offset; Executed by:
| 4 | ||||||||||||||||||||||||||||||
1414 | } else { | - | ||||||||||||||||||||||||||||||
1415 | - | |||||||||||||||||||||||||||||||
1416 | dist = qMin(qreal(modelCount-1), qreal(v2 / (accel * 2.0) + 0.25)); | - | ||||||||||||||||||||||||||||||
1417 | - | |||||||||||||||||||||||||||||||
1418 | - | |||||||||||||||||||||||||||||||
1419 | if (velocity > 0.
| 4-10 | ||||||||||||||||||||||||||||||
1420 | dist = qRound(dist + offset) - offset; executed 4 times by 1 test: dist = qRound(dist + offset) - offset; Executed by:
| 4 | ||||||||||||||||||||||||||||||
1421 | else | - | ||||||||||||||||||||||||||||||
1422 | dist = qRound(dist - offset) + offset; executed 10 times by 1 test: dist = qRound(dist - offset) + offset; Executed by:
| 10 | ||||||||||||||||||||||||||||||
1423 | } | - | ||||||||||||||||||||||||||||||
1424 | - | |||||||||||||||||||||||||||||||
1425 | if (dist <= 0.
| 2-16 | ||||||||||||||||||||||||||||||
1426 | dist = 0.; | - | ||||||||||||||||||||||||||||||
1427 | accel = 0.; | - | ||||||||||||||||||||||||||||||
1428 | } executed 2 times by 1 test: else {end of block Executed by:
| 2 | ||||||||||||||||||||||||||||||
1429 | accel = v2 / (2.0f * qAbs(dist)); | - | ||||||||||||||||||||||||||||||
1430 | } executed 16 times by 1 test: end of block Executed by:
| 16 | ||||||||||||||||||||||||||||||
1431 | } else { | - | ||||||||||||||||||||||||||||||
1432 | dist = qMin(qreal(modelCount-1), qreal(v2 / (accel * 2.0))); | - | ||||||||||||||||||||||||||||||
1433 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1434 | flickDuration = static_cast<int>(1000 * qAbs(velocity) / accel); | - | ||||||||||||||||||||||||||||||
1435 | offsetAdj = 0.0; | - | ||||||||||||||||||||||||||||||
1436 | moveOffset.setValue(offset); | - | ||||||||||||||||||||||||||||||
1437 | tl.accel(moveOffset, velocity, accel, dist); | - | ||||||||||||||||||||||||||||||
1438 | tl.callback(QQuickTimeLineCallback(&moveOffset, fixOffsetCallback, this)); | - | ||||||||||||||||||||||||||||||
1439 | if (!flicking
| 0-18 | ||||||||||||||||||||||||||||||
1440 | flicking = true; | - | ||||||||||||||||||||||||||||||
1441 | q->flickingChanged(); | - | ||||||||||||||||||||||||||||||
1442 | q->flickStarted(); | - | ||||||||||||||||||||||||||||||
1443 | } executed 18 times by 1 test: end of block Executed by:
| 18 | ||||||||||||||||||||||||||||||
1444 | } executed 18 times by 1 test: else {end of block Executed by:
| 18 | ||||||||||||||||||||||||||||||
1445 | fixOffset(); | - | ||||||||||||||||||||||||||||||
1446 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||||||||||||||
1447 | - | |||||||||||||||||||||||||||||||
1448 | timer.invalidate(); | - | ||||||||||||||||||||||||||||||
1449 | if (!tl.isActive()
| 0-20 | ||||||||||||||||||||||||||||||
1450 | q->movementEnding(); never executed: q->movementEnding(); | 0 | ||||||||||||||||||||||||||||||
1451 | } executed 20 times by 1 test: end of block Executed by:
| 20 | ||||||||||||||||||||||||||||||
1452 | - | |||||||||||||||||||||||||||||||
1453 | bool QQuickPathView::sendMouseEvent(QMouseEvent *event) | - | ||||||||||||||||||||||||||||||
1454 | { | - | ||||||||||||||||||||||||||||||
1455 | QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
1456 | QPointF localPos = mapFromScene(event->windowPos()); | - | ||||||||||||||||||||||||||||||
1457 | - | |||||||||||||||||||||||||||||||
1458 | QQuickWindow *c = window(); | - | ||||||||||||||||||||||||||||||
1459 | QQuickItem *grabber = c
| 0-48 | ||||||||||||||||||||||||||||||
1460 | if (grabber == this
| 0-48 | ||||||||||||||||||||||||||||||
1461 | - | |||||||||||||||||||||||||||||||
1462 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||||||||||||||
1463 | } | - | ||||||||||||||||||||||||||||||
1464 | - | |||||||||||||||||||||||||||||||
1465 | bool grabberDisabled = grabber
| 0-42 | ||||||||||||||||||||||||||||||
1466 | bool stealThisEvent = d->stealMouse; | - | ||||||||||||||||||||||||||||||
1467 | if ((stealThisEvent
| 0-42 | ||||||||||||||||||||||||||||||
1468 | QScopedPointer<QMouseEvent> mouseEvent(QQuickWindowPrivate::cloneMouseEvent(event, &localPos)); | - | ||||||||||||||||||||||||||||||
1469 | mouseEvent->setAccepted(false); | - | ||||||||||||||||||||||||||||||
1470 | - | |||||||||||||||||||||||||||||||
1471 | switch (mouseEvent->type()) { | - | ||||||||||||||||||||||||||||||
1472 | case executed 26 times by 1 test: QEvent::MouseMove:case QEvent::MouseMove: Executed by:
executed 26 times by 1 test: case QEvent::MouseMove: Executed by:
| 26 | ||||||||||||||||||||||||||||||
1473 | d->handleMouseMoveEvent(mouseEvent.data()); | - | ||||||||||||||||||||||||||||||
1474 | break; executed 26 times by 1 test: break; Executed by:
| 26 | ||||||||||||||||||||||||||||||
1475 | case executed 6 times by 1 test: QEvent::MouseButtonPress:case QEvent::MouseButtonPress: Executed by:
executed 6 times by 1 test: case QEvent::MouseButtonPress: Executed by:
| 6 | ||||||||||||||||||||||||||||||
1476 | d->handleMousePressEvent(mouseEvent.data()); | - | ||||||||||||||||||||||||||||||
1477 | stealThisEvent = d->stealMouse; | - | ||||||||||||||||||||||||||||||
1478 | break; executed 6 times by 1 test: break; Executed by:
| 6 | ||||||||||||||||||||||||||||||
1479 | case executed 2 times by 1 test: QEvent::MouseButtonRelease:case QEvent::MouseButtonRelease: Executed by:
executed 2 times by 1 test: case QEvent::MouseButtonRelease: Executed by:
| 2 | ||||||||||||||||||||||||||||||
1480 | d->handleMouseReleaseEvent(mouseEvent.data()); | - | ||||||||||||||||||||||||||||||
1481 | break; executed 2 times by 1 test: break; Executed by:
| 2 | ||||||||||||||||||||||||||||||
1482 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||||||||||||||
1483 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||
1484 | } | - | ||||||||||||||||||||||||||||||
1485 | grabber = c
| 0-34 | ||||||||||||||||||||||||||||||
1486 | if ((grabber
| 0-32 | ||||||||||||||||||||||||||||||
1487 | grabMouse(); | - | ||||||||||||||||||||||||||||||
1488 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||||||||||||||
1489 | - | |||||||||||||||||||||||||||||||
1490 | const bool filtered = stealThisEvent
| 0-32 | ||||||||||||||||||||||||||||||
1491 | if (filtered
| 2-32 | ||||||||||||||||||||||||||||||
1492 | event->setAccepted(false); | - | ||||||||||||||||||||||||||||||
1493 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||||||||||||||
1494 | return executed 34 times by 1 test: filtered;return filtered; Executed by:
executed 34 times by 1 test: return filtered; Executed by:
| 34 | ||||||||||||||||||||||||||||||
1495 | } else if (d->timer.isValid()
| 4-10 | ||||||||||||||||||||||||||||||
1496 | d->timer.invalidate(); | - | ||||||||||||||||||||||||||||||
1497 | d->fixOffset(); | - | ||||||||||||||||||||||||||||||
1498 | } executed 4 times by 1 test: end of block Executed by:
| 4 | ||||||||||||||||||||||||||||||
1499 | if (event->type() == QEvent::MouseButtonRelease
| 0-10 | ||||||||||||||||||||||||||||||
1500 | d->stealMouse = false; | - | ||||||||||||||||||||||||||||||
1501 | } executed 14 times by 1 test: end of block Executed by:
| 14 | ||||||||||||||||||||||||||||||
1502 | return executed 14 times by 1 test: false;return false; Executed by:
executed 14 times by 1 test: return false; Executed by:
| 14 | ||||||||||||||||||||||||||||||
1503 | } | - | ||||||||||||||||||||||||||||||
1504 | - | |||||||||||||||||||||||||||||||
1505 | bool QQuickPathView::childMouseEventFilter(QQuickItem *i, QEvent *e) | - | ||||||||||||||||||||||||||||||
1506 | { | - | ||||||||||||||||||||||||||||||
1507 | QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
1508 | if (!isVisible()
| 0-58 | ||||||||||||||||||||||||||||||
1509 | return never executed: QQuickItem::childMouseEventFilter(i, e);return QQuickItem::childMouseEventFilter(i, e); never executed: return QQuickItem::childMouseEventFilter(i, e); | 0 | ||||||||||||||||||||||||||||||
1510 | - | |||||||||||||||||||||||||||||||
1511 | switch (e->type()) { | - | ||||||||||||||||||||||||||||||
1512 | case executed 6 times by 1 test: QEvent::MouseButtonPress:case QEvent::MouseButtonPress: Executed by:
executed 6 times by 1 test: case QEvent::MouseButtonPress: Executed by:
| 6 | ||||||||||||||||||||||||||||||
1513 | case executed 36 times by 1 test: QEvent::MouseMove:case QEvent::MouseMove: Executed by:
executed 36 times by 1 test: case QEvent::MouseMove: Executed by:
| 36 | ||||||||||||||||||||||||||||||
1514 | case executed 6 times by 1 test: QEvent::MouseButtonRelease:case QEvent::MouseButtonRelease: Executed by:
executed 6 times by 1 test: case QEvent::MouseButtonRelease: Executed by:
| 6 | ||||||||||||||||||||||||||||||
1515 | return executed 48 times by 1 test: sendMouseEvent(static_cast<QMouseEvent *>(e));return sendMouseEvent(static_cast<QMouseEvent *>(e)); Executed by:
executed 48 times by 1 test: return sendMouseEvent(static_cast<QMouseEvent *>(e)); Executed by:
| 48 | ||||||||||||||||||||||||||||||
1516 | default executed 10 times by 1 test: :default: Executed by:
executed 10 times by 1 test: default: Executed by:
| 10 | ||||||||||||||||||||||||||||||
1517 | break; executed 10 times by 1 test: break; Executed by:
| 10 | ||||||||||||||||||||||||||||||
1518 | } | - | ||||||||||||||||||||||||||||||
1519 | - | |||||||||||||||||||||||||||||||
1520 | return executed 10 times by 1 test: QQuickItem::childMouseEventFilter(i, e);return QQuickItem::childMouseEventFilter(i, e); Executed by:
executed 10 times by 1 test: return QQuickItem::childMouseEventFilter(i, e); Executed by:
| 10 | ||||||||||||||||||||||||||||||
1521 | } | - | ||||||||||||||||||||||||||||||
1522 | - | |||||||||||||||||||||||||||||||
1523 | void QQuickPathView::mouseUngrabEvent() | - | ||||||||||||||||||||||||||||||
1524 | { | - | ||||||||||||||||||||||||||||||
1525 | QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
1526 | if (d->stealMouse
| 2-20 | ||||||||||||||||||||||||||||||
1527 | - | |||||||||||||||||||||||||||||||
1528 | - | |||||||||||||||||||||||||||||||
1529 | d->stealMouse = false; | - | ||||||||||||||||||||||||||||||
1530 | setKeepMouseGrab(false); | - | ||||||||||||||||||||||||||||||
1531 | d->timer.invalidate(); | - | ||||||||||||||||||||||||||||||
1532 | d->fixOffset(); | - | ||||||||||||||||||||||||||||||
1533 | d->setDragging(false); | - | ||||||||||||||||||||||||||||||
1534 | if (!d->tl.isActive()
| 0-2 | ||||||||||||||||||||||||||||||
1535 | movementEnding(); never executed: movementEnding(); | 0 | ||||||||||||||||||||||||||||||
1536 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||||||||||||||
1537 | } executed 22 times by 1 test: end of block Executed by:
| 22 | ||||||||||||||||||||||||||||||
1538 | - | |||||||||||||||||||||||||||||||
1539 | void QQuickPathView::updatePolish() | - | ||||||||||||||||||||||||||||||
1540 | { | - | ||||||||||||||||||||||||||||||
1541 | QQuickItem::updatePolish(); | - | ||||||||||||||||||||||||||||||
1542 | refill(); | - | ||||||||||||||||||||||||||||||
1543 | } executed 37 times by 2 tests: end of block Executed by:
| 37 | ||||||||||||||||||||||||||||||
1544 | - | |||||||||||||||||||||||||||||||
1545 | static inline int currentIndexRemainder(int currentIndex, int modelCount) noexcept | - | ||||||||||||||||||||||||||||||
1546 | { | - | ||||||||||||||||||||||||||||||
1547 | if (currentIndex < 0
| 0-6 | ||||||||||||||||||||||||||||||
1548 | return never executed: modelCount + currentIndex % modelCount;return modelCount + currentIndex % modelCount; never executed: return modelCount + currentIndex % modelCount; | 0 | ||||||||||||||||||||||||||||||
1549 | else | - | ||||||||||||||||||||||||||||||
1550 | return executed 6 times by 1 test: currentIndex % modelCount;return currentIndex % modelCount; Executed by:
executed 6 times by 1 test: return currentIndex % modelCount; Executed by:
| 6 | ||||||||||||||||||||||||||||||
1551 | } | - | ||||||||||||||||||||||||||||||
1552 | - | |||||||||||||||||||||||||||||||
1553 | void QQuickPathView::componentComplete() | - | ||||||||||||||||||||||||||||||
1554 | { | - | ||||||||||||||||||||||||||||||
1555 | QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
1556 | if (d->model && d->ownModel
| 20-258 | ||||||||||||||||||||||||||||||
1557 | static_cast< executed 258 times by 3 tests: QQmlDelegateModel *>(d->model.data())->componentComplete();static_cast<QQmlDelegateModel *>(d->model.data())->componentComplete(); Executed by:
executed 258 times by 3 tests: static_cast<QQmlDelegateModel *>(d->model.data())->componentComplete(); Executed by:
| 258 | ||||||||||||||||||||||||||||||
1558 | - | |||||||||||||||||||||||||||||||
1559 | QQuickItem::componentComplete(); | - | ||||||||||||||||||||||||||||||
1560 | - | |||||||||||||||||||||||||||||||
1561 | if (d->model
| 4-278 | ||||||||||||||||||||||||||||||
1562 | d->modelCount = d->model->count(); | - | ||||||||||||||||||||||||||||||
1563 | if (d->modelCount
| 6-268 | ||||||||||||||||||||||||||||||
1564 | 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:
| 6 | ||||||||||||||||||||||||||||||
1565 | } executed 278 times by 3 tests: end of block Executed by:
| 278 | ||||||||||||||||||||||||||||||
1566 | - | |||||||||||||||||||||||||||||||
1567 | d->createHighlight(); | - | ||||||||||||||||||||||||||||||
1568 | d->regenerate(); | - | ||||||||||||||||||||||||||||||
1569 | d->updateHighlight(); | - | ||||||||||||||||||||||||||||||
1570 | d->updateCurrent(); | - | ||||||||||||||||||||||||||||||
1571 | - | |||||||||||||||||||||||||||||||
1572 | if (d->modelCount
| 14-268 | ||||||||||||||||||||||||||||||
1573 | countChanged(); executed 268 times by 3 tests: countChanged(); Executed by:
| 268 | ||||||||||||||||||||||||||||||
1574 | } executed 282 times by 3 tests: end of block Executed by:
| 282 | ||||||||||||||||||||||||||||||
1575 | - | |||||||||||||||||||||||||||||||
1576 | void QQuickPathView::refill() | - | ||||||||||||||||||||||||||||||
1577 | { | - | ||||||||||||||||||||||||||||||
1578 | QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
1579 | - | |||||||||||||||||||||||||||||||
1580 | if (d->inRefill
| 2-4448 | ||||||||||||||||||||||||||||||
1581 | d->scheduleLayout(); | - | ||||||||||||||||||||||||||||||
1582 | return; executed 2 times by 1 test: return; Executed by:
| 2 | ||||||||||||||||||||||||||||||
1583 | } | - | ||||||||||||||||||||||||||||||
1584 | - | |||||||||||||||||||||||||||||||
1585 | d->layoutScheduled = false; | - | ||||||||||||||||||||||||||||||
1586 | - | |||||||||||||||||||||||||||||||
1587 | if (!d->isValid()
| 12-3948 | ||||||||||||||||||||||||||||||
1588 | return; executed 512 times by 3 tests: return; Executed by:
| 512 | ||||||||||||||||||||||||||||||
1589 | - | |||||||||||||||||||||||||||||||
1590 | d->inRefill = true; | - | ||||||||||||||||||||||||||||||
1591 | - | |||||||||||||||||||||||||||||||
1592 | bool currentVisible = false; | - | ||||||||||||||||||||||||||||||
1593 | int count = d->pathItems == -1
| 1555-2381 | ||||||||||||||||||||||||||||||
1594 | - | |||||||||||||||||||||||||||||||
1595 | - | |||||||||||||||||||||||||||||||
1596 | for (bool qt_category_enabled = lcItemViewDelegateLifecycle().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 1956, __PRETTY_FUNCTION__, lcItemViewDelegateLifecycle().categoryName()).debug() << "currentIndex" << d->currentIndex << "offset" << d->offset; | 0-3936 | ||||||||||||||||||||||||||||||
1597 | QList<QQuickItem*>::iterator it = d->items.begin(); | - | ||||||||||||||||||||||||||||||
1598 | while (it != d->items.end()
| 3936-37500 | ||||||||||||||||||||||||||||||
1599 | QQuickItem *item = *it; | - | ||||||||||||||||||||||||||||||
1600 | int idx = d->model->indexOf(item, nullptr); | - | ||||||||||||||||||||||||||||||
1601 | qreal pos = d->positionOfIndex(idx); | - | ||||||||||||||||||||||||||||||
1602 | if (lcItemViewDelegateLifecycle().isDebugEnabled()
| 0-37500 | ||||||||||||||||||||||||||||||
1603 | QQuickText *text = qmlobject_cast<QQuickText*>(item); | - | ||||||||||||||||||||||||||||||
1604 | if (text
| 0 | ||||||||||||||||||||||||||||||
1605 | for (bool qt_category_enabled = lcItemViewDelegateLifecycle().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 1965, __PRETTY_FUNCTION__, lcItemViewDelegateLifecycle().categoryName()).debug() << "idx" << idx << "@" << pos << ": QQuickText" << text->objectName() << text->text().leftRef(40); | 0 | ||||||||||||||||||||||||||||||
1606 | else | - | ||||||||||||||||||||||||||||||
1607 | for (bool qt_category_enabled = lcItemViewDelegateLifecycle().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 1967, __PRETTY_FUNCTION__, lcItemViewDelegateLifecycle().categoryName()).debug() << "idx" << idx << "@" << pos << ":" << item; | 0 | ||||||||||||||||||||||||||||||
1608 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1609 | if (pos < 1.0
| 594-36906 | ||||||||||||||||||||||||||||||
1610 | d->updateItem(item, pos); | - | ||||||||||||||||||||||||||||||
1611 | if (idx == d->currentIndex
| 3361-33545 | ||||||||||||||||||||||||||||||
1612 | currentVisible = true; | - | ||||||||||||||||||||||||||||||
1613 | d->currentItemOffset = pos; | - | ||||||||||||||||||||||||||||||
1614 | } executed 3361 times by 1 test: end of block Executed by:
| 3361 | ||||||||||||||||||||||||||||||
1615 | ++it; | - | ||||||||||||||||||||||||||||||
1616 | } executed 36906 times by 1 test: else {end of block Executed by:
| 36906 | ||||||||||||||||||||||||||||||
1617 | d->updateItem(item, pos); | - | ||||||||||||||||||||||||||||||
1618 | if (QQuickPathViewAttached *att = d->attached(item)
| 0-594 | ||||||||||||||||||||||||||||||
1619 | att->setOnPath(pos < 1.0); executed 594 times by 1 test: att->setOnPath(pos < 1.0); Executed by:
| 594 | ||||||||||||||||||||||||||||||
1620 | if (!d->isInBound(pos, d->mappedRange - d->mappedCache, 1.0 + d->mappedCache)
| 40-554 | ||||||||||||||||||||||||||||||
1621 | for (bool qt_category_enabled = lcItemViewDelegateLifecycle().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 1981, __PRETTY_FUNCTION__, lcItemViewDelegateLifecycle().categoryName()).debug() << "release" << idx << "@" << pos << ", !isInBound: lower" << (d->mappedRange - d->mappedCache) << "upper" << (1.0 + d->mappedCache); | 0-554 | ||||||||||||||||||||||||||||||
1622 | d->releaseItem(item); | - | ||||||||||||||||||||||||||||||
1623 | it = d->items.erase(it); | - | ||||||||||||||||||||||||||||||
1624 | } executed 554 times by 1 test: else {end of block Executed by:
| 554 | ||||||||||||||||||||||||||||||
1625 | ++it; | - | ||||||||||||||||||||||||||||||
1626 | } executed 40 times by 1 test: end of block Executed by:
| 40 | ||||||||||||||||||||||||||||||
1627 | } | - | ||||||||||||||||||||||||||||||
1628 | } | - | ||||||||||||||||||||||||||||||
1629 | - | |||||||||||||||||||||||||||||||
1630 | bool waiting = false; | - | ||||||||||||||||||||||||||||||
1631 | if (d->modelCount
| 18-3918 | ||||||||||||||||||||||||||||||
1632 | - | |||||||||||||||||||||||||||||||
1633 | if (d->items.count() < count+d->cacheSize
| 805-3113 | ||||||||||||||||||||||||||||||
1634 | int endIdx = 0; | - | ||||||||||||||||||||||||||||||
1635 | qreal endPos; | - | ||||||||||||||||||||||||||||||
1636 | int startIdx = 0; | - | ||||||||||||||||||||||||||||||
1637 | qreal startPos = 0.0; | - | ||||||||||||||||||||||||||||||
1638 | const bool wasEmpty = d->items.isEmpty(); | - | ||||||||||||||||||||||||||||||
1639 | if (!wasEmpty
| 350-455 | ||||||||||||||||||||||||||||||
1640 | - | |||||||||||||||||||||||||||||||
1641 | endPos = -1.0; | - | ||||||||||||||||||||||||||||||
1642 | startPos = 2.0; | - | ||||||||||||||||||||||||||||||
1643 | - | |||||||||||||||||||||||||||||||
1644 | for (QQuickItem * item : qAsConst(d->items)) { | - | ||||||||||||||||||||||||||||||
1645 | int idx = d->model->indexOf(item, nullptr); | - | ||||||||||||||||||||||||||||||
1646 | qreal curPos = d->positionOfIndex(idx); | - | ||||||||||||||||||||||||||||||
1647 | if (curPos > endPos
| 44-4838 | ||||||||||||||||||||||||||||||
1648 | endPos = curPos; | - | ||||||||||||||||||||||||||||||
1649 | endIdx = idx; | - | ||||||||||||||||||||||||||||||
1650 | } executed 4838 times by 1 test: end of block Executed by:
| 4838 | ||||||||||||||||||||||||||||||
1651 | - | |||||||||||||||||||||||||||||||
1652 | if (curPos < startPos
| 356-4526 | ||||||||||||||||||||||||||||||
1653 | startPos = curPos; | - | ||||||||||||||||||||||||||||||
1654 | startIdx = idx; | - | ||||||||||||||||||||||||||||||
1655 | } executed 356 times by 1 test: end of block Executed by:
| 356 | ||||||||||||||||||||||||||||||
1656 | } executed 4882 times by 1 test: end of block Executed by:
| 4882 | ||||||||||||||||||||||||||||||
1657 | } executed 350 times by 1 test: else {end of block Executed by:
| 350 | ||||||||||||||||||||||||||||||
1658 | if (d->haveHighlightRange
| 0-455 | ||||||||||||||||||||||||||||||
1659 | && (d->highlightRangeMode != QQuickPathView::NoHighlightRange
| 114-341 | ||||||||||||||||||||||||||||||
1660 | || d->snapMode != QQuickPathView::NoSnap
| 8-106 | ||||||||||||||||||||||||||||||
1661 | startPos = d->highlightRangeStart; executed 349 times by 3 tests: startPos = d->highlightRangeStart; Executed by:
| 349 | ||||||||||||||||||||||||||||||
1662 | - | |||||||||||||||||||||||||||||||
1663 | endIdx = (qRound(d->modelCount - d->offset) - 1) % d->modelCount; | - | ||||||||||||||||||||||||||||||
1664 | endPos = d->positionOfIndex(endIdx); | - | ||||||||||||||||||||||||||||||
1665 | } executed 455 times by 3 tests: end of block Executed by:
| 455 | ||||||||||||||||||||||||||||||
1666 | - | |||||||||||||||||||||||||||||||
1667 | int idx = endIdx + 1; | - | ||||||||||||||||||||||||||||||
1668 | if (idx >= d->modelCount
| 300-505 | ||||||||||||||||||||||||||||||
1669 | idx = 0; executed 300 times by 3 tests: idx = 0; Executed by:
| 300 | ||||||||||||||||||||||||||||||
1670 | qreal nextPos = d->positionOfIndex(idx); | - | ||||||||||||||||||||||||||||||
1671 | while ((d->isInBound(nextPos, endPos, 1.0 + d->mappedCache)
| 250-2615 | ||||||||||||||||||||||||||||||
1672 | && d->items.count() < count+d->cacheSize
| 8-2857 | ||||||||||||||||||||||||||||||
1673 | for (bool qt_category_enabled = lcItemViewDelegateLifecycle().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 2033, __PRETTY_FUNCTION__, lcItemViewDelegateLifecycle().categoryName()).debug() << "append" << idx << "@" << nextPos << (d->currentIndex == idx ? "current" : "") << "items count was" << d->items.count(); | 0-2857 | ||||||||||||||||||||||||||||||
1674 | QQuickItem *item = d->getItem(idx, idx+1, nextPos >= 1.0); | - | ||||||||||||||||||||||||||||||
1675 | if (!item
| 18-2839 | ||||||||||||||||||||||||||||||
1676 | waiting = true; | - | ||||||||||||||||||||||||||||||
1677 | break; executed 18 times by 1 test: break; Executed by:
| 18 | ||||||||||||||||||||||||||||||
1678 | } | - | ||||||||||||||||||||||||||||||
1679 | if (d->items.contains(item)
| 6-2833 | ||||||||||||||||||||||||||||||
1680 | d->releaseItem(item); | - | ||||||||||||||||||||||||||||||
1681 | break; executed 6 times by 1 test: break; Executed by:
| 6 | ||||||||||||||||||||||||||||||
1682 | } | - | ||||||||||||||||||||||||||||||
1683 | if (d->currentIndex == idx
| 441-2392 | ||||||||||||||||||||||||||||||
1684 | currentVisible = true; | - | ||||||||||||||||||||||||||||||
1685 | d->currentItemOffset = nextPos; | - | ||||||||||||||||||||||||||||||
1686 | } executed 441 times by 3 tests: end of block Executed by:
| 441 | ||||||||||||||||||||||||||||||
1687 | d->items.append(item); | - | ||||||||||||||||||||||||||||||
1688 | d->updateItem(item, nextPos); | - | ||||||||||||||||||||||||||||||
1689 | endIdx = idx; | - | ||||||||||||||||||||||||||||||
1690 | endPos = nextPos; | - | ||||||||||||||||||||||||||||||
1691 | ++idx; | - | ||||||||||||||||||||||||||||||
1692 | if (idx >= d->modelCount
| 395-2438 | ||||||||||||||||||||||||||||||
1693 | idx = 0; executed 395 times by 3 tests: idx = 0; Executed by:
| 395 | ||||||||||||||||||||||||||||||
1694 | nextPos = d->positionOfIndex(idx); | - | ||||||||||||||||||||||||||||||
1695 | } executed 2833 times by 3 tests: end of block Executed by:
| 2833 | ||||||||||||||||||||||||||||||
1696 | - | |||||||||||||||||||||||||||||||
1697 | - | |||||||||||||||||||||||||||||||
1698 | idx = (wasEmpty
| 350-455 | ||||||||||||||||||||||||||||||
1699 | - | |||||||||||||||||||||||||||||||
1700 | if (idx < 0
| 323-482 | ||||||||||||||||||||||||||||||
1701 | idx = d->modelCount - 1; executed 323 times by 3 tests: idx = d->modelCount - 1; Executed by:
| 323 | ||||||||||||||||||||||||||||||
1702 | nextPos = d->positionOfIndex(idx); | - | ||||||||||||||||||||||||||||||
1703 | while (!waiting
| 18-1318 | ||||||||||||||||||||||||||||||
1704 | && d->items.count() < count+d->cacheSize
| 0-545 | ||||||||||||||||||||||||||||||
1705 | for (bool qt_category_enabled = lcItemViewDelegateLifecycle().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 2065, __PRETTY_FUNCTION__, lcItemViewDelegateLifecycle().categoryName()).debug() << "prepend" << idx << "@" << nextPos << (d->currentIndex == idx ? "current" : "") << "items count was" << d->items.count(); | 0-545 | ||||||||||||||||||||||||||||||
1706 | QQuickItem *item = d->getItem(idx, idx+1, nextPos >= 1.0); | - | ||||||||||||||||||||||||||||||
1707 | if (!item
| 8-537 | ||||||||||||||||||||||||||||||
1708 | waiting = true; | - | ||||||||||||||||||||||||||||||
1709 | break; executed 8 times by 1 test: break; Executed by:
| 8 | ||||||||||||||||||||||||||||||
1710 | } | - | ||||||||||||||||||||||||||||||
1711 | if (d->items.contains(item)
| 6-531 | ||||||||||||||||||||||||||||||
1712 | d->releaseItem(item); | - | ||||||||||||||||||||||||||||||
1713 | break; executed 6 times by 1 test: break; Executed by:
| 6 | ||||||||||||||||||||||||||||||
1714 | } | - | ||||||||||||||||||||||||||||||
1715 | if (d->currentIndex == idx
| 22-509 | ||||||||||||||||||||||||||||||
1716 | currentVisible = true; | - | ||||||||||||||||||||||||||||||
1717 | d->currentItemOffset = nextPos; | - | ||||||||||||||||||||||||||||||
1718 | } executed 22 times by 1 test: end of block Executed by:
| 22 | ||||||||||||||||||||||||||||||
1719 | d->items.prepend(item); | - | ||||||||||||||||||||||||||||||
1720 | d->updateItem(item, nextPos); | - | ||||||||||||||||||||||||||||||
1721 | startIdx = idx; | - | ||||||||||||||||||||||||||||||
1722 | startPos = nextPos; | - | ||||||||||||||||||||||||||||||
1723 | --idx; | - | ||||||||||||||||||||||||||||||
1724 | if (idx < 0
| 5-526 | ||||||||||||||||||||||||||||||
1725 | idx = d->modelCount - 1; executed 5 times by 1 test: idx = d->modelCount - 1; Executed by:
| 5 | ||||||||||||||||||||||||||||||
1726 | nextPos = d->positionOfIndex(idx); | - | ||||||||||||||||||||||||||||||
1727 | } executed 531 times by 2 tests: end of block Executed by:
| 531 | ||||||||||||||||||||||||||||||
1728 | - | |||||||||||||||||||||||||||||||
1729 | - | |||||||||||||||||||||||||||||||
1730 | - | |||||||||||||||||||||||||||||||
1731 | - | |||||||||||||||||||||||||||||||
1732 | - | |||||||||||||||||||||||||||||||
1733 | if (!waiting
| 6-779 | ||||||||||||||||||||||||||||||
1734 | for (bool qt_category_enabled = lcItemViewDelegateLifecycle().isDebugEnabled(); qt_category_enabled
never executed: QMessageLogger(__FILE__, 2094, __PRETTY_FUNCTION__, lcItemViewDelegateLifecycle().categoryName()).debug() << "Checking for pathview middle inserts, items count was" << d->items.count(); | 0-6 | ||||||||||||||||||||||||||||||
1735 | idx = startIdx; | - | ||||||||||||||||||||||||||||||
1736 | QQuickItem *lastItem = d->items.at(0); | - | ||||||||||||||||||||||||||||||
1737 | while (idx != endIdx
| 2-52 | ||||||||||||||||||||||||||||||
1738 | nextPos = d->positionOfIndex(idx); | - | ||||||||||||||||||||||||||||||
1739 | if (d->isInBound(nextPos, d->mappedRange - d->mappedCache, 1.0 + d->mappedCache)
| 0-52 | ||||||||||||||||||||||||||||||
1740 | - | |||||||||||||||||||||||||||||||
1741 | QQuickItem *item = d->getItem(idx, idx+1, nextPos >= 1.0); | - | ||||||||||||||||||||||||||||||
1742 | if (!item
| 4-48 | ||||||||||||||||||||||||||||||
1743 | waiting = true; | - | ||||||||||||||||||||||||||||||
1744 | break; executed 4 times by 1 test: break; Executed by:
| 4 | ||||||||||||||||||||||||||||||
1745 | } | - | ||||||||||||||||||||||||||||||
1746 | - | |||||||||||||||||||||||||||||||
1747 | if (!d->items.contains(item)
| 4-44 | ||||||||||||||||||||||||||||||
1748 | for (bool qt_category_enabled = lcItemViewDelegateLifecycle().isDebugEnabled(); qt_category_enabled
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-4 | ||||||||||||||||||||||||||||||
1749 | << (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 | ||||||||||||||||||||||||||||||
1750 | << "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 | ||||||||||||||||||||||||||||||
1751 | if (d->currentIndex == idx
| 0-4 | ||||||||||||||||||||||||||||||
1752 | currentVisible = true; | - | ||||||||||||||||||||||||||||||
1753 | d->currentItemOffset = nextPos; | - | ||||||||||||||||||||||||||||||
1754 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1755 | int lastListIdx = d->items.indexOf(lastItem); | - | ||||||||||||||||||||||||||||||
1756 | d->items.insert(lastListIdx + 1, item); | - | ||||||||||||||||||||||||||||||
1757 | d->updateItem(item, nextPos); | - | ||||||||||||||||||||||||||||||
1758 | } executed 4 times by 1 test: else {end of block Executed by:
| 4 | ||||||||||||||||||||||||||||||
1759 | d->releaseItem(item); | - | ||||||||||||||||||||||||||||||
1760 | } executed 44 times by 1 test: end of block Executed by:
| 44 | ||||||||||||||||||||||||||||||
1761 | - | |||||||||||||||||||||||||||||||
1762 | lastItem = item; | - | ||||||||||||||||||||||||||||||
1763 | } executed 48 times by 1 test: end of block Executed by:
| 48 | ||||||||||||||||||||||||||||||
1764 | - | |||||||||||||||||||||||||||||||
1765 | ++idx; | - | ||||||||||||||||||||||||||||||
1766 | if (idx >= d->modelCount
| 6-42 | ||||||||||||||||||||||||||||||
1767 | idx = 0; executed 6 times by 1 test: idx = 0; Executed by:
| 6 | ||||||||||||||||||||||||||||||
1768 | } executed 48 times by 1 test: end of block Executed by:
| 48 | ||||||||||||||||||||||||||||||
1769 | } executed 6 times by 1 test: end of block Executed by:
| 6 | ||||||||||||||||||||||||||||||
1770 | } executed 805 times by 3 tests: end of block Executed by:
| 805 | ||||||||||||||||||||||||||||||
1771 | } executed 3918 times by 3 tests: end of block Executed by:
| 3918 | ||||||||||||||||||||||||||||||
1772 | - | |||||||||||||||||||||||||||||||
1773 | bool currentChanged = false; | - | ||||||||||||||||||||||||||||||
1774 | if (!currentVisible
| 112-3824 | ||||||||||||||||||||||||||||||
1775 | d->currentItemOffset = 1.0; | - | ||||||||||||||||||||||||||||||
1776 | if (d->currentItem
| 20-92 | ||||||||||||||||||||||||||||||
1777 | d->updateItem(d->currentItem, 1.0); | - | ||||||||||||||||||||||||||||||
1778 | } executed 92 times by 1 test: else if (!waitingend of block Executed by:
| 0-92 | ||||||||||||||||||||||||||||||
1779 | if ((
| 0 | ||||||||||||||||||||||||||||||
1780 | currentChanged = true; | - | ||||||||||||||||||||||||||||||
1781 | d->updateItem(d->currentItem, 1.0); | - | ||||||||||||||||||||||||||||||
1782 | if (QQuickPathViewAttached *att = d->attached(d->currentItem)
| 0 | ||||||||||||||||||||||||||||||
1783 | att->setIsCurrentItem(true); never executed: att->setIsCurrentItem(true); | 0 | ||||||||||||||||||||||||||||||
1784 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1785 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1786 | } executed 112 times by 2 tests: else if (!waitingend of block Executed by:
| 26-3798 | ||||||||||||||||||||||||||||||
1787 | if ((
| 0-420 | ||||||||||||||||||||||||||||||
1788 | currentChanged = true; | - | ||||||||||||||||||||||||||||||
1789 | d->currentItem->setFocus(true); | - | ||||||||||||||||||||||||||||||
1790 | if (QQuickPathViewAttached *att = d->attached(d->currentItem)
| 0-420 | ||||||||||||||||||||||||||||||
1791 | att->setIsCurrentItem(true); executed 420 times by 3 tests: att->setIsCurrentItem(true); Executed by:
| 420 | ||||||||||||||||||||||||||||||
1792 | } executed 420 times by 3 tests: end of block Executed by:
| 420 | ||||||||||||||||||||||||||||||
1793 | } executed 420 times by 3 tests: end of block Executed by:
| 420 | ||||||||||||||||||||||||||||||
1794 | - | |||||||||||||||||||||||||||||||
1795 | if (d->highlightItem
| 4-3918 | ||||||||||||||||||||||||||||||
1796 | d->updateItem(d->highlightItem, d->highlightRangeStart); | - | ||||||||||||||||||||||||||||||
1797 | if (QQuickPathViewAttached *att = d->attached(d->highlightItem)
| 0-3476 | ||||||||||||||||||||||||||||||
1798 | att->setOnPath(true); never executed: att->setOnPath(true); | 0 | ||||||||||||||||||||||||||||||
1799 | } executed 3476 times by 3 tests: else if (d->highlightItemend of block Executed by:
| 4-3476 | ||||||||||||||||||||||||||||||
1800 | d->updateItem(d->highlightItem, d->currentItemOffset); | - | ||||||||||||||||||||||||||||||
1801 | if (QQuickPathViewAttached *att = d->attached(d->highlightItem)
| 0-438 | ||||||||||||||||||||||||||||||
1802 | att->setOnPath(currentVisible); never executed: att->setOnPath(currentVisible); | 0 | ||||||||||||||||||||||||||||||
1803 | } executed 438 times by 1 test: end of block Executed by:
| 438 | ||||||||||||||||||||||||||||||
1804 | for (QQuickItem *item : qAsConst(d->itemCache)) | - | ||||||||||||||||||||||||||||||
1805 | d->releaseItem(item); executed 141 times by 1 test: d->releaseItem(item); Executed by:
| 141 | ||||||||||||||||||||||||||||||
1806 | d->itemCache.clear(); | - | ||||||||||||||||||||||||||||||
1807 | - | |||||||||||||||||||||||||||||||
1808 | d->inRefill = false; | - | ||||||||||||||||||||||||||||||
1809 | if (currentChanged
| 420-3516 | ||||||||||||||||||||||||||||||
1810 | currentItemChanged(); executed 420 times by 3 tests: currentItemChanged(); Executed by:
| 420 | ||||||||||||||||||||||||||||||
1811 | } executed 3936 times by 3 tests: end of block Executed by:
| 3936 | ||||||||||||||||||||||||||||||
1812 | - | |||||||||||||||||||||||||||||||
1813 | void QQuickPathView::modelUpdated(const QQmlChangeSet &changeSet, bool reset) | - | ||||||||||||||||||||||||||||||
1814 | { | - | ||||||||||||||||||||||||||||||
1815 | QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
1816 | if (!d->model
| 0-690 | ||||||||||||||||||||||||||||||
1817 | return; executed 524 times by 3 tests: return; Executed by:
| 524 | ||||||||||||||||||||||||||||||
1818 | - | |||||||||||||||||||||||||||||||
1819 | if (reset
| 2-164 | ||||||||||||||||||||||||||||||
1820 | d->modelCount = d->model->count(); | - | ||||||||||||||||||||||||||||||
1821 | d->regenerate(); | - | ||||||||||||||||||||||||||||||
1822 | countChanged(); | - | ||||||||||||||||||||||||||||||
1823 | return; executed 2 times by 1 test: return; Executed by:
| 2 | ||||||||||||||||||||||||||||||
1824 | } | - | ||||||||||||||||||||||||||||||
1825 | - | |||||||||||||||||||||||||||||||
1826 | if (changeSet.removes().isEmpty()
| 0-98 | ||||||||||||||||||||||||||||||
1827 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
1828 | - | |||||||||||||||||||||||||||||||
1829 | const int modelCount = d->modelCount; | - | ||||||||||||||||||||||||||||||
1830 | int moveId = -1; | - | ||||||||||||||||||||||||||||||
1831 | int moveOffset = 0; | - | ||||||||||||||||||||||||||||||
1832 | bool currentChanged = false; | - | ||||||||||||||||||||||||||||||
1833 | bool changedOffset = false; | - | ||||||||||||||||||||||||||||||
1834 | for (const QQmlChangeSet::Change &r : changeSet.removes()) { | - | ||||||||||||||||||||||||||||||
1835 | if (moveId == -1
| 0-98 | ||||||||||||||||||||||||||||||
1836 | d->currentIndex -= r.count; | - | ||||||||||||||||||||||||||||||
1837 | currentChanged = true; | - | ||||||||||||||||||||||||||||||
1838 | } executed 36 times by 1 test: else if (moveId == -1end of block Executed by:
| 0-62 | ||||||||||||||||||||||||||||||
1839 | - | |||||||||||||||||||||||||||||||
1840 | if (r.isMove()
| 10-18 | ||||||||||||||||||||||||||||||
1841 | moveId = r.moveId; | - | ||||||||||||||||||||||||||||||
1842 | moveOffset = d->currentIndex - r.index; | - | ||||||||||||||||||||||||||||||
1843 | } executed 10 times by 1 test: else if (d->currentItemend of block Executed by:
| 2-16 | ||||||||||||||||||||||||||||||
1844 | if (QQuickPathViewAttached *att = d->attached(d->currentItem)
| 0-16 | ||||||||||||||||||||||||||||||
1845 | att->setIsCurrentItem(true); executed 16 times by 1 test: att->setIsCurrentItem(true); Executed by:
| 16 | ||||||||||||||||||||||||||||||
1846 | d->releaseItem(d->currentItem); | - | ||||||||||||||||||||||||||||||
1847 | d->currentItem = nullptr; | - | ||||||||||||||||||||||||||||||
1848 | } executed 16 times by 1 test: end of block Executed by:
| 16 | ||||||||||||||||||||||||||||||
1849 | d->currentIndex = qMin(r.index, d->modelCount - r.count - 1); | - | ||||||||||||||||||||||||||||||
1850 | currentChanged = true; | - | ||||||||||||||||||||||||||||||
1851 | } executed 28 times by 2 tests: end of block Executed by:
| 28 | ||||||||||||||||||||||||||||||
1852 | - | |||||||||||||||||||||||||||||||
1853 | if (r.index > d->currentIndex
| 48-50 | ||||||||||||||||||||||||||||||
1854 | changedOffset = true; | - | ||||||||||||||||||||||||||||||
1855 | d->offset -= r.count; | - | ||||||||||||||||||||||||||||||
1856 | d->offsetAdj -= r.count; | - | ||||||||||||||||||||||||||||||
1857 | } executed 50 times by 2 tests: end of block Executed by:
| 50 | ||||||||||||||||||||||||||||||
1858 | d->modelCount -= r.count; | - | ||||||||||||||||||||||||||||||
1859 | } executed 98 times by 2 tests: end of block Executed by:
| 98 | ||||||||||||||||||||||||||||||
1860 | for (const QQmlChangeSet::Change &i : changeSet.inserts()) { | - | ||||||||||||||||||||||||||||||
1861 | if (d->modelCount
| 14-96 | ||||||||||||||||||||||||||||||
1862 | if (moveId == -1
| 10-86 | ||||||||||||||||||||||||||||||
1863 | d->currentIndex += i.count; | - | ||||||||||||||||||||||||||||||
1864 | currentChanged = true; | - | ||||||||||||||||||||||||||||||
1865 | } executed 38 times by 1 test: else {end of block Executed by:
| 38 | ||||||||||||||||||||||||||||||
1866 | if (moveId != -1
| 0-48 | ||||||||||||||||||||||||||||||
1867 | d->currentIndex = i.index + moveOffset; | - | ||||||||||||||||||||||||||||||
1868 | currentChanged = true; | - | ||||||||||||||||||||||||||||||
1869 | } executed 10 times by 1 test: end of block Executed by:
| 10 | ||||||||||||||||||||||||||||||
1870 | if (i.index > d->currentIndex
| 10-48 | ||||||||||||||||||||||||||||||
1871 | d->offset += i.count; | - | ||||||||||||||||||||||||||||||
1872 | d->offsetAdj += i.count; | - | ||||||||||||||||||||||||||||||
1873 | changedOffset = true; | - | ||||||||||||||||||||||||||||||
1874 | } executed 48 times by 1 test: end of block Executed by:
| 48 | ||||||||||||||||||||||||||||||
1875 | } executed 58 times by 1 test: end of block Executed by:
| 58 | ||||||||||||||||||||||||||||||
1876 | } | - | ||||||||||||||||||||||||||||||
1877 | d->modelCount += i.count; | - | ||||||||||||||||||||||||||||||
1878 | } executed 110 times by 2 tests: end of block Executed by:
| 110 | ||||||||||||||||||||||||||||||
1879 | - | |||||||||||||||||||||||||||||||
1880 | d->offset = std::fmod(d->offset, qreal(d->modelCount)); | - | ||||||||||||||||||||||||||||||
1881 | if (d->offset < 0
| 2-162 | ||||||||||||||||||||||||||||||
1882 | d->offset += d->modelCount; executed 2 times by 1 test: d->offset += d->modelCount; Executed by:
| 2 | ||||||||||||||||||||||||||||||
1883 | if (d->currentIndex == -1
| 12-152 | ||||||||||||||||||||||||||||||
1884 | d->currentIndex = d->calcCurrentIndex(); executed 12 times by 2 tests: d->currentIndex = d->calcCurrentIndex(); Executed by:
| 12 | ||||||||||||||||||||||||||||||
1885 | - | |||||||||||||||||||||||||||||||
1886 | d->itemCache += d->items; | - | ||||||||||||||||||||||||||||||
1887 | d->items.clear(); | - | ||||||||||||||||||||||||||||||
1888 | - | |||||||||||||||||||||||||||||||
1889 | if (!d->modelCount
| 10-154 | ||||||||||||||||||||||||||||||
1890 | for (QQuickItem * item : qAsConst(d->itemCache)) | - | ||||||||||||||||||||||||||||||
1891 | d->releaseItem(item); executed 54 times by 1 test: d->releaseItem(item); Executed by:
| 54 | ||||||||||||||||||||||||||||||
1892 | d->itemCache.clear(); | - | ||||||||||||||||||||||||||||||
1893 | d->offset = 0; | - | ||||||||||||||||||||||||||||||
1894 | changedOffset = true; | - | ||||||||||||||||||||||||||||||
1895 | d->tl.reset(d->moveOffset); | - | ||||||||||||||||||||||||||||||
1896 | } executed 10 times by 2 tests: else {end of block Executed by:
| 10 | ||||||||||||||||||||||||||||||
1897 | if (!d->flicking
| 0-154 | ||||||||||||||||||||||||||||||
1898 | d->offset = std::fmod(qreal(d->modelCount - d->currentIndex), qreal(d->modelCount)); | - | ||||||||||||||||||||||||||||||
1899 | changedOffset = true; | - | ||||||||||||||||||||||||||||||
1900 | } executed 88 times by 2 tests: end of block Executed by:
| 88 | ||||||||||||||||||||||||||||||
1901 | d->updateMappedRange(); | - | ||||||||||||||||||||||||||||||
1902 | d->scheduleLayout(); | - | ||||||||||||||||||||||||||||||
1903 | } executed 154 times by 2 tests: end of block Executed by:
| 154 | ||||||||||||||||||||||||||||||
1904 | if (changedOffset
| 36-128 | ||||||||||||||||||||||||||||||
1905 | offsetChanged(); executed 128 times by 2 tests: offsetChanged(); Executed by:
| 128 | ||||||||||||||||||||||||||||||
1906 | if (currentChanged
| 70-94 | ||||||||||||||||||||||||||||||
1907 | currentIndexChanged(); executed 94 times by 2 tests: currentIndexChanged(); Executed by:
| 94 | ||||||||||||||||||||||||||||||
1908 | if (d->modelCount != modelCount
| 44-120 | ||||||||||||||||||||||||||||||
1909 | countChanged(); executed 120 times by 2 tests: countChanged(); Executed by:
| 120 | ||||||||||||||||||||||||||||||
1910 | } executed 164 times by 2 tests: end of block Executed by:
| 164 | ||||||||||||||||||||||||||||||
1911 | - | |||||||||||||||||||||||||||||||
1912 | void QQuickPathView::destroyingItem(QObject *item) | - | ||||||||||||||||||||||||||||||
1913 | { | - | ||||||||||||||||||||||||||||||
1914 | (void)item;; | - | ||||||||||||||||||||||||||||||
1915 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
1916 | - | |||||||||||||||||||||||||||||||
1917 | void QQuickPathView::ticked() | - | ||||||||||||||||||||||||||||||
1918 | { | - | ||||||||||||||||||||||||||||||
1919 | QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
1920 | d->updateCurrent(); | - | ||||||||||||||||||||||||||||||
1921 | } executed 3334 times by 1 test: end of block Executed by:
| 3334 | ||||||||||||||||||||||||||||||
1922 | - | |||||||||||||||||||||||||||||||
1923 | void QQuickPathView::movementEnding() | - | ||||||||||||||||||||||||||||||
1924 | { | - | ||||||||||||||||||||||||||||||
1925 | QQuickPathViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||
1926 | if (d->flicking
| 16-98 | ||||||||||||||||||||||||||||||
1927 | d->flicking = false; | - | ||||||||||||||||||||||||||||||
1928 | flickingChanged(); | - | ||||||||||||||||||||||||||||||
1929 | flickEnded(); | - | ||||||||||||||||||||||||||||||
1930 | } executed 16 times by 1 test: end of block Executed by:
| 16 | ||||||||||||||||||||||||||||||
1931 | if (d->moving
| 0-94 | ||||||||||||||||||||||||||||||
1932 | d->moving = false; | - | ||||||||||||||||||||||||||||||
1933 | movingChanged(); | - | ||||||||||||||||||||||||||||||
1934 | movementEnded(); | - | ||||||||||||||||||||||||||||||
1935 | } executed 20 times by 1 test: end of block Executed by:
| 20 | ||||||||||||||||||||||||||||||
1936 | d->moveDirection = d->movementDirection; | - | ||||||||||||||||||||||||||||||
1937 | } executed 114 times by 1 test: end of block Executed by:
| 114 | ||||||||||||||||||||||||||||||
1938 | - | |||||||||||||||||||||||||||||||
1939 | - | |||||||||||||||||||||||||||||||
1940 | int QQuickPathViewPrivate::calcCurrentIndex() | - | ||||||||||||||||||||||||||||||
1941 | { | - | ||||||||||||||||||||||||||||||
1942 | int current = 0; | - | ||||||||||||||||||||||||||||||
1943 | if (modelCount
| 10-2435 | ||||||||||||||||||||||||||||||
1944 | offset = std::fmod(offset, qreal(modelCount)); | - | ||||||||||||||||||||||||||||||
1945 | if (offset < 0
| 0-2421 | ||||||||||||||||||||||||||||||
1946 | offset += modelCount; never executed: offset += modelCount; | 0 | ||||||||||||||||||||||||||||||
1947 | current = qRound(qAbs(std::fmod(modelCount - offset, qreal(modelCount)))); | - | ||||||||||||||||||||||||||||||
1948 | current = current % modelCount; | - | ||||||||||||||||||||||||||||||
1949 | } executed 2421 times by 3 tests: end of block Executed by:
| 2421 | ||||||||||||||||||||||||||||||
1950 | - | |||||||||||||||||||||||||||||||
1951 | return executed 2445 times by 3 tests: current;return current; Executed by:
executed 2445 times by 3 tests: return current; Executed by:
| 2445 | ||||||||||||||||||||||||||||||
1952 | } | - | ||||||||||||||||||||||||||||||
1953 | - | |||||||||||||||||||||||||||||||
1954 | void QQuickPathViewPrivate::createCurrentItem() | - | ||||||||||||||||||||||||||||||
1955 | { | - | ||||||||||||||||||||||||||||||
1956 | if (requestedIndex != -1
| 6-549 | ||||||||||||||||||||||||||||||
1957 | return; executed 6 times by 1 test: return; Executed by:
| 6 | ||||||||||||||||||||||||||||||
1958 | - | |||||||||||||||||||||||||||||||
1959 | bool inItems = false; | - | ||||||||||||||||||||||||||||||
1960 | for (QQuickItem *item : qAsConst(items)) { | - | ||||||||||||||||||||||||||||||
1961 | if (model->indexOf(item, nullptr) == currentIndex
| 519-3277 | ||||||||||||||||||||||||||||||
1962 | inItems = true; | - | ||||||||||||||||||||||||||||||
1963 | break; executed 519 times by 1 test: break; Executed by:
| 519 | ||||||||||||||||||||||||||||||
1964 | } | - | ||||||||||||||||||||||||||||||
1965 | } executed 3277 times by 1 test: end of block Executed by:
| 3277 | ||||||||||||||||||||||||||||||
1966 | - | |||||||||||||||||||||||||||||||
1967 | if (inItems
| 30-519 | ||||||||||||||||||||||||||||||
1968 | if ((
| 0-519 | ||||||||||||||||||||||||||||||
1969 | currentItem->setFocus(true); | - | ||||||||||||||||||||||||||||||
1970 | if (QQuickPathViewAttached *att = attached(currentItem)
| 0-519 | ||||||||||||||||||||||||||||||
1971 | att->setIsCurrentItem(true); executed 519 times by 1 test: att->setIsCurrentItem(true); Executed by:
| 519 | ||||||||||||||||||||||||||||||
1972 | } executed 519 times by 1 test: end of block Executed by:
| 519 | ||||||||||||||||||||||||||||||
1973 | } executed 519 times by 1 test: else if (currentIndex >= 0end of block Executed by:
| 0-519 | ||||||||||||||||||||||||||||||
1974 | if ((
| 0-30 | ||||||||||||||||||||||||||||||
1975 | updateItem(currentItem, 1.0); | - | ||||||||||||||||||||||||||||||
1976 | if (QQuickPathViewAttached *att = attached(currentItem)
| 0-30 | ||||||||||||||||||||||||||||||
1977 | att->setIsCurrentItem(true); executed 30 times by 1 test: att->setIsCurrentItem(true); Executed by:
| 30 | ||||||||||||||||||||||||||||||
1978 | } executed 30 times by 1 test: end of block Executed by:
| 30 | ||||||||||||||||||||||||||||||
1979 | } executed 30 times by 1 test: end of block Executed by:
| 30 | ||||||||||||||||||||||||||||||
1980 | } executed 549 times by 1 test: end of block Executed by:
| 549 | ||||||||||||||||||||||||||||||
1981 | - | |||||||||||||||||||||||||||||||
1982 | void QQuickPathViewPrivate::updateCurrent() | - | ||||||||||||||||||||||||||||||
1983 | { | - | ||||||||||||||||||||||||||||||
1984 | QQuickPathView * const q = q_func(); | - | ||||||||||||||||||||||||||||||
1985 | if (moveReason == SetIndex
| 1646-2298 | ||||||||||||||||||||||||||||||
1986 | return; executed 1646 times by 1 test: return; Executed by:
| 1646 | ||||||||||||||||||||||||||||||
1987 | if (!modelCount
| 0-2210 | ||||||||||||||||||||||||||||||
1988 | return; executed 432 times by 2 tests: return; Executed by:
| 432 | ||||||||||||||||||||||||||||||
1989 | - | |||||||||||||||||||||||||||||||
1990 | int idx = calcCurrentIndex(); | - | ||||||||||||||||||||||||||||||
1991 | if (model && (idx != currentIndex
| 6-1461 | ||||||||||||||||||||||||||||||
1992 | if (currentItem
| 6-405 | ||||||||||||||||||||||||||||||
1993 | if (QQuickPathViewAttached *att = attached(currentItem)
| 0-405 | ||||||||||||||||||||||||||||||
1994 | att->setIsCurrentItem(false); executed 405 times by 1 test: att->setIsCurrentItem(false); Executed by:
| 405 | ||||||||||||||||||||||||||||||
1995 | releaseItem(currentItem); | - | ||||||||||||||||||||||||||||||
1996 | } executed 405 times by 1 test: end of block Executed by:
| 405 | ||||||||||||||||||||||||||||||
1997 | int oldCurrentIndex = currentIndex; | - | ||||||||||||||||||||||||||||||
1998 | currentIndex = idx; | - | ||||||||||||||||||||||||||||||
1999 | currentItem = nullptr; | - | ||||||||||||||||||||||||||||||
2000 | createCurrentItem(); | - | ||||||||||||||||||||||||||||||
2001 | if (oldCurrentIndex != currentIndex
| 6-405 | ||||||||||||||||||||||||||||||
2002 | q->currentIndexChanged(); executed 405 times by 1 test: q->currentIndexChanged(); Executed by:
| 405 | ||||||||||||||||||||||||||||||
2003 | q->currentItemChanged(); | - | ||||||||||||||||||||||||||||||
2004 | } executed 411 times by 1 test: end of block Executed by:
| 411 | ||||||||||||||||||||||||||||||
2005 | } executed 1866 times by 3 tests: end of block Executed by:
| 1866 | ||||||||||||||||||||||||||||||
2006 | - | |||||||||||||||||||||||||||||||
2007 | void QQuickPathViewPrivate::fixOffsetCallback(void *d) | - | ||||||||||||||||||||||||||||||
2008 | { | - | ||||||||||||||||||||||||||||||
2009 | ((QQuickPathViewPrivate *)d)->fixOffset(); | - | ||||||||||||||||||||||||||||||
2010 | } executed 18 times by 1 test: end of block Executed by:
| 18 | ||||||||||||||||||||||||||||||
2011 | - | |||||||||||||||||||||||||||||||
2012 | void QQuickPathViewPrivate::fixOffset() | - | ||||||||||||||||||||||||||||||
2013 | { | - | ||||||||||||||||||||||||||||||
2014 | QQuickPathView * const q = q_func(); | - | ||||||||||||||||||||||||||||||
2015 | if (model && items.count()
| 0-26 | ||||||||||||||||||||||||||||||
2016 | if (haveHighlightRange
| 0-26 | ||||||||||||||||||||||||||||||
2017 | || snapMode != QQuickPathView::NoSnap
| 0-4 | ||||||||||||||||||||||||||||||
2018 | int curr = calcCurrentIndex(); | - | ||||||||||||||||||||||||||||||
2019 | if (curr != currentIndex
| 0-22 | ||||||||||||||||||||||||||||||
2020 | q->setCurrentIndex(curr); never executed: q->setCurrentIndex(curr); | 0 | ||||||||||||||||||||||||||||||
2021 | else | - | ||||||||||||||||||||||||||||||
2022 | snapToIndex(curr, Other); executed 26 times by 1 test: snapToIndex(curr, Other); Executed by:
| 26 | ||||||||||||||||||||||||||||||
2023 | } | - | ||||||||||||||||||||||||||||||
2024 | } executed 26 times by 1 test: end of block Executed by:
| 26 | ||||||||||||||||||||||||||||||
2025 | } executed 26 times by 1 test: end of block Executed by:
| 26 | ||||||||||||||||||||||||||||||
2026 | - | |||||||||||||||||||||||||||||||
2027 | void QQuickPathViewPrivate::snapToIndex(int index, MovementReason reason) | - | ||||||||||||||||||||||||||||||
2028 | { | - | ||||||||||||||||||||||||||||||
2029 | if (!model
| 0-194 | ||||||||||||||||||||||||||||||
2030 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
2031 | - | |||||||||||||||||||||||||||||||
2032 | qreal targetOffset = std::fmod(qreal(modelCount - index), qreal(modelCount)); | - | ||||||||||||||||||||||||||||||
2033 | - | |||||||||||||||||||||||||||||||
2034 | if (offset == targetOffset
| 96-98 | ||||||||||||||||||||||||||||||
2035 | return; executed 96 times by 1 test: return; Executed by:
| 96 | ||||||||||||||||||||||||||||||
2036 | - | |||||||||||||||||||||||||||||||
2037 | moveReason = reason; | - | ||||||||||||||||||||||||||||||
2038 | offsetAdj = 0.0; | - | ||||||||||||||||||||||||||||||
2039 | tl.reset(moveOffset); | - | ||||||||||||||||||||||||||||||
2040 | moveOffset.setValue(offset); | - | ||||||||||||||||||||||||||||||
2041 | - | |||||||||||||||||||||||||||||||
2042 | const int duration = highlightMoveDuration; | - | ||||||||||||||||||||||||||||||
2043 | - | |||||||||||||||||||||||||||||||
2044 | if (!duration
| 6-92 | ||||||||||||||||||||||||||||||
2045 | tl.set(moveOffset, targetOffset); | - | ||||||||||||||||||||||||||||||
2046 | } executed 6 times by 1 test: else if (moveDirection == QQuickPathView::Positiveend of block Executed by:
| 4-84 | ||||||||||||||||||||||||||||||
2047 | qreal distance = modelCount - targetOffset + offset; | - | ||||||||||||||||||||||||||||||
2048 | if (targetOffset > moveOffset
| 4-8 | ||||||||||||||||||||||||||||||
2049 | tl.move(moveOffset, 0.0, QEasingCurve(QEasingCurve::InQuad), int(duration * offset / distance)); | - | ||||||||||||||||||||||||||||||
2050 | tl.set(moveOffset, modelCount); | - | ||||||||||||||||||||||||||||||
2051 | tl.move(moveOffset, targetOffset, QEasingCurve(offset == 0.0 ? QEasingCurve::InOutQuad : QEasingCurve::OutQuad), int(duration * (modelCount-targetOffset) / distance)); | - | ||||||||||||||||||||||||||||||
2052 | } executed 8 times by 1 test: else {end of block Executed by:
| 8 | ||||||||||||||||||||||||||||||
2053 | tl.move(moveOffset, targetOffset, QEasingCurve(QEasingCurve::InOutQuad), duration); | - | ||||||||||||||||||||||||||||||
2054 | } executed 4 times by 1 test: end of block Executed by:
| 4 | ||||||||||||||||||||||||||||||
2055 | } else if (moveDirection == QQuickPathView::Negative
| 0-72 | ||||||||||||||||||||||||||||||
2056 | qreal distance = modelCount - offset + targetOffset; | - | ||||||||||||||||||||||||||||||
2057 | if (targetOffset < moveOffset
| 2-6 | ||||||||||||||||||||||||||||||
2058 | tl.move(moveOffset, modelCount, QEasingCurve(targetOffset == 0 ? QEasingCurve::InOutQuad : QEasingCurve::InQuad), int(duration * (modelCount-offset) / distance)); | - | ||||||||||||||||||||||||||||||
2059 | tl.set(moveOffset, 0.0); | - | ||||||||||||||||||||||||||||||
2060 | tl.move(moveOffset, targetOffset, QEasingCurve(QEasingCurve::OutQuad), int(duration * targetOffset / distance)); | - | ||||||||||||||||||||||||||||||
2061 | } executed 2 times by 1 test: else {end of block Executed by:
| 2 | ||||||||||||||||||||||||||||||
2062 | tl.move(moveOffset, targetOffset, QEasingCurve(QEasingCurve::InOutQuad), duration); | - | ||||||||||||||||||||||||||||||
2063 | } executed 6 times by 1 test: end of block Executed by:
| 6 | ||||||||||||||||||||||||||||||
2064 | } else { | - | ||||||||||||||||||||||||||||||
2065 | tl.move(moveOffset, targetOffset, QEasingCurve(QEasingCurve::InOutQuad), duration); | - | ||||||||||||||||||||||||||||||
2066 | } executed 72 times by 1 test: end of block Executed by:
| 72 | ||||||||||||||||||||||||||||||
2067 | } | - | ||||||||||||||||||||||||||||||
2068 | - | |||||||||||||||||||||||||||||||
2069 | QQuickPathViewAttached *QQuickPathView::qmlAttachedProperties(QObject *obj) | - | ||||||||||||||||||||||||||||||
2070 | { | - | ||||||||||||||||||||||||||||||
2071 | return executed 3338 times by 3 tests: new QQuickPathViewAttached(obj);return new QQuickPathViewAttached(obj); Executed by:
executed 3338 times by 3 tests: return new QQuickPathViewAttached(obj); Executed by:
| 3338 | ||||||||||||||||||||||||||||||
2072 | } | - | ||||||||||||||||||||||||||||||
2073 | - | |||||||||||||||||||||||||||||||
2074 | - | |||||||||||||||||||||||||||||||
2075 | - | |||||||||||||||||||||||||||||||
Switch to Source code | Preprocessed file |