itemviews/qlistview.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4 -
5 -
6 -
7QListView::QListView(QWidget *parent) -
8 : QAbstractItemView(*new QListViewPrivate, parent) -
9{ -
10 setViewMode(ListMode); -
11 setSelectionMode(SingleSelection); -
12 setAttribute(Qt::WA_MacShowFocusRect); -
13 QListViewPrivate * const d = d_func(); -
14 d->updateStyledFrameWidths(); -
15}
executed: }
Execution Count:900
900
16 -
17 -
18 -
19 -
20QListView::QListView(QListViewPrivate &dd, QWidget *parent) -
21 : QAbstractItemView(dd, parent) -
22{ -
23 setViewMode(ListMode); -
24 setSelectionMode(SingleSelection); -
25 setAttribute(Qt::WA_MacShowFocusRect); -
26 QListViewPrivate * const d = d_func(); -
27 d->updateStyledFrameWidths(); -
28}
executed: }
Execution Count:108
108
29 -
30 -
31 -
32 -
33QListView::~QListView() -
34{ -
35} -
36void QListView::setMovement(Movement movement) -
37{ -
38 QListViewPrivate * const d = d_func(); -
39 d->modeProperties |= uint(QListViewPrivate::Movement); -
40 d->movement = movement; -
41 -
42 -
43 bool movable = (movement != Static); -
44 setDragEnabled(movable); -
45 d->viewport->setAcceptDrops(movable); -
46 -
47 d->doDelayedItemsLayout(); -
48}
executed: }
Execution Count:5
5
49 -
50QListView::Movement QListView::movement() const -
51{ -
52 const QListViewPrivate * const d = d_func(); -
53 return d->movement;
executed: return d->movement;
Execution Count:3
3
54} -
55void QListView::setFlow(Flow flow) -
56{ -
57 QListViewPrivate * const d = d_func(); -
58 d->modeProperties |= uint(QListViewPrivate::Flow); -
59 d->flow = flow; -
60 d->doDelayedItemsLayout(); -
61}
executed: }
Execution Count:44
44
62 -
63QListView::Flow QListView::flow() const -
64{ -
65 const QListViewPrivate * const d = d_func(); -
66 return d->flow;
executed: return d->flow;
Execution Count:9114
9114
67} -
68void QListView::setWrapping(bool enable) -
69{ -
70 QListViewPrivate * const d = d_func(); -
71 d->modeProperties |= uint(QListViewPrivate::Wrap); -
72 d->setWrapping(enable); -
73 d->doDelayedItemsLayout(); -
74}
executed: }
Execution Count:206
206
75 -
76bool QListView::isWrapping() const -
77{ -
78 const QListViewPrivate * const d = d_func(); -
79 return d->isWrapping();
never executed: return d->isWrapping();
0
80} -
81void QListView::setResizeMode(ResizeMode mode) -
82{ -
83 QListViewPrivate * const d = d_func(); -
84 d->modeProperties |= uint(QListViewPrivate::ResizeMode); -
85 d->resizeMode = mode; -
86}
executed: }
Execution Count:207
207
87 -
88QListView::ResizeMode QListView::resizeMode() const -
89{ -
90 const QListViewPrivate * const d = d_func(); -
91 return d->resizeMode;
executed: return d->resizeMode;
Execution Count:3
3
92} -
93void QListView::setLayoutMode(LayoutMode mode) -
94{ -
95 QListViewPrivate * const d = d_func(); -
96 d->layoutMode = mode; -
97}
executed: }
Execution Count:7
7
98 -
99QListView::LayoutMode QListView::layoutMode() const -
100{ -
101 const QListViewPrivate * const d = d_func(); -
102 return d->layoutMode;
executed: return d->layoutMode;
Execution Count:1128
1128
103} -
104void QListView::setSpacing(int space) -
105{ -
106 QListViewPrivate * const d = d_func(); -
107 d->modeProperties |= uint(QListViewPrivate::Spacing); -
108 d->setSpacing(space); -
109 d->doDelayedItemsLayout(); -
110}
executed: }
Execution Count:26
26
111 -
112int QListView::spacing() const -
113{ -
114 const QListViewPrivate * const d = d_func(); -
115 return d->spacing();
executed: return d->spacing();
Execution Count:7
7
116} -
117void QListView::setBatchSize(int batchSize) -
118{ -
119 QListViewPrivate * const d = d_func(); -
120 if (batchSize <= 0) {
partially evaluated: batchSize <= 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
121 QMessageLogger("itemviews/qlistview.cpp", 401, __PRETTY_FUNCTION__).warning("Invalid batchSize (%d)", batchSize); -
122 return;
never executed: return;
0
123 } -
124 d->batchSize = batchSize; -
125}
executed: }
Execution Count:2
2
126 -
127int QListView::batchSize() const -
128{ -
129 const QListViewPrivate * const d = d_func(); -
130 return d->batchSize;
executed: return d->batchSize;
Execution Count:204
204
131} -
132void QListView::setGridSize(const QSize &size) -
133{ -
134 QListViewPrivate * const d = d_func(); -
135 d->modeProperties |= uint(QListViewPrivate::GridSize); -
136 d->setGridSize(size); -
137 d->doDelayedItemsLayout(); -
138}
executed: }
Execution Count:10
10
139 -
140QSize QListView::gridSize() const -
141{ -
142 const QListViewPrivate * const d = d_func(); -
143 return d->gridSize();
executed: return d->gridSize();
Execution Count:17
17
144} -
145void QListView::setViewMode(ViewMode mode) -
146{ -
147 QListViewPrivate * const d = d_func(); -
148 if (d->commonListView && d->viewMode == mode)
evaluated: d->commonListView
TRUEFALSE
yes
Evaluation Count:36
yes
Evaluation Count:1008
evaluated: d->viewMode == mode
TRUEFALSE
yes
Evaluation Count:20
yes
Evaluation Count:16
16-1008
149 return;
executed: return;
Execution Count:20
20
150 d->viewMode = mode; -
151 -
152 delete d->commonListView; -
153 if (mode == ListMode) {
evaluated: mode == ListMode
TRUEFALSE
yes
Evaluation Count:1008
yes
Evaluation Count:16
16-1008
154 d->commonListView = new QListModeViewBase(this, d); -
155 if (!(d->modeProperties & QListViewPrivate::Wrap))
partially evaluated: !(d->modeProperties & QListViewPrivate::Wrap)
TRUEFALSE
yes
Evaluation Count:1008
no
Evaluation Count:0
0-1008
156 d->setWrapping(false);
executed: d->setWrapping(false);
Execution Count:1008
1008
157 if (!(d->modeProperties & QListViewPrivate::Spacing))
partially evaluated: !(d->modeProperties & QListViewPrivate::Spacing)
TRUEFALSE
yes
Evaluation Count:1008
no
Evaluation Count:0
0-1008
158 d->setSpacing(0);
executed: d->setSpacing(0);
Execution Count:1008
1008
159 if (!(d->modeProperties & QListViewPrivate::GridSize))
partially evaluated: !(d->modeProperties & QListViewPrivate::GridSize)
TRUEFALSE
yes
Evaluation Count:1008
no
Evaluation Count:0
0-1008
160 d->setGridSize(QSize());
executed: d->setGridSize(QSize());
Execution Count:1008
1008
161 if (!(d->modeProperties & QListViewPrivate::Flow))
partially evaluated: !(d->modeProperties & QListViewPrivate::Flow)
TRUEFALSE
yes
Evaluation Count:1008
no
Evaluation Count:0
0-1008
162 d->flow = TopToBottom;
executed: d->flow = TopToBottom;
Execution Count:1008
1008
163 if (!(d->modeProperties & QListViewPrivate::Movement))
partially evaluated: !(d->modeProperties & QListViewPrivate::Movement)
TRUEFALSE
yes
Evaluation Count:1008
no
Evaluation Count:0
0-1008
164 d->movement = Static;
executed: d->movement = Static;
Execution Count:1008
1008
165 if (!(d->modeProperties & QListViewPrivate::ResizeMode))
partially evaluated: !(d->modeProperties & QListViewPrivate::ResizeMode)
TRUEFALSE
yes
Evaluation Count:1008
no
Evaluation Count:0
0-1008
166 d->resizeMode = Fixed;
executed: d->resizeMode = Fixed;
Execution Count:1008
1008
167 if (!(d->modeProperties & QListViewPrivate::SelectionRectVisible))
partially evaluated: !(d->modeProperties & QListViewPrivate::SelectionRectVisible)
TRUEFALSE
yes
Evaluation Count:1008
no
Evaluation Count:0
0-1008
168 d->showElasticBand = false;
executed: d->showElasticBand = false;
Execution Count:1008
1008
169 } else {
executed: }
Execution Count:1008
1008
170 d->commonListView = new QIconModeViewBase(this, d); -
171 if (!(d->modeProperties & QListViewPrivate::Wrap))
evaluated: !(d->modeProperties & QListViewPrivate::Wrap)
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:1
1-15
172 d->setWrapping(true);
executed: d->setWrapping(true);
Execution Count:15
15
173 if (!(d->modeProperties & QListViewPrivate::Spacing))
evaluated: !(d->modeProperties & QListViewPrivate::Spacing)
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:1
1-15
174 d->setSpacing(0);
executed: d->setSpacing(0);
Execution Count:15
15
175 if (!(d->modeProperties & QListViewPrivate::GridSize))
evaluated: !(d->modeProperties & QListViewPrivate::GridSize)
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:7
7-9
176 d->setGridSize(QSize());
executed: d->setGridSize(QSize());
Execution Count:9
9
177 if (!(d->modeProperties & QListViewPrivate::Flow))
evaluated: !(d->modeProperties & QListViewPrivate::Flow)
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:7
7-9
178 d->flow = LeftToRight;
executed: d->flow = LeftToRight;
Execution Count:9
9
179 if (!(d->modeProperties & QListViewPrivate::Movement))
evaluated: !(d->modeProperties & QListViewPrivate::Movement)
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:2
2-14
180 d->movement = Free;
executed: d->movement = Free;
Execution Count:14
14
181 if (!(d->modeProperties & QListViewPrivate::ResizeMode))
evaluated: !(d->modeProperties & QListViewPrivate::ResizeMode)
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:2
2-14
182 d->resizeMode = Fixed;
executed: d->resizeMode = Fixed;
Execution Count:14
14
183 if (!(d->modeProperties & QListViewPrivate::SelectionRectVisible))
partially evaluated: !(d->modeProperties & QListViewPrivate::SelectionRectVisible)
TRUEFALSE
yes
Evaluation Count:16
no
Evaluation Count:0
0-16
184 d->showElasticBand = true;
executed: d->showElasticBand = true;
Execution Count:16
16
185 }
executed: }
Execution Count:16
16
186 -
187 -
188 bool movable = (d->movement != Static); -
189 setDragEnabled(movable); -
190 setAcceptDrops(movable); -
191 -
192 d->clear(); -
193 d->doDelayedItemsLayout(); -
194}
executed: }
Execution Count:1024
1024
195 -
196QListView::ViewMode QListView::viewMode() const -
197{ -
198 const QListViewPrivate * const d = d_func(); -
199 return d->viewMode;
executed: return d->viewMode;
Execution Count:2
2
200} -
201void QListView::clearPropertyFlags() -
202{ -
203 QListViewPrivate * const d = d_func(); -
204 d->modeProperties = 0; -
205}
executed: }
Execution Count:1
1
206 -
207 -
208 -
209 -
210bool QListView::isRowHidden(int row) const -
211{ -
212 const QListViewPrivate * const d = d_func(); -
213 return d->isHidden(row);
executed: return d->isHidden(row);
Execution Count:15
15
214} -
215 -
216 -
217 -
218 -
219 -
220void QListView::setRowHidden(int row, bool hide) -
221{ -
222 QListViewPrivate * const d = d_func(); -
223 const bool hidden = d->isHidden(row); -
224 if (hide && !hidden)
evaluated: hide
TRUEFALSE
yes
Evaluation Count:736
yes
Evaluation Count:6
evaluated: !hidden
TRUEFALSE
yes
Evaluation Count:637
yes
Evaluation Count:99
6-736
225 d->commonListView->appendHiddenRow(row);
executed: d->commonListView->appendHiddenRow(row);
Execution Count:637
637
226 else if (!hide && hidden)
evaluated: !hide
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:99
evaluated: hidden
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:1
1-99
227 d->commonListView->removeHiddenRow(row);
executed: d->commonListView->removeHiddenRow(row);
Execution Count:5
5
228 d->doDelayedItemsLayout(); -
229 d->viewport->update(); -
230}
executed: }
Execution Count:742
742
231 -
232 -
233 -
234 -
235QRect QListView::visualRect(const QModelIndex &index) const -
236{ -
237 const QListViewPrivate * const d = d_func(); -
238 return d->mapToViewport(rectForIndex(index));
executed: return d->mapToViewport(rectForIndex(index));
Execution Count:24131
24131
239} -
240 -
241 -
242 -
243 -
244void QListView::scrollTo(const QModelIndex &index, ScrollHint hint) -
245{ -
246 QListViewPrivate * const d = d_func(); -
247 -
248 if (index.parent() != d->root || index.column() != d->column)
partially evaluated: index.parent() != d->root
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6072
evaluated: index.column() != d->column
TRUEFALSE
yes
Evaluation Count:5230
yes
Evaluation Count:842
0-6072
249 return;
executed: return;
Execution Count:5230
5230
250 -
251 const QRect rect = visualRect(index); -
252 if (hint == EnsureVisible && d->viewport->rect().contains(rect)) {
evaluated: hint == EnsureVisible
TRUEFALSE
yes
Evaluation Count:829
yes
Evaluation Count:13
evaluated: d->viewport->rect().contains(rect)
TRUEFALSE
yes
Evaluation Count:418
yes
Evaluation Count:411
13-829
253 d->viewport->update(rect); -
254 return;
executed: return;
Execution Count:418
418
255 } -
256 -
257 if (d->flow == QListView::TopToBottom || d->isWrapping())
evaluated: d->flow == QListView::TopToBottom
TRUEFALSE
yes
Evaluation Count:285
yes
Evaluation Count:139
evaluated: d->isWrapping()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:137
2-285
258 verticalScrollBar()->setValue(d->verticalScrollToValue(index, rect, hint));
executed: verticalScrollBar()->setValue(d->verticalScrollToValue(index, rect, hint));
Execution Count:287
287
259 -
260 if (d->flow == QListView::LeftToRight || d->isWrapping())
evaluated: d->flow == QListView::LeftToRight
TRUEFALSE
yes
Evaluation Count:139
yes
Evaluation Count:285
evaluated: d->isWrapping()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:282
3-285
261 horizontalScrollBar()->setValue(d->horizontalScrollToValue(index, rect, hint));
executed: horizontalScrollBar()->setValue(d->horizontalScrollToValue(index, rect, hint));
Execution Count:142
142
262}
executed: }
Execution Count:424
424
263 -
264int QListViewPrivate::horizontalScrollToValue(const QModelIndex &index, const QRect &rect, -
265 QListView::ScrollHint hint) const -
266{ -
267 const QListView * const q = q_func(); -
268 const QRect area = viewport->rect(); -
269 const bool leftOf = q->isRightToLeft()
partially evaluated: q->isRightToLeft()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:142
0-142
270 ? (rect.left() < area.left()) && (rect.right() < area.right()) -
271 : rect.left() < area.left(); -
272 const bool rightOf = q->isRightToLeft()
partially evaluated: q->isRightToLeft()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:142
0-142
273 ? rect.right() > area.right() -
274 : (rect.right() > area.right()) && (rect.left() > area.left()); -
275 return commonListView->horizontalScrollToValue(q->visualIndex(index), hint, leftOf, rightOf, area, rect);
executed: return commonListView->horizontalScrollToValue(q->visualIndex(index), hint, leftOf, rightOf, area, rect);
Execution Count:142
142
276} -
277 -
278int QListViewPrivate::verticalScrollToValue(const QModelIndex &index, const QRect &rect, -
279 QListView::ScrollHint hint) const -
280{ -
281 const QListView * const q = q_func(); -
282 const QRect area = viewport->rect(); -
283 const bool above = (hint == QListView::EnsureVisible && rect.top() < area.top());
evaluated: hint == QListView::EnsureVisible
TRUEFALSE
yes
Evaluation Count:276
yes
Evaluation Count:11
evaluated: rect.top() < area.top()
TRUEFALSE
yes
Evaluation Count:92
yes
Evaluation Count:184
11-276
284 const bool below = (hint == QListView::EnsureVisible && rect.bottom() > area.bottom());
evaluated: hint == QListView::EnsureVisible
TRUEFALSE
yes
Evaluation Count:276
yes
Evaluation Count:11
evaluated: rect.bottom() > area.bottom()
TRUEFALSE
yes
Evaluation Count:182
yes
Evaluation Count:94
11-276
285 return commonListView->verticalScrollToValue(q->visualIndex(index), hint, above, below, area, rect);
executed: return commonListView->verticalScrollToValue(q->visualIndex(index), hint, above, below, area, rect);
Execution Count:287
287
286} -
287 -
288void QListViewPrivate::selectAll(QItemSelectionModel::SelectionFlags command) -
289{ -
290 if (!selectionModel)
evaluated: !selectionModel
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:6
5-6
291 return;
executed: return;
Execution Count:5
5
292 -
293 QItemSelection selection; -
294 QModelIndex topLeft; -
295 int row = 0; -
296 const int colCount = model->columnCount(root); -
297 for(; row < model->rowCount(root); ++row) {
evaluated: row < model->rowCount(root)
TRUEFALSE
yes
Evaluation Count:31
yes
Evaluation Count:6
6-31
298 if (isHidden(row)) {
evaluated: isHidden(row)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:30
1-30
299 -
300 if (topLeft.isValid()) {
partially evaluated: topLeft.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
301 QModelIndex bottomRight = model->index(row - 1, colCount - 1, root); -
302 selection.append(QItemSelectionRange(topLeft, bottomRight)); -
303 topLeft = QModelIndex(); -
304 }
never executed: }
0
305 continue;
executed: continue;
Execution Count:1
1
306 } -
307 -
308 if (!topLeft.isValid())
evaluated: !topLeft.isValid()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:25
5-25
309 topLeft = model->index(row, 0, root);
executed: topLeft = model->index(row, 0, root);
Execution Count:5
5
310 }
executed: }
Execution Count:30
30
311 -
312 if (topLeft.isValid()) {
evaluated: topLeft.isValid()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:1
1-5
313 -
314 QModelIndex bottomRight = model->index(row - 1, colCount - 1, root); -
315 selection.append(QItemSelectionRange(topLeft, bottomRight)); -
316 }
executed: }
Execution Count:5
5
317 -
318 if (!selection.isEmpty())
evaluated: !selection.isEmpty()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:1
1-5
319 selectionModel->select(selection, command);
executed: selectionModel->select(selection, command);
Execution Count:5
5
320}
executed: }
Execution Count:6
6
321 -
322 -
323 -
324 -
325 -
326 -
327 -
328QItemViewPaintPairs QListViewPrivate::draggablePaintPairs(const QModelIndexList &indexes, QRect *r) const -
329{ -
330 qt_noop(); -
331 const QListView * const q = q_func(); -
332 QRect &rect = *r; -
333 const QRect viewportRect = viewport->rect(); -
334 QItemViewPaintPairs ret; -
335 const QSet<QModelIndex> visibleIndexes = intersectingSet(viewportRect.translated(q->horizontalOffset(), q->verticalOffset())).toList().toSet(); -
336 for (int i = 0; i < indexes.count(); ++i) {
evaluated: i < indexes.count()
TRUEFALSE
yes
Evaluation Count:30
yes
Evaluation Count:30
30
337 const QModelIndex &index = indexes.at(i); -
338 if (visibleIndexes.contains(index)) {
partially evaluated: visibleIndexes.contains(index)
TRUEFALSE
yes
Evaluation Count:30
no
Evaluation Count:0
0-30
339 const QRect current = q->visualRect(index); -
340 ret += qMakePair(current, index); -
341 rect |= current; -
342 }
executed: }
Execution Count:30
30
343 }
executed: }
Execution Count:30
30
344 rect &= viewportRect; -
345 return ret;
executed: return ret;
Execution Count:30
30
346} -
347 -
348 -
349 -
350 -
351void QListView::reset() -
352{ -
353 QListViewPrivate * const d = d_func(); -
354 d->clear(); -
355 d->hiddenRows.clear(); -
356 QAbstractItemView::reset(); -
357}
executed: }
Execution Count:1749
1749
358 -
359 -
360 -
361 -
362void QListView::setRootIndex(const QModelIndex &index) -
363{ -
364 QListViewPrivate * const d = d_func(); -
365 d->column = qBound(0, d->column, d->model->columnCount(index) - 1); -
366 QAbstractItemView::setRootIndex(index); -
367 -
368 d->clear(); -
369 d->hiddenRows.clear(); -
370}
executed: }
Execution Count:1995
1995
371 -
372 -
373 -
374 -
375 -
376 -
377 -
378void QListView::scrollContentsBy(int dx, int dy) -
379{ -
380 QListViewPrivate * const d = d_func(); -
381 d->delayedAutoScroll.stop(); -
382 d->commonListView->scrollContentsBy(dx, dy, d->state == QListView::DragSelectingState); -
383}
executed: }
Execution Count:445
445
384 -
385 -
386 -
387 -
388 -
389 -
390 -
391void QListView::resizeContents(int width, int height) -
392{ -
393 QListViewPrivate * const d = d_func(); -
394 d->setContentsSize(width, height); -
395}
executed: }
Execution Count:1
1
396 -
397 -
398 -
399 -
400QSize QListView::contentsSize() const -
401{ -
402 const QListViewPrivate * const d = d_func(); -
403 return d->contentsSize();
executed: return d->contentsSize();
Execution Count:67
67
404} -
405 -
406 -
407 -
408 -
409void QListView::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles) -
410{ -
411 d_func()->commonListView->dataChanged(topLeft, bottomRight); -
412 QAbstractItemView::dataChanged(topLeft, bottomRight, roles); -
413}
executed: }
Execution Count:3979
3979
414 -
415 -
416 -
417 -
418void QListView::rowsInserted(const QModelIndex &parent, int start, int end) -
419{ -
420 QListViewPrivate * const d = d_func(); -
421 -
422 d->clear(); -
423 d->doDelayedItemsLayout(); -
424 QAbstractItemView::rowsInserted(parent, start, end); -
425}
executed: }
Execution Count:16401
16401
426 -
427 -
428 -
429 -
430void QListView::rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end) -
431{ -
432 QListViewPrivate * const d = d_func(); -
433 -
434 QAbstractItemView::rowsAboutToBeRemoved(parent, start, end); -
435 if (parent == d->root) {
partially evaluated: parent == d->root
TRUEFALSE
yes
Evaluation Count:176
no
Evaluation Count:0
0-176
436 QSet<QPersistentModelIndex>::iterator it = d->hiddenRows.begin(); -
437 while (it != d->hiddenRows.end()) {
partially evaluated: it != d->hiddenRows.end()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:176
0-176
438 int hiddenRow = it->row(); -
439 if (hiddenRow >= start && hiddenRow <= end) {
never evaluated: hiddenRow >= start
never evaluated: hiddenRow <= end
0
440 it = d->hiddenRows.erase(it); -
441 } else {
never executed: }
0
442 ++it; -
443 }
never executed: }
0
444 } -
445 }
executed: }
Execution Count:176
176
446 d->clear(); -
447 d->doDelayedItemsLayout(); -
448}
executed: }
Execution Count:176
176
449 -
450 -
451 -
452 -
453void QListView::mouseMoveEvent(QMouseEvent *e) -
454{ -
455 if (!isVisible())
partially evaluated: !isVisible()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
456 return;
never executed: return;
0
457 QListViewPrivate * const d = d_func(); -
458 QAbstractItemView::mouseMoveEvent(e); -
459 if (state() == DragSelectingState
partially evaluated: state() == DragSelectingState
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
460 && d->showElasticBand
partially evaluated: d->showElasticBand
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
461 && d->selectionMode != SingleSelection
partially evaluated: d->selectionMode != SingleSelection
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
462 && d->selectionMode != NoSelection) {
partially evaluated: d->selectionMode != NoSelection
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
463 QRect rect(d->pressedPosition, e->pos() + QPoint(horizontalOffset(), verticalOffset())); -
464 rect = rect.normalized(); -
465 d->viewport->update(d->mapToViewport(rect.united(d->elasticBand))); -
466 d->elasticBand = rect; -
467 }
executed: }
Execution Count:3
3
468}
executed: }
Execution Count:3
3
469 -
470 -
471 -
472 -
473void QListView::mouseReleaseEvent(QMouseEvent *e) -
474{ -
475 QListViewPrivate * const d = d_func(); -
476 QAbstractItemView::mouseReleaseEvent(e); -
477 -
478 if (d->showElasticBand && d->elasticBand.isValid()) {
evaluated: d->showElasticBand
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:184
evaluated: d->elasticBand.isValid()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:1
1-184
479 d->viewport->update(d->mapToViewport(d->elasticBand)); -
480 d->elasticBand = QRect(); -
481 }
executed: }
Execution Count:3
3
482}
executed: }
Execution Count:188
188
483 -
484 -
485 -
486 -
487void QListView::timerEvent(QTimerEvent *e) -
488{ -
489 QListViewPrivate * const d = d_func(); -
490 if (e->timerId() == d->batchLayoutTimer.timerId()) {
evaluated: e->timerId() == d->batchLayoutTimer.timerId()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:993
4-993
491 if (d->doItemsLayout(d->batchSize)) {
partially evaluated: d->doItemsLayout(d->batchSize)
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
0-4
492 d->batchLayoutTimer.stop(); -
493 updateGeometries(); -
494 d->viewport->update(); -
495 }
executed: }
Execution Count:4
4
496 }
executed: }
Execution Count:4
4
497 QAbstractItemView::timerEvent(e); -
498}
executed: }
Execution Count:997
997
499 -
500 -
501 -
502 -
503void QListView::resizeEvent(QResizeEvent *e) -
504{ -
505 QListViewPrivate * const d = d_func(); -
506 if (d->delayedPendingLayout)
evaluated: d->delayedPendingLayout
TRUEFALSE
yes
Evaluation Count:213
yes
Evaluation Count:356
213-356
507 return;
executed: return;
Execution Count:213
213
508 -
509 QSize delta = e->size() - e->oldSize(); -
510 -
511 if (delta.isNull())
partially evaluated: delta.isNull()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:356
0-356
512 return;
never executed: return;
0
513 -
514 bool listWrap = (d->viewMode == ListMode) && d->wrapItemText;
evaluated: (d->viewMode == ListMode)
TRUEFALSE
yes
Evaluation Count:352
yes
Evaluation Count:4
evaluated: d->wrapItemText
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:350
2-352
515 bool flowDimensionChanged = (d->flow == LeftToRight && delta.width() != 0)
evaluated: d->flow == LeftToRight
TRUEFALSE
yes
Evaluation Count:17
yes
Evaluation Count:339
evaluated: delta.width() != 0
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:12
5-339
516 || (d->flow == TopToBottom && delta.height() != 0);
evaluated: d->flow == TopToBottom
TRUEFALSE
yes
Evaluation Count:339
yes
Evaluation Count:12
evaluated: delta.height() != 0
TRUEFALSE
yes
Evaluation Count:276
yes
Evaluation Count:63
12-339
517 -
518 -
519 -
520 -
521 if (listWrap
evaluated: listWrap
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:354
2-354
522 || (state() == NoState && d->resizeMode == Adjust && flowDimensionChanged)) {
evaluated: state() == NoState
TRUEFALSE
yes
Evaluation Count:353
yes
Evaluation Count:1
evaluated: d->resizeMode == Adjust
TRUEFALSE
yes
Evaluation Count:35
yes
Evaluation Count:318
partially evaluated: flowDimensionChanged
TRUEFALSE
yes
Evaluation Count:35
no
Evaluation Count:0
0-353
523 d->doDelayedItemsLayout(100); -
524 } else {
executed: }
Execution Count:37
37
525 QAbstractItemView::resizeEvent(e); -
526 }
executed: }
Execution Count:319
319
527} -
528 -
529 -
530 -
531 -
532 -
533 -
534void QListView::dragMoveEvent(QDragMoveEvent *e) -
535{ -
536 QListViewPrivate * const d = d_func(); -
537 if (!d->commonListView->filterDragMoveEvent(e)) {
never evaluated: !d->commonListView->filterDragMoveEvent(e)
0
538 if (viewMode() == QListView::ListMode && flow() == QListView::LeftToRight)
never evaluated: viewMode() == QListView::ListMode
never evaluated: flow() == QListView::LeftToRight
0
539 static_cast<QListModeViewBase *>(d->commonListView)->dragMoveEvent(e);
never executed: static_cast<QListModeViewBase *>(d->commonListView)->dragMoveEvent(e);
0
540 else -
541 QAbstractItemView::dragMoveEvent(e);
never executed: QAbstractItemView::dragMoveEvent(e);
0
542 } -
543}
never executed: }
0
544 -
545 -
546 -
547 -
548 -
549void QListView::dragLeaveEvent(QDragLeaveEvent *e) -
550{ -
551 if (!d_func()->commonListView->filterDragLeaveEvent(e))
never evaluated: !d_func()->commonListView->filterDragLeaveEvent(e)
0
552 QAbstractItemView::dragLeaveEvent(e);
never executed: QAbstractItemView::dragLeaveEvent(e);
0
553}
never executed: }
0
554 -
555 -
556 -
557 -
558void QListView::dropEvent(QDropEvent *e) -
559{ -
560 if (!d_func()->commonListView->filterDropEvent(e))
never evaluated: !d_func()->commonListView->filterDropEvent(e)
0
561 QAbstractItemView::dropEvent(e);
never executed: QAbstractItemView::dropEvent(e);
0
562}
never executed: }
0
563 -
564 -
565 -
566 -
567void QListView::startDrag(Qt::DropActions supportedActions) -
568{ -
569 if (!d_func()->commonListView->filterStartDrag(supportedActions))
partially evaluated: !d_func()->commonListView->filterStartDrag(supportedActions)
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
570 QAbstractItemView::startDrag(supportedActions);
executed: QAbstractItemView::startDrag(supportedActions);
Execution Count:1
1
571}
executed: }
Execution Count:1
1
572 -
573 -
574 -
575 -
576 -
577 -
578QStyleOptionViewItem QListView::viewOptions() const -
579{ -
580 const QListViewPrivate * const d = d_func(); -
581 return d->viewOptions();
executed: return d->viewOptions();
Execution Count:4
4
582} -
583 -
584QStyleOptionViewItem QListViewPrivate::viewOptions() const -
585{ -
586 const QListView * const q = q_func(); -
587 QStyleOptionViewItem option = QAbstractItemViewPrivate::viewOptions(); -
588 if (!iconSize.isValid()) {
evaluated: !iconSize.isValid()
TRUEFALSE
yes
Evaluation Count:22381
yes
Evaluation Count:503
503-22381
589 int pm = (viewMode == QListView::ListMode
evaluated: viewMode == QListView::ListMode
TRUEFALSE
yes
Evaluation Count:22301
yes
Evaluation Count:80
80-22301
590 ? q->style()->pixelMetric(QStyle::PM_ListViewIconSize, 0, q) -
591 : q->style()->pixelMetric(QStyle::PM_IconViewIconSize, 0, q)); -
592 option.decorationSize = QSize(pm, pm); -
593 }
executed: }
Execution Count:22381
22381
594 if (viewMode == QListView::IconMode) {
evaluated: viewMode == QListView::IconMode
TRUEFALSE
yes
Evaluation Count:83
yes
Evaluation Count:22801
83-22801
595 option.showDecorationSelected = false; -
596 option.decorationPosition = QStyleOptionViewItem::Top; -
597 option.displayAlignment = Qt::AlignCenter; -
598 } else {
executed: }
Execution Count:83
83
599 option.decorationPosition = QStyleOptionViewItem::Left; -
600 }
executed: }
Execution Count:22801
22801
601 return option;
executed: return option;
Execution Count:22884
22884
602} -
603 -
604 -
605 -
606 -
607 -
608void QListView::paintEvent(QPaintEvent *e) -
609{ -
610 QListViewPrivate * const d = d_func(); -
611 if (!d->itemDelegate)
partially evaluated: !d->itemDelegate
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1057
0-1057
612 return;
never executed: return;
0
613 QStyleOptionViewItem option = d->viewOptions(); -
614 QPainter painter(d->viewport); -
615 -
616 const QVector<QModelIndex> toBeRendered = d->intersectingSet(e->rect().translated(horizontalOffset(), verticalOffset()), false); -
617 -
618 const QModelIndex current = currentIndex(); -
619 const QModelIndex hover = d->hover; -
620 const QAbstractItemModel *itemModel = d->model; -
621 const QItemSelectionModel *selections = d->selectionModel; -
622 const bool focus = (hasFocus() || d->viewport->hasFocus()) && current.isValid();
evaluated: hasFocus()
TRUEFALSE
yes
Evaluation Count:755
yes
Evaluation Count:302
partially evaluated: d->viewport->hasFocus()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:302
evaluated: current.isValid()
TRUEFALSE
yes
Evaluation Count:701
yes
Evaluation Count:54
0-755
623 const bool alternate = d->alternatingColors; -
624 const QStyle::State state = option.state; -
625 const QAbstractItemView::State viewState = this->state(); -
626 const bool enabled = (state & QStyle::State_Enabled) != 0; -
627 -
628 bool alternateBase = false; -
629 int previousRow = -2; -
630 -
631 int maxSize = (flow() == TopToBottom)
evaluated: (flow() == TopToBottom)
TRUEFALSE
yes
Evaluation Count:800
yes
Evaluation Count:257
257-800
632 ? qMax(viewport()->size().width(), d->contentsSize().width()) - 2 * d->spacing() -
633 : qMax(viewport()->size().height(), d->contentsSize().height()) - 2 * d->spacing(); -
634 -
635 QVector<QModelIndex>::const_iterator end = toBeRendered.constEnd(); -
636 for (QVector<QModelIndex>::const_iterator it = toBeRendered.constBegin(); it != end; ++it) {
evaluated: it != end
TRUEFALSE
yes
Evaluation Count:8033
yes
Evaluation Count:1057
1057-8033
637 qt_noop(); -
638 option.rect = visualRect(*it); -
639 -
640 if (flow() == TopToBottom)
evaluated: flow() == TopToBottom
TRUEFALSE
yes
Evaluation Count:6391
yes
Evaluation Count:1642
1642-6391
641 option.rect.setWidth(qMin(maxSize, option.rect.width()));
executed: option.rect.setWidth(qMin(maxSize, option.rect.width()));
Execution Count:6391
6391
642 else -
643 option.rect.setHeight(qMin(maxSize, option.rect.height()));
executed: option.rect.setHeight(qMin(maxSize, option.rect.height()));
Execution Count:1642
1642
644 -
645 option.state = state; -
646 if (selections && selections->isSelected(*it))
partially evaluated: selections
TRUEFALSE
yes
Evaluation Count:8033
no
Evaluation Count:0
evaluated: selections->isSelected(*it)
TRUEFALSE
yes
Evaluation Count:514
yes
Evaluation Count:7519
0-8033
647 option.state |= QStyle::State_Selected;
executed: option.state |= QStyle::State_Selected;
Execution Count:514
514
648 if (enabled) {
partially evaluated: enabled
TRUEFALSE
yes
Evaluation Count:8033
no
Evaluation Count:0
0-8033
649 QPalette::ColorGroup cg; -
650 if ((itemModel->flags(*it) & Qt::ItemIsEnabled) == 0) {
evaluated: (itemModel->flags(*it) & Qt::ItemIsEnabled) == 0
TRUEFALSE
yes
Evaluation Count:54
yes
Evaluation Count:7979
54-7979
651 option.state &= ~QStyle::State_Enabled; -
652 cg = QPalette::Disabled; -
653 } else {
executed: }
Execution Count:54
54
654 cg = QPalette::Normal; -
655 }
executed: }
Execution Count:7979
7979
656 option.palette.setCurrentColorGroup(cg); -
657 }
executed: }
Execution Count:8033
8033
658 if (focus && current == *it) {
evaluated: focus
TRUEFALSE
yes
Evaluation Count:4643
yes
Evaluation Count:3390
evaluated: current == *it
TRUEFALSE
yes
Evaluation Count:685
yes
Evaluation Count:3958
685-4643
659 option.state |= QStyle::State_HasFocus; -
660 if (viewState == EditingState)
partially evaluated: viewState == EditingState
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:685
0-685
661 option.state |= QStyle::State_Editing;
never executed: option.state |= QStyle::State_Editing;
0
662 }
executed: }
Execution Count:685
685
663 if (*it == hover)
evaluated: *it == hover
TRUEFALSE
yes
Evaluation Count:243
yes
Evaluation Count:7790
243-7790
664 option.state |= QStyle::State_MouseOver;
executed: option.state |= QStyle::State_MouseOver;
Execution Count:243
243
665 else -
666 option.state &= ~QStyle::State_MouseOver;
executed: option.state &= ~QStyle::State_MouseOver;
Execution Count:7790
7790
667 -
668 if (alternate) {
partially evaluated: alternate
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8033
0-8033
669 int row = (*it).row(); -
670 if (row != previousRow + 1) {
never evaluated: row != previousRow + 1
0
671 -
672 if (!d->hiddenRows.isEmpty()) {
never evaluated: !d->hiddenRows.isEmpty()
0
673 for (int r = qMax(previousRow + 1, 0); r < row; ++r) {
never evaluated: r < row
0
674 if (!d->isHidden(r))
never evaluated: !d->isHidden(r)
0
675 alternateBase = !alternateBase;
never executed: alternateBase = !alternateBase;
0
676 }
never executed: }
0
677 } else {
never executed: }
0
678 alternateBase = (row & 1) != 0; -
679 }
never executed: }
0
680 } -
681 if (alternateBase) {
never evaluated: alternateBase
0
682 option.features |= QStyleOptionViewItem::Alternate; -
683 } else {
never executed: }
0
684 option.features &= ~QStyleOptionViewItem::Alternate; -
685 }
never executed: }
0
686 -
687 -
688 -
689 QStyle::State oldState = option.state; -
690 option.state &= ~QStyle::State_Selected; -
691 style()->drawPrimitive(QStyle::PE_PanelItemViewRow, &option, &painter, this); -
692 option.state = oldState; -
693 -
694 alternateBase = !alternateBase; -
695 previousRow = row; -
696 }
never executed: }
0
697 -
698 d->delegateForIndex(*it)->paint(&painter, option, *it); -
699 }
executed: }
Execution Count:8033
8033
700 -
701 -
702 d->commonListView->paintDragDrop(&painter); -
703 -
704 -
705 -
706 -
707 if (d->showElasticBand && d->elasticBand.isValid()) {
evaluated: d->showElasticBand
TRUEFALSE
yes
Evaluation Count:39
yes
Evaluation Count:1018
partially evaluated: d->elasticBand.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:39
0-1018
708 QStyleOptionRubberBand opt; -
709 opt.initFrom(this); -
710 opt.shape = QRubberBand::Rectangle; -
711 opt.opaque = false; -
712 opt.rect = d->mapToViewport(d->elasticBand, false).intersected( -
713 d->viewport->rect().adjusted(-16, -16, 16, 16)); -
714 painter.save(); -
715 style()->drawControl(QStyle::CE_RubberBand, &opt, &painter); -
716 painter.restore(); -
717 }
never executed: }
0
718 -
719}
executed: }
Execution Count:1057
1057
720 -
721 -
722 -
723 -
724QModelIndex QListView::indexAt(const QPoint &p) const -
725{ -
726 const QListViewPrivate * const d = d_func(); -
727 QRect rect(p.x() + horizontalOffset(), p.y() + verticalOffset(), 1, 1); -
728 const QVector<QModelIndex> intersectVector = d->intersectingSet(rect); -
729 QModelIndex index = intersectVector.count() > 0
evaluated: intersectVector.count() > 0
TRUEFALSE
yes
Evaluation Count:1257
yes
Evaluation Count:62
62-1257
730 ? intersectVector.last() : QModelIndex(); -
731 if (index.isValid() && visualRect(index).contains(p))
evaluated: index.isValid()
TRUEFALSE
yes
Evaluation Count:1257
yes
Evaluation Count:62
evaluated: visualRect(index).contains(p)
TRUEFALSE
yes
Evaluation Count:1179
yes
Evaluation Count:78
62-1257
732 return index;
executed: return index;
Execution Count:1179
1179
733 return QModelIndex();
executed: return QModelIndex();
Execution Count:140
140
734} -
735 -
736 -
737 -
738 -
739int QListView::horizontalOffset() const -
740{ -
741 return d_func()->commonListView->horizontalOffset();
executed: return d_func()->commonListView->horizontalOffset();
Execution Count:24903
24903
742} -
743 -
744 -
745 -
746 -
747int QListView::verticalOffset() const -
748{ -
749 return d_func()->commonListView->verticalOffset();
executed: return d_func()->commonListView->verticalOffset();
Execution Count:24903
24903
750} -
751 -
752 -
753 -
754 -
755QModelIndex QListView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers) -
756{ -
757 QListViewPrivate * const d = d_func(); -
758 (void)modifiers;; -
759 -
760 QModelIndex current = currentIndex(); -
761 if (!current.isValid()) {
evaluated: !current.isValid()
TRUEFALSE
yes
Evaluation Count:107
yes
Evaluation Count:469
107-469
762 int rowCount = d->model->rowCount(d->root); -
763 if (!rowCount)
evaluated: !rowCount
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:99
8-99
764 return QModelIndex();
executed: return QModelIndex();
Execution Count:8
8
765 int row = 0; -
766 while (row < rowCount && d->isHiddenOrDisabled(row))
evaluated: row < rowCount
TRUEFALSE
yes
Evaluation Count:204
yes
Evaluation Count:1
evaluated: d->isHiddenOrDisabled(row)
TRUEFALSE
yes
Evaluation Count:106
yes
Evaluation Count:98
1-204
767 ++row;
executed: ++row;
Execution Count:106
106
768 if (row >= rowCount)
evaluated: row >= rowCount
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:98
1-98
769 return QModelIndex();
executed: return QModelIndex();
Execution Count:1
1
770 return d->model->index(row, d->column, d->root);
executed: return d->model->index(row, d->column, d->root);
Execution Count:98
98
771 } -
772 -
773 const QRect initialRect = rectForIndex(current); -
774 QRect rect = initialRect; -
775 if (rect.isEmpty()) {
partially evaluated: rect.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:469
0-469
776 return d->model->index(0, d->column, d->root);
never executed: return d->model->index(0, d->column, d->root);
0
777 } -
778 if (d->gridSize().isValid()) rect.setSize(d->gridSize());
executed: rect.setSize(d->gridSize());
Execution Count:25
evaluated: d->gridSize().isValid()
TRUEFALSE
yes
Evaluation Count:25
yes
Evaluation Count:444
25-444
779 -
780 QSize contents = d->contentsSize(); -
781 QVector<QModelIndex> intersectVector; -
782 -
783 switch (cursorAction) { -
784 case MoveLeft: -
785 while (intersectVector.isEmpty()) {
evaluated: intersectVector.isEmpty()
TRUEFALSE
yes
Evaluation Count:117
yes
Evaluation Count:94
94-117
786 rect.translate(-rect.width(), 0); -
787 if (rect.right() <= 0)
evaluated: rect.right() <= 0
TRUEFALSE
yes
Evaluation Count:22
yes
Evaluation Count:95
22-95
788 return current;
executed: return current;
Execution Count:22
22
789 if (rect.left() < 0)
evaluated: rect.left() < 0
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:94
1-94
790 rect.setLeft(0);
executed: rect.setLeft(0);
Execution Count:1
1
791 intersectVector = d->intersectingSet(rect); -
792 d->removeCurrentAndDisabled(&intersectVector, current); -
793 }
executed: }
Execution Count:95
95
794 return d->closestIndex(initialRect, intersectVector);
executed: return d->closestIndex(initialRect, intersectVector);
Execution Count:94
94
795 case MoveRight: -
796 while (intersectVector.isEmpty()) {
evaluated: intersectVector.isEmpty()
TRUEFALSE
yes
Evaluation Count:94
yes
Evaluation Count:89
89-94
797 rect.translate(rect.width(), 0); -
798 if (rect.left() >= contents.width())
evaluated: rect.left() >= contents.width()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:90
4-90
799 return current;
executed: return current;
Execution Count:4
4
800 if (rect.right() > contents.width())
evaluated: rect.right() > contents.width()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:88
2-88
801 rect.setRight(contents.width());
executed: rect.setRight(contents.width());
Execution Count:2
2
802 intersectVector = d->intersectingSet(rect); -
803 d->removeCurrentAndDisabled(&intersectVector, current); -
804 }
executed: }
Execution Count:90
90
805 return d->closestIndex(initialRect, intersectVector);
executed: return d->closestIndex(initialRect, intersectVector);
Execution Count:89
89
806 case MovePageUp: -
807 -
808 -
809 rect.moveTop(rect.top() - d->viewport->height() + 2 * rect.height()); -
810 if (rect.top() < rect.height())
evaluated: rect.top() < rect.height()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:10
2-10
811 rect.moveTop(rect.height());
executed: rect.moveTop(rect.height());
Execution Count:2
2
812 case MovePrevious:
code before this statement executed: case MovePrevious:
Execution Count:12
12
813 case MoveUp: -
814 while (intersectVector.isEmpty()) {
evaluated: intersectVector.isEmpty()
TRUEFALSE
yes
Evaluation Count:147
yes
Evaluation Count:129
129-147
815 rect.translate(0, -rect.height()); -
816 if (rect.bottom() <= 0) {
evaluated: rect.bottom() <= 0
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:137
10-137
817 return current;
executed: return current;
Execution Count:10
10
818 } -
819 if (rect.top() < 0)
evaluated: rect.top() < 0
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:136
1-136
820 rect.setTop(0);
executed: rect.setTop(0);
Execution Count:1
1
821 intersectVector = d->intersectingSet(rect); -
822 d->removeCurrentAndDisabled(&intersectVector, current); -
823 }
executed: }
Execution Count:137
137
824 return d->closestIndex(initialRect, intersectVector);
executed: return d->closestIndex(initialRect, intersectVector);
Execution Count:129
129
825 case MovePageDown: -
826 -
827 -
828 rect.moveTop(rect.top() + d->viewport->height() - 2 * rect.height()); -
829 if (rect.bottom() > contents.height() - rect.height())
evaluated: rect.bottom() > contents.height() - rect.height()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:10
2-10
830 rect.moveBottom(contents.height() - rect.height());
executed: rect.moveBottom(contents.height() - rect.height());
Execution Count:2
2
831 case MoveNext:
code before this statement executed: case MoveNext:
Execution Count:12
12
832 case MoveDown: -
833 while (intersectVector.isEmpty()) {
evaluated: intersectVector.isEmpty()
TRUEFALSE
yes
Evaluation Count:121
yes
Evaluation Count:115
115-121
834 rect.translate(0, rect.height()); -
835 if (rect.top() >= contents.height()) {
evaluated: rect.top() >= contents.height()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:116
5-116
836 return current;
executed: return current;
Execution Count:5
5
837 } -
838 if (rect.bottom() > contents.height())
evaluated: rect.bottom() > contents.height()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:113
3-113
839 rect.setBottom(contents.height());
executed: rect.setBottom(contents.height());
Execution Count:3
3
840 intersectVector = d->intersectingSet(rect); -
841 d->removeCurrentAndDisabled(&intersectVector, current); -
842 }
executed: }
Execution Count:116
116
843 return d->closestIndex(initialRect, intersectVector);
executed: return d->closestIndex(initialRect, intersectVector);
Execution Count:115
115
844 case MoveHome: -
845 return d->model->index(0, d->column, d->root);
executed: return d->model->index(0, d->column, d->root);
Execution Count:1
1
846 case MoveEnd: -
847 return d->model->index(d->batchStartRow() - 1, d->column, d->root);}
never executed: return d->model->index(d->batchStartRow() - 1, d->column, d->root);
0
848 -
849 return current;
never executed: return current;
0
850} -
851 -
852 -
853 -
854 -
855 -
856 -
857 -
858QRect QListView::rectForIndex(const QModelIndex &index) const -
859{ -
860 return d_func()->rectForIndex(index);
executed: return d_func()->rectForIndex(index);
Execution Count:24628
24628
861} -
862void QListView::setPositionForIndex(const QPoint &position, const QModelIndex &index) -
863{ -
864 QListViewPrivate * const d = d_func(); -
865 if (d->movement == Static
partially evaluated: d->movement == Static
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:17
0-17
866 || !d->isIndexValid(index)
partially evaluated: !d->isIndexValid(index)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:17
0-17
867 || index.parent() != d->root
partially evaluated: index.parent() != d->root
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:17
0-17
868 || index.column() != d->column)
evaluated: index.column() != d->column
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:5
5-12
869 return;
executed: return;
Execution Count:12
12
870 -
871 d->executePostedLayout(); -
872 d->commonListView->setPositionForIndex(position, index); -
873}
executed: }
Execution Count:5
5
874 -
875 -
876 -
877 -
878void QListView::setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags command) -
879{ -
880 QListViewPrivate * const d = d_func(); -
881 if (!d->selectionModel)
evaluated: !d->selectionModel
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:660
2-660
882 return;
executed: return;
Execution Count:2
2
883 -
884 -
885 int w = qMax(d->contentsSize().width(), d->viewport->width()); -
886 int h = qMax(d->contentsSize().height(), d->viewport->height()); -
887 if (d->wrap && !QRect(0, 0, w, h).intersects(rect))
evaluated: d->wrap
TRUEFALSE
yes
Evaluation Count:40
yes
Evaluation Count:620
evaluated: !QRect(0, 0, w, h).intersects(rect)
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:38
2-620
888 return;
executed: return;
Execution Count:2
2
889 -
890 QItemSelection selection; -
891 -
892 if (rect.width() == 1 && rect.height() == 1) {
evaluated: rect.width() == 1
TRUEFALSE
yes
Evaluation Count:648
yes
Evaluation Count:10
evaluated: rect.height() == 1
TRUEFALSE
yes
Evaluation Count:638
yes
Evaluation Count:10
10-648
893 const QVector<QModelIndex> intersectVector = d->intersectingSet(rect.translated(horizontalOffset(), verticalOffset())); -
894 QModelIndex tl; -
895 if (!intersectVector.isEmpty())
evaluated: !intersectVector.isEmpty()
TRUEFALSE
yes
Evaluation Count:634
yes
Evaluation Count:4
4-634
896 tl = intersectVector.last();
executed: tl = intersectVector.last();
Execution Count:634
634
897 if (tl.isValid() && d->isIndexEnabled(tl))
evaluated: tl.isValid()
TRUEFALSE
yes
Evaluation Count:634
yes
Evaluation Count:4
partially evaluated: d->isIndexEnabled(tl)
TRUEFALSE
yes
Evaluation Count:634
no
Evaluation Count:0
0-634
898 selection.select(tl, tl);
executed: selection.select(tl, tl);
Execution Count:634
634
899 } else {
executed: }
Execution Count:638
638
900 if (state() == DragSelectingState) {
evaluated: state() == DragSelectingState
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:17
3-17
901 selection = d->selection(rect.translated(horizontalOffset(), verticalOffset())); -
902 } else {
executed: }
Execution Count:3
3
903 QModelIndex tl, br; -
904 -
905 const QRect topLeft(rect.left() + horizontalOffset(), rect.top() + verticalOffset(), 1, 1); -
906 QVector<QModelIndex> intersectVector = d->intersectingSet(topLeft); -
907 if (!intersectVector.isEmpty())
evaluated: !intersectVector.isEmpty()
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:3
3-14
908 tl = intersectVector.last();
executed: tl = intersectVector.last();
Execution Count:14
14
909 -
910 const QRect bottomRight(rect.right() + horizontalOffset(), rect.bottom() + verticalOffset(), 1, 1); -
911 intersectVector = d->intersectingSet(bottomRight); -
912 if (!intersectVector.isEmpty())
evaluated: !intersectVector.isEmpty()
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:3
3-14
913 br = intersectVector.last();
executed: br = intersectVector.last();
Execution Count:14
14
914 -
915 -
916 if (tl.isValid() && br.isValid()
evaluated: tl.isValid()
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:3
partially evaluated: br.isValid()
TRUEFALSE
yes
Evaluation Count:14
no
Evaluation Count:0
0-14
917 && d->isIndexEnabled(tl)
partially evaluated: d->isIndexEnabled(tl)
TRUEFALSE
yes
Evaluation Count:14
no
Evaluation Count:0
0-14
918 && d->isIndexEnabled(br)) {
partially evaluated: d->isIndexEnabled(br)
TRUEFALSE
yes
Evaluation Count:14
no
Evaluation Count:0
0-14
919 QRect first = rectForIndex(tl); -
920 QRect last = rectForIndex(br); -
921 QRect middle; -
922 if (d->flow == LeftToRight) {
evaluated: d->flow == LeftToRight
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:7
7
923 QRect &top = first; -
924 QRect &bottom = last; -
925 -
926 if (top.center().y() > bottom.center().y()) {
evaluated: top.center().y() > bottom.center().y()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:6
1-6
927 QRect tmp = top; -
928 top = bottom; -
929 bottom = tmp; -
930 }
executed: }
Execution Count:1
1
931 -
932 if (top.top() != bottom.top()) {
evaluated: top.top() != bottom.top()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:2
2-5
933 -
934 if (isRightToLeft())
partially evaluated: isRightToLeft()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
935 top.setLeft(0);
never executed: top.setLeft(0);
0
936 else -
937 top.setRight(contentsSize().width());
executed: top.setRight(contentsSize().width());
Execution Count:5
5
938 -
939 if (isRightToLeft())
partially evaluated: isRightToLeft()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
940 bottom.setRight(contentsSize().width());
never executed: bottom.setRight(contentsSize().width());
0
941 else -
942 bottom.setLeft(0);
executed: bottom.setLeft(0);
Execution Count:5
5
943 } else if (top.left() > bottom.right()) {
evaluated: top.left() > bottom.right()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1
944 if (isRightToLeft())
partially evaluated: isRightToLeft()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
945 bottom.setLeft(top.right());
never executed: bottom.setLeft(top.right());
0
946 else -
947 bottom.setRight(top.left());
executed: bottom.setRight(top.left());
Execution Count:1
1
948 } else { -
949 if (isRightToLeft())
partially evaluated: isRightToLeft()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
950 top.setLeft(bottom.right());
never executed: top.setLeft(bottom.right());
0
951 else -
952 top.setRight(bottom.left());
executed: top.setRight(bottom.left());
Execution Count:1
1
953 } -
954 -
955 if (top.bottom() < bottom.top()) {
evaluated: top.bottom() < bottom.top()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:2
2-5
956 if (gridSize().isValid() && !gridSize().isNull())
evaluated: gridSize().isValid()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:1
partially evaluated: !gridSize().isNull()
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
0-4
957 middle.setTop(top.top() + gridSize().height());
executed: middle.setTop(top.top() + gridSize().height());
Execution Count:4
4
958 else -
959 middle.setTop(top.bottom() + 1);
executed: middle.setTop(top.bottom() + 1);
Execution Count:1
1
960 middle.setLeft(qMin(top.left(), bottom.left())); -
961 middle.setBottom(bottom.top() - 1); -
962 middle.setRight(qMax(top.right(), bottom.right())); -
963 }
executed: }
Execution Count:5
5
964 } else {
executed: }
Execution Count:7
7
965 QRect &left = first; -
966 QRect &right = last; -
967 if (left.center().x() > right.center().x())
evaluated: left.center().x() > right.center().x()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:6
1-6
968 qSwap(left, right);
executed: qSwap(left, right);
Execution Count:1
1
969 -
970 int ch = contentsSize().height(); -
971 if (left.left() != right.left()) {
evaluated: left.left() != right.left()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:5
2-5
972 -
973 if (isRightToLeft())
partially evaluated: isRightToLeft()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
974 left.setTop(0);
never executed: left.setTop(0);
0
975 else -
976 left.setBottom(ch);
executed: left.setBottom(ch);
Execution Count:2
2
977 -
978 -
979 if (isRightToLeft())
partially evaluated: isRightToLeft()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
980 right.setBottom(ch);
never executed: right.setBottom(ch);
0
981 else -
982 right.setTop(0);
executed: right.setTop(0);
Execution Count:2
2
983 -
984 middle.setTop(0); -
985 middle.setBottom(ch); -
986 if (gridSize().isValid() && !gridSize().isNull())
evaluated: gridSize().isValid()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
partially evaluated: !gridSize().isNull()
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
987 middle.setLeft(left.left() + gridSize().width());
executed: middle.setLeft(left.left() + gridSize().width());
Execution Count:1
1
988 else -
989 middle.setLeft(left.right() + 1);
executed: middle.setLeft(left.right() + 1);
Execution Count:1
1
990 middle.setRight(right.left() - 1); -
991 } else if (left.bottom() < right.top()) {
executed: }
Execution Count:2
evaluated: left.bottom() < right.top()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:3
2-3
992 left.setBottom(right.top() - 1); -
993 } else {
executed: }
Execution Count:2
2
994 right.setBottom(left.top() - 1); -
995 }
executed: }
Execution Count:3
3
996 } -
997 -
998 -
999 QItemSelection topSelection = d->selection(first); -
1000 QItemSelection middleSelection = d->selection(middle); -
1001 QItemSelection bottomSelection = d->selection(last); -
1002 -
1003 selection.merge(topSelection, QItemSelectionModel::Select); -
1004 selection.merge(middleSelection, QItemSelectionModel::Select); -
1005 selection.merge(bottomSelection, QItemSelectionModel::Select); -
1006 }
executed: }
Execution Count:14
14
1007 }
executed: }
Execution Count:17
17
1008 } -
1009 -
1010 d->selectionModel->select(selection, command); -
1011}
executed: }
Execution Count:658
658
1012 -
1013 -
1014 -
1015 -
1016 -
1017 -
1018 -
1019QRegion QListView::visualRegionForSelection(const QItemSelection &selection) const -
1020{ -
1021 const QListViewPrivate * const d = d_func(); -
1022 -
1023 int c = d->column; -
1024 QRegion selectionRegion; -
1025 const QRect &viewportRect = d->viewport->rect(); -
1026 for (int i = 0; i < selection.count(); ++i) {
evaluated: i < selection.count()
TRUEFALSE
yes
Evaluation Count:1570
yes
Evaluation Count:1681
1570-1681
1027 if (!selection.at(i).isValid())
partially evaluated: !selection.at(i).isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1570
0-1570
1028 continue;
never executed: continue;
0
1029 QModelIndex parent = selection.at(i).topLeft().parent(); -
1030 -
1031 -
1032 if (parent != d->root)
evaluated: parent != d->root
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:1557
13-1557
1033 continue;
executed: continue;
Execution Count:13
13
1034 int t = selection.at(i).topLeft().row(); -
1035 int b = selection.at(i).bottomRight().row(); -
1036 if (d->viewMode == IconMode || d->isWrapping()) {
evaluated: d->viewMode == IconMode
TRUEFALSE
yes
Evaluation Count:46
yes
Evaluation Count:1511
evaluated: d->isWrapping()
TRUEFALSE
yes
Evaluation Count:51
yes
Evaluation Count:1460
46-1511
1037 for (int r = t; r <= b; ++r) {
evaluated: r <= b
TRUEFALSE
yes
Evaluation Count:142
yes
Evaluation Count:97
97-142
1038 const QRect &rect = visualRect(d->model->index(r, c, parent)); -
1039 if (viewportRect.intersects(rect))
evaluated: viewportRect.intersects(rect)
TRUEFALSE
yes
Evaluation Count:134
yes
Evaluation Count:8
8-134
1040 selectionRegion += rect;
executed: selectionRegion += rect;
Execution Count:134
134
1041 }
executed: }
Execution Count:142
142
1042 } else {
executed: }
Execution Count:97
97
1043 while (t <= b && d->isHidden(t)) ++t;
never executed: ++t;
partially evaluated: t <= b
TRUEFALSE
yes
Evaluation Count:1460
no
Evaluation Count:0
partially evaluated: d->isHidden(t)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1460
0-1460
1044 while (b >= t && d->isHidden(b)) --b;
never executed: --b;
partially evaluated: b >= t
TRUEFALSE
yes
Evaluation Count:1460
no
Evaluation Count:0
partially evaluated: d->isHidden(b)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1460
0-1460
1045 const QModelIndex top = d->model->index(t, c, parent); -
1046 const QModelIndex bottom = d->model->index(b, c, parent); -
1047 QRect rect(visualRect(top).topLeft(), -
1048 visualRect(bottom).bottomRight()); -
1049 if (viewportRect.intersects(rect))
evaluated: viewportRect.intersects(rect)
TRUEFALSE
yes
Evaluation Count:1225
yes
Evaluation Count:235
235-1225
1050 selectionRegion += rect;
executed: selectionRegion += rect;
Execution Count:1225
1225
1051 }
executed: }
Execution Count:1460
1460
1052 } -
1053 -
1054 return selectionRegion;
executed: return selectionRegion;
Execution Count:1681
1681
1055} -
1056 -
1057 -
1058 -
1059 -
1060QModelIndexList QListView::selectedIndexes() const -
1061{ -
1062 const QListViewPrivate * const d = d_func(); -
1063 if (!d->selectionModel)
evaluated: !d->selectionModel
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1
1-2
1064 return QModelIndexList();
executed: return QModelIndexList();
Execution Count:2
2
1065 -
1066 QModelIndexList viewSelected = d->selectionModel->selectedIndexes(); -
1067 for (int i = 0; i < viewSelected.count(); ++i) {
partially evaluated: i < viewSelected.count()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
1068 const QModelIndex &index = viewSelected.at(i); -
1069 if (!isIndexHidden(index) && index.parent() == d->root && index.column() == d->column)
never evaluated: !isIndexHidden(index)
never evaluated: index.parent() == d->root
never evaluated: index.column() == d->column
0
1070 ++i;
never executed: ++i;
0
1071 else -
1072 viewSelected.removeAt(i);
never executed: viewSelected.removeAt(i);
0
1073 } -
1074 return viewSelected;
executed: return viewSelected;
Execution Count:1
1
1075} -
1076 -
1077 -
1078 -
1079 -
1080 -
1081 -
1082void QListView::doItemsLayout() -
1083{ -
1084 QListViewPrivate * const d = d_func(); -
1085 -
1086 -
1087 -
1088 QAbstractItemView::State oldState = state(); -
1089 setState(ExpandingState); -
1090 if (d->model->columnCount(d->root) > 0) {
evaluated: d->model->columnCount(d->root) > 0
TRUEFALSE
yes
Evaluation Count:1126
yes
Evaluation Count:39
39-1126
1091 d->resetBatchStartRow(); -
1092 if (layoutMode() == SinglePass)
evaluated: layoutMode() == SinglePass
TRUEFALSE
yes
Evaluation Count:1121
yes
Evaluation Count:5
5-1121
1093 d->doItemsLayout(d->model->rowCount(d->root));
executed: d->doItemsLayout(d->model->rowCount(d->root));
Execution Count:1121
1121
1094 else if (!d->batchLayoutTimer.isActive()) {
partially evaluated: !d->batchLayoutTimer.isActive()
TRUEFALSE
yes
Evaluation Count:5
no
Evaluation Count:0
0-5
1095 if (!d->doItemsLayout(d->batchSize))
evaluated: !d->doItemsLayout(d->batchSize)
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:1
1-4
1096 d->batchLayoutTimer.start(0, this);
executed: d->batchLayoutTimer.start(0, this);
Execution Count:4
4
1097 }
executed: }
Execution Count:5
5
1098 } -
1099 QAbstractItemView::doItemsLayout(); -
1100 setState(oldState); -
1101}
executed: }
Execution Count:1165
1165
1102 -
1103 -
1104 -
1105 -
1106void QListView::updateGeometries() -
1107{ -
1108 QListViewPrivate * const d = d_func(); -
1109 if (d->model->rowCount(d->root) <= 0 || d->model->columnCount(d->root) <= 0) {
evaluated: d->model->rowCount(d->root) <= 0
TRUEFALSE
yes
Evaluation Count:286
yes
Evaluation Count:1275
partially evaluated: d->model->columnCount(d->root) <= 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1275
0-1275
1110 horizontalScrollBar()->setRange(0, 0); -
1111 verticalScrollBar()->setRange(0, 0); -
1112 } else {
executed: }
Execution Count:286
286
1113 QModelIndex index = d->model->index(0, d->column, d->root); -
1114 QStyleOptionViewItem option = d->viewOptions(); -
1115 QSize step = d->itemSize(option, index); -
1116 d->commonListView->updateHorizontalScrollBar(step); -
1117 d->commonListView->updateVerticalScrollBar(step); -
1118 }
executed: }
Execution Count:1275
1275
1119 -
1120 QAbstractItemView::updateGeometries(); -
1121 -
1122 -
1123 if (d->movement == Static && !d->isWrapping()) {
evaluated: d->movement == Static
TRUEFALSE
yes
Evaluation Count:1540
yes
Evaluation Count:21
evaluated: !d->isWrapping()
TRUEFALSE
yes
Evaluation Count:1262
yes
Evaluation Count:278
21-1540
1124 const QSize maxSize = maximumViewportSize(); -
1125 if (d->flow == TopToBottom) {
evaluated: d->flow == TopToBottom
TRUEFALSE
yes
Evaluation Count:1215
yes
Evaluation Count:47
47-1215
1126 if (horizontalScrollBarPolicy() == Qt::ScrollBarAlwaysOff) {
evaluated: horizontalScrollBarPolicy() == Qt::ScrollBarAlwaysOff
TRUEFALSE
yes
Evaluation Count:52
yes
Evaluation Count:1163
52-1163
1127 d->setContentsSize(maxSize.width(), contentsSize().height()); -
1128 horizontalScrollBar()->setRange(0, 0); -
1129 }
executed: }
Execution Count:52
52
1130 } else {
executed: }
Execution Count:1215
1215
1131 if (verticalScrollBarPolicy() == Qt::ScrollBarAlwaysOff) {
partially evaluated: verticalScrollBarPolicy() == Qt::ScrollBarAlwaysOff
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:47
0-47
1132 d->setContentsSize(contentsSize().width(), maxSize.height()); -
1133 verticalScrollBar()->setRange(0, 0); -
1134 }
never executed: }
0
1135 }
executed: }
Execution Count:47
47
1136 } -
1137 -
1138}
executed: }
Execution Count:1561
1561
1139 -
1140 -
1141 -
1142 -
1143bool QListView::isIndexHidden(const QModelIndex &index) const -
1144{ -
1145 const QListViewPrivate * const d = d_func(); -
1146 return (d->isHidden(index.row()) 4
1147 && (index.parent() == d->root) 4
1148 && index.column() == d->column);
executed: return (d->isHidden(index.row()) && (index.parent() == d->root) && index.column() == d->column);
Execution Count:4
4
1149} -
1150void QListView::setModelColumn(int column) -
1151{ -
1152 QListViewPrivate * const d = d_func(); -
1153 if (column < 0 || column >= d->model->columnCount(d->root))
evaluated: column < 0
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:65
evaluated: column >= d->model->columnCount(d->root)
TRUEFALSE
yes
Evaluation Count:29
yes
Evaluation Count:36
2-65
1154 return;
executed: return;
Execution Count:31
31
1155 d->column = column; -
1156 d->doDelayedItemsLayout(); -
1157}
executed: }
Execution Count:36
36
1158 -
1159int QListView::modelColumn() const -
1160{ -
1161 const QListViewPrivate * const d = d_func(); -
1162 return d->column;
executed: return d->column;
Execution Count:9
9
1163} -
1164void QListView::setUniformItemSizes(bool enable) -
1165{ -
1166 QListViewPrivate * const d = d_func(); -
1167 d->uniformItemSizes = enable; -
1168}
executed: }
Execution Count:337
337
1169 -
1170bool QListView::uniformItemSizes() const -
1171{ -
1172 const QListViewPrivate * const d = d_func(); -
1173 return d->uniformItemSizes;
executed: return d->uniformItemSizes;
Execution Count:2
2
1174} -
1175void QListView::setWordWrap(bool on) -
1176{ -
1177 QListViewPrivate * const d = d_func(); -
1178 if (d->wrapItemText == on)
evaluated: d->wrapItemText == on
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:4
1-4
1179 return;
executed: return;
Execution Count:1
1
1180 d->wrapItemText = on; -
1181 d->doDelayedItemsLayout(); -
1182}
executed: }
Execution Count:4
4
1183 -
1184bool QListView::wordWrap() const -
1185{ -
1186 const QListViewPrivate * const d = d_func(); -
1187 return d->wrapItemText;
executed: return d->wrapItemText;
Execution Count:2
2
1188} -
1189void QListView::setSelectionRectVisible(bool show) -
1190{ -
1191 QListViewPrivate * const d = d_func(); -
1192 d->modeProperties |= uint(QListViewPrivate::SelectionRectVisible); -
1193 d->setSelectionRectVisible(show); -
1194}
never executed: }
0
1195 -
1196bool QListView::isSelectionRectVisible() const -
1197{ -
1198 const QListViewPrivate * const d = d_func(); -
1199 return d->isSelectionRectVisible();
never executed: return d->isSelectionRectVisible();
0
1200} -
1201 -
1202 -
1203 -
1204 -
1205bool QListView::event(QEvent *e) -
1206{ -
1207 return QAbstractItemView::event(e);
executed: return QAbstractItemView::event(e);
Execution Count:15078
15078
1208} -
1209 -
1210 -
1211 -
1212 -
1213 -
1214QListViewPrivate::QListViewPrivate() -
1215 : QAbstractItemViewPrivate(), -
1216 commonListView(0), -
1217 wrap(false), -
1218 space(0), -
1219 flow(QListView::TopToBottom), -
1220 movement(QListView::Static), -
1221 resizeMode(QListView::Fixed), -
1222 layoutMode(QListView::SinglePass), -
1223 viewMode(QListView::ListMode), -
1224 modeProperties(0), -
1225 column(0), -
1226 uniformItemSizes(false), -
1227 batchSize(100), -
1228 showElasticBand(false) -
1229{ -
1230}
executed: }
Execution Count:1008
1008
1231 -
1232QListViewPrivate::~QListViewPrivate() -
1233{ -
1234 delete commonListView; -
1235}
executed: }
Execution Count:902
902
1236 -
1237void QListViewPrivate::clear() -
1238{ -
1239 -
1240 cachedItemSize = QSize(); -
1241 commonListView->clear(); -
1242}
executed: }
Execution Count:22471
22471
1243 -
1244void QListViewPrivate::prepareItemsLayout() -
1245{ -
1246 QListView * const q = q_func(); -
1247 clear(); -
1248 -
1249 -
1250 layoutBounds = QRect(QPoint(), q->maximumViewportSize()); -
1251 -
1252 int frameAroundContents = 0; -
1253 if (q->style()->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents))
partially evaluated: q->style()->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1126
0-1126
1254 frameAroundContents = q->style()->pixelMetric(QStyle::PM_DefaultFrameWidth) * 2;
never executed: frameAroundContents = q->style()->pixelMetric(QStyle::PM_DefaultFrameWidth) * 2;
0
1255 -
1256 -
1257 -
1258 -
1259 int verticalMargin = vbarpolicy==Qt::ScrollBarAsNeeded
evaluated: vbarpolicy==Qt::ScrollBarAsNeeded
TRUEFALSE
yes
Evaluation Count:1114
yes
Evaluation Count:12
12-1114
1260 ? q->style()->pixelMetric(QStyle::PM_ScrollBarExtent, 0, vbar) + frameAroundContents -
1261 : 0; -
1262 int horizontalMargin = hbarpolicy==Qt::ScrollBarAsNeeded
evaluated: hbarpolicy==Qt::ScrollBarAsNeeded
TRUEFALSE
yes
Evaluation Count:1071
yes
Evaluation Count:55
55-1071
1263 ? q->style()->pixelMetric(QStyle::PM_ScrollBarExtent, 0, hbar) + frameAroundContents -
1264 : 0; -
1265 -
1266 layoutBounds.adjust(0, 0, -verticalMargin, -horizontalMargin); -
1267 -
1268 int rowCount = model->columnCount(root) <= 0 ? 0 : model->rowCount(root);
partially evaluated: model->columnCount(root) <= 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1126
0-1126
1269 commonListView->setRowCount(rowCount); -
1270}
executed: }
Execution Count:1126
1126
1271 -
1272 -
1273 -
1274 -
1275bool QListViewPrivate::doItemsLayout(int delta) -
1276{ -
1277 int max = model->rowCount(root) - 1; -
1278 int first = batchStartRow(); -
1279 int last = qMin(first + delta - 1, max); -
1280 -
1281 if (first == 0) {
evaluated: first == 0
TRUEFALSE
yes
Evaluation Count:1126
yes
Evaluation Count:4
4-1126
1282 layoutChildren(); -
1283 prepareItemsLayout(); -
1284 }
executed: }
Execution Count:1126
1126
1285 -
1286 if (max < 0 || last < first) {
evaluated: max < 0
TRUEFALSE
yes
Evaluation Count:175
yes
Evaluation Count:955
partially evaluated: last < first
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:955
0-955
1287 return true;
executed: return true;
Execution Count:175
175
1288 } -
1289 -
1290 QListViewLayoutInfo info; -
1291 info.bounds = layoutBounds; -
1292 info.grid = gridSize(); -
1293 info.spacing = (info.grid.isValid() ? 0 : spacing());
evaluated: info.grid.isValid()
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:945
10-945
1294 info.first = first; -
1295 info.last = last; -
1296 info.wrap = isWrapping(); -
1297 info.flow = flow; -
1298 info.max = max; -
1299 -
1300 return commonListView->doBatchedItemLayout(info, max);
executed: return commonListView->doBatchedItemLayout(info, max);
Execution Count:955
955
1301} -
1302 -
1303QListViewItem QListViewPrivate::indexToListViewItem(const QModelIndex &index) const -
1304{ -
1305 if (!index.isValid() || isHidden(index.row()))
partially evaluated: !index.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:20110
partially evaluated: isHidden(index.row())
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:20110
0-20110
1306 return QListViewItem();
never executed: return QListViewItem();
0
1307 -
1308 return commonListView->indexToListViewItem(index);
executed: return commonListView->indexToListViewItem(index);
Execution Count:20110
20110
1309} -
1310 -
1311QRect QListViewPrivate::mapToViewport(const QRect &rect, bool extend) const -
1312{ -
1313 const QListView * const q = q_func(); -
1314 if (!rect.isValid())
evaluated: !rect.isValid()
TRUEFALSE
yes
Evaluation Count:5435
yes
Evaluation Count:18702
5435-18702
1315 return rect;
executed: return rect;
Execution Count:5435
5435
1316 -
1317 QRect result = extend ? commonListView->mapToViewport(rect) : rect;
partially evaluated: extend
TRUEFALSE
yes
Evaluation Count:18702
no
Evaluation Count:0
0-18702
1318 int dx = -q->horizontalOffset(); -
1319 int dy = -q->verticalOffset(); -
1320 return result.adjusted(dx, dy, dx, dy);
executed: return result.adjusted(dx, dy, dx, dy);
Execution Count:18702
18702
1321} -
1322 -
1323QModelIndex QListViewPrivate::closestIndex(const QRect &target, -
1324 const QVector<QModelIndex> &candidates) const -
1325{ -
1326 int distance = 0; -
1327 int shortest = 2147483647; -
1328 QModelIndex closest; -
1329 QVector<QModelIndex>::const_iterator it = candidates.begin(); -
1330 -
1331 for (; it != candidates.end(); ++it) {
evaluated: it != candidates.end()
TRUEFALSE
yes
Evaluation Count:472
yes
Evaluation Count:427
427-472
1332 if (!(*it).isValid())
partially evaluated: !(*it).isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:472
0-472
1333 continue;
never executed: continue;
0
1334 -
1335 const QRect indexRect = indexToListViewItem(*it).rect(); -
1336 -
1337 -
1338 -
1339 -
1340 if ((target.center().x() >= indexRect.x() && target.center().x() < indexRect.right())
evaluated: target.center().x() >= indexRect.x()
TRUEFALSE
yes
Evaluation Count:375
yes
Evaluation Count:97
evaluated: target.center().x() < indexRect.right()
TRUEFALSE
yes
Evaluation Count:263
yes
Evaluation Count:112
97-375
1341 || (indexRect.center().x() >= target.x() && indexRect.center().x() < target.right())) {
evaluated: indexRect.center().x() >= target.x()
TRUEFALSE
yes
Evaluation Count:113
yes
Evaluation Count:96
evaluated: indexRect.center().x() < target.right()
TRUEFALSE
yes
Evaluation Count:16
yes
Evaluation Count:97
16-113
1342 -
1343 distance = qAbs(indexRect.center().y() - target.center().y()); -
1344 } else if ((target.center().y() >= indexRect.y() && target.center().y() < indexRect.bottom())
executed: }
Execution Count:279
evaluated: target.center().y() >= indexRect.y()
TRUEFALSE
yes
Evaluation Count:192
yes
Evaluation Count:1
evaluated: target.center().y() < indexRect.bottom()
TRUEFALSE
yes
Evaluation Count:184
yes
Evaluation Count:8
1-279
1345 || (indexRect.center().y() >= target.y() && indexRect.center().y() < target.bottom())) {
partially evaluated: indexRect.center().y() >= target.y()
TRUEFALSE
yes
Evaluation Count:9
no
Evaluation Count:0
evaluated: indexRect.center().y() < target.bottom()
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:1
0-9
1346 -
1347 distance = qAbs(indexRect.center().x() - target.center().x()); -
1348 } else {
executed: }
Execution Count:192
192
1349 distance = (indexRect.center() - target.center()).manhattanLength(); -
1350 }
executed: }
Execution Count:1
1
1351 if (distance < shortest) {
evaluated: distance < shortest
TRUEFALSE
yes
Evaluation Count:439
yes
Evaluation Count:33
33-439
1352 shortest = distance; -
1353 closest = *it; -
1354 }
executed: }
Execution Count:439
439
1355 }
executed: }
Execution Count:472
472
1356 return closest;
executed: return closest;
Execution Count:427
427
1357} -
1358 -
1359QSize QListViewPrivate::itemSize(const QStyleOptionViewItem &option, const QModelIndex &index) const -
1360{ -
1361 if (!uniformItemSizes) {
evaluated: !uniformItemSizes
TRUEFALSE
yes
Evaluation Count:55543
yes
Evaluation Count:857
857-55543
1362 const QAbstractItemDelegate *delegate = delegateForIndex(index); -
1363 return delegate ? delegate->sizeHint(option, index) : QSize();
executed: return delegate ? delegate->sizeHint(option, index) : QSize();
Execution Count:55543
55543
1364 } -
1365 if (!cachedItemSize.isValid()) {
evaluated: !cachedItemSize.isValid()
TRUEFALSE
yes
Evaluation Count:105
yes
Evaluation Count:752
105-752
1366 int row = model->rowCount(root) - 1; -
1367 QModelIndex sample = model->index(row, column, root); -
1368 const QAbstractItemDelegate *delegate = delegateForIndex(sample); -
1369 cachedItemSize = delegate ? delegate->sizeHint(option, sample) : QSize();
partially evaluated: delegate
TRUEFALSE
yes
Evaluation Count:105
no
Evaluation Count:0
0-105
1370 }
executed: }
Execution Count:105
105
1371 return cachedItemSize;
executed: return cachedItemSize;
Execution Count:857
857
1372} -
1373 -
1374QItemSelection QListViewPrivate::selection(const QRect &rect) const -
1375{ -
1376 QItemSelection selection; -
1377 QModelIndex tl, br; -
1378 const QVector<QModelIndex> intersectVector = intersectingSet(rect); -
1379 QVector<QModelIndex>::const_iterator it = intersectVector.begin(); -
1380 for (; it != intersectVector.end(); ++it) {
evaluated: it != intersectVector.end()
TRUEFALSE
yes
Evaluation Count:89
yes
Evaluation Count:45
45-89
1381 if (!tl.isValid() && !br.isValid()) {
evaluated: !tl.isValid()
TRUEFALSE
yes
Evaluation Count:33
yes
Evaluation Count:56
partially evaluated: !br.isValid()
TRUEFALSE
yes
Evaluation Count:33
no
Evaluation Count:0
0-56
1382 tl = br = *it; -
1383 } else if ((*it).row() == (tl.row() - 1)) {
executed: }
Execution Count:33
partially evaluated: (*it).row() == (tl.row() - 1)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:56
0-56
1384 tl = *it; -
1385 } else if ((*it).row() == (br.row() + 1)) {
never executed: }
partially evaluated: (*it).row() == (br.row() + 1)
TRUEFALSE
yes
Evaluation Count:56
no
Evaluation Count:0
0-56
1386 br = (*it); -
1387 } else {
executed: }
Execution Count:56
56
1388 selection.select(tl, br); -
1389 tl = br = *it; -
1390 }
never executed: }
0
1391 } -
1392 -
1393 if (tl.isValid() && br.isValid())
evaluated: tl.isValid()
TRUEFALSE
yes
Evaluation Count:33
yes
Evaluation Count:12
partially evaluated: br.isValid()
TRUEFALSE
yes
Evaluation Count:33
no
Evaluation Count:0
0-33
1394 selection.select(tl, br);
executed: selection.select(tl, br);
Execution Count:33
33
1395 else if (tl.isValid())
partially evaluated: tl.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12
0-12
1396 selection.select(tl, tl);
never executed: selection.select(tl, tl);
0
1397 else if (br.isValid())
partially evaluated: br.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12
0-12
1398 selection.select(br, br);
never executed: selection.select(br, br);
0
1399 -
1400 return selection;
executed: return selection;
Execution Count:45
45
1401} -
1402 -
1403 -
1404QAbstractItemView::DropIndicatorPosition QListViewPrivate::position(const QPoint &pos, const QRect &rect, const QModelIndex &idx) const -
1405{ -
1406 if (viewMode == QListView::ListMode && flow == QListView::LeftToRight)
never evaluated: viewMode == QListView::ListMode
never evaluated: flow == QListView::LeftToRight
0
1407 return static_cast<QListModeViewBase *>(commonListView)->position(pos, rect, idx);
never executed: return static_cast<QListModeViewBase *>(commonListView)->position(pos, rect, idx);
0
1408 else -
1409 return QAbstractItemViewPrivate::position(pos, rect, idx);
never executed: return QAbstractItemViewPrivate::position(pos, rect, idx);
0
1410} -
1411 -
1412bool QListViewPrivate::dropOn(QDropEvent *event, int *dropRow, int *dropCol, QModelIndex *dropIndex) -
1413{ -
1414 if (viewMode == QListView::ListMode && flow == QListView::LeftToRight)
never evaluated: viewMode == QListView::ListMode
never evaluated: flow == QListView::LeftToRight
0
1415 return static_cast<QListModeViewBase *>(commonListView)->dropOn(event, dropRow, dropCol, dropIndex);
never executed: return static_cast<QListModeViewBase *>(commonListView)->dropOn(event, dropRow, dropCol, dropIndex);
0
1416 else -
1417 return QAbstractItemViewPrivate::dropOn(event, dropRow, dropCol, dropIndex);
never executed: return QAbstractItemViewPrivate::dropOn(event, dropRow, dropCol, dropIndex);
0
1418} -
1419 -
1420 -
1421 -
1422 -
1423 -
1424 -
1425void QCommonListViewBase::appendHiddenRow(int row) -
1426{ -
1427 dd->hiddenRows.insert(dd->model->index(row, 0, qq->rootIndex())); -
1428}
executed: }
Execution Count:637
637
1429 -
1430void QCommonListViewBase::removeHiddenRow(int row) -
1431{ -
1432 dd->hiddenRows.remove(dd->model->index(row, 0, qq->rootIndex())); -
1433}
executed: }
Execution Count:5
5
1434 -
1435void QCommonListViewBase::updateHorizontalScrollBar(const QSize &step) -
1436{ -
1437 horizontalScrollBar()->setSingleStep(step.width() + spacing()); -
1438 horizontalScrollBar()->setPageStep(viewport()->width()); -
1439 horizontalScrollBar()->setRange(0, contentsSize.width() - viewport()->width()); -
1440}
executed: }
Execution Count:1121
1121
1441 -
1442void QCommonListViewBase::updateVerticalScrollBar(const QSize &step) -
1443{ -
1444 verticalScrollBar()->setSingleStep(step.height() + spacing()); -
1445 verticalScrollBar()->setPageStep(viewport()->height()); -
1446 verticalScrollBar()->setRange(0, contentsSize.height() - viewport()->height()); -
1447}
executed: }
Execution Count:189
189
1448 -
1449void QCommonListViewBase::scrollContentsBy(int dx, int dy, bool ) -
1450{ -
1451 dd->scrollContentsBy(isRightToLeft() ? -dx : dx, dy); -
1452}
executed: }
Execution Count:445
445
1453 -
1454int QCommonListViewBase::verticalScrollToValue(int , QListView::ScrollHint hint, -
1455 bool above, bool below, const QRect &area, const QRect &rect) const -
1456{ -
1457 int verticalValue = verticalScrollBar()->value(); -
1458 QRect adjusted = rect.adjusted(-spacing(), -spacing(), spacing(), spacing()); -
1459 if (hint == QListView::PositionAtTop || above)
partially evaluated: hint == QListView::PositionAtTop
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:36
evaluated: above
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:31
0-36
1460 verticalValue += adjusted.top();
executed: verticalValue += adjusted.top();
Execution Count:5
5
1461 else if (hint == QListView::PositionAtBottom || below)
partially evaluated: hint == QListView::PositionAtBottom
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:31
partially evaluated: below
TRUEFALSE
yes
Evaluation Count:31
no
Evaluation Count:0
0-31
1462 verticalValue += qMin(adjusted.top(), adjusted.bottom() - area.height() + 1);
executed: verticalValue += qMin(adjusted.top(), adjusted.bottom() - area.height() + 1);
Execution Count:31
31
1463 else if (hint == QListView::PositionAtCenter)
never evaluated: hint == QListView::PositionAtCenter
0
1464 verticalValue += adjusted.top() - ((area.height() - adjusted.height()) / 2);
never executed: verticalValue += adjusted.top() - ((area.height() - adjusted.height()) / 2);
0
1465 return verticalValue;
executed: return verticalValue;
Execution Count:36
36
1466} -
1467 -
1468int QCommonListViewBase::horizontalOffset() const -
1469{ -
1470 return (isRightToLeft() ? horizontalScrollBar()->maximum() - horizontalScrollBar()->value() : horizontalScrollBar()->value());
executed: return (isRightToLeft() ? horizontalScrollBar()->maximum() - horizontalScrollBar()->value() : horizontalScrollBar()->value());
Execution Count:17361
17361
1471} -
1472 -
1473int QCommonListViewBase::horizontalScrollToValue(const int , QListView::ScrollHint hint, -
1474 bool leftOf, bool rightOf, const QRect &area, const QRect &rect) const -
1475{ -
1476 int horizontalValue = horizontalScrollBar()->value(); -
1477 if (isRightToLeft()) {
partially evaluated: isRightToLeft()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
1478 if (hint == QListView::PositionAtCenter) {
never evaluated: hint == QListView::PositionAtCenter
0
1479 horizontalValue += ((area.width() - rect.width()) / 2) - rect.left(); -
1480 } else {
never executed: }
0
1481 if (leftOf)
never evaluated: leftOf
0
1482 horizontalValue -= rect.left();
never executed: horizontalValue -= rect.left();
0
1483 else if (rightOf)
never evaluated: rightOf
0
1484 horizontalValue += qMin(rect.left(), area.width() - rect.right());
never executed: horizontalValue += qMin(rect.left(), area.width() - rect.right());
0
1485 } -
1486 } else { -
1487 if (hint == QListView::PositionAtCenter) {
partially evaluated: hint == QListView::PositionAtCenter
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
1488 horizontalValue += rect.left() - ((area.width()- rect.width()) / 2); -
1489 } else {
never executed: }
0
1490 if (leftOf)
partially evaluated: leftOf
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
1491 horizontalValue += rect.left();
never executed: horizontalValue += rect.left();
0
1492 else if (rightOf)
partially evaluated: rightOf
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
1493 horizontalValue += qMin(rect.left(), rect.right() - area.width());
never executed: horizontalValue += qMin(rect.left(), rect.right() - area.width());
0
1494 } -
1495 } -
1496 return horizontalValue;
executed: return horizontalValue;
Execution Count:2
2
1497} -
1498 -
1499 -
1500 -
1501 -
1502 -
1503 -
1504void QListModeViewBase::paintDragDrop(QPainter *painter) -
1505{ -
1506 -
1507 -
1508 dd->paintDropIndicator(painter); -
1509}
executed: }
Execution Count:1018
1018
1510 -
1511QAbstractItemView::DropIndicatorPosition QListModeViewBase::position(const QPoint &pos, const QRect &rect, const QModelIndex &index) const -
1512{ -
1513 QAbstractItemView::DropIndicatorPosition r = QAbstractItemView::OnViewport; -
1514 if (!dd->overwrite) {
never evaluated: !dd->overwrite
0
1515 const int margin = 2; -
1516 if (pos.x() - rect.left() < margin) {
never evaluated: pos.x() - rect.left() < margin
0
1517 r = QAbstractItemView::AboveItem; -
1518 } else if (rect.right() - pos.x() < margin) {
never executed: }
never evaluated: rect.right() - pos.x() < margin
0
1519 r = QAbstractItemView::BelowItem; -
1520 } else if (rect.contains(pos, true)) {
never executed: }
never evaluated: rect.contains(pos, true)
0
1521 r = QAbstractItemView::OnItem; -
1522 }
never executed: }
0
1523 } else { -
1524 QRect touchingRect = rect; -
1525 touchingRect.adjust(-1, -1, 1, 1); -
1526 if (touchingRect.contains(pos, false)) {
never evaluated: touchingRect.contains(pos, false)
0
1527 r = QAbstractItemView::OnItem; -
1528 }
never executed: }
0
1529 }
never executed: }
0
1530 -
1531 if (r == QAbstractItemView::OnItem && (!(dd->model->flags(index) & Qt::ItemIsDropEnabled)))
never evaluated: r == QAbstractItemView::OnItem
never evaluated: (!(dd->model->flags(index) & Qt::ItemIsDropEnabled))
0
1532 r = pos.x() < rect.center().x() ? QAbstractItemView::AboveItem : QAbstractItemView::BelowItem;
never executed: r = pos.x() < rect.center().x() ? QAbstractItemView::AboveItem : QAbstractItemView::BelowItem;
never evaluated: pos.x() < rect.center().x()
0
1533 -
1534 return r;
never executed: return r;
0
1535} -
1536 -
1537void QListModeViewBase::dragMoveEvent(QDragMoveEvent *event) -
1538{ -
1539 if (qq->dragDropMode() == QAbstractItemView::InternalMove
never evaluated: qq->dragDropMode() == QAbstractItemView::InternalMove
0
1540 && (event->source() != qq || !(event->possibleActions() & Qt::MoveAction)))
never evaluated: event->source() != qq
never evaluated: !(event->possibleActions() & Qt::MoveAction)
0
1541 return;
never executed: return;
0
1542 -
1543 -
1544 event->ignore(); -
1545 -
1546 -
1547 QPoint p = event->pos(); -
1548 QRect rect(p.x() + horizontalOffset(), p.y() + verticalOffset(), 1, 1); -
1549 rect.adjust(-dd->spacing(), -dd->spacing(), dd->spacing(), dd->spacing()); -
1550 const QVector<QModelIndex> intersectVector = dd->intersectingSet(rect); -
1551 QModelIndex index = intersectVector.count() > 0
never evaluated: intersectVector.count() > 0
0
1552 ? intersectVector.last() : QModelIndex(); -
1553 dd->hover = index; -
1554 if (!dd->droppingOnItself(event, index)
never evaluated: !dd->droppingOnItself(event, index)
0
1555 && dd->canDecode(event)) {
never evaluated: dd->canDecode(event)
0
1556 -
1557 if (index.isValid() && dd->showDropIndicator) {
never evaluated: index.isValid()
never evaluated: dd->showDropIndicator
0
1558 QRect rect = qq->visualRect(index); -
1559 dd->dropIndicatorPosition = position(event->pos(), rect, index); -
1560 -
1561 switch (dd->dropIndicatorPosition) { -
1562 case QAbstractItemView::AboveItem: -
1563 if (dd->isIndexDropEnabled(index.parent())) {
never evaluated: dd->isIndexDropEnabled(index.parent())
0
1564 dd->dropIndicatorRect = QRect(rect.left()-dd->spacing(), rect.top(), 0, rect.height()); -
1565 event->accept(); -
1566 } else {
never executed: }
0
1567 dd->dropIndicatorRect = QRect(); -
1568 }
never executed: }
0
1569 break;
never executed: break;
0
1570 case QAbstractItemView::BelowItem: -
1571 if (dd->isIndexDropEnabled(index.parent())) {
never evaluated: dd->isIndexDropEnabled(index.parent())
0
1572 dd->dropIndicatorRect = QRect(rect.right()+dd->spacing(), rect.top(), 0, rect.height()); -
1573 event->accept(); -
1574 } else {
never executed: }
0
1575 dd->dropIndicatorRect = QRect(); -
1576 }
never executed: }
0
1577 break;
never executed: break;
0
1578 case QAbstractItemView::OnItem: -
1579 if (dd->isIndexDropEnabled(index)) {
never evaluated: dd->isIndexDropEnabled(index)
0
1580 dd->dropIndicatorRect = rect; -
1581 event->accept(); -
1582 } else {
never executed: }
0
1583 dd->dropIndicatorRect = QRect(); -
1584 }
never executed: }
0
1585 break;
never executed: break;
0
1586 case QAbstractItemView::OnViewport: -
1587 dd->dropIndicatorRect = QRect(); -
1588 if (dd->isIndexDropEnabled(qq->rootIndex())) {
never evaluated: dd->isIndexDropEnabled(qq->rootIndex())
0
1589 event->accept(); -
1590 }
never executed: }
0
1591 break;
never executed: break;
0
1592 } -
1593 } else {
never executed: }
0
1594 dd->dropIndicatorRect = QRect(); -
1595 dd->dropIndicatorPosition = QAbstractItemView::OnViewport; -
1596 if (dd->isIndexDropEnabled(qq->rootIndex())) {
never evaluated: dd->isIndexDropEnabled(qq->rootIndex())
0
1597 event->accept(); -
1598 }
never executed: }
0
1599 }
never executed: }
0
1600 dd->viewport->update(); -
1601 }
never executed: }
0
1602 -
1603 if (dd->shouldAutoScroll(event->pos()))
never evaluated: dd->shouldAutoScroll(event->pos())
0
1604 qq->startAutoScroll();
never executed: qq->startAutoScroll();
0
1605}
never executed: }
0
1606bool QListModeViewBase::dropOn(QDropEvent *event, int *dropRow, int *dropCol, QModelIndex *dropIndex) -
1607{ -
1608 if (event->isAccepted())
never evaluated: event->isAccepted()
0
1609 return false;
never executed: return false;
0
1610 -
1611 QModelIndex index; -
1612 if (dd->viewport->rect().contains(event->pos())) {
never evaluated: dd->viewport->rect().contains(event->pos())
0
1613 -
1614 QPoint p = event->pos(); -
1615 QRect rect(p.x() + horizontalOffset(), p.y() + verticalOffset(), 1, 1); -
1616 rect.adjust(-dd->spacing(), -dd->spacing(), dd->spacing(), dd->spacing()); -
1617 const QVector<QModelIndex> intersectVector = dd->intersectingSet(rect); -
1618 index = intersectVector.count() > 0
never evaluated: intersectVector.count() > 0
0
1619 ? intersectVector.last() : QModelIndex(); -
1620 if (!index.isValid())
never evaluated: !index.isValid()
0
1621 index = dd->root;
never executed: index = dd->root;
0
1622 }
never executed: }
0
1623 -
1624 -
1625 if (dd->model->supportedDropActions() & event->dropAction()) {
never evaluated: dd->model->supportedDropActions() & event->dropAction()
0
1626 int row = -1; -
1627 int col = -1; -
1628 if (index != dd->root) {
never evaluated: index != dd->root
0
1629 dd->dropIndicatorPosition = position(event->pos(), qq->visualRect(index), index); -
1630 switch (dd->dropIndicatorPosition) { -
1631 case QAbstractItemView::AboveItem: -
1632 row = index.row(); -
1633 col = index.column(); -
1634 index = index.parent(); -
1635 break;
never executed: break;
0
1636 case QAbstractItemView::BelowItem: -
1637 row = index.row() + 1; -
1638 col = index.column(); -
1639 index = index.parent(); -
1640 break;
never executed: break;
0
1641 case QAbstractItemView::OnItem: -
1642 case QAbstractItemView::OnViewport: -
1643 break;
never executed: break;
0
1644 } -
1645 } else {
never executed: }
0
1646 dd->dropIndicatorPosition = QAbstractItemView::OnViewport; -
1647 }
never executed: }
0
1648 *dropIndex = index; -
1649 *dropRow = row; -
1650 *dropCol = col; -
1651 if (!dd->droppingOnItself(event, index))
never evaluated: !dd->droppingOnItself(event, index)
0
1652 return true;
never executed: return true;
0
1653 }
never executed: }
0
1654 return false;
never executed: return false;
0
1655} -
1656 -
1657 -
1658 -
1659void QListModeViewBase::updateVerticalScrollBar(const QSize &step) -
1660{ -
1661 if (verticalScrollMode() == QAbstractItemView::ScrollPerItem
evaluated: verticalScrollMode() == QAbstractItemView::ScrollPerItem
TRUEFALSE
yes
Evaluation Count:1240
yes
Evaluation Count:10
10-1240
1662 && ((flow() == QListView::TopToBottom && !isWrapping())
evaluated: flow() == QListView::TopToBottom
TRUEFALSE
yes
Evaluation Count:1200
yes
Evaluation Count:40
evaluated: !isWrapping()
TRUEFALSE
yes
Evaluation Count:1083
yes
Evaluation Count:117
40-1200
1663 || (flow() == QListView::LeftToRight && isWrapping()))) {
evaluated: flow() == QListView::LeftToRight
TRUEFALSE
yes
Evaluation Count:40
yes
Evaluation Count:117
evaluated: isWrapping()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:37
3-117
1664 const int steps = (flow() == QListView::TopToBottom ? scrollValueMap : segmentPositions).count() - 1;
evaluated: flow() == QListView::TopToBottom
TRUEFALSE
yes
Evaluation Count:1083
yes
Evaluation Count:3
3-1083
1665 if (steps > 0) {
partially evaluated: steps > 0
TRUEFALSE
yes
Evaluation Count:1086
no
Evaluation Count:0
0-1086
1666 const int pageSteps = perItemScrollingPageSteps(viewport()->height(), contentsSize.height(), isWrapping()); -
1667 verticalScrollBar()->setSingleStep(1); -
1668 verticalScrollBar()->setPageStep(pageSteps); -
1669 verticalScrollBar()->setRange(0, steps - pageSteps); -
1670 } else {
executed: }
Execution Count:1086
1086
1671 verticalScrollBar()->setRange(0, 0); -
1672 }
never executed: }
0
1673 -
1674 -
1675 } else { -
1676 QCommonListViewBase::updateVerticalScrollBar(step); -
1677 }
executed: }
Execution Count:164
164
1678} -
1679 -
1680void QListModeViewBase::updateHorizontalScrollBar(const QSize &step) -
1681{ -
1682 if (horizontalScrollMode() == QAbstractItemView::ScrollPerItem
evaluated: horizontalScrollMode() == QAbstractItemView::ScrollPerItem
TRUEFALSE
yes
Evaluation Count:1238
yes
Evaluation Count:12
12-1238
1683 && ((flow() == QListView::TopToBottom && isWrapping())
evaluated: flow() == QListView::TopToBottom
TRUEFALSE
yes
Evaluation Count:1198
yes
Evaluation Count:40
evaluated: isWrapping()
TRUEFALSE
yes
Evaluation Count:117
yes
Evaluation Count:1081
40-1198
1684 || (flow() == QListView::LeftToRight && !isWrapping()))) {
evaluated: flow() == QListView::LeftToRight
TRUEFALSE
yes
Evaluation Count:40
yes
Evaluation Count:1081
evaluated: !isWrapping()
TRUEFALSE
yes
Evaluation Count:37
yes
Evaluation Count:3
3-1081
1685 int steps = (flow() == QListView::TopToBottom ? segmentPositions : scrollValueMap).count() - 1;
evaluated: flow() == QListView::TopToBottom
TRUEFALSE
yes
Evaluation Count:117
yes
Evaluation Count:37
37-117
1686 if (steps > 0) {
partially evaluated: steps > 0
TRUEFALSE
yes
Evaluation Count:154
no
Evaluation Count:0
0-154
1687 const int pageSteps = perItemScrollingPageSteps(viewport()->width(), contentsSize.width(), isWrapping()); -
1688 horizontalScrollBar()->setSingleStep(1); -
1689 horizontalScrollBar()->setPageStep(pageSteps); -
1690 horizontalScrollBar()->setRange(0, steps - pageSteps); -
1691 } else {
executed: }
Execution Count:154
154
1692 horizontalScrollBar()->setRange(0, 0); -
1693 }
never executed: }
0
1694 } else { -
1695 QCommonListViewBase::updateHorizontalScrollBar(step); -
1696 }
executed: }
Execution Count:1096
1096
1697} -
1698 -
1699int QListModeViewBase::verticalScrollToValue(int index, QListView::ScrollHint hint, -
1700 bool above, bool below, const QRect &area, const QRect &rect) const -
1701{ -
1702 if (verticalScrollMode() == QAbstractItemView::ScrollPerItem) {
evaluated: verticalScrollMode() == QAbstractItemView::ScrollPerItem
TRUEFALSE
yes
Evaluation Count:251
yes
Evaluation Count:34
34-251
1703 int value; -
1704 if (scrollValueMap.isEmpty()) {
partially evaluated: scrollValueMap.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:251
0-251
1705 value = 0; -
1706 } else {
never executed: }
0
1707 int scrollBarValue = verticalScrollBar()->value(); -
1708 int numHidden = 0; -
1709 for (int i = 0; i < flowPositions.count() - 1 && i <= scrollBarValue; ++i)
evaluated: i < flowPositions.count() - 1
TRUEFALSE
yes
Evaluation Count:2534
yes
Evaluation Count:2
evaluated: i <= scrollBarValue
TRUEFALSE
yes
Evaluation Count:2285
yes
Evaluation Count:249
2-2534
1710 if (isHidden(i))
evaluated: isHidden(i)
TRUEFALSE
yes
Evaluation Count:528
yes
Evaluation Count:1757
528-1757
1711 ++numHidden;
executed: ++numHidden;
Execution Count:528
528
1712 value = qBound(0, scrollValueMap.at(verticalScrollBar()->value()) - numHidden, flowPositions.count() - 1); -
1713 }
executed: }
Execution Count:251
251
1714 if (above)
evaluated: above
TRUEFALSE
yes
Evaluation Count:87
yes
Evaluation Count:164
87-164
1715 hint = QListView::PositionAtTop;
executed: hint = QListView::PositionAtTop;
Execution Count:87
87
1716 else if (below)
evaluated: below
TRUEFALSE
yes
Evaluation Count:151
yes
Evaluation Count:13
13-151
1717 hint = QListView::PositionAtBottom;
executed: hint = QListView::PositionAtBottom;
Execution Count:151
151
1718 if (hint == QListView::EnsureVisible)
evaluated: hint == QListView::EnsureVisible
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:249
2-249
1719 return value;
executed: return value;
Execution Count:2
2
1720 -
1721 return perItemScrollToValue(index, value, area.height(), hint, Qt::Vertical, isWrapping(), rect.height());
executed: return perItemScrollToValue(index, value, area.height(), hint, Qt::Vertical, isWrapping(), rect.height());
Execution Count:249
249
1722 } -
1723 -
1724 return QCommonListViewBase::verticalScrollToValue(index, hint, above, below, area, rect);
executed: return QCommonListViewBase::verticalScrollToValue(index, hint, above, below, area, rect);
Execution Count:34
34
1725} -
1726 -
1727int QListModeViewBase::horizontalOffset() const -
1728{ -
1729 if (horizontalScrollMode() == QAbstractItemView::ScrollPerItem) {
evaluated: horizontalScrollMode() == QAbstractItemView::ScrollPerItem
TRUEFALSE
yes
Evaluation Count:21670
yes
Evaluation Count:2552
2552-21670
1730 if (isWrapping()) {
evaluated: isWrapping()
TRUEFALSE
yes
Evaluation Count:3405
yes
Evaluation Count:18265
3405-18265
1731 if (flow() == QListView::TopToBottom && !segmentPositions.isEmpty()) {
evaluated: flow() == QListView::TopToBottom
TRUEFALSE
yes
Evaluation Count:2930
yes
Evaluation Count:475
evaluated: !segmentPositions.isEmpty()
TRUEFALSE
yes
Evaluation Count:2897
yes
Evaluation Count:33
33-2930
1732 const int max = segmentPositions.count() - 1; -
1733 int currentValue = qBound(0, horizontalScrollBar()->value(), max); -
1734 int position = segmentPositions.at(currentValue); -
1735 int maximumValue = qBound(0, horizontalScrollBar()->maximum(), max); -
1736 int maximum = segmentPositions.at(maximumValue); -
1737 return (isRightToLeft() ? maximum - position : position);
executed: return (isRightToLeft() ? maximum - position : position);
Execution Count:2897
2897
1738 } -
1739 } else if (flow() == QListView::LeftToRight && !flowPositions.isEmpty()) {
executed: }
Execution Count:508
evaluated: flow() == QListView::LeftToRight
TRUEFALSE
yes
Evaluation Count:4668
yes
Evaluation Count:13597
evaluated: !flowPositions.isEmpty()
TRUEFALSE
yes
Evaluation Count:4645
yes
Evaluation Count:23
23-13597
1740 int position = flowPositions.at(scrollValueMap.at(horizontalScrollBar()->value())); -
1741 int maximum = flowPositions.at(scrollValueMap.at(horizontalScrollBar()->maximum())); -
1742 return (isRightToLeft() ? maximum - position : position);
executed: return (isRightToLeft() ? maximum - position : position);
Execution Count:4645
4645
1743 } -
1744 } -
1745 return QCommonListViewBase::horizontalOffset();
executed: return QCommonListViewBase::horizontalOffset();
Execution Count:16680
16680
1746} -
1747 -
1748int QListModeViewBase::verticalOffset() const -
1749{ -
1750 if (verticalScrollMode() == QAbstractItemView::ScrollPerItem) {
evaluated: verticalScrollMode() == QAbstractItemView::ScrollPerItem
TRUEFALSE
yes
Evaluation Count:21743
yes
Evaluation Count:2479
2479-21743
1751 if (isWrapping()) {
evaluated: isWrapping()
TRUEFALSE
yes
Evaluation Count:3405
yes
Evaluation Count:18338
3405-18338
1752 if (flow() == QListView::LeftToRight && !segmentPositions.isEmpty()) {
evaluated: flow() == QListView::LeftToRight
TRUEFALSE
yes
Evaluation Count:475
yes
Evaluation Count:2930
partially evaluated: !segmentPositions.isEmpty()
TRUEFALSE
yes
Evaluation Count:475
no
Evaluation Count:0
0-2930
1753 int value = verticalScrollBar()->value(); -
1754 if (value >= segmentPositions.count())
partially evaluated: value >= segmentPositions.count()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:475
0-475
1755 return 0;
never executed: return 0;
0
1756 return segmentPositions.at(value) - spacing();
executed: return segmentPositions.at(value) - spacing();
Execution Count:475
475
1757 } -
1758 } else if (flow() == QListView::TopToBottom && !flowPositions.isEmpty()) {
executed: }
Execution Count:2930
evaluated: flow() == QListView::TopToBottom
TRUEFALSE
yes
Evaluation Count:13670
yes
Evaluation Count:4668
evaluated: !flowPositions.isEmpty()
TRUEFALSE
yes
Evaluation Count:13094
yes
Evaluation Count:576
576-13670
1759 int value = verticalScrollBar()->value(); -
1760 if (value > scrollValueMap.count())
partially evaluated: value > scrollValueMap.count()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13094
0-13094
1761 return 0;
never executed: return 0;
0
1762 return flowPositions.at(scrollValueMap.at(value)) - spacing();
executed: return flowPositions.at(scrollValueMap.at(value)) - spacing();
Execution Count:13094
13094
1763 } -
1764 } -
1765 return QCommonListViewBase::verticalOffset();
executed: return QCommonListViewBase::verticalOffset();
Execution Count:10653
10653
1766} -
1767 -
1768int QListModeViewBase::horizontalScrollToValue(int index, QListView::ScrollHint hint, -
1769 bool leftOf, bool rightOf, const QRect &area, const QRect &rect) const -
1770{ -
1771 if (horizontalScrollMode() != QAbstractItemView::ScrollPerItem)
partially evaluated: horizontalScrollMode() != QAbstractItemView::ScrollPerItem
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:140
0-140
1772 return QCommonListViewBase::horizontalScrollToValue(index, hint, leftOf, rightOf, area, rect);
never executed: return QCommonListViewBase::horizontalScrollToValue(index, hint, leftOf, rightOf, area, rect);
0
1773 -
1774 int value; -
1775 if (scrollValueMap.isEmpty())
partially evaluated: scrollValueMap.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:140
0-140
1776 value = 0;
never executed: value = 0;
0
1777 else -
1778 value = qBound(0, scrollValueMap.at(horizontalScrollBar()->value()), flowPositions.count() - 1);
executed: value = qBound(0, scrollValueMap.at(horizontalScrollBar()->value()), flowPositions.count() - 1);
Execution Count:140
140
1779 if (leftOf)
evaluated: leftOf
TRUEFALSE
yes
Evaluation Count:72
yes
Evaluation Count:68
68-72
1780 hint = QListView::PositionAtTop;
executed: hint = QListView::PositionAtTop;
Execution Count:72
72
1781 else if (rightOf)
evaluated: rightOf
TRUEFALSE
yes
Evaluation Count:67
yes
Evaluation Count:1
1-67
1782 hint = QListView::PositionAtBottom;
executed: hint = QListView::PositionAtBottom;
Execution Count:67
67
1783 if (hint == QListView::EnsureVisible)
partially evaluated: hint == QListView::EnsureVisible
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:140
0-140
1784 return value;
never executed: return value;
0
1785 -
1786 return perItemScrollToValue(index, value, area.width(), hint, Qt::Horizontal, isWrapping(), rect.width());
executed: return perItemScrollToValue(index, value, area.width(), hint, Qt::Horizontal, isWrapping(), rect.width());
Execution Count:140
140
1787} -
1788 -
1789void QListModeViewBase::scrollContentsBy(int dx, int dy, bool scrollElasticBand) -
1790{ -
1791 -
1792 const int verticalValue = verticalScrollBar()->value(); -
1793 const int horizontalValue = horizontalScrollBar()->value(); -
1794 const bool vertical = (verticalScrollMode() == QAbstractItemView::ScrollPerItem); -
1795 const bool horizontal = (horizontalScrollMode() == QAbstractItemView::ScrollPerItem); -
1796 -
1797 if (isWrapping()) {
evaluated: isWrapping()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:439
4-439
1798 if (segmentPositions.isEmpty())
partially evaluated: segmentPositions.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
1799 return;
never executed: return;
0
1800 const int max = segmentPositions.count() - 1; -
1801 if (horizontal && flow() == QListView::TopToBottom && dx != 0) {
partially evaluated: horizontal
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
partially evaluated: flow() == QListView::TopToBottom
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
evaluated: dx != 0
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:1
0-4
1802 int currentValue = qBound(0, horizontalValue, max); -
1803 int previousValue = qBound(0, currentValue + dx, max); -
1804 int currentCoordinate = segmentPositions.at(currentValue) - spacing(); -
1805 int previousCoordinate = segmentPositions.at(previousValue) - spacing(); -
1806 dx = previousCoordinate - currentCoordinate; -
1807 } else if (vertical && flow() == QListView::LeftToRight && dy != 0) {
executed: }
Execution Count:3
partially evaluated: vertical
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
partially evaluated: flow() == QListView::LeftToRight
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
never evaluated: dy != 0
0-3
1808 int currentValue = qBound(0, verticalValue, max); -
1809 int previousValue = qBound(0, currentValue + dy, max); -
1810 int currentCoordinate = segmentPositions.at(currentValue) - spacing(); -
1811 int previousCoordinate = segmentPositions.at(previousValue) - spacing(); -
1812 dy = previousCoordinate - currentCoordinate; -
1813 }
never executed: }
0
1814 } else { -
1815 if (flowPositions.isEmpty())
partially evaluated: flowPositions.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:439
0-439
1816 return;
never executed: return;
0
1817 const int max = scrollValueMap.count() - 1; -
1818 if (vertical && flow() == QListView::TopToBottom && dy != 0) {
evaluated: vertical
TRUEFALSE
yes
Evaluation Count:403
yes
Evaluation Count:36
evaluated: flow() == QListView::TopToBottom
TRUEFALSE
yes
Evaluation Count:255
yes
Evaluation Count:148
partially evaluated: dy != 0
TRUEFALSE
yes
Evaluation Count:255
no
Evaluation Count:0
0-403
1819 int currentValue = qBound(0, verticalValue, max); -
1820 int previousValue = qBound(0, currentValue + dy, max); -
1821 int currentCoordinate = flowPositions.at(scrollValueMap.at(currentValue)); -
1822 int previousCoordinate = flowPositions.at(scrollValueMap.at(previousValue)); -
1823 dy = previousCoordinate - currentCoordinate; -
1824 } else if (horizontal && flow() == QListView::LeftToRight && dx != 0) {
executed: }
Execution Count:255
evaluated: horizontal
TRUEFALSE
yes
Evaluation Count:148
yes
Evaluation Count:36
partially evaluated: flow() == QListView::LeftToRight
TRUEFALSE
yes
Evaluation Count:148
no
Evaluation Count:0
partially evaluated: dx != 0
TRUEFALSE
yes
Evaluation Count:148
no
Evaluation Count:0
0-255
1825 int currentValue = qBound(0, horizontalValue, max); -
1826 int previousValue = qBound(0, currentValue + dx, max); -
1827 int currentCoordinate = flowPositions.at(scrollValueMap.at(currentValue)); -
1828 int previousCoordinate = flowPositions.at(scrollValueMap.at(previousValue)); -
1829 dx = previousCoordinate - currentCoordinate; -
1830 }
executed: }
Execution Count:148
148
1831 } -
1832 QCommonListViewBase::scrollContentsBy(dx, dy, scrollElasticBand); -
1833}
executed: }
Execution Count:443
443
1834 -
1835bool QListModeViewBase::doBatchedItemLayout(const QListViewLayoutInfo &info, int max) -
1836{ -
1837 doStaticLayout(info); -
1838 if (batchStartRow > max) {
evaluated: batchStartRow > max
TRUEFALSE
yes
Evaluation Count:936
yes
Evaluation Count:1
1-936
1839 flowPositions.resize(flowPositions.count()); -
1840 segmentPositions.resize(segmentPositions.count()); -
1841 segmentStartRows.resize(segmentStartRows.count()); -
1842 return true;
executed: return true;
Execution Count:936
936
1843 } -
1844 return false;
executed: return false;
Execution Count:1
1
1845} -
1846 -
1847QListViewItem QListModeViewBase::indexToListViewItem(const QModelIndex &index) const -
1848{ -
1849 if (flowPositions.isEmpty()
evaluated: flowPositions.isEmpty()
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:19593
6-19593
1850 || segmentPositions.isEmpty()
partially evaluated: segmentPositions.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:19593
0-19593
1851 || index.row() >= flowPositions.count())
partially evaluated: index.row() >= flowPositions.count()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:19593
0-19593
1852 return QListViewItem();
executed: return QListViewItem();
Execution Count:6
6
1853 -
1854 const int segment = qBinarySearch<int>(segmentStartRows, index.row(), -
1855 0, segmentStartRows.count() - 1); -
1856 -
1857 -
1858 QStyleOptionViewItem options = viewOptions(); -
1859 options.rect.setSize(contentsSize); -
1860 QSize size = (uniformItemSizes() && cachedItemSize().isValid())
evaluated: uniformItemSizes()
TRUEFALSE
yes
Evaluation Count:493
yes
Evaluation Count:19100
partially evaluated: cachedItemSize().isValid()
TRUEFALSE
yes
Evaluation Count:493
no
Evaluation Count:0
0-19100
1861 ? cachedItemSize() : itemSize(options, index); -
1862 -
1863 QPoint pos; -
1864 if (flow() == QListView::LeftToRight) {
evaluated: flow() == QListView::LeftToRight
TRUEFALSE
yes
Evaluation Count:4474
yes
Evaluation Count:15119
4474-15119
1865 pos.setX(flowPositions.at(index.row())); -
1866 pos.setY(segmentPositions.at(segment)); -
1867 } else {
executed: }
Execution Count:4474
4474
1868 pos.setY(flowPositions.at(index.row())); -
1869 pos.setX(segmentPositions.at(segment)); -
1870 if (isWrapping()) {
evaluated: isWrapping()
TRUEFALSE
yes
Evaluation Count:2664
yes
Evaluation Count:12455
2664-12455
1871 int right = (segment + 1 >= segmentPositions.count()
partially evaluated: segment + 1 >= segmentPositions.count()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2664
0-2664
1872 ? contentsSize.width() -
1873 : segmentPositions.at(segment + 1)); -
1874 size.setWidth(right - pos.x()); -
1875 } else {
executed: }
Execution Count:2664
2664
1876 size.setWidth(qMax(size.width(), viewport()->width() - 2 * spacing())); -
1877 }
executed: }
Execution Count:12455
12455
1878 } -
1879 -
1880 return QListViewItem(QRect(pos, size), index.row());
executed: return QListViewItem(QRect(pos, size), index.row());
Execution Count:19593
19593
1881} -
1882 -
1883QPoint QListModeViewBase::initStaticLayout(const QListViewLayoutInfo &info) -
1884{ -
1885 int x, y; -
1886 if (info.first == 0) {
evaluated: info.first == 0
TRUEFALSE
yes
Evaluation Count:936
yes
Evaluation Count:1
1-936
1887 flowPositions.clear(); -
1888 segmentPositions.clear(); -
1889 segmentStartRows.clear(); -
1890 segmentExtents.clear(); -
1891 scrollValueMap.clear(); -
1892 x = info.bounds.left() + info.spacing; -
1893 y = info.bounds.top() + info.spacing; -
1894 segmentPositions.append(info.flow == QListView::LeftToRight ? y : x); -
1895 segmentStartRows.append(0); -
1896 } else if (info.wrap) {
executed: }
Execution Count:936
partially evaluated: info.wrap
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-936
1897 if (info.flow == QListView::LeftToRight) {
never evaluated: info.flow == QListView::LeftToRight
0
1898 x = batchSavedPosition; -
1899 y = segmentPositions.last(); -
1900 } else {
never executed: }
0
1901 x = segmentPositions.last(); -
1902 y = batchSavedPosition; -
1903 }
never executed: }
0
1904 } else { -
1905 if (info.flow == QListView::LeftToRight) {
partially evaluated: info.flow == QListView::LeftToRight
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
1906 x = batchSavedPosition; -
1907 y = info.bounds.top() + info.spacing; -
1908 } else {
never executed: }
0
1909 x = info.bounds.left() + info.spacing; -
1910 y = batchSavedPosition; -
1911 }
executed: }
Execution Count:1
1
1912 } -
1913 return QPoint(x, y);
executed: return QPoint(x, y);
Execution Count:937
937
1914} -
1915 -
1916 -
1917 -
1918 -
1919void QListModeViewBase::doStaticLayout(const QListViewLayoutInfo &info) -
1920{ -
1921 const bool useItemSize = !info.grid.isValid(); -
1922 const QPoint topLeft = initStaticLayout(info); -
1923 QStyleOptionViewItem option = viewOptions(); -
1924 option.rect = info.bounds; -
1925 option.rect.adjust(info.spacing, info.spacing, -info.spacing, -info.spacing); -
1926 -
1927 -
1928 -
1929 -
1930 -
1931 -
1932 -
1933 int segStartPosition; -
1934 int segEndPosition; -
1935 int deltaFlowPosition; -
1936 int deltaSegPosition; -
1937 int deltaSegHint; -
1938 int flowPosition; -
1939 int segPosition; -
1940 -
1941 if (info.flow == QListView::LeftToRight) {
evaluated: info.flow == QListView::LeftToRight
TRUEFALSE
yes
Evaluation Count:28
yes
Evaluation Count:909
28-909
1942 segStartPosition = info.bounds.left(); -
1943 segEndPosition = info.bounds.width(); -
1944 flowPosition = topLeft.x(); -
1945 segPosition = topLeft.y(); -
1946 deltaFlowPosition = info.grid.width(); -
1947 deltaSegPosition = useItemSize ? batchSavedDeltaSeg : info.grid.height();
evaluated: useItemSize
TRUEFALSE
yes
Evaluation Count:27
yes
Evaluation Count:1
1-27
1948 deltaSegHint = info.grid.height(); -
1949 } else {
executed: }
Execution Count:28
28
1950 segStartPosition = info.bounds.top(); -
1951 segEndPosition = info.bounds.height(); -
1952 flowPosition = topLeft.y(); -
1953 segPosition = topLeft.x(); -
1954 deltaFlowPosition = info.grid.height(); -
1955 deltaSegPosition = useItemSize ? batchSavedDeltaSeg : info.grid.width();
evaluated: useItemSize
TRUEFALSE
yes
Evaluation Count:908
yes
Evaluation Count:1
1-908
1956 deltaSegHint = info.grid.width(); -
1957 }
executed: }
Execution Count:909
909
1958 -
1959 for (int row = info.first; row <= info.last; ++row) {
evaluated: row <= info.last
TRUEFALSE
yes
Evaluation Count:36280
yes
Evaluation Count:937
937-36280
1960 if (isHidden(row)) {
evaluated: isHidden(row)
TRUEFALSE
yes
Evaluation Count:631
yes
Evaluation Count:35649
631-35649
1961 flowPositions.append(flowPosition); -
1962 } else {
executed: }
Execution Count:631
631
1963 -
1964 if (useItemSize) {
evaluated: useItemSize
TRUEFALSE
yes
Evaluation Count:35609
yes
Evaluation Count:40
40-35609
1965 QSize hint = itemSize(option, modelIndex(row)); -
1966 if (info.flow == QListView::LeftToRight) {
evaluated: info.flow == QListView::LeftToRight
TRUEFALSE
yes
Evaluation Count:852
yes
Evaluation Count:34757
852-34757
1967 deltaFlowPosition = hint.width() + info.spacing; -
1968 deltaSegHint = hint.height() + info.spacing; -
1969 } else {
executed: }
Execution Count:852
852
1970 deltaFlowPosition = hint.height() + info.spacing; -
1971 deltaSegHint = hint.width() + info.spacing; -
1972 }
executed: }
Execution Count:34757
34757
1973 } -
1974 -
1975 if (info.wrap && (flowPosition + deltaFlowPosition >= segEndPosition)) {
evaluated: info.wrap
TRUEFALSE
yes
Evaluation Count:15032
yes
Evaluation Count:20617
evaluated: (flowPosition + deltaFlowPosition >= segEndPosition)
TRUEFALSE
yes
Evaluation Count:925
yes
Evaluation Count:14107
925-20617
1976 segmentExtents.append(flowPosition); -
1977 flowPosition = info.spacing + segStartPosition; -
1978 segPosition += deltaSegPosition; -
1979 if (info.wrap)
partially evaluated: info.wrap
TRUEFALSE
yes
Evaluation Count:925
no
Evaluation Count:0
0-925
1980 segPosition += info.spacing;
executed: segPosition += info.spacing;
Execution Count:925
925
1981 segmentPositions.append(segPosition); -
1982 segmentStartRows.append(row); -
1983 deltaSegPosition = 0; -
1984 }
executed: }
Execution Count:925
925
1985 -
1986 scrollValueMap.append(flowPositions.count()); -
1987 flowPositions.append(flowPosition); -
1988 -
1989 deltaSegPosition = qMax(deltaSegHint, deltaSegPosition); -
1990 flowPosition += info.spacing + deltaFlowPosition; -
1991 }
executed: }
Execution Count:35649
35649
1992 } -
1993 -
1994 batchSavedPosition = flowPosition; -
1995 batchSavedDeltaSeg = deltaSegPosition; -
1996 batchStartRow = info.last + 1; -
1997 if (info.last == info.max)
evaluated: info.last == info.max
TRUEFALSE
yes
Evaluation Count:936
yes
Evaluation Count:1
1-936
1998 flowPosition -= info.spacing;
executed: flowPosition -= info.spacing;
Execution Count:936
936
1999 -
2000 QRect rect = info.bounds; -
2001 if (info.flow == QListView::LeftToRight) {
evaluated: info.flow == QListView::LeftToRight
TRUEFALSE
yes
Evaluation Count:28
yes
Evaluation Count:909
28-909
2002 rect.setRight(segmentPositions.count() == 1 ? flowPosition : info.bounds.right()); -
2003 rect.setBottom(segPosition + deltaSegPosition); -
2004 } else {
executed: }
Execution Count:28
28
2005 rect.setRight(segPosition + deltaSegPosition); -
2006 rect.setBottom(segmentPositions.count() == 1 ? flowPosition : info.bounds.bottom()); -
2007 }
executed: }
Execution Count:909
909
2008 contentsSize = QSize(rect.right(), rect.bottom()); -
2009 -
2010 if (info.last == info.max) {
evaluated: info.last == info.max
TRUEFALSE
yes
Evaluation Count:936
yes
Evaluation Count:1
1-936
2011 segmentExtents.append(flowPosition); -
2012 scrollValueMap.append(flowPositions.count()); -
2013 flowPositions.append(flowPosition); -
2014 segmentPositions.append(info.wrap ? segPosition + deltaSegPosition : 2147483647); -
2015 }
executed: }
Execution Count:936
936
2016 -
2017 QRect changedRect(topLeft, rect.bottomRight()); -
2018 if (clipRect().intersects(changedRect))
evaluated: clipRect().intersects(changedRect)
TRUEFALSE
yes
Evaluation Count:374
yes
Evaluation Count:563
374-563
2019 viewport()->update();
executed: viewport()->update();
Execution Count:374
374
2020}
executed: }
Execution Count:937
937
2021 -
2022 -
2023 -
2024 -
2025 -
2026 -
2027QVector<QModelIndex> QListModeViewBase::intersectingSet(const QRect &area) const -
2028{ -
2029 QVector<QModelIndex> ret; -
2030 int segStartPosition; -
2031 int segEndPosition; -
2032 int flowStartPosition; -
2033 int flowEndPosition; -
2034 if (flow() == QListView::LeftToRight) {
evaluated: flow() == QListView::LeftToRight
TRUEFALSE
yes
Evaluation Count:741
yes
Evaluation Count:2652
741-2652
2035 segStartPosition = area.top(); -
2036 segEndPosition = area.bottom(); -
2037 flowStartPosition = area.left(); -
2038 flowEndPosition = area.right(); -
2039 } else {
executed: }
Execution Count:741
741
2040 segStartPosition = area.left(); -
2041 segEndPosition = area.right(); -
2042 flowStartPosition = area.top(); -
2043 flowEndPosition = area.bottom(); -
2044 }
executed: }
Execution Count:2652
2652
2045 if (segmentPositions.count() < 2 || flowPositions.isEmpty())
evaluated: segmentPositions.count() < 2
TRUEFALSE
yes
Evaluation Count:83
yes
Evaluation Count:3310
partially evaluated: flowPositions.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3310
0-3310
2046 return ret;
executed: return ret;
Execution Count:83
83
2047 -
2048 const int segLast = segmentPositions.count() - 2; -
2049 int seg = qBinarySearch<int>(segmentPositions, segStartPosition, 0, segLast + 1); -
2050 for (; seg <= segLast && segmentPositions.at(seg) <= segEndPosition; ++seg) {
evaluated: seg <= segLast
TRUEFALSE
yes
Evaluation Count:3536
yes
Evaluation Count:3246
evaluated: segmentPositions.at(seg) <= segEndPosition
TRUEFALSE
yes
Evaluation Count:3472
yes
Evaluation Count:64
64-3536
2051 int first = segmentStartRows.at(seg); -
2052 int last = (seg < segLast ? segmentStartRows.at(seg + 1) : batchStartRow) - 1;
evaluated: seg < segLast
TRUEFALSE
yes
Evaluation Count:231
yes
Evaluation Count:3241
231-3241
2053 if (segmentExtents.at(seg) < flowStartPosition)
evaluated: segmentExtents.at(seg) < flowStartPosition
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:3461
11-3461
2054 continue;
executed: continue;
Execution Count:11
11
2055 int row = qBinarySearch<int>(flowPositions, flowStartPosition, first, last); -
2056 for (; row <= last && flowPositions.at(row) <= flowEndPosition; ++row) {
evaluated: row <= last
TRUEFALSE
yes
Evaluation Count:15243
yes
Evaluation Count:560
evaluated: flowPositions.at(row) <= flowEndPosition
TRUEFALSE
yes
Evaluation Count:12342
yes
Evaluation Count:2901
560-15243
2057 if (isHidden(row))
evaluated: isHidden(row)
TRUEFALSE
yes
Evaluation Count:1679
yes
Evaluation Count:10663
1679-10663
2058 continue;
executed: continue;
Execution Count:1679
1679
2059 QModelIndex index = modelIndex(row); -
2060 if (index.isValid())
partially evaluated: index.isValid()
TRUEFALSE
yes
Evaluation Count:10663
no
Evaluation Count:0
0-10663
2061 ret += index;
executed: ret += index;
Execution Count:10663
10663
2062 -
2063 -
2064 -
2065 -
2066 }
executed: }
Execution Count:10663
10663
2067 }
executed: }
Execution Count:3461
3461
2068 return ret;
executed: return ret;
Execution Count:3310
3310
2069} -
2070 -
2071void QListModeViewBase::dataChanged(const QModelIndex &, const QModelIndex &) -
2072{ -
2073 dd->doDelayedItemsLayout(); -
2074}
executed: }
Execution Count:3979
3979
2075 -
2076 -
2077QRect QListModeViewBase::mapToViewport(const QRect &rect) const -
2078{ -
2079 if (isWrapping())
evaluated: isWrapping()
TRUEFALSE
yes
Evaluation Count:3096
yes
Evaluation Count:15146
3096-15146
2080 return rect;
executed: return rect;
Execution Count:3096
3096
2081 -
2082 -
2083 QRect result = rect; -
2084 if (flow() == QListView::TopToBottom) {
evaluated: flow() == QListView::TopToBottom
TRUEFALSE
yes
Evaluation Count:11630
yes
Evaluation Count:3516
3516-11630
2085 result.setLeft(spacing()); -
2086 result.setWidth(qMax(rect.width(), qMax(contentsSize.width(), viewport()->width()) - 2 * spacing())); -
2087 } else {
executed: }
Execution Count:11630
11630
2088 result.setTop(spacing()); -
2089 result.setHeight(qMax(rect.height(), qMax(contentsSize.height(), viewport()->height()) - 2 * spacing())); -
2090 }
executed: }
Execution Count:3516
3516
2091 return result;
executed: return result;
Execution Count:15146
15146
2092} -
2093 -
2094int QListModeViewBase::perItemScrollingPageSteps(int length, int bounds, bool wrap) const -
2095{ -
2096 QVector<int> positions; -
2097 if (wrap)
evaluated: wrap
TRUEFALSE
yes
Evaluation Count:120
yes
Evaluation Count:1120
120-1120
2098 positions = segmentPositions;
executed: positions = segmentPositions;
Execution Count:120
120
2099 else if (!flowPositions.isEmpty()) {
evaluated: !flowPositions.isEmpty()
TRUEFALSE
yes
Evaluation Count:1118
yes
Evaluation Count:2
2-1118
2100 positions.reserve(scrollValueMap.size()); -
2101 for (QForeachContainer<__typeof__(scrollValueMap)> _container_(scrollValueMap); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (int itemShown = *_container_.i;; __extension__ ({--_container_.brk; break;})) -
2102 positions.append(flowPositions.at(itemShown));
executed: positions.append(flowPositions.at(itemShown));
Execution Count:29227
29227
2103 }
executed: }
Execution Count:1118
1118
2104 if (positions.isEmpty() || bounds <= length)
evaluated: positions.isEmpty()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1238
evaluated: bounds <= length
TRUEFALSE
yes
Evaluation Count:372
yes
Evaluation Count:866
2-1238
2105 return positions.count();
executed: return positions.count();
Execution Count:374
374
2106 if (uniformItemSizes()) {
evaluated: uniformItemSizes()
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:852
14-852
2107 for (int i = 1; i < positions.count(); ++i)
partially evaluated: i < positions.count()
TRUEFALSE
yes
Evaluation Count:14
no
Evaluation Count:0
0-14
2108 if (positions.at(i) > 0)
partially evaluated: positions.at(i) > 0
TRUEFALSE
yes
Evaluation Count:14
no
Evaluation Count:0
0-14
2109 return length / positions.at(i);
executed: return length / positions.at(i);
Execution Count:14
14
2110 return 0;
never executed: return 0;
0
2111 } -
2112 int pageSteps = 0; -
2113 int steps = positions.count() - 1; -
2114 int max = qMax(length, bounds); -
2115 int min = qMin(length, bounds); -
2116 int pos = min - (max - positions.last()); -
2117 -
2118 while (pos >= 0 && steps > 0) {
evaluated: pos >= 0
TRUEFALSE
yes
Evaluation Count:3691
yes
Evaluation Count:852
partially evaluated: steps > 0
TRUEFALSE
yes
Evaluation Count:3691
no
Evaluation Count:0
0-3691
2119 pos -= (positions.at(steps) - positions.at(steps - 1)); -
2120 if (pos >= 0)
evaluated: pos >= 0
TRUEFALSE
yes
Evaluation Count:2839
yes
Evaluation Count:852
852-2839
2121 ++pageSteps;
executed: ++pageSteps;
Execution Count:2839
2839
2122 --steps; -
2123 }
executed: }
Execution Count:3691
3691
2124 -
2125 -
2126 return qMax(pageSteps, 1);
executed: return qMax(pageSteps, 1);
Execution Count:852
852
2127} -
2128 -
2129int QListModeViewBase::perItemScrollToValue(int index, int scrollValue, int viewportSize, -
2130 QAbstractItemView::ScrollHint hint, -
2131 Qt::Orientation orientation, bool wrap, int itemExtent) const -
2132{ -
2133 if (index < 0)
partially evaluated: index < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:389
0-389
2134 return scrollValue;
never executed: return scrollValue;
0
2135 -
2136 itemExtent += spacing(); -
2137 QVector<int> visibleFlowPositions; -
2138 visibleFlowPositions.reserve(flowPositions.count() - 1); -
2139 for (int i = 0; i < flowPositions.count() - 1; i++) {
evaluated: i < flowPositions.count() - 1
TRUEFALSE
yes
Evaluation Count:17381
yes
Evaluation Count:389
389-17381
2140 if (!isHidden(i))
evaluated: !isHidden(i)
TRUEFALSE
yes
Evaluation Count:11102
yes
Evaluation Count:6279
6279-11102
2141 visibleFlowPositions.append(flowPositions.at(i));
executed: visibleFlowPositions.append(flowPositions.at(i));
Execution Count:11102
11102
2142 }
executed: }
Execution Count:17381
17381
2143 -
2144 if (!wrap) {
evaluated: !wrap
TRUEFALSE
yes
Evaluation Count:384
yes
Evaluation Count:5
5-384
2145 int topIndex = index; -
2146 const int bottomIndex = topIndex; -
2147 const int bottomCoordinate = visibleFlowPositions.at(index); -
2148 -
2149 while (topIndex > 0 &&
evaluated: topIndex > 0
TRUEFALSE
yes
Evaluation Count:2609
yes
Evaluation Count:95
95-2609
2150 (bottomCoordinate - visibleFlowPositions.at(topIndex - 1) + itemExtent) <= (viewportSize)) {
evaluated: (bottomCoordinate - visibleFlowPositions.at(topIndex - 1) + itemExtent) <= (viewportSize)
TRUEFALSE
yes
Evaluation Count:2320
yes
Evaluation Count:289
289-2320
2151 topIndex--; -
2152 }
executed: }
Execution Count:2320
2320
2153 -
2154 const int itemCount = bottomIndex - topIndex + 1; -
2155 switch (hint) { -
2156 case QAbstractItemView::PositionAtTop: -
2157 return index;
executed: return index;
Execution Count:170
170
2158 case QAbstractItemView::PositionAtBottom: -
2159 return index - itemCount + 1;
executed: return index - itemCount + 1;
Execution Count:214
214
2160 case QAbstractItemView::PositionAtCenter: -
2161 return index - (itemCount / 2);
never executed: return index - (itemCount / 2);
0
2162 default: -
2163 break;
never executed: break;
0
2164 } -
2165 } else {
never executed: }
0
2166 Qt::Orientation flowOrientation = (flow() == QListView::LeftToRight
partially evaluated: flow() == QListView::LeftToRight
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
2167 ? Qt::Horizontal : Qt::Vertical); -
2168 if (flowOrientation == orientation) {
evaluated: flowOrientation == orientation
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:3
2-3
2169 -
2170 return visibleFlowPositions.at(index);
executed: return visibleFlowPositions.at(index);
Execution Count:2
2
2171 } else if (!segmentStartRows.isEmpty()) {
partially evaluated: !segmentStartRows.isEmpty()
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
2172 int segment = qBinarySearch<int>(segmentStartRows, index, 0, segmentStartRows.count() - 1); -
2173 int leftSegment = segment; -
2174 const int rightSegment = leftSegment; -
2175 const int bottomCoordinate = segmentPositions.at(segment); -
2176 -
2177 while (leftSegment > scrollValue &&
evaluated: leftSegment > scrollValue
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1
1-2
2178 (bottomCoordinate - segmentPositions.at(leftSegment-1) + itemExtent) <= (viewportSize)) {
partially evaluated: (bottomCoordinate - segmentPositions.at(leftSegment-1) + itemExtent) <= (viewportSize)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
2179 leftSegment--; -
2180 }
never executed: }
0
2181 -
2182 const int segmentCount = rightSegment - leftSegment + 1; -
2183 switch (hint) { -
2184 case QAbstractItemView::PositionAtTop: -
2185 return segment;
executed: return segment;
Execution Count:1
1
2186 case QAbstractItemView::PositionAtBottom: -
2187 return segment - segmentCount + 1;
executed: return segment - segmentCount + 1;
Execution Count:2
2
2188 case QAbstractItemView::PositionAtCenter: -
2189 return segment - (segmentCount / 2);
never executed: return segment - (segmentCount / 2);
0
2190 default: -
2191 break;
never executed: break;
0
2192 } -
2193 }
never executed: }
0
2194 } -
2195 return scrollValue;
never executed: return scrollValue;
0
2196} -
2197 -
2198void QListModeViewBase::clear() -
2199{ -
2200 flowPositions.clear(); -
2201 segmentPositions.clear(); -
2202 segmentStartRows.clear(); -
2203 segmentExtents.clear(); -
2204 batchSavedPosition = 0; -
2205 batchStartRow = 0; -
2206 batchSavedDeltaSeg = 0; -
2207}
executed: }
Execution Count:22224
22224
2208 -
2209 -
2210 -
2211 -
2212 -
2213void QIconModeViewBase::setPositionForIndex(const QPoint &position, const QModelIndex &index) -
2214{ -
2215 if (index.row() >= items.count())
partially evaluated: index.row() >= items.count()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
2216 return;
never executed: return;
0
2217 const QSize oldContents = contentsSize; -
2218 qq->update(index); -
2219 moveItem(index.row(), position); -
2220 qq->update(index); -
2221 -
2222 if (contentsSize != oldContents)
evaluated: contentsSize != oldContents
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:1
1-4
2223 dd->viewUpdateGeometries();
executed: dd->viewUpdateGeometries();
Execution Count:4
4
2224}
executed: }
Execution Count:5
5
2225 -
2226void QIconModeViewBase::appendHiddenRow(int row) -
2227{ -
2228 if (row >= 0 && row < items.count())
partially evaluated: row >= 0
TRUEFALSE
yes
Evaluation Count:182
no
Evaluation Count:0
partially evaluated: row < items.count()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:182
0-182
2229 tree.removeLeaf(items.at(row).rect(), row);
never executed: tree.removeLeaf(items.at(row).rect(), row);
0
2230 QCommonListViewBase::appendHiddenRow(row); -
2231}
executed: }
Execution Count:182
182
2232 -
2233void QIconModeViewBase::removeHiddenRow(int row) -
2234{ -
2235 QCommonListViewBase::removeHiddenRow(row); -
2236 if (row >= 0 && row < items.count())
never evaluated: row >= 0
never evaluated: row < items.count()
0
2237 tree.insertLeaf(items.at(row).rect(), row);
never executed: tree.insertLeaf(items.at(row).rect(), row);
0
2238}
never executed: }
0
2239 -
2240 -
2241void QIconModeViewBase::paintDragDrop(QPainter *painter) -
2242{ -
2243 if (!draggedItems.isEmpty() && viewport()->rect().contains(draggedItemsPos)) {
partially evaluated: !draggedItems.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:39
never evaluated: viewport()->rect().contains(draggedItemsPos)
0-39
2244 -
2245 painter->translate(draggedItemsDelta()); -
2246 QStyleOptionViewItem option = viewOptions(); -
2247 option.state &= ~QStyle::State_MouseOver; -
2248 QVector<QModelIndex>::const_iterator it = draggedItems.constBegin(); -
2249 QListViewItem item = indexToListViewItem(*it); -
2250 for (; it != draggedItems.constEnd(); ++it) {
never evaluated: it != draggedItems.constEnd()
0
2251 item = indexToListViewItem(*it); -
2252 option.rect = viewItemRect(item); -
2253 delegate(*it)->paint(painter, option, *it); -
2254 }
never executed: }
0
2255 }
never executed: }
0
2256}
executed: }
Execution Count:39
39
2257 -
2258bool QIconModeViewBase::filterStartDrag(Qt::DropActions supportedActions) -
2259{ -
2260 -
2261 -
2262 -
2263 QModelIndexList indexes = dd->selectionModel->selectedIndexes(); -
2264 if (indexes.count() > 0 ) {
never evaluated: indexes.count() > 0
0
2265 if (viewport()->acceptDrops()) {
never evaluated: viewport()->acceptDrops()
0
2266 QModelIndexList::ConstIterator it = indexes.constBegin(); -
2267 for (; it != indexes.constEnd(); ++it)
never evaluated: it != indexes.constEnd()
0
2268 if (dd->model->flags(*it) & Qt::ItemIsDragEnabled
never evaluated: dd->model->flags(*it) & Qt::ItemIsDragEnabled
0
2269 && (*it).column() == dd->column)
never evaluated: (*it).column() == dd->column
0
2270 draggedItems.push_back(*it);
never executed: draggedItems.push_back(*it);
0
2271 }
never executed: }
0
2272 QDrag *drag = new QDrag(qq); -
2273 drag->setMimeData(dd->model->mimeData(indexes)); -
2274 Qt::DropAction action = drag->exec(supportedActions, Qt::CopyAction); -
2275 draggedItems.clear(); -
2276 if (action == Qt::MoveAction)
never evaluated: action == Qt::MoveAction
0
2277 dd->clearOrRemove();
never executed: dd->clearOrRemove();
0
2278 }
never executed: }
0
2279 return true;
never executed: return true;
0
2280} -
2281 -
2282bool QIconModeViewBase::filterDropEvent(QDropEvent *e) -
2283{ -
2284 if (e->source() != qq)
never evaluated: e->source() != qq
0
2285 return false;
never executed: return false;
0
2286 -
2287 const QSize contents = contentsSize; -
2288 QPoint offset(horizontalOffset(), verticalOffset()); -
2289 QPoint end = e->pos() + offset; -
2290 if (qq->acceptDrops()) {
never evaluated: qq->acceptDrops()
0
2291 const Qt::ItemFlags dropableFlags = Qt::ItemIsDropEnabled|Qt::ItemIsEnabled; -
2292 const QVector<QModelIndex> &dropIndices = intersectingSet(QRect(end, QSize(1, 1))); -
2293 for (QForeachContainer<__typeof__(dropIndices)> _container_(dropIndices); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (const QModelIndex &index = *_container_.i;; __extension__ ({--_container_.brk; break;})) -
2294 if ((index.flags() & dropableFlags) == dropableFlags)
never evaluated: (index.flags() & dropableFlags) == dropableFlags
0
2295 return false;
never executed: return false;
0
2296 }
never executed: }
0
2297 QPoint start = dd->pressedPosition; -
2298 QPoint delta = (dd->movement == QListView::Snap ? snapToGrid(end) - snapToGrid(start) : end - start);
never evaluated: dd->movement == QListView::Snap
0
2299 QList<QModelIndex> indexes = dd->selectionModel->selectedIndexes(); -
2300 for (int i = 0; i < indexes.count(); ++i) {
never evaluated: i < indexes.count()
0
2301 QModelIndex index = indexes.at(i); -
2302 QRect rect = dd->rectForIndex(index); -
2303 viewport()->update(dd->mapToViewport(rect, false)); -
2304 QPoint dest = rect.topLeft() + delta; -
2305 if (qq->isRightToLeft())
never evaluated: qq->isRightToLeft()
0
2306 dest.setX(dd->flipX(dest.x()) - rect.width());
never executed: dest.setX(dd->flipX(dest.x()) - rect.width());
0
2307 moveItem(index.row(), dest); -
2308 qq->update(index); -
2309 }
never executed: }
0
2310 dd->stopAutoScroll(); -
2311 draggedItems.clear(); -
2312 dd->emitIndexesMoved(indexes); -
2313 e->accept(); -
2314 -
2315 if (contentsSize != contents) {
never evaluated: contentsSize != contents
0
2316 if ((contentsSize.width() <= contents.width()
never evaluated: contentsSize.width() <= contents.width()
0
2317 || contentsSize.height() <= contents.height())) {
never evaluated: contentsSize.height() <= contents.height()
0
2318 updateContentsSize(); -
2319 }
never executed: }
0
2320 dd->viewUpdateGeometries(); -
2321 }
never executed: }
0
2322 return true;
never executed: return true;
0
2323} -
2324 -
2325bool QIconModeViewBase::filterDragLeaveEvent(QDragLeaveEvent *e) -
2326{ -
2327 viewport()->update(draggedItemsRect()); -
2328 draggedItemsPos = QPoint(-1, -1); -
2329 return QCommonListViewBase::filterDragLeaveEvent(e);
never executed: return QCommonListViewBase::filterDragLeaveEvent(e);
0
2330} -
2331 -
2332bool QIconModeViewBase::filterDragMoveEvent(QDragMoveEvent *e) -
2333{ -
2334 if (e->source() != qq || !dd->canDecode(e))
never evaluated: e->source() != qq
never evaluated: !dd->canDecode(e)
0
2335 return false;
never executed: return false;
0
2336 -
2337 -
2338 e->ignore(); -
2339 -
2340 QRect itemsRect = this->itemsRect(draggedItems); -
2341 viewport()->update(itemsRect.translated(draggedItemsDelta())); -
2342 -
2343 draggedItemsPos = e->pos(); -
2344 -
2345 viewport()->update(itemsRect.translated(draggedItemsDelta())); -
2346 -
2347 QModelIndex index; -
2348 if (movement() == QListView::Snap) {
never evaluated: movement() == QListView::Snap
0
2349 QRect rect(snapToGrid(e->pos() + offset()), gridSize()); -
2350 const QVector<QModelIndex> intersectVector = intersectingSet(rect); -
2351 index = intersectVector.count() > 0 ? intersectVector.last() : QModelIndex();
never evaluated: intersectVector.count() > 0
0
2352 } else {
never executed: }
0
2353 index = qq->indexAt(e->pos()); -
2354 }
never executed: }
0
2355 -
2356 if (draggedItems.contains(index))
never evaluated: draggedItems.contains(index)
0
2357 e->accept();
never executed: e->accept();
0
2358 else if (dd->model->flags(index) & Qt::ItemIsDropEnabled)
never evaluated: dd->model->flags(index) & Qt::ItemIsDropEnabled
0
2359 e->accept();
never executed: e->accept();
0
2360 else if (!index.isValid())
never evaluated: !index.isValid()
0
2361 e->accept();
never executed: e->accept();
0
2362 -
2363 -
2364 if (dd->shouldAutoScroll(e->pos()))
never evaluated: dd->shouldAutoScroll(e->pos())
0
2365 dd->startAutoScroll();
never executed: dd->startAutoScroll();
0
2366 return true;
never executed: return true;
0
2367} -
2368 -
2369 -
2370void QIconModeViewBase::setRowCount(int rowCount) -
2371{ -
2372 tree.create(qMax(rowCount - hiddenCount(), 0)); -
2373}
executed: }
Execution Count:15
15
2374 -
2375void QIconModeViewBase::scrollContentsBy(int dx, int dy, bool scrollElasticBand) -
2376{ -
2377 if (scrollElasticBand)
partially evaluated: scrollElasticBand
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
2378 dd->scrollElasticBandBy(isRightToLeft() ? -dx : dx, dy);
never executed: dd->scrollElasticBandBy(isRightToLeft() ? -dx : dx, dy);
0
2379 -
2380 QCommonListViewBase::scrollContentsBy(dx, dy, scrollElasticBand); -
2381 if (!draggedItems.isEmpty())
partially evaluated: !draggedItems.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
2382 viewport()->update(draggedItemsRect().translated(dx, dy));
never executed: viewport()->update(draggedItemsRect().translated(dx, dy));
0
2383}
executed: }
Execution Count:2
2
2384 -
2385void QIconModeViewBase::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight) -
2386{ -
2387 if (column() >= topLeft.column() && column() <= bottomRight.column()) {
never evaluated: column() >= topLeft.column()
never evaluated: column() <= bottomRight.column()
0
2388 QStyleOptionViewItem option = viewOptions(); -
2389 int bottom = qMin(items.count(), bottomRight.row() + 1); -
2390 for (int row = topLeft.row(); row < bottom; ++row)
never evaluated: row < bottom
0
2391 items[row].resize(itemSize(option, modelIndex(row)));
never executed: items[row].resize(itemSize(option, modelIndex(row)));
0
2392 }
never executed: }
0
2393}
never executed: }
0
2394 -
2395bool QIconModeViewBase::doBatchedItemLayout(const QListViewLayoutInfo &info, int max) -
2396{ -
2397 if (info.last >= items.count()) {
partially evaluated: info.last >= items.count()
TRUEFALSE
yes
Evaluation Count:18
no
Evaluation Count:0
0-18
2398 -
2399 QStyleOptionViewItem option = viewOptions(); -
2400 for (int row = items.count(); row <= info.last; ++row) {
evaluated: row <= info.last
TRUEFALSE
yes
Evaluation Count:416
yes
Evaluation Count:18
18-416
2401 QSize size = itemSize(option, modelIndex(row)); -
2402 QListViewItem item(QRect(0, 0, size.width(), size.height()), row); -
2403 items.append(item); -
2404 }
executed: }
Execution Count:416
416
2405 doDynamicLayout(info); -
2406 }
executed: }
Execution Count:18
18
2407 return (batchStartRow > max);
executed: return (batchStartRow > max);
Execution Count:18
18
2408} -
2409 -
2410QListViewItem QIconModeViewBase::indexToListViewItem(const QModelIndex &index) const -
2411{ -
2412 if (index.isValid() && index.row() < items.count())
partially evaluated: index.isValid()
TRUEFALSE
yes
Evaluation Count:511
no
Evaluation Count:0
partially evaluated: index.row() < items.count()
TRUEFALSE
yes
Evaluation Count:511
no
Evaluation Count:0
0-511
2413 return items.at(index.row());
executed: return items.at(index.row());
Execution Count:511
511
2414 return QListViewItem();
never executed: return QListViewItem();
0
2415} -
2416 -
2417void QIconModeViewBase::initBspTree(const QSize &contents) -
2418{ -
2419 -
2420 int leafCount = tree.leafCount(); -
2421 for (int l = 0; l < leafCount; ++l)
evaluated: l < leafCount
TRUEFALSE
yes
Evaluation Count:186
yes
Evaluation Count:17
17-186
2422 tree.leaf(l).clear();
executed: tree.leaf(l).clear();
Execution Count:186
186
2423 -
2424 QBspTree::Node::Type type = QBspTree::Node::Both; -
2425 -
2426 if (contents.height() / contents.width() >= 3)
evaluated: contents.height() / contents.width() >= 3
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:13
4-13
2427 type = QBspTree::Node::HorizontalPlane;
executed: type = QBspTree::Node::HorizontalPlane;
Execution Count:4
4
2428 else if (contents.width() / contents.height() >= 3)
evaluated: contents.width() / contents.height() >= 3
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:12
1-12
2429 type = QBspTree::Node::VerticalPlane;
executed: type = QBspTree::Node::VerticalPlane;
Execution Count:1
1
2430 -
2431 tree.init(QRect(0, 0, contents.width(), contents.height()), type); -
2432}
executed: }
Execution Count:17
17
2433 -
2434QPoint QIconModeViewBase::initDynamicLayout(const QListViewLayoutInfo &info) -
2435{ -
2436 int x, y; -
2437 if (info.first == 0) {
evaluated: info.first == 0
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:3
3-15
2438 x = info.bounds.x() + info.spacing; -
2439 y = info.bounds.y() + info.spacing; -
2440 items.reserve(rowCount() - hiddenCount()); -
2441 } else {
executed: }
Execution Count:15
15
2442 int idx = info.first - 1; -
2443 while (idx > 0 && !items.at(idx).isValid())
evaluated: idx > 0
TRUEFALSE
yes
Evaluation Count:109
yes
Evaluation Count:1
evaluated: !items.at(idx).isValid()
TRUEFALSE
yes
Evaluation Count:107
yes
Evaluation Count:2
1-109
2444 --idx;
executed: --idx;
Execution Count:107
107
2445 const QListViewItem &item = items.at(idx); -
2446 x = item.x; -
2447 y = item.y; -
2448 if (info.flow == QListView::LeftToRight)
evaluated: info.flow == QListView::LeftToRight
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1
1-2
2449 x += (info.grid.isValid() ? info.grid.width() : item.w) + info.spacing;
partially evaluated: info.grid.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
executed: x += (info.grid.isValid() ? info.grid.width() : item.w) + info.spacing;
Execution Count:2
0-2
2450 else -
2451 y += (info.grid.isValid() ? info.grid.height() : item.h) + info.spacing;
partially evaluated: info.grid.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
executed: y += (info.grid.isValid() ? info.grid.height() : item.h) + info.spacing;
Execution Count:1
0-1
2452 } -
2453 return QPoint(x, y);
executed: return QPoint(x, y);
Execution Count:18
18
2454} -
2455 -
2456 -
2457 -
2458 -
2459void QIconModeViewBase::doDynamicLayout(const QListViewLayoutInfo &info) -
2460{ -
2461 const bool useItemSize = !info.grid.isValid(); -
2462 const QPoint topLeft = initDynamicLayout(info); -
2463 -
2464 int segStartPosition; -
2465 int segEndPosition; -
2466 int deltaFlowPosition; -
2467 int deltaSegPosition; -
2468 int deltaSegHint; -
2469 int flowPosition; -
2470 int segPosition; -
2471 -
2472 if (info.flow == QListView::LeftToRight) {
evaluated: info.flow == QListView::LeftToRight
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:3
3-15
2473 segStartPosition = info.bounds.left() + info.spacing; -
2474 segEndPosition = info.bounds.right(); -
2475 deltaFlowPosition = info.grid.width(); -
2476 deltaSegPosition = (useItemSize ? batchSavedDeltaSeg : info.grid.height());
evaluated: useItemSize
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:7
7-8
2477 deltaSegHint = info.grid.height(); -
2478 flowPosition = topLeft.x(); -
2479 segPosition = topLeft.y(); -
2480 } else {
executed: }
Execution Count:15
15
2481 segStartPosition = info.bounds.top() + info.spacing; -
2482 segEndPosition = info.bounds.bottom(); -
2483 deltaFlowPosition = info.grid.height(); -
2484 deltaSegPosition = (useItemSize ? batchSavedDeltaSeg : info.grid.width());
evaluated: useItemSize
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1
1-2
2485 deltaSegHint = info.grid.width(); -
2486 flowPosition = topLeft.y(); -
2487 segPosition = topLeft.x(); -
2488 }
executed: }
Execution Count:3
3
2489 -
2490 if (moved.count() != items.count())
partially evaluated: moved.count() != items.count()
TRUEFALSE
yes
Evaluation Count:18
no
Evaluation Count:0
0-18
2491 moved.resize(items.count());
executed: moved.resize(items.count());
Execution Count:18
18
2492 -
2493 QRect rect(QPoint(), topLeft); -
2494 QListViewItem *item = 0; -
2495 for (int row = info.first; row <= info.last; ++row) {
evaluated: row <= info.last
TRUEFALSE
yes
Evaluation Count:416
yes
Evaluation Count:18
18-416
2496 item = &items[row]; -
2497 if (isHidden(row)) {
evaluated: isHidden(row)
TRUEFALSE
yes
Evaluation Count:182
yes
Evaluation Count:234
182-234
2498 item->invalidate(); -
2499 } else {
executed: }
Execution Count:182
182
2500 -
2501 if (useItemSize) {
evaluated: useItemSize
TRUEFALSE
yes
Evaluation Count:38
yes
Evaluation Count:196
38-196
2502 if (info.flow == QListView::LeftToRight)
evaluated: info.flow == QListView::LeftToRight
TRUEFALSE
yes
Evaluation Count:35
yes
Evaluation Count:3
3-35
2503 deltaFlowPosition = item->w + info.spacing;
executed: deltaFlowPosition = item->w + info.spacing;
Execution Count:35
35
2504 else -
2505 deltaFlowPosition = item->h + info.spacing;
executed: deltaFlowPosition = item->h + info.spacing;
Execution Count:3
3
2506 } else { -
2507 item->w = qMin<int>(info.grid.width(), item->w); -
2508 item->h = qMin<int>(info.grid.height(), item->h); -
2509 }
executed: }
Execution Count:196
196
2510 -
2511 -
2512 if (info.wrap
partially evaluated: info.wrap
TRUEFALSE
yes
Evaluation Count:234
no
Evaluation Count:0
0-234
2513 && flowPosition + deltaFlowPosition > segEndPosition
evaluated: flowPosition + deltaFlowPosition > segEndPosition
TRUEFALSE
yes
Evaluation Count:49
yes
Evaluation Count:185
49-185
2514 && flowPosition > segStartPosition) {
evaluated: flowPosition > segStartPosition
TRUEFALSE
yes
Evaluation Count:48
yes
Evaluation Count:1
1-48
2515 flowPosition = segStartPosition; -
2516 segPosition += deltaSegPosition; -
2517 if (useItemSize)
evaluated: useItemSize
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:37
11-37
2518 deltaSegPosition = 0;
executed: deltaSegPosition = 0;
Execution Count:11
11
2519 }
executed: }
Execution Count:48
48
2520 -
2521 -
2522 if (useItemSize) {
evaluated: useItemSize
TRUEFALSE
yes
Evaluation Count:38
yes
Evaluation Count:196
38-196
2523 if (info.flow == QListView::LeftToRight)
evaluated: info.flow == QListView::LeftToRight
TRUEFALSE
yes
Evaluation Count:35
yes
Evaluation Count:3
3-35
2524 deltaSegHint = item->h + info.spacing;
executed: deltaSegHint = item->h + info.spacing;
Execution Count:35
35
2525 else -
2526 deltaSegHint = item->w + info.spacing;
executed: deltaSegHint = item->w + info.spacing;
Execution Count:3
3
2527 deltaSegPosition = qMax(deltaSegPosition, deltaSegHint); -
2528 }
executed: }
Execution Count:38
38
2529 -
2530 -
2531 -
2532 -
2533 if (!moved.testBit(row)) {
partially evaluated: !moved.testBit(row)
TRUEFALSE
yes
Evaluation Count:234
no
Evaluation Count:0
0-234
2534 if (info.flow == QListView::LeftToRight) {
evaluated: info.flow == QListView::LeftToRight
TRUEFALSE
yes
Evaluation Count:227
yes
Evaluation Count:7
7-227
2535 if (useItemSize) {
evaluated: useItemSize
TRUEFALSE
yes
Evaluation Count:35
yes
Evaluation Count:192
35-192
2536 item->x = flowPosition; -
2537 item->y = segPosition; -
2538 } else {
executed: }
Execution Count:35
35
2539 item->x = flowPosition + ((deltaFlowPosition - item->w) / 2); -
2540 item->y = segPosition; -
2541 }
executed: }
Execution Count:192
192
2542 } else { -
2543 if (useItemSize) {
evaluated: useItemSize
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:4
3-4
2544 item->y = flowPosition; -
2545 item->x = segPosition; -
2546 } else {
executed: }
Execution Count:3
3
2547 item->y = flowPosition + ((deltaFlowPosition - item->h) / 2); -
2548 item->x = segPosition; -
2549 }
executed: }
Execution Count:4
4
2550 } -
2551 } -
2552 -
2553 -
2554 if (useItemSize)
evaluated: useItemSize
TRUEFALSE
yes
Evaluation Count:38
yes
Evaluation Count:196
38-196
2555 rect |= item->rect();
executed: rect |= item->rect();
Execution Count:38
38
2556 else if (info.flow == QListView::LeftToRight)
evaluated: info.flow == QListView::LeftToRight
TRUEFALSE
yes
Evaluation Count:192
yes
Evaluation Count:4
4-192
2557 rect |= QRect(flowPosition, segPosition, deltaFlowPosition, deltaSegPosition);
executed: rect |= QRect(flowPosition, segPosition, deltaFlowPosition, deltaSegPosition);
Execution Count:192
192
2558 else -
2559 rect |= QRect(segPosition, flowPosition, deltaSegPosition, deltaFlowPosition);
executed: rect |= QRect(segPosition, flowPosition, deltaSegPosition, deltaFlowPosition);
Execution Count:4
4
2560 -
2561 -
2562 flowPosition += deltaFlowPosition; -
2563 }
executed: }
Execution Count:234
234
2564 } -
2565 batchSavedDeltaSeg = deltaSegPosition; -
2566 batchStartRow = info.last + 1; -
2567 bool done = (info.last >= rowCount() - 1); -
2568 -
2569 if (done || !info.bounds.contains(item->rect())) {
evaluated: done
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:3
evaluated: !info.bounds.contains(item->rect())
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1
1-15
2570 contentsSize = rect.size(); -
2571 if (info.flow == QListView::LeftToRight)
evaluated: info.flow == QListView::LeftToRight
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:2
2-15
2572 contentsSize.rheight() += info.spacing;
executed: contentsSize.rheight() += info.spacing;
Execution Count:15
15
2573 else -
2574 contentsSize.rwidth() += info.spacing;
executed: contentsSize.rwidth() += info.spacing;
Execution Count:2
2
2575 } -
2576 if (rect.size().isEmpty())
evaluated: rect.size().isEmpty()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:17
1-17
2577 return;
executed: return;
Execution Count:1
1
2578 -
2579 int insertFrom = info.first; -
2580 if (done || info.first == 0) {
evaluated: done
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:3
partially evaluated: info.first == 0
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-14
2581 initBspTree(rect.size()); -
2582 insertFrom = 0; -
2583 }
executed: }
Execution Count:17
17
2584 -
2585 for (int row = insertFrom; row <= info.last; ++row)
evaluated: row <= info.last
TRUEFALSE
yes
Evaluation Count:517
yes
Evaluation Count:17
17-517
2586 tree.insertLeaf(items.at(row).rect(), row);
executed: tree.insertLeaf(items.at(row).rect(), row);
Execution Count:517
517
2587 -
2588 QRect changedRect(topLeft, rect.bottomRight()); -
2589 if (clipRect().intersects(changedRect))
evaluated: clipRect().intersects(changedRect)
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:2
2-15
2590 viewport()->update();
executed: viewport()->update();
Execution Count:15
15
2591}
executed: }
Execution Count:17
17
2592 -
2593QVector<QModelIndex> QIconModeViewBase::intersectingSet(const QRect &area) const -
2594{ -
2595 QIconModeViewBase *that = const_cast<QIconModeViewBase*>(this); -
2596 QBspTree::Data data(static_cast<void*>(that)); -
2597 QVector<QModelIndex> res; -
2598 that->interSectingVector = &res; -
2599 that->tree.climbTree(area, &QIconModeViewBase::addLeaf, data); -
2600 that->interSectingVector = 0; -
2601 return res;
executed: return res;
Execution Count:168
168
2602} -
2603 -
2604QRect QIconModeViewBase::itemsRect(const QVector<QModelIndex> &indexes) const -
2605{ -
2606 QVector<QModelIndex>::const_iterator it = indexes.begin(); -
2607 QListViewItem item = indexToListViewItem(*it); -
2608 QRect rect(item.x, item.y, item.w, item.h); -
2609 for (; it != indexes.end(); ++it) {
never evaluated: it != indexes.end()
0
2610 item = indexToListViewItem(*it); -
2611 rect |= viewItemRect(item); -
2612 }
never executed: }
0
2613 return rect;
never executed: return rect;
0
2614} -
2615 -
2616int QIconModeViewBase::itemIndex(const QListViewItem &item) const -
2617{ -
2618 if (!item.isValid())
partially evaluated: !item.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:310
0-310
2619 return -1;
never executed: return -1;
0
2620 int i = item.indexHint; -
2621 if (i < items.count()) {
partially evaluated: i < items.count()
TRUEFALSE
yes
Evaluation Count:310
no
Evaluation Count:0
0-310
2622 if (items.at(i) == item)
partially evaluated: items.at(i) == item
TRUEFALSE
yes
Evaluation Count:310
no
Evaluation Count:0
0-310
2623 return i;
executed: return i;
Execution Count:310
310
2624 } else {
never executed: }
0
2625 i = items.count() - 1; -
2626 }
never executed: }
0
2627 -
2628 int j = i; -
2629 int c = items.count(); -
2630 bool a = true; -
2631 bool b = true; -
2632 -
2633 while (a || b) {
never evaluated: a
never evaluated: b
0
2634 if (a) {
never evaluated: a
0
2635 if (items.at(i) == item) {
never evaluated: items.at(i) == item
0
2636 items.at(i).indexHint = i; -
2637 return i;
never executed: return i;
0
2638 } -
2639 a = ++i < c; -
2640 }
never executed: }
0
2641 if (b) {
never evaluated: b
0
2642 if (items.at(j) == item) {
never evaluated: items.at(j) == item
0
2643 items.at(j).indexHint = j; -
2644 return j;
never executed: return j;
0
2645 } -
2646 b = --j > -1; -
2647 }
never executed: }
0
2648 }
never executed: }
0
2649 return -1;
never executed: return -1;
0
2650} -
2651 -
2652void QIconModeViewBase::addLeaf(QVector<int> &leaf, const QRect &area, -
2653 uint visited, QBspTree::Data data) -
2654{ -
2655 QListViewItem *vi; -
2656 QIconModeViewBase *_this = static_cast<QIconModeViewBase *>(data.ptr); -
2657 for (int i = 0; i < leaf.count(); ++i) {
evaluated: i < leaf.count()
TRUEFALSE
yes
Evaluation Count:922
yes
Evaluation Count:330
330-922
2658 int idx = leaf.at(i); -
2659 if (idx < 0 || idx >= _this->items.count())
partially evaluated: idx < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:922
partially evaluated: idx >= _this->items.count()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:922
0-922
2660 continue;
never executed: continue;
0
2661 vi = &_this->items[idx]; -
2662 qt_noop(); -
2663 if (vi->isValid() && vi->rect().intersects(area) && vi->visited != visited) {
evaluated: vi->isValid()
TRUEFALSE
yes
Evaluation Count:756
yes
Evaluation Count:166
evaluated: vi->rect().intersects(area)
TRUEFALSE
yes
Evaluation Count:486
yes
Evaluation Count:270
evaluated: vi->visited != visited
TRUEFALSE
yes
Evaluation Count:306
yes
Evaluation Count:180
166-756
2664 QModelIndex index = _this->dd->listViewItemToIndex(*vi); -
2665 qt_noop(); -
2666 _this->interSectingVector->append(index); -
2667 vi->visited = visited; -
2668 }
executed: }
Execution Count:306
306
2669 }
executed: }
Execution Count:922
922
2670}
executed: }
Execution Count:330
330
2671 -
2672void QIconModeViewBase::moveItem(int index, const QPoint &dest) -
2673{ -
2674 -
2675 QListViewItem *item = &items[index]; -
2676 QRect rect = item->rect(); -
2677 -
2678 -
2679 tree.removeLeaf(rect, index); -
2680 item->move(dest); -
2681 tree.insertLeaf(QRect(dest, rect.size()), index); -
2682 -
2683 -
2684 contentsSize = (QRect(QPoint(0, 0), contentsSize)|QRect(dest, rect.size())).size(); -
2685 -
2686 -
2687 if (moved.count() != items.count())
partially evaluated: moved.count() != items.count()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
2688 moved.resize(items.count());
never executed: moved.resize(items.count());
0
2689 moved.setBit(index, true); -
2690}
executed: }
Execution Count:5
5
2691 -
2692QPoint QIconModeViewBase::snapToGrid(const QPoint &pos) const -
2693{ -
2694 int x = pos.x() - (pos.x() % gridSize().width()); -
2695 int y = pos.y() - (pos.y() % gridSize().height()); -
2696 return QPoint(x, y);
never executed: return QPoint(x, y);
0
2697} -
2698 -
2699QPoint QIconModeViewBase::draggedItemsDelta() const -
2700{ -
2701 if (movement() == QListView::Snap) {
never evaluated: movement() == QListView::Snap
0
2702 QPoint snapdelta = QPoint((offset().x() % gridSize().width()), -
2703 (offset().y() % gridSize().height())); -
2704 return snapToGrid(draggedItemsPos + snapdelta) - snapToGrid(pressedPosition()) - snapdelta;
never executed: return snapToGrid(draggedItemsPos + snapdelta) - snapToGrid(pressedPosition()) - snapdelta;
0
2705 } -
2706 return draggedItemsPos - pressedPosition();
never executed: return draggedItemsPos - pressedPosition();
0
2707} -
2708 -
2709QRect QIconModeViewBase::draggedItemsRect() const -
2710{ -
2711 QRect rect = itemsRect(draggedItems); -
2712 rect.translate(draggedItemsDelta()); -
2713 return rect;
never executed: return rect;
0
2714} -
2715 -
2716void QListViewPrivate::scrollElasticBandBy(int dx, int dy) -
2717{ -
2718 if (dx > 0)
never evaluated: dx > 0
0
2719 elasticBand.moveRight(elasticBand.right() + dx);
never executed: elasticBand.moveRight(elasticBand.right() + dx);
0
2720 else if (dx < 0)
never evaluated: dx < 0
0
2721 elasticBand.moveLeft(elasticBand.left() - dx);
never executed: elasticBand.moveLeft(elasticBand.left() - dx);
0
2722 if (dy > 0)
never evaluated: dy > 0
0
2723 elasticBand.moveBottom(elasticBand.bottom() + dy);
never executed: elasticBand.moveBottom(elasticBand.bottom() + dy);
0
2724 else if (dy < 0)
never evaluated: dy < 0
0
2725 elasticBand.moveTop(elasticBand.top() - dy);
never executed: elasticBand.moveTop(elasticBand.top() - dy);
0
2726} -
2727 -
2728void QIconModeViewBase::clear() -
2729{ -
2730 tree.destroy(); -
2731 items.clear(); -
2732 moved.clear(); -
2733 batchStartRow = 0; -
2734 batchSavedDeltaSeg = 0; -
2735}
executed: }
Execution Count:247
247
2736 -
2737void QIconModeViewBase::updateContentsSize() -
2738{ -
2739 QRect bounding; -
2740 for (int i = 0; i < items.count(); ++i)
never evaluated: i < items.count()
0
2741 bounding |= items.at(i).rect();
never executed: bounding |= items.at(i).rect();
0
2742 contentsSize = bounding.size(); -
2743}
never executed: }
0
2744 -
2745 -
2746 -
2747 -
2748void QListView::currentChanged(const QModelIndex &current, const QModelIndex &previous) -
2749{ -
2750 -
2751 if (QAccessible::isActive()) {
evaluated: QAccessible::isActive()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:1888
4-1888
2752 if (current.isValid()) {
partially evaluated: current.isValid()
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
0-4
2753 int entry = visualIndex(current); -
2754 QAccessibleEvent event(this, QAccessible::Focus); -
2755 event.setChild(entry); -
2756 QAccessible::updateAccessibility(&event); -
2757 }
executed: }
Execution Count:4
4
2758 }
executed: }
Execution Count:4
4
2759 -
2760 QAbstractItemView::currentChanged(current, previous); -
2761}
executed: }
Execution Count:1892
1892
2762 -
2763 -
2764 -
2765 -
2766void QListView::selectionChanged(const QItemSelection &selected, -
2767 const QItemSelection &deselected) -
2768{ -
2769 -
2770 if (QAccessible::isActive()) {
evaluated: QAccessible::isActive()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:2263
5-2263
2771 -
2772 QModelIndex sel = selected.indexes().value(0); -
2773 if (sel.isValid()) {
evaluated: sel.isValid()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:1
1-4
2774 int entry = visualIndex(sel); -
2775 QAccessibleEvent event(this, QAccessible::Selection); -
2776 event.setChild(entry); -
2777 QAccessible::updateAccessibility(&event); -
2778 }
executed: }
Execution Count:4
4
2779 QModelIndex desel = deselected.indexes().value(0); -
2780 if (desel.isValid()) {
evaluated: desel.isValid()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:3
2-3
2781 int entry = visualIndex(desel); -
2782 QAccessibleEvent event(this, QAccessible::SelectionRemove); -
2783 event.setChild(entry); -
2784 QAccessible::updateAccessibility(&event); -
2785 }
executed: }
Execution Count:2
2
2786 }
executed: }
Execution Count:5
5
2787 -
2788 QAbstractItemView::selectionChanged(selected, deselected); -
2789}
executed: }
Execution Count:2268
2268
2790 -
2791int QListView::visualIndex(const QModelIndex &index) const -
2792{ -
2793 const QListViewPrivate * const d = d_func(); -
2794 d->executePostedLayout(); -
2795 QListViewItem itm = d->indexToListViewItem(index); -
2796 int visualIndex = d->commonListView->itemIndex(itm); -
2797 for (int row = 0; row <= index.row() && visualIndex >= 0; row++) {
evaluated: row <= index.row()
TRUEFALSE
yes
Evaluation Count:9072
yes
Evaluation Count:439
partially evaluated: visualIndex >= 0
TRUEFALSE
yes
Evaluation Count:9072
no
Evaluation Count:0
0-9072
2798 if (d->isHidden(row))
evaluated: d->isHidden(row)
TRUEFALSE
yes
Evaluation Count:2704
yes
Evaluation Count:6368
2704-6368
2799 visualIndex--;
executed: visualIndex--;
Execution Count:2704
2704
2800 }
executed: }
Execution Count:9072
9072
2801 return visualIndex;
executed: return visualIndex;
Execution Count:439
439
2802} -
2803 -
2804 -
2805 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial