itemviews/qtreeview.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4 -
5 -
6 -
7 -
8QTreeView::QTreeView(QWidget *parent) -
9 : QAbstractItemView(*new QTreeViewPrivate, parent) -
10{ -
11 QTreeViewPrivate * const d = d_func(); -
12 d->initialize(); -
13}
executed: }
Execution Count:406
406
14 -
15 -
16 -
17 -
18QTreeView::QTreeView(QTreeViewPrivate &dd, QWidget *parent) -
19 : QAbstractItemView(dd, parent) -
20{ -
21 QTreeViewPrivate * const d = d_func(); -
22 d->initialize(); -
23}
executed: }
Execution Count:264
264
24 -
25 -
26 -
27 -
28QTreeView::~QTreeView() -
29{ -
30} -
31 -
32 -
33 -
34 -
35void QTreeView::setModel(QAbstractItemModel *model) -
36{ -
37 QTreeViewPrivate * const d = d_func(); -
38 if (model == d->model)
evaluated: model == d->model
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:633
2-633
39 return;
executed: return;
Execution Count:2
2
40 if (d->model && d->model != QAbstractItemModelPrivate::staticEmptyModel()) {
partially evaluated: d->model
TRUEFALSE
yes
Evaluation Count:633
no
Evaluation Count:0
evaluated: d->model != QAbstractItemModelPrivate::staticEmptyModel()
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:627
0-633
41 disconnect(d->model, "2""rowsRemoved(QModelIndex,int,int)", -
42 this, "1""rowsRemoved(QModelIndex,int,int)"); -
43 -
44 disconnect(d->model, "2""modelAboutToBeReset()", this, "1""_q_modelAboutToBeReset()"); -
45 }
executed: }
Execution Count:6
6
46 -
47 if (d->selectionModel) {
evaluated: d->selectionModel
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:623
10-623
48 disconnect(d->selectionModel, "2""currentRowChanged(QModelIndex,QModelIndex)", -
49 d->model, "1""submit()"); -
50 disconnect(d->model, "2""rowsRemoved(QModelIndex,int,int)", -
51 this, "1""rowsRemoved(QModelIndex,int,int)"); -
52 disconnect(d->model, "2""modelAboutToBeReset()", this, "1""_q_modelAboutToBeReset()"); -
53 }
executed: }
Execution Count:10
10
54 d->viewItems.clear(); -
55 d->expandedIndexes.clear(); -
56 d->hiddenIndexes.clear(); -
57 d->header->setModel(model); -
58 QAbstractItemView::setModel(model); -
59 -
60 -
61 disconnect(d->model, "2""rowsRemoved(QModelIndex,int,int)", -
62 this, "1""_q_rowsRemoved(QModelIndex,int,int)"); -
63 -
64 disconnect(d->model, "2""layoutChanged()", -
65 d->header, "1""_q_layoutChanged()"); -
66 -
67 connect(d->model, "2""rowsRemoved(QModelIndex,int,int)", -
68 this, "1""rowsRemoved(QModelIndex,int,int)"); -
69 -
70 connect(d->model, "2""modelAboutToBeReset()", "1""_q_modelAboutToBeReset()"); -
71 -
72 if (d->sortingEnabled)
evaluated: d->sortingEnabled
TRUEFALSE
yes
Evaluation Count:195
yes
Evaluation Count:438
195-438
73 d->_q_sortIndicatorChanged(header()->sortIndicatorSection(), header()->sortIndicatorOrder());
executed: d->_q_sortIndicatorChanged(header()->sortIndicatorSection(), header()->sortIndicatorOrder());
Execution Count:195
195
74}
executed: }
Execution Count:633
633
75 -
76 -
77 -
78 -
79void QTreeView::setRootIndex(const QModelIndex &index) -
80{ -
81 QTreeViewPrivate * const d = d_func(); -
82 d->header->setRootIndex(index); -
83 QAbstractItemView::setRootIndex(index); -
84}
executed: }
Execution Count:1160
1160
85 -
86 -
87 -
88 -
89void QTreeView::setSelectionModel(QItemSelectionModel *selectionModel) -
90{ -
91 QTreeViewPrivate * const d = d_func(); -
92 qt_noop(); -
93 if (d->selectionModel) {
evaluated: d->selectionModel
TRUEFALSE
yes
Evaluation Count:203
yes
Evaluation Count:623
203-623
94 -
95 disconnect(d->selectionModel, "2""currentRowChanged(QModelIndex,QModelIndex)", -
96 d->model, "1""submit()"); -
97 }
executed: }
Execution Count:203
203
98 -
99 d->header->setSelectionModel(selectionModel); -
100 QAbstractItemView::setSelectionModel(selectionModel); -
101 -
102 if (d->selectionModel) {
partially evaluated: d->selectionModel
TRUEFALSE
yes
Evaluation Count:826
no
Evaluation Count:0
0-826
103 -
104 connect(d->selectionModel, "2""currentRowChanged(QModelIndex,QModelIndex)", -
105 d->model, "1""submit()"); -
106 }
executed: }
Execution Count:826
826
107}
executed: }
Execution Count:826
826
108 -
109 -
110 -
111 -
112 -
113 -
114QHeaderView *QTreeView::header() const -
115{ -
116 const QTreeViewPrivate * const d = d_func(); -
117 return d->header;
executed: return d->header;
Execution Count:6185
6185
118} -
119void QTreeView::setHeader(QHeaderView *header) -
120{ -
121 QTreeViewPrivate * const d = d_func(); -
122 if (header == d->header || !header)
evaluated: header == d->header
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:674
evaluated: !header
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:672
2-674
123 return;
executed: return;
Execution Count:4
4
124 if (d->header && d->header->parent() == this)
evaluated: d->header
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:670
partially evaluated: d->header->parent() == this
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-670
125 delete d->header;
executed: delete d->header;
Execution Count:2
2
126 d->header = header; -
127 d->header->setParent(this); -
128 d->header->d_func()->setAllowUserMoveOfSection0(false); -
129 -
130 if (!d->header->model()) {
partially evaluated: !d->header->model()
TRUEFALSE
yes
Evaluation Count:672
no
Evaluation Count:0
0-672
131 d->header->setModel(d->model); -
132 if (d->selectionModel)
partially evaluated: d->selectionModel
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:672
0-672
133 d->header->setSelectionModel(d->selectionModel);
never executed: d->header->setSelectionModel(d->selectionModel);
0
134 }
executed: }
Execution Count:672
672
135 -
136 connect(d->header, "2""sectionResized(int,int,int)", -
137 this, "1""columnResized(int,int,int)"); -
138 connect(d->header, "2""sectionMoved(int,int,int)", -
139 this, "1""columnMoved()"); -
140 connect(d->header, "2""sectionCountChanged(int,int)", -
141 this, "1""columnCountChanged(int,int)"); -
142 connect(d->header, "2""sectionHandleDoubleClicked(int)", -
143 this, "1""resizeColumnToContents(int)"); -
144 connect(d->header, "2""geometriesChanged()", -
145 this, "1""updateGeometries()"); -
146 -
147 setSortingEnabled(d->sortingEnabled); -
148}
executed: }
Execution Count:672
672
149int QTreeView::autoExpandDelay() const -
150{ -
151 const QTreeViewPrivate * const d = d_func(); -
152 return d->autoExpandDelay;
executed: return d->autoExpandDelay;
Execution Count:1
1
153} -
154 -
155void QTreeView::setAutoExpandDelay(int delay) -
156{ -
157 QTreeViewPrivate * const d = d_func(); -
158 d->autoExpandDelay = delay; -
159}
never executed: }
0
160int QTreeView::indentation() const -
161{ -
162 const QTreeViewPrivate * const d = d_func(); -
163 return d->indent;
executed: return d->indent;
Execution Count:12
12
164} -
165 -
166void QTreeView::setIndentation(int i) -
167{ -
168 QTreeViewPrivate * const d = d_func(); -
169 if (i != d->indent) {
partially evaluated: i != d->indent
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
170 d->indent = i; -
171 d->viewport->update(); -
172 }
executed: }
Execution Count:3
3
173}
executed: }
Execution Count:3
3
174bool QTreeView::rootIsDecorated() const -
175{ -
176 const QTreeViewPrivate * const d = d_func(); -
177 return d->rootDecoration;
executed: return d->rootDecoration;
Execution Count:4
4
178} -
179 -
180void QTreeView::setRootIsDecorated(bool show) -
181{ -
182 QTreeViewPrivate * const d = d_func(); -
183 if (show != d->rootDecoration) {
partially evaluated: show != d->rootDecoration
TRUEFALSE
yes
Evaluation Count:197
no
Evaluation Count:0
0-197
184 d->rootDecoration = show; -
185 d->viewport->update(); -
186 }
executed: }
Execution Count:197
197
187}
executed: }
Execution Count:197
197
188bool QTreeView::uniformRowHeights() const -
189{ -
190 const QTreeViewPrivate * const d = d_func(); -
191 return d->uniformRowHeights;
executed: return d->uniformRowHeights;
Execution Count:4
4
192} -
193 -
194void QTreeView::setUniformRowHeights(bool uniform) -
195{ -
196 QTreeViewPrivate * const d = d_func(); -
197 d->uniformRowHeights = uniform; -
198}
executed: }
Execution Count:16
16
199bool QTreeView::itemsExpandable() const -
200{ -
201 const QTreeViewPrivate * const d = d_func(); -
202 return d->itemsExpandable;
executed: return d->itemsExpandable;
Execution Count:4
4
203} -
204 -
205void QTreeView::setItemsExpandable(bool enable) -
206{ -
207 QTreeViewPrivate * const d = d_func(); -
208 d->itemsExpandable = enable; -
209}
executed: }
Execution Count:201
201
210bool QTreeView::expandsOnDoubleClick() const -
211{ -
212 const QTreeViewPrivate * const d = d_func(); -
213 return d->expandsOnDoubleClick;
never executed: return d->expandsOnDoubleClick;
0
214} -
215 -
216void QTreeView::setExpandsOnDoubleClick(bool enable) -
217{ -
218 QTreeViewPrivate * const d = d_func(); -
219 d->expandsOnDoubleClick = enable; -
220}
executed: }
Execution Count:1
1
221 -
222 -
223 -
224 -
225int QTreeView::columnViewportPosition(int column) const -
226{ -
227 const QTreeViewPrivate * const d = d_func(); -
228 return d->header->sectionViewportPosition(column);
executed: return d->header->sectionViewportPosition(column);
Execution Count:24951
24951
229} -
230 -
231 -
232 -
233 -
234 -
235 -
236int QTreeView::columnWidth(int column) const -
237{ -
238 const QTreeViewPrivate * const d = d_func(); -
239 return d->header->sectionSize(column);
executed: return d->header->sectionSize(column);
Execution Count:18976
18976
240} -
241void QTreeView::setColumnWidth(int column, int width) -
242{ -
243 QTreeViewPrivate * const d = d_func(); -
244 d->header->resizeSection(column, width); -
245}
never executed: }
0
246 -
247 -
248 -
249 -
250 -
251int QTreeView::columnAt(int x) const -
252{ -
253 const QTreeViewPrivate * const d = d_func(); -
254 return d->header->logicalIndexAt(x);
executed: return d->header->logicalIndexAt(x);
Execution Count:4
4
255} -
256 -
257 -
258 -
259 -
260 -
261 -
262bool QTreeView::isColumnHidden(int column) const -
263{ -
264 const QTreeViewPrivate * const d = d_func(); -
265 return d->header->isSectionHidden(column);
executed: return d->header->isSectionHidden(column);
Execution Count:18632
18632
266} -
267 -
268 -
269 -
270 -
271 -
272 -
273void QTreeView::setColumnHidden(int column, bool hide) -
274{ -
275 QTreeViewPrivate * const d = d_func(); -
276 if (column < 0 || column >= d->header->count())
partially evaluated: column < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:46
partially evaluated: column >= d->header->count()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:46
0-46
277 return;
never executed: return;
0
278 d->header->setSectionHidden(column, hide); -
279}
executed: }
Execution Count:46
46
280bool QTreeView::isHeaderHidden() const -
281{ -
282 const QTreeViewPrivate * const d = d_func(); -
283 return d->header->isHidden();
executed: return d->header->isHidden();
Execution Count:2
2
284} -
285 -
286void QTreeView::setHeaderHidden(bool hide) -
287{ -
288 QTreeViewPrivate * const d = d_func(); -
289 d->header->setHidden(hide); -
290}
executed: }
Execution Count:1
1
291 -
292 -
293 -
294 -
295 -
296 -
297 -
298bool QTreeView::isRowHidden(int row, const QModelIndex &parent) const -
299{ -
300 const QTreeViewPrivate * const d = d_func(); -
301 if (!d->model)
partially evaluated: !d->model
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:24494
0-24494
302 return false;
never executed: return false;
0
303 return d->isRowHidden(d->model->index(row, 0, parent));
executed: return d->isRowHidden(d->model->index(row, 0, parent));
Execution Count:24494
24494
304} -
305 -
306 -
307 -
308 -
309 -
310 -
311void QTreeView::setRowHidden(int row, const QModelIndex &parent, bool hide) -
312{ -
313 QTreeViewPrivate * const d = d_func(); -
314 if (!d->model)
partially evaluated: !d->model
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4194
0-4194
315 return;
never executed: return;
0
316 QModelIndex index = d->model->index(row, 0, parent); -
317 if (!index.isValid())
evaluated: !index.isValid()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:4191
3-4191
318 return;
executed: return;
Execution Count:3
3
319 -
320 if (hide) {
evaluated: hide
TRUEFALSE
yes
Evaluation Count:2117
yes
Evaluation Count:2074
2074-2117
321 d->hiddenIndexes.insert(index); -
322 } else if(d->isPersistent(index)) {
executed: }
Execution Count:2117
evaluated: d->isPersistent(index)
TRUEFALSE
yes
Evaluation Count:1374
yes
Evaluation Count:700
700-2117
323 d->hiddenIndexes.remove(index); -
324 }
executed: }
Execution Count:1374
1374
325 -
326 d->doDelayedItemsLayout(); -
327}
executed: }
Execution Count:4191
4191
328bool QTreeView::isFirstColumnSpanned(int row, const QModelIndex &parent) const -
329{ -
330 const QTreeViewPrivate * const d = d_func(); -
331 if (d->spanningIndexes.isEmpty() || !d->model)
evaluated: d->spanningIndexes.isEmpty()
TRUEFALSE
yes
Evaluation Count:9235
yes
Evaluation Count:34
partially evaluated: !d->model
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:34
0-9235
332 return false;
executed: return false;
Execution Count:9235
9235
333 QModelIndex index = d->model->index(row, 0, parent); -
334 for (int i = 0; i < d->spanningIndexes.count(); ++i)
evaluated: i < d->spanningIndexes.count()
TRUEFALSE
yes
Evaluation Count:64
yes
Evaluation Count:23
23-64
335 if (d->spanningIndexes.at(i) == index)
evaluated: d->spanningIndexes.at(i) == index
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:53
11-53
336 return true;
executed: return true;
Execution Count:11
11
337 return false;
executed: return false;
Execution Count:23
23
338} -
339void QTreeView::setFirstColumnSpanned(int row, const QModelIndex &parent, bool span) -
340{ -
341 QTreeViewPrivate * const d = d_func(); -
342 if (!d->model)
partially evaluated: !d->model
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:9
0-9
343 return;
never executed: return;
0
344 QModelIndex index = d->model->index(row, 0, parent); -
345 if (!index.isValid())
partially evaluated: !index.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:9
0-9
346 return;
never executed: return;
0
347 -
348 if (span) {
partially evaluated: span
TRUEFALSE
yes
Evaluation Count:9
no
Evaluation Count:0
0-9
349 QPersistentModelIndex persistent(index); -
350 if (!d->spanningIndexes.contains(persistent))
partially evaluated: !d->spanningIndexes.contains(persistent)
TRUEFALSE
yes
Evaluation Count:9
no
Evaluation Count:0
0-9
351 d->spanningIndexes.append(persistent);
executed: d->spanningIndexes.append(persistent);
Execution Count:9
9
352 } else {
executed: }
Execution Count:9
9
353 QPersistentModelIndex persistent(index); -
354 int i = d->spanningIndexes.indexOf(persistent); -
355 if (i >= 0)
never evaluated: i >= 0
0
356 d->spanningIndexes.remove(i);
never executed: d->spanningIndexes.remove(i);
0
357 }
never executed: }
0
358 -
359 d->executePostedLayout(); -
360 int i = d->viewIndex(index); -
361 if (i >= 0)
partially evaluated: i >= 0
TRUEFALSE
yes
Evaluation Count:9
no
Evaluation Count:0
0-9
362 d->viewItems[i].spanning = span;
executed: d->viewItems[i].spanning = span;
Execution Count:9
9
363 -
364 d->viewport->update(); -
365}
executed: }
Execution Count:9
9
366 -
367 -
368 -
369 -
370void QTreeView::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles) -
371{ -
372 QTreeViewPrivate * const d = d_func(); -
373 -
374 -
375 if (d->delayedPendingLayout)
evaluated: d->delayedPendingLayout
TRUEFALSE
yes
Evaluation Count:5957
yes
Evaluation Count:523
523-5957
376 return;
executed: return;
Execution Count:5957
5957
377 -
378 -
379 -
380 -
381 bool sizeChanged = false; -
382 int topViewIndex = d->viewIndex(topLeft); -
383 if (topViewIndex == 0) {
evaluated: topViewIndex == 0
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:511
12-511
384 int newDefaultItemHeight = indexRowSizeHint(topLeft); -
385 sizeChanged = d->defaultItemHeight != newDefaultItemHeight; -
386 d->defaultItemHeight = newDefaultItemHeight; -
387 }
executed: }
Execution Count:12
12
388 -
389 if (topViewIndex != -1) {
evaluated: topViewIndex != -1
TRUEFALSE
yes
Evaluation Count:45
yes
Evaluation Count:478
45-478
390 if (topLeft.row() == bottomRight.row()) {
partially evaluated: topLeft.row() == bottomRight.row()
TRUEFALSE
yes
Evaluation Count:45
no
Evaluation Count:0
0-45
391 int oldHeight = d->itemHeight(topViewIndex); -
392 d->invalidateHeightCache(topViewIndex); -
393 sizeChanged |= (oldHeight != d->itemHeight(topViewIndex)); -
394 if (topLeft.column() == 0)
evaluated: topLeft.column() == 0
TRUEFALSE
yes
Evaluation Count:29
yes
Evaluation Count:16
16-29
395 d->viewItems[topViewIndex].hasChildren = d->hasVisibleChildren(topLeft);
executed: d->viewItems[topViewIndex].hasChildren = d->hasVisibleChildren(topLeft);
Execution Count:29
29
396 } else {
executed: }
Execution Count:45
45
397 int bottomViewIndex = d->viewIndex(bottomRight); -
398 for (int i = topViewIndex; i <= bottomViewIndex; ++i) {
never evaluated: i <= bottomViewIndex
0
399 int oldHeight = d->itemHeight(i); -
400 d->invalidateHeightCache(i); -
401 sizeChanged |= (oldHeight != d->itemHeight(i)); -
402 if (topLeft.column() == 0)
never evaluated: topLeft.column() == 0
0
403 d->viewItems[i].hasChildren = d->hasVisibleChildren(d->viewItems.at(i).index);
never executed: d->viewItems[i].hasChildren = d->hasVisibleChildren(d->viewItems.at(i).index);
0
404 }
never executed: }
0
405 }
never executed: }
0
406 } -
407 -
408 if (sizeChanged) {
evaluated: sizeChanged
TRUEFALSE
yes
Evaluation Count:18
yes
Evaluation Count:505
18-505
409 d->updateScrollBars(); -
410 d->viewport->update(); -
411 }
executed: }
Execution Count:18
18
412 QAbstractItemView::dataChanged(topLeft, bottomRight, roles); -
413}
executed: }
Execution Count:523
523
414void QTreeView::hideColumn(int column) -
415{ -
416 QTreeViewPrivate * const d = d_func(); -
417 d->header->hideSection(column); -
418}
executed: }
Execution Count:2
2
419 -
420 -
421 -
422 -
423 -
424 -
425void QTreeView::showColumn(int column) -
426{ -
427 QTreeViewPrivate * const d = d_func(); -
428 d->header->showSection(column); -
429}
never executed: }
0
430void QTreeView::expand(const QModelIndex &index) -
431{ -
432 QTreeViewPrivate * const d = d_func(); -
433 if (!d->isIndexValid(index))
evaluated: !d->isIndexValid(index)
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:213
8-213
434 return;
executed: return;
Execution Count:8
8
435 if (d->delayedPendingLayout) {
evaluated: d->delayedPendingLayout
TRUEFALSE
yes
Evaluation Count:161
yes
Evaluation Count:52
52-161
436 -
437 if (d->storeExpanded(index))
evaluated: d->storeExpanded(index)
TRUEFALSE
yes
Evaluation Count:153
yes
Evaluation Count:8
8-153
438 expanded(index);
executed: expanded(index);
Execution Count:153
153
439 return;
executed: return;
Execution Count:161
161
440 } -
441 -
442 int i = d->viewIndex(index); -
443 if (i != -1) {
evaluated: i != -1
TRUEFALSE
yes
Evaluation Count:49
yes
Evaluation Count:3
3-49
444 d->expand(i, true); -
445 if (!d->isAnimating()) {
evaluated: !d->isAnimating()
TRUEFALSE
yes
Evaluation Count:34
yes
Evaluation Count:15
15-34
446 updateGeometries(); -
447 d->viewport->update(); -
448 }
executed: }
Execution Count:34
34
449 } else if (d->storeExpanded(index)) {
partially evaluated: d->storeExpanded(index)
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
executed: }
Execution Count:49
0-49
450 expanded(index); -
451 }
executed: }
Execution Count:3
3
452} -
453void QTreeView::collapse(const QModelIndex &index) -
454{ -
455 QTreeViewPrivate * const d = d_func(); -
456 if (!d->isIndexValid(index))
evaluated: !d->isIndexValid(index)
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:94
8-94
457 return;
executed: return;
Execution Count:8
8
458 -
459 d->delayedAutoScroll.stop(); -
460 -
461 if (d->delayedPendingLayout) {
evaluated: d->delayedPendingLayout
TRUEFALSE
yes
Evaluation Count:46
yes
Evaluation Count:48
46-48
462 -
463 if (d->isPersistent(index) && d->expandedIndexes.remove(index))
evaluated: d->isPersistent(index)
TRUEFALSE
yes
Evaluation Count:39
yes
Evaluation Count:7
evaluated: d->expandedIndexes.remove(index)
TRUEFALSE
yes
Evaluation Count:33
yes
Evaluation Count:6
6-39
464 collapsed(index);
executed: collapsed(index);
Execution Count:33
33
465 return;
executed: return;
Execution Count:46
46
466 } -
467 int i = d->viewIndex(index); -
468 if (i != -1) {
partially evaluated: i != -1
TRUEFALSE
yes
Evaluation Count:48
no
Evaluation Count:0
0-48
469 d->collapse(i, true); -
470 if (!d->isAnimating()) {
evaluated: !d->isAnimating()
TRUEFALSE
yes
Evaluation Count:39
yes
Evaluation Count:9
9-39
471 updateGeometries(); -
472 viewport()->update(); -
473 }
executed: }
Execution Count:39
39
474 } else {
executed: }
Execution Count:48
48
475 if (d->isPersistent(index) && d->expandedIndexes.remove(index))
never evaluated: d->expandedIndexes.remove(index)
never evaluated: d->isPersistent(index)
0
476 collapsed(index);
never executed: collapsed(index);
0
477 }
never executed: }
0
478} -
479bool QTreeView::isExpanded(const QModelIndex &index) const -
480{ -
481 const QTreeViewPrivate * const d = d_func(); -
482 return d->isIndexExpanded(index);
executed: return d->isIndexExpanded(index);
Execution Count:871
871
483} -
484 -
485 -
486 -
487 -
488 -
489 -
490 -
491void QTreeView::setExpanded(const QModelIndex &index, bool expanded) -
492{ -
493 if (expanded)
evaluated: expanded
TRUEFALSE
yes
Evaluation Count:123
yes
Evaluation Count:24
24-123
494 this->expand(index);
executed: this->expand(index);
Execution Count:123
123
495 else -
496 this->collapse(index);
executed: this->collapse(index);
Execution Count:24
24
497} -
498void QTreeView::setSortingEnabled(bool enable) -
499{ -
500 QTreeViewPrivate * const d = d_func(); -
501 header()->setSortIndicatorShown(enable); -
502 header()->setSectionsClickable(enable); -
503 if (enable) {
evaluated: enable
TRUEFALSE
yes
Evaluation Count:289
yes
Evaluation Count:683
289-683
504 -
505 -
506 sortByColumn(header()->sortIndicatorSection(), header()->sortIndicatorOrder()); -
507 connect(header(), "2""sortIndicatorChanged(int,Qt::SortOrder)", -
508 this, "1""_q_sortIndicatorChanged(int,Qt::SortOrder)", Qt::UniqueConnection); -
509 } else {
executed: }
Execution Count:289
289
510 disconnect(header(), "2""sortIndicatorChanged(int,Qt::SortOrder)", -
511 this, "1""_q_sortIndicatorChanged(int,Qt::SortOrder)"); -
512 }
executed: }
Execution Count:683
683
513 d->sortingEnabled = enable; -
514}
executed: }
Execution Count:972
972
515 -
516bool QTreeView::isSortingEnabled() const -
517{ -
518 const QTreeViewPrivate * const d = d_func(); -
519 return d->sortingEnabled;
executed: return d->sortingEnabled;
Execution Count:68181
68181
520} -
521void QTreeView::setAnimated(bool animate) -
522{ -
523 QTreeViewPrivate * const d = d_func(); -
524 d->animationsEnabled = animate; -
525}
executed: }
Execution Count:6
6
526 -
527bool QTreeView::isAnimated() const -
528{ -
529 const QTreeViewPrivate * const d = d_func(); -
530 return d->animationsEnabled;
executed: return d->animationsEnabled;
Execution Count:4
4
531} -
532void QTreeView::setAllColumnsShowFocus(bool enable) -
533{ -
534 QTreeViewPrivate * const d = d_func(); -
535 if (d->allColumnsShowFocus == enable)
evaluated: d->allColumnsShowFocus == enable
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1
536 return;
executed: return;
Execution Count:1
1
537 d->allColumnsShowFocus = enable; -
538 d->viewport->update(); -
539}
executed: }
Execution Count:1
1
540 -
541bool QTreeView::allColumnsShowFocus() const -
542{ -
543 const QTreeViewPrivate * const d = d_func(); -
544 return d->allColumnsShowFocus;
executed: return d->allColumnsShowFocus;
Execution Count:472
472
545} -
546void QTreeView::setWordWrap(bool on) -
547{ -
548 QTreeViewPrivate * const d = d_func(); -
549 if (d->wrapItemText == on)
never evaluated: d->wrapItemText == on
0
550 return;
never executed: return;
0
551 d->wrapItemText = on; -
552 d->doDelayedItemsLayout(); -
553}
never executed: }
0
554 -
555bool QTreeView::wordWrap() const -
556{ -
557 const QTreeViewPrivate * const d = d_func(); -
558 return d->wrapItemText;
executed: return d->wrapItemText;
Execution Count:1
1
559} -
560 -
561 -
562 -
563 -
564 -
565void QTreeView::keyboardSearch(const QString &search) -
566{ -
567 QTreeViewPrivate * const d = d_func(); -
568 if (!d->model->rowCount(d->root) || !d->model->columnCount(d->root))
evaluated: !d->model->rowCount(d->root)
TRUEFALSE
yes
Evaluation Count:16
yes
Evaluation Count:12
partially evaluated: !d->model->columnCount(d->root)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12
0-16
569 return;
executed: return;
Execution Count:16
16
570 -
571 QModelIndex start; -
572 if (currentIndex().isValid())
evaluated: currentIndex().isValid()
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:4
4-8
573 start = currentIndex();
executed: start = currentIndex();
Execution Count:8
8
574 else -
575 start = d->model->index(0, 0, d->root);
executed: start = d->model->index(0, 0, d->root);
Execution Count:4
4
576 -
577 bool skipRow = false; -
578 bool keyboardTimeWasValid = d->keyboardInputTime.isValid(); -
579 qint64 keyboardInputTimeElapsed = d->keyboardInputTime.restart(); -
580 if (search.isEmpty() || !keyboardTimeWasValid
evaluated: search.isEmpty()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:11
evaluated: !keyboardTimeWasValid
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:8
1-11
581 || keyboardInputTimeElapsed > QApplication::keyboardInputInterval()) {
evaluated: keyboardInputTimeElapsed > QApplication::keyboardInputInterval()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:6
2-6
582 d->keyboardInput = search; -
583 skipRow = currentIndex().isValid(); -
584 } else {
executed: }
Execution Count:6
6
585 d->keyboardInput += search; -
586 }
executed: }
Execution Count:6
6
587 -
588 -
589 bool sameKey = false; -
590 if (d->keyboardInput.length() > 1) {
evaluated: d->keyboardInput.length() > 1
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:5
5-7
591 int c = d->keyboardInput.count(d->keyboardInput.at(d->keyboardInput.length() - 1)); -
592 sameKey = (c == d->keyboardInput.length()); -
593 if (sameKey)
evaluated: sameKey
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:6
1-6
594 skipRow = true;
executed: skipRow = true;
Execution Count:1
1
595 }
executed: }
Execution Count:7
7
596 -
597 -
598 if (skipRow) {
evaluated: skipRow
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:7
5-7
599 if (indexBelow(start).isValid())
evaluated: indexBelow(start).isValid()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:1
1-4
600 start = indexBelow(start);
executed: start = indexBelow(start);
Execution Count:4
4
601 else -
602 start = d->model->index(0, start.column(), d->root);
executed: start = d->model->index(0, start.column(), d->root);
Execution Count:1
1
603 } -
604 -
605 d->executePostedLayout(); -
606 int startIndex = d->viewIndex(start); -
607 if (startIndex <= -1)
partially evaluated: startIndex <= -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12
0-12
608 return;
never executed: return;
0
609 -
610 int previousLevel = -1; -
611 int bestAbove = -1; -
612 int bestBelow = -1; -
613 QString searchString = sameKey ? QString(d->keyboardInput.at(0)) : d->keyboardInput;
evaluated: sameKey
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:11
1-11
614 for (int i = 0; i < d->viewItems.count(); ++i) {
evaluated: i < d->viewItems.count()
TRUEFALSE
yes
Evaluation Count:84
yes
Evaluation Count:12
12-84
615 if ((int)d->viewItems.at(i).level > previousLevel) {
evaluated: (int)d->viewItems.at(i).level > previousLevel
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:71
13-71
616 QModelIndex searchFrom = d->viewItems.at(i).index; -
617 if (start.column() > 0)
evaluated: start.column() > 0
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:11
2-11
618 searchFrom = searchFrom.sibling(searchFrom.row(), start.column());
executed: searchFrom = searchFrom.sibling(searchFrom.row(), start.column());
Execution Count:2
2
619 if (searchFrom.parent() == start.parent())
evaluated: searchFrom.parent() == start.parent()
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:1
1-12
620 searchFrom = start;
executed: searchFrom = start;
Execution Count:12
12
621 QModelIndexList match = d->model->match(searchFrom, Qt::DisplayRole, searchString); -
622 if (match.count()) {
evaluated: match.count()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:8
5-8
623 int hitIndex = d->viewIndex(match.at(0)); -
624 if (hitIndex >= 0 && hitIndex < startIndex)
partially evaluated: hitIndex >= 0
TRUEFALSE
yes
Evaluation Count:5
no
Evaluation Count:0
partially evaluated: hitIndex < startIndex
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
625 bestAbove = bestAbove == -1 ? hitIndex : qMin(hitIndex, bestAbove);
never evaluated: bestAbove == -1
never executed: bestAbove = bestAbove == -1 ? hitIndex : qMin(hitIndex, bestAbove);
0
626 else if (hitIndex >= startIndex)
partially evaluated: hitIndex >= startIndex
TRUEFALSE
yes
Evaluation Count:5
no
Evaluation Count:0
0-5
627 bestBelow = bestBelow == -1 ? hitIndex : qMin(hitIndex, bestBelow);
partially evaluated: bestBelow == -1
TRUEFALSE
yes
Evaluation Count:5
no
Evaluation Count:0
executed: bestBelow = bestBelow == -1 ? hitIndex : qMin(hitIndex, bestBelow);
Execution Count:5
0-5
628 } -
629 }
executed: }
Execution Count:13
13
630 previousLevel = d->viewItems.at(i).level; -
631 }
executed: }
Execution Count:84
84
632 -
633 QModelIndex index; -
634 if (bestBelow > -1)
evaluated: bestBelow > -1
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:7
5-7
635 index = d->viewItems.at(bestBelow).index;
executed: index = d->viewItems.at(bestBelow).index;
Execution Count:5
5
636 else if (bestAbove > -1)
partially evaluated: bestAbove > -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7
0-7
637 index = d->viewItems.at(bestAbove).index;
never executed: index = d->viewItems.at(bestAbove).index;
0
638 -
639 if (start.column() > 0)
evaluated: start.column() > 0
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:10
2-10
640 index = index.sibling(index.row(), start.column());
executed: index = index.sibling(index.row(), start.column());
Execution Count:2
2
641 -
642 if (index.isValid()) {
evaluated: index.isValid()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:7
5-7
643 QItemSelectionModel::SelectionFlags flags = (d->selectionMode == SingleSelection
partially evaluated: d->selectionMode == SingleSelection
TRUEFALSE
yes
Evaluation Count:5
no
Evaluation Count:0
0-5
644 ? QItemSelectionModel::SelectionFlags( -
645 QItemSelectionModel::ClearAndSelect -
646 |d->selectionBehaviorFlags()) -
647 : QItemSelectionModel::SelectionFlags( -
648 QItemSelectionModel::NoUpdate)); -
649 selectionModel()->setCurrentIndex(index, flags); -
650 }
executed: }
Execution Count:5
5
651}
executed: }
Execution Count:12
12
652 -
653 -
654 -
655 -
656 -
657QRect QTreeView::visualRect(const QModelIndex &index) const -
658{ -
659 const QTreeViewPrivate * const d = d_func(); -
660 -
661 if (!d->isIndexValid(index) || isIndexHidden(index))
evaluated: !d->isIndexValid(index)
TRUEFALSE
yes
Evaluation Count:47
yes
Evaluation Count:16830
evaluated: isIndexHidden(index)
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:16824
6-16830
662 return QRect();
executed: return QRect();
Execution Count:53
53
663 -
664 d->executePostedLayout(); -
665 -
666 int vi = d->viewIndex(index); -
667 if (vi < 0)
evaluated: vi < 0
TRUEFALSE
yes
Evaluation Count:568
yes
Evaluation Count:16256
568-16256
668 return QRect();
executed: return QRect();
Execution Count:568
568
669 -
670 bool spanning = d->viewItems.at(vi).spanning; -
671 -
672 -
673 int x = (spanning ? 0 : columnViewportPosition(index.column()));
evaluated: spanning
TRUEFALSE
yes
Evaluation Count:22
yes
Evaluation Count:16234
22-16234
674 int w = (spanning ? d->header->length() : columnWidth(index.column()));
evaluated: spanning
TRUEFALSE
yes
Evaluation Count:22
yes
Evaluation Count:16234
22-16234
675 -
676 if (index.column() == 0) {
evaluated: index.column() == 0
TRUEFALSE
yes
Evaluation Count:6931
yes
Evaluation Count:9325
6931-9325
677 int i = d->indentationForItem(vi); -
678 w -= i; -
679 if (!isRightToLeft())
evaluated: !isRightToLeft()
TRUEFALSE
yes
Evaluation Count:6923
yes
Evaluation Count:8
8-6923
680 x += i;
executed: x += i;
Execution Count:6923
6923
681 }
executed: }
Execution Count:6931
6931
682 -
683 int y = d->coordinateForItem(vi); -
684 int h = d->itemHeight(vi); -
685 -
686 return QRect(x, y, w, h);
executed: return QRect(x, y, w, h);
Execution Count:16256
16256
687} -
688void QTreeView::scrollTo(const QModelIndex &index, ScrollHint hint) -
689{ -
690 QTreeViewPrivate * const d = d_func(); -
691 -
692 if (!d->isIndexValid(index))
evaluated: !d->isIndexValid(index)
TRUEFALSE
yes
Evaluation Count:30
yes
Evaluation Count:5635
30-5635
693 return;
executed: return;
Execution Count:30
30
694 -
695 d->executePostedLayout(); -
696 d->updateScrollBars(); -
697 -
698 -
699 QModelIndex parent = index.parent(); -
700 while (parent != d->root && parent.isValid() && state() == NoState && d->itemsExpandable) {
evaluated: parent != d->root
TRUEFALSE
yes
Evaluation Count:56
yes
Evaluation Count:5635
partially evaluated: parent.isValid()
TRUEFALSE
yes
Evaluation Count:56
no
Evaluation Count:0
partially evaluated: state() == NoState
TRUEFALSE
yes
Evaluation Count:56
no
Evaluation Count:0
partially evaluated: d->itemsExpandable
TRUEFALSE
yes
Evaluation Count:56
no
Evaluation Count:0
0-5635
701 if (!isExpanded(parent))
evaluated: !isExpanded(parent)
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:49
7-49
702 expand(parent);
executed: expand(parent);
Execution Count:7
7
703 parent = d->model->parent(parent); -
704 }
executed: }
Execution Count:56
56
705 -
706 int item = d->viewIndex(index); -
707 if (item < 0)
partially evaluated: item < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5635
0-5635
708 return;
never executed: return;
0
709 -
710 QRect area = d->viewport->rect(); -
711 -
712 -
713 if (verticalScrollMode() == QAbstractItemView::ScrollPerItem) {
evaluated: verticalScrollMode() == QAbstractItemView::ScrollPerItem
TRUEFALSE
yes
Evaluation Count:2897
yes
Evaluation Count:2738
2738-2897
714 int top = verticalScrollBar()->value(); -
715 int bottom = top + verticalScrollBar()->pageStep(); -
716 if (hint == EnsureVisible && item >= top && item < bottom) {
evaluated: hint == EnsureVisible
TRUEFALSE
yes
Evaluation Count:2889
yes
Evaluation Count:8
evaluated: item >= top
TRUEFALSE
yes
Evaluation Count:2882
yes
Evaluation Count:7
evaluated: item < bottom
TRUEFALSE
yes
Evaluation Count:2842
yes
Evaluation Count:40
7-2889
717 -
718 } else if (hint == PositionAtTop || (hint == EnsureVisible && item < top)) {
evaluated: hint == PositionAtTop
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:48
evaluated: hint == EnsureVisible
TRUEFALSE
yes
Evaluation Count:47
yes
Evaluation Count:1
evaluated: item < top
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:40
executed: }
Execution Count:2842
1-2842
719 verticalScrollBar()->setValue(item); -
720 } else {
executed: }
Execution Count:14
14
721 const int currentItemHeight = d->itemHeight(item); -
722 int y = (hint == PositionAtCenter
partially evaluated: hint == PositionAtCenter
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:41
0-41
723 -
724 ? area.height() / 2 + currentItemHeight - 1 -
725 -
726 : area.height()); -
727 if (y > currentItemHeight) {
partially evaluated: y > currentItemHeight
TRUEFALSE
yes
Evaluation Count:41
no
Evaluation Count:0
0-41
728 while (item >= 0) {
evaluated: item >= 0
TRUEFALSE
yes
Evaluation Count:357
yes
Evaluation Count:1
1-357
729 y -= d->itemHeight(item); -
730 if (y < 0) {
evaluated: y < 0
TRUEFALSE
yes
Evaluation Count:40
yes
Evaluation Count:317
40-317
731 item++; -
732 break;
executed: break;
Execution Count:40
40
733 } -
734 item--; -
735 }
executed: }
Execution Count:317
317
736 }
executed: }
Execution Count:41
41
737 verticalScrollBar()->setValue(item); -
738 }
executed: }
Execution Count:41
41
739 } else { -
740 QRect rect(columnViewportPosition(index.column()), -
741 d->coordinateForItem(item), -
742 columnWidth(index.column()), -
743 d->itemHeight(item)); -
744 -
745 if (rect.isEmpty()) {
partially evaluated: rect.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2738
0-2738
746 -
747 } else if (hint == EnsureVisible && area.contains(rect)) {
evaluated: hint == EnsureVisible
TRUEFALSE
yes
Evaluation Count:2736
yes
Evaluation Count:2
evaluated: area.contains(rect)
TRUEFALSE
yes
Evaluation Count:461
yes
Evaluation Count:2275
never executed: }
0-2736
748 d->viewport->update(rect); -
749 -
750 } else {
executed: }
Execution Count:461
461
751 bool above = (hint == EnsureVisible
evaluated: hint == EnsureVisible
TRUEFALSE
yes
Evaluation Count:2275
yes
Evaluation Count:2
2-2275
752 && (rect.top() < area.top()
evaluated: rect.top() < area.top()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:2271
4-2271
753 || area.height() < rect.height()));
partially evaluated: area.height() < rect.height()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2271
0-2271
754 bool below = (hint == EnsureVisible
evaluated: hint == EnsureVisible
TRUEFALSE
yes
Evaluation Count:2275
yes
Evaluation Count:2
2-2275
755 && rect.bottom() > area.bottom()
evaluated: rect.bottom() > area.bottom()
TRUEFALSE
yes
Evaluation Count:1873
yes
Evaluation Count:402
402-1873
756 && rect.height() < area.height());
partially evaluated: rect.height() < area.height()
TRUEFALSE
yes
Evaluation Count:1873
no
Evaluation Count:0
0-1873
757 -
758 int verticalValue = verticalScrollBar()->value(); -
759 if (hint == PositionAtTop || above)
evaluated: hint == PositionAtTop
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2275
evaluated: above
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:2271
2-2275
760 verticalValue += rect.top();
executed: verticalValue += rect.top();
Execution Count:6
6
761 else if (hint == PositionAtBottom || below)
partially evaluated: hint == PositionAtBottom
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2271
evaluated: below
TRUEFALSE
yes
Evaluation Count:1873
yes
Evaluation Count:398
0-2271
762 verticalValue += rect.bottom() - area.height();
executed: verticalValue += rect.bottom() - area.height();
Execution Count:1873
1873
763 else if (hint == PositionAtCenter)
partially evaluated: hint == PositionAtCenter
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:398
0-398
764 verticalValue += rect.top() - ((area.height() - rect.height()) / 2);
never executed: verticalValue += rect.top() - ((area.height() - rect.height()) / 2);
0
765 verticalScrollBar()->setValue(verticalValue); -
766 }
executed: }
Execution Count:2277
2277
767 } -
768 -
769 int viewportWidth = d->viewport->width(); -
770 int horizontalOffset = d->header->offset(); -
771 int horizontalPosition = d->header->sectionPosition(index.column()); -
772 int cellWidth = d->header->sectionSize(index.column()); -
773 -
774 if (hint == PositionAtCenter) {
partially evaluated: hint == PositionAtCenter
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5635
0-5635
775 horizontalScrollBar()->setValue(horizontalPosition - ((viewportWidth - cellWidth) / 2)); -
776 } else {
never executed: }
0
777 if (horizontalPosition - horizontalOffset < 0 || cellWidth > viewportWidth)
evaluated: horizontalPosition - horizontalOffset < 0
TRUEFALSE
yes
Evaluation Count:2355
yes
Evaluation Count:3280
evaluated: cellWidth > viewportWidth
TRUEFALSE
yes
Evaluation Count:25
yes
Evaluation Count:3255
25-3280
778 horizontalScrollBar()->setValue(horizontalPosition);
executed: horizontalScrollBar()->setValue(horizontalPosition);
Execution Count:2380
2380
779 else if (horizontalPosition - horizontalOffset + cellWidth > viewportWidth)
evaluated: horizontalPosition - horizontalOffset + cellWidth > viewportWidth
TRUEFALSE
yes
Evaluation Count:1317
yes
Evaluation Count:1938
1317-1938
780 horizontalScrollBar()->setValue(horizontalPosition - viewportWidth + cellWidth);
executed: horizontalScrollBar()->setValue(horizontalPosition - viewportWidth + cellWidth);
Execution Count:1317
1317
781 } -
782} -
783 -
784 -
785 -
786 -
787void QTreeView::timerEvent(QTimerEvent *event) -
788{ -
789 QTreeViewPrivate * const d = d_func(); -
790 if (event->timerId() == d->columnResizeTimerID) {
evaluated: event->timerId() == d->columnResizeTimerID
TRUEFALSE
yes
Evaluation Count:92
yes
Evaluation Count:483
92-483
791 updateGeometries(); -
792 killTimer(d->columnResizeTimerID); -
793 d->columnResizeTimerID = 0; -
794 QRect rect; -
795 int viewportHeight = d->viewport->height(); -
796 int viewportWidth = d->viewport->width(); -
797 for (int i = d->columnsToUpdate.size() - 1; i >= 0; --i) {
evaluated: i >= 0
TRUEFALSE
yes
Evaluation Count:224
yes
Evaluation Count:92
92-224
798 int column = d->columnsToUpdate.at(i); -
799 int x = columnViewportPosition(column); -
800 if (isRightToLeft())
evaluated: isRightToLeft()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:223
1-223
801 rect |= QRect(0, 0, x + columnWidth(column), viewportHeight);
executed: rect |= QRect(0, 0, x + columnWidth(column), viewportHeight);
Execution Count:1
1
802 else -
803 rect |= QRect(x, 0, viewportWidth - x, viewportHeight);
executed: rect |= QRect(x, 0, viewportWidth - x, viewportHeight);
Execution Count:223
223
804 } -
805 d->viewport->update(rect.normalized()); -
806 d->columnsToUpdate.clear(); -
807 } else if (event->timerId() == d->openTimer.timerId()) {
executed: }
Execution Count:92
partially evaluated: event->timerId() == d->openTimer.timerId()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:483
0-483
808 QPoint pos = d->viewport->mapFromGlobal(QCursor::pos()); -
809 if (state() == QAbstractItemView::DraggingState
never evaluated: state() == QAbstractItemView::DraggingState
0
810 && d->viewport->rect().contains(pos)) {
never evaluated: d->viewport->rect().contains(pos)
0
811 QModelIndex index = indexAt(pos); -
812 setExpanded(index, !isExpanded(index)); -
813 }
never executed: }
0
814 d->openTimer.stop(); -
815 }
never executed: }
0
816 -
817 QAbstractItemView::timerEvent(event); -
818}
executed: }
Execution Count:575
575
819 -
820 -
821 -
822 -
823 -
824void QTreeView::dragMoveEvent(QDragMoveEvent *event) -
825{ -
826 QTreeViewPrivate * const d = d_func(); -
827 if (d->autoExpandDelay >= 0)
never evaluated: d->autoExpandDelay >= 0
0
828 d->openTimer.start(d->autoExpandDelay, this);
never executed: d->openTimer.start(d->autoExpandDelay, this);
0
829 QAbstractItemView::dragMoveEvent(event); -
830}
never executed: }
0
831 -
832 -
833 -
834 -
835 -
836bool QTreeView::viewportEvent(QEvent *event) -
837{ -
838 QTreeViewPrivate * const d = d_func(); -
839 switch (event->type()) { -
840 case QEvent::HoverEnter: -
841 case QEvent::HoverLeave: -
842 case QEvent::HoverMove: { -
843 QHoverEvent *he = static_cast<QHoverEvent*>(event); -
844 int oldBranch = d->hoverBranch; -
845 d->hoverBranch = d->itemDecorationAt(he->pos()); -
846 QModelIndex newIndex = indexAt(he->pos()); -
847 if (d->hover != newIndex || d->hoverBranch != oldBranch) {
never evaluated: d->hover != newIndex
never evaluated: d->hoverBranch != oldBranch
0
848 -
849 -
850 QRect rect = visualRect(newIndex); -
851 rect.setX(0); -
852 rect.setWidth(viewport()->width()); -
853 viewport()->update(rect); -
854 }
never executed: }
0
855 break; }
never executed: break;
0
856 default: -
857 break;
executed: break;
Execution Count:11783
11783
858 } -
859 return QAbstractItemView::viewportEvent(event);
executed: return QAbstractItemView::viewportEvent(event);
Execution Count:11783
11783
860} -
861 -
862 -
863 -
864 -
865void QTreeView::paintEvent(QPaintEvent *event) -
866{ -
867 QTreeViewPrivate * const d = d_func(); -
868 d->executePostedLayout(); -
869 QPainter painter(viewport()); -
870 -
871 if (d->isAnimating()) {
evaluated: d->isAnimating()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:365
1-365
872 drawTree(&painter, event->region() - d->animatedOperation.rect()); -
873 d->drawAnimatedOperation(&painter); -
874 } else
executed: }
Execution Count:1
1
875 -
876 { -
877 drawTree(&painter, event->region()); -
878 -
879 d->paintDropIndicator(&painter); -
880 -
881 }
executed: }
Execution Count:365
365
882} -
883 -
884void QTreeViewPrivate::paintAlternatingRowColors(QPainter *painter, QStyleOptionViewItem *option, int y, int bottom) const -
885{ -
886 const QTreeView * const q = q_func(); -
887 if (!alternatingColors || !q->style()->styleHint(QStyle::SH_ItemView_PaintAlternatingRowColorsForEmptyArea, option, q))
evaluated: !alternatingColors
TRUEFALSE
yes
Evaluation Count:149
yes
Evaluation Count:19
partially evaluated: !q->style()->styleHint(QStyle::SH_ItemView_PaintAlternatingRowColorsForEmptyArea, option, q)
TRUEFALSE
yes
Evaluation Count:19
no
Evaluation Count:0
0-149
888 return;
executed: return;
Execution Count:168
168
889 int rowHeight = defaultItemHeight; -
890 if (rowHeight <= 0) {
never evaluated: rowHeight <= 0
0
891 rowHeight = itemDelegate->sizeHint(*option, QModelIndex()).height(); -
892 if (rowHeight <= 0)
never evaluated: rowHeight <= 0
0
893 return;
never executed: return;
0
894 }
never executed: }
0
895 while (y <= bottom) {
never evaluated: y <= bottom
0
896 option->rect.setRect(0, y, viewport->width(), rowHeight); -
897 if (current & 1) {
never evaluated: current & 1
0
898 option->features |= QStyleOptionViewItem::Alternate; -
899 } else {
never executed: }
0
900 option->features &= ~QStyleOptionViewItem::Alternate; -
901 }
never executed: }
0
902 ++current; -
903 q->style()->drawPrimitive(QStyle::PE_PanelItemViewRow, option, painter, q); -
904 y += rowHeight; -
905 }
never executed: }
0
906}
never executed: }
0
907 -
908bool QTreeViewPrivate::expandOrCollapseItemAtPos(const QPoint &pos) -
909{ -
910 QTreeView * const q = q_func(); -
911 -
912 if ((state != QAbstractItemView::NoState
evaluated: state != QAbstractItemView::NoState
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:4577
1-4577
913 && state != QAbstractItemView::EditingState)
partially evaluated: state != QAbstractItemView::EditingState
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
914 || !viewport->rect().contains(pos))
evaluated: !viewport->rect().contains(pos)
TRUEFALSE
yes
Evaluation Count:4298
yes
Evaluation Count:280
280-4298
915 return true;
executed: return true;
Execution Count:4298
4298
916 -
917 int i = itemDecorationAt(pos); -
918 if ((i != -1) && itemsExpandable && hasVisibleChildren(viewItems.at(i).index)) {
evaluated: (i != -1)
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:278
partially evaluated: itemsExpandable
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
partially evaluated: hasVisibleChildren(viewItems.at(i).index)
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-278
919 if (viewItems.at(i).expanded)
partially evaluated: viewItems.at(i).expanded
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
920 collapse(i, true);
never executed: collapse(i, true);
0
921 else -
922 expand(i, true);
executed: expand(i, true);
Execution Count:2
2
923 if (!isAnimating()) {
partially evaluated: !isAnimating()
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
924 q->updateGeometries(); -
925 viewport->update(); -
926 }
executed: }
Execution Count:2
2
927 return true;
executed: return true;
Execution Count:2
2
928 } -
929 return false;
executed: return false;
Execution Count:278
278
930} -
931 -
932void QTreeViewPrivate::_q_modelDestroyed() -
933{ -
934 -
935 -
936 viewItems.clear(); -
937 QAbstractItemViewPrivate::_q_modelDestroyed(); -
938}
executed: }
Execution Count:367
367
939 -
940 -
941 -
942 -
943 -
944 -
945QItemViewPaintPairs QTreeViewPrivate::draggablePaintPairs(const QModelIndexList &indexes, QRect *r) const -
946{ -
947 qt_noop(); -
948 const QTreeView * const q = q_func(); -
949 if (spanningIndexes.isEmpty())
never evaluated: spanningIndexes.isEmpty()
0
950 return QAbstractItemViewPrivate::draggablePaintPairs(indexes, r);
never executed: return QAbstractItemViewPrivate::draggablePaintPairs(indexes, r);
0
951 QModelIndexList list; -
952 for (QForeachContainer<__typeof__(indexes)> _container_(indexes); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (const QModelIndex &idx = *_container_.i;; __extension__ ({--_container_.brk; break;})) { -
953 if (idx.column() > 0 && q->isFirstColumnSpanned(idx.row(), idx.parent()))
never evaluated: idx.column() > 0
never evaluated: q->isFirstColumnSpanned(idx.row(), idx.parent())
0
954 continue;
never executed: continue;
0
955 list << idx; -
956 }
never executed: }
0
957 return QAbstractItemViewPrivate::draggablePaintPairs(list, r);
never executed: return QAbstractItemViewPrivate::draggablePaintPairs(list, r);
0
958} -
959 -
960void QTreeViewPrivate::adjustViewOptionsForIndex(QStyleOptionViewItem *option, const QModelIndex &current) const -
961{ -
962 const int row = viewIndex(current); -
963 option->state = option->state | (viewItems.at(row).expanded ? QStyle::State_Open : QStyle::State_None) -
964 | (viewItems.at(row).hasChildren ? QStyle::State_Children : QStyle::State_None) -
965 | (viewItems.at(row).hasMoreSiblings ? QStyle::State_Sibling : QStyle::State_None); -
966 -
967 option->showDecorationSelected = (selectionBehavior & QTreeView::SelectRows)
never evaluated: (selectionBehavior & QTreeView::SelectRows)
0
968 || option->showDecorationSelected;
never evaluated: option->showDecorationSelected
0
969 -
970 QVector<int> logicalIndices; -
971 QVector<QStyleOptionViewItem::ViewItemPosition> viewItemPosList; -
972 const bool spanning = viewItems.at(row).spanning; -
973 const int left = (spanning ? header->visualIndex(0) : 0);
never evaluated: spanning
0
974 const int right = (spanning ? header->visualIndex(0) : header->count() - 1 );
never evaluated: spanning
0
975 calcLogicalIndices(&logicalIndices, &viewItemPosList, left, right); -
976 -
977 int columnIndex = 0; -
978 for (int visualIndex = 0; visualIndex < current.column(); ++visualIndex) {
never evaluated: visualIndex < current.column()
0
979 int logicalIndex = header->logicalIndex(visualIndex); -
980 if (!header->isSectionHidden(logicalIndex)) {
never evaluated: !header->isSectionHidden(logicalIndex)
0
981 ++columnIndex; -
982 }
never executed: }
0
983 }
never executed: }
0
984 -
985 option->viewItemPosition = viewItemPosList.at(columnIndex); -
986}
never executed: }
0
987void QTreeView::drawTree(QPainter *painter, const QRegion &region) const -
988{ -
989 const QTreeViewPrivate * const d = d_func(); -
990 const QVector<QTreeViewItem> viewItems = d->viewItems; -
991 -
992 QStyleOptionViewItem option = d->viewOptions(); -
993 const QStyle::State state = option.state; -
994 d->current = 0; -
995 -
996 if (viewItems.count() == 0 || d->header->count() == 0 || !d->itemDelegate) {
evaluated: viewItems.count() == 0
TRUEFALSE
yes
Evaluation Count:43
yes
Evaluation Count:360
partially evaluated: d->header->count() == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:360
partially evaluated: !d->itemDelegate
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:360
0-360
997 d->paintAlternatingRowColors(painter, &option, 0, region.boundingRect().bottom()+1); -
998 return;
executed: return;
Execution Count:43
43
999 } -
1000 -
1001 int firstVisibleItemOffset = 0; -
1002 const int firstVisibleItem = d->firstVisibleItem(&firstVisibleItemOffset); -
1003 if (firstVisibleItem < 0) {
partially evaluated: firstVisibleItem < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:360
0-360
1004 d->paintAlternatingRowColors(painter, &option, 0, region.boundingRect().bottom()+1); -
1005 return;
never executed: return;
0
1006 } -
1007 -
1008 const int viewportWidth = d->viewport->width(); -
1009 -
1010 QPoint hoverPos = d->viewport->mapFromGlobal(QCursor::pos()); -
1011 d->hoverBranch = d->itemDecorationAt(hoverPos); -
1012 -
1013 QVector<QRect> rects = region.rects(); -
1014 QVector<int> drawn; -
1015 bool multipleRects = (rects.size() > 1); -
1016 for (int a = 0; a < rects.size(); ++a) {
evaluated: a < rects.size()
TRUEFALSE
yes
Evaluation Count:471
yes
Evaluation Count:360
360-471
1017 const QRect area = (multipleRects
evaluated: multipleRects
TRUEFALSE
yes
Evaluation Count:174
yes
Evaluation Count:297
174-297
1018 ? QRect(0, rects.at(a).y(), viewportWidth, rects.at(a).height()) -
1019 : rects.at(a)); -
1020 d->leftAndRight = d->startAndEndColumns(area); -
1021 -
1022 int i = firstVisibleItem; -
1023 int y = firstVisibleItemOffset; -
1024 -
1025 -
1026 for (; i < viewItems.count(); ++i) {
evaluated: i < viewItems.count()
TRUEFALSE
yes
Evaluation Count:1269
yes
Evaluation Count:8
8-1269
1027 const int itemHeight = d->itemHeight(i); -
1028 if (y + itemHeight > area.top())
evaluated: y + itemHeight > area.top()
TRUEFALSE
yes
Evaluation Count:463
yes
Evaluation Count:806
463-806
1029 break;
executed: break;
Execution Count:463
463
1030 y += itemHeight; -
1031 }
executed: }
Execution Count:806
806
1032 -
1033 -
1034 for (; i < viewItems.count() && y <= area.bottom(); ++i) {
evaluated: i < viewItems.count()
TRUEFALSE
yes
Evaluation Count:2307
yes
Evaluation Count:163
evaluated: y <= area.bottom()
TRUEFALSE
yes
Evaluation Count:1999
yes
Evaluation Count:308
163-2307
1035 const int itemHeight = d->itemHeight(i); -
1036 option.rect.setRect(0, y, viewportWidth, itemHeight); -
1037 option.state = state | (viewItems.at(i).expanded ? QStyle::State_Open : QStyle::State_None) -
1038 | (viewItems.at(i).hasChildren ? QStyle::State_Children : QStyle::State_None) -
1039 | (viewItems.at(i).hasMoreSiblings ? QStyle::State_Sibling : QStyle::State_None); -
1040 d->current = i; -
1041 d->spanning = viewItems.at(i).spanning; -
1042 if (!multipleRects || !drawn.contains(i)) {
evaluated: !multipleRects
TRUEFALSE
yes
Evaluation Count:1799
yes
Evaluation Count:200
evaluated: !drawn.contains(i)
TRUEFALSE
yes
Evaluation Count:193
yes
Evaluation Count:7
7-1799
1043 drawRow(painter, option, viewItems.at(i).index); -
1044 if (multipleRects)
evaluated: multipleRects
TRUEFALSE
yes
Evaluation Count:193
yes
Evaluation Count:1799
193-1799
1045 drawn.append(i);
executed: drawn.append(i);
Execution Count:193
193
1046 }
executed: }
Execution Count:1992
1992
1047 y += itemHeight; -
1048 }
executed: }
Execution Count:1999
1999
1049 -
1050 if (y <= area.bottom()) {
evaluated: y <= area.bottom()
TRUEFALSE
yes
Evaluation Count:125
yes
Evaluation Count:346
125-346
1051 d->current = i; -
1052 d->paintAlternatingRowColors(painter, &option, y, area.bottom()); -
1053 }
executed: }
Execution Count:125
125
1054 }
executed: }
Execution Count:471
471
1055}
executed: }
Execution Count:360
360
1056 -
1057 -
1058static inline bool ancestorOf(QObject *widget, QObject *other) -
1059{ -
1060 for (QObject *parent = other; parent != 0; parent = parent->parent()) {
evaluated: parent != 0
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:1
1-5
1061 if (parent == widget)
partially evaluated: parent == widget
TRUEFALSE
yes
Evaluation Count:5
no
Evaluation Count:0
0-5
1062 return true;
executed: return true;
Execution Count:5
5
1063 }
never executed: }
0
1064 return false;
executed: return false;
Execution Count:1
1
1065} -
1066 -
1067void QTreeViewPrivate::calcLogicalIndices(QVector<int> *logicalIndices, QVector<QStyleOptionViewItem::ViewItemPosition> *itemPositions, int left, int right) const -
1068{ -
1069 const int columnCount = header->count(); -
1070 -
1071 -
1072 -
1073 int logicalIndexBeforeLeft = -1, logicalIndexAfterRight = -1; -
1074 for (int visualIndex = left - 1; visualIndex >= 0; --visualIndex) {
evaluated: visualIndex >= 0
TRUEFALSE
yes
Evaluation Count:17
yes
Evaluation Count:1982
17-1982
1075 int logicalIndex = header->logicalIndex(visualIndex); -
1076 if (!header->isSectionHidden(logicalIndex)) {
evaluated: !header->isSectionHidden(logicalIndex)
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:7
7-10
1077 logicalIndexBeforeLeft = logicalIndex; -
1078 break;
executed: break;
Execution Count:10
10
1079 } -
1080 }
executed: }
Execution Count:7
7
1081 -
1082 for (int visualIndex = left; visualIndex < columnCount; ++visualIndex) {
evaluated: visualIndex < columnCount
TRUEFALSE
yes
Evaluation Count:5910
yes
Evaluation Count:1093
1093-5910
1083 int logicalIndex = header->logicalIndex(visualIndex); -
1084 if (!header->isSectionHidden(logicalIndex)) {
evaluated: !header->isSectionHidden(logicalIndex)
TRUEFALSE
yes
Evaluation Count:5884
yes
Evaluation Count:26
26-5884
1085 if (visualIndex > right) {
evaluated: visualIndex > right
TRUEFALSE
yes
Evaluation Count:899
yes
Evaluation Count:4985
899-4985
1086 logicalIndexAfterRight = logicalIndex; -
1087 break;
executed: break;
Execution Count:899
899
1088 } -
1089 logicalIndices->append(logicalIndex); -
1090 }
executed: }
Execution Count:4985
4985
1091 }
executed: }
Execution Count:5011
5011
1092 -
1093 itemPositions->resize(logicalIndices->count()); -
1094 for (int currentLogicalSection = 0; currentLogicalSection < logicalIndices->count(); ++currentLogicalSection) {
evaluated: currentLogicalSection < logicalIndices->count()
TRUEFALSE
yes
Evaluation Count:4985
yes
Evaluation Count:1992
1992-4985
1095 const int headerSection = logicalIndices->at(currentLogicalSection); -
1096 -
1097 int nextLogicalSection = currentLogicalSection + 1 >= logicalIndices->count()
evaluated: currentLogicalSection + 1 >= logicalIndices->count()
TRUEFALSE
yes
Evaluation Count:1992
yes
Evaluation Count:2993
1992-2993
1098 ? logicalIndexAfterRight -
1099 : logicalIndices->at(currentLogicalSection + 1); -
1100 int prevLogicalSection = currentLogicalSection - 1 < 0
evaluated: currentLogicalSection - 1 < 0
TRUEFALSE
yes
Evaluation Count:1992
yes
Evaluation Count:2993
1992-2993
1101 ? logicalIndexBeforeLeft -
1102 : logicalIndices->at(currentLogicalSection - 1); -
1103 QStyleOptionViewItem::ViewItemPosition pos; -
1104 if (columnCount == 1 || (nextLogicalSection == 0 && prevLogicalSection == -1)
evaluated: columnCount == 1
TRUEFALSE
yes
Evaluation Count:328
yes
Evaluation Count:4657
partially evaluated: nextLogicalSection == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4657
never evaluated: prevLogicalSection == -1
0-4657
1105 || (headerSection == 0 && nextLogicalSection == -1) || spanning)
evaluated: headerSection == 0
TRUEFALSE
yes
Evaluation Count:1647
yes
Evaluation Count:3010
partially evaluated: nextLogicalSection == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1647
evaluated: spanning
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:4651
0-4651
1106 pos = QStyleOptionViewItem::OnlyOne;
executed: pos = QStyleOptionViewItem::OnlyOne;
Execution Count:334
334
1107 else if (headerSection == 0 || (nextLogicalSection != 0 && prevLogicalSection == -1))
evaluated: headerSection == 0
TRUEFALSE
yes
Evaluation Count:1641
yes
Evaluation Count:3010
partially evaluated: nextLogicalSection != 0
TRUEFALSE
yes
Evaluation Count:3010
no
Evaluation Count:0
evaluated: prevLogicalSection == -1
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:3003
0-3010
1108 pos = QStyleOptionViewItem::Beginning;
executed: pos = QStyleOptionViewItem::Beginning;
Execution Count:1648
1648
1109 else if (nextLogicalSection == 0 || nextLogicalSection == -1)
partially evaluated: nextLogicalSection == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3003
evaluated: nextLogicalSection == -1
TRUEFALSE
yes
Evaluation Count:758
yes
Evaluation Count:2245
0-3003
1110 pos = QStyleOptionViewItem::End;
executed: pos = QStyleOptionViewItem::End;
Execution Count:758
758
1111 else -
1112 pos = QStyleOptionViewItem::Middle;
executed: pos = QStyleOptionViewItem::Middle;
Execution Count:2245
2245
1113 (*itemPositions)[currentLogicalSection] = pos; -
1114 }
executed: }
Execution Count:4985
4985
1115}
executed: }
Execution Count:1992
1992
1116void QTreeView::drawRow(QPainter *painter, const QStyleOptionViewItem &option, -
1117 const QModelIndex &index) const -
1118{ -
1119 const QTreeViewPrivate * const d = d_func(); -
1120 QStyleOptionViewItem opt = option; -
1121 const QPoint offset = d->scrollDelayOffset; -
1122 const int y = option.rect.y() + offset.y(); -
1123 const QModelIndex parent = index.parent(); -
1124 const QHeaderView *header = d->header; -
1125 const QModelIndex current = currentIndex(); -
1126 const QModelIndex hover = d->hover; -
1127 const bool reverse = isRightToLeft(); -
1128 const QStyle::State state = opt.state; -
1129 const bool spanning = d->spanning; -
1130 const int left = (spanning ? header->visualIndex(0) : d->leftAndRight.first);
evaluated: spanning
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:1986
6-1986
1131 const int right = (spanning ? header->visualIndex(0) : d->leftAndRight.second);
evaluated: spanning
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:1986
6-1986
1132 const bool alternate = d->alternatingColors; -
1133 const bool enabled = (state & QStyle::State_Enabled) != 0; -
1134 const bool allColumnsShowFocus = d->allColumnsShowFocus; -
1135 -
1136 -
1137 -
1138 -
1139 bool indexWidgetHasFocus = false; -
1140 if ((current.row() == index.row()) && !d->editorIndexHash.isEmpty()) {
evaluated: (current.row() == index.row())
TRUEFALSE
yes
Evaluation Count:268
yes
Evaluation Count:1724
evaluated: !d->editorIndexHash.isEmpty()
TRUEFALSE
yes
Evaluation Count:17
yes
Evaluation Count:251
17-1724
1141 const int r = index.row(); -
1142 QWidget *fw = QApplication::focusWidget(); -
1143 for (int c = 0; c < header->count(); ++c) {
evaluated: c < header->count()
TRUEFALSE
yes
Evaluation Count:54
yes
Evaluation Count:12
12-54
1144 QModelIndex idx = d->model->index(r, c, parent); -
1145 if (QWidget *editor = indexWidget(idx)) {
evaluated: QWidget *editor = indexWidget(idx)
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:48
6-48
1146 if (ancestorOf(editor, fw)) {
evaluated: ancestorOf(editor, fw)
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:1
1-5
1147 indexWidgetHasFocus = true; -
1148 break;
executed: break;
Execution Count:5
5
1149 } -
1150 }
executed: }
Execution Count:1
1
1151 }
executed: }
Execution Count:49
49
1152 }
executed: }
Execution Count:17
17
1153 -
1154 const bool widgetHasFocus = hasFocus(); -
1155 bool currentRowHasFocus = false; -
1156 if (allColumnsShowFocus && widgetHasFocus && current.isValid()) {
partially evaluated: allColumnsShowFocus
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1992
never evaluated: widgetHasFocus
never evaluated: current.isValid()
0-1992
1157 -
1158 const int r = index.row(); -
1159 for (int c = 0; c < left && !currentRowHasFocus; ++c) {
never evaluated: c < left
never evaluated: !currentRowHasFocus
0
1160 QModelIndex idx = d->model->index(r, c, parent); -
1161 currentRowHasFocus = (idx == current); -
1162 }
never executed: }
0
1163 QModelIndex parent = d->model->parent(index); -
1164 for (int c = right; c < header->count() && !currentRowHasFocus; ++c) {
never evaluated: c < header->count()
never evaluated: !currentRowHasFocus
0
1165 currentRowHasFocus = (d->model->index(r, c, parent) == current); -
1166 }
never executed: }
0
1167 }
never executed: }
0
1168 -
1169 -
1170 -
1171 opt.showDecorationSelected = (d->selectionBehavior & SelectRows)
evaluated: (d->selectionBehavior & SelectRows)
TRUEFALSE
yes
Evaluation Count:1637
yes
Evaluation Count:355
355-1637
1172 || option.showDecorationSelected;
partially evaluated: option.showDecorationSelected
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:355
0-355
1173 -
1174 int width, height = option.rect.height(); -
1175 int position; -
1176 QModelIndex modelIndex; -
1177 const bool hoverRow = selectionBehavior() == QAbstractItemView::SelectRows
evaluated: selectionBehavior() == QAbstractItemView::SelectRows
TRUEFALSE
yes
Evaluation Count:1637
yes
Evaluation Count:355
355-1637
1178 && index.parent() == hover.parent()
evaluated: index.parent() == hover.parent()
TRUEFALSE
yes
Evaluation Count:864
yes
Evaluation Count:773
773-864
1179 && index.row() == hover.row();
evaluated: index.row() == hover.row()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:860
4-860
1180 -
1181 QVector<int> logicalIndices; -
1182 QVector<QStyleOptionViewItem::ViewItemPosition> viewItemPosList; -
1183 d->calcLogicalIndices(&logicalIndices, &viewItemPosList, left, right); -
1184 -
1185 for (int currentLogicalSection = 0; currentLogicalSection < logicalIndices.count(); ++currentLogicalSection) {
evaluated: currentLogicalSection < logicalIndices.count()
TRUEFALSE
yes
Evaluation Count:4985
yes
Evaluation Count:1992
1992-4985
1186 int headerSection = logicalIndices.at(currentLogicalSection); -
1187 position = columnViewportPosition(headerSection) + offset.x(); -
1188 width = header->sectionSize(headerSection); -
1189 -
1190 if (spanning) {
evaluated: spanning
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:4979
6-4979
1191 int lastSection = header->logicalIndex(header->count() - 1); -
1192 if (!reverse) {
partially evaluated: !reverse
TRUEFALSE
yes
Evaluation Count:6
no
Evaluation Count:0
0-6
1193 width = columnViewportPosition(lastSection) + header->sectionSize(lastSection) - position; -
1194 } else {
executed: }
Execution Count:6
6
1195 width += position - columnViewportPosition(lastSection); -
1196 position = columnViewportPosition(lastSection); -
1197 }
never executed: }
0
1198 } -
1199 -
1200 modelIndex = d->model->index(index.row(), headerSection, parent); -
1201 if (!modelIndex.isValid())
partially evaluated: !modelIndex.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4985
0-4985
1202 continue;
never executed: continue;
0
1203 opt.state = state; -
1204 -
1205 opt.viewItemPosition = viewItemPosList.at(currentLogicalSection); -
1206 -
1207 -
1208 if (indexWidgetHasFocus)
evaluated: indexWidgetHasFocus
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:4977
8-4977
1209 opt.state |= QStyle::State_Active;
executed: opt.state |= QStyle::State_Active;
Execution Count:8
8
1210 -
1211 if (d->selectionModel->isSelected(modelIndex))
evaluated: d->selectionModel->isSelected(modelIndex)
TRUEFALSE
yes
Evaluation Count:169
yes
Evaluation Count:4816
169-4816
1212 opt.state |= QStyle::State_Selected;
executed: opt.state |= QStyle::State_Selected;
Execution Count:169
169
1213 if (widgetHasFocus && (current == modelIndex)) {
evaluated: widgetHasFocus
TRUEFALSE
yes
Evaluation Count:3182
yes
Evaluation Count:1803
evaluated: (current == modelIndex)
TRUEFALSE
yes
Evaluation Count:192
yes
Evaluation Count:2990
192-3182
1214 if (allColumnsShowFocus)
partially evaluated: allColumnsShowFocus
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:192
0-192
1215 currentRowHasFocus = true;
never executed: currentRowHasFocus = true;
0
1216 else -
1217 opt.state |= QStyle::State_HasFocus;
executed: opt.state |= QStyle::State_HasFocus;
Execution Count:192
192
1218 } -
1219 if ((hoverRow || modelIndex == hover)
evaluated: hoverRow
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:4981
evaluated: modelIndex == hover
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:4975
4-4981
1220 && (option.showDecorationSelected || (d->hoverBranch == -1)))
partially evaluated: option.showDecorationSelected
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:10
partially evaluated: (d->hoverBranch == -1)
TRUEFALSE
yes
Evaluation Count:10
no
Evaluation Count:0
0-10
1221 opt.state |= QStyle::State_MouseOver;
executed: opt.state |= QStyle::State_MouseOver;
Execution Count:10
10
1222 else -
1223 opt.state &= ~QStyle::State_MouseOver;
executed: opt.state &= ~QStyle::State_MouseOver;
Execution Count:4975
4975
1224 -
1225 if (enabled) {
partially evaluated: enabled
TRUEFALSE
yes
Evaluation Count:4985
no
Evaluation Count:0
0-4985
1226 QPalette::ColorGroup cg; -
1227 if ((d->model->flags(modelIndex) & Qt::ItemIsEnabled) == 0) {
evaluated: (d->model->flags(modelIndex) & Qt::ItemIsEnabled) == 0
TRUEFALSE
yes
Evaluation Count:394
yes
Evaluation Count:4591
394-4591
1228 opt.state &= ~QStyle::State_Enabled; -
1229 cg = QPalette::Disabled; -
1230 } else if (opt.state & QStyle::State_Active) {
executed: }
Execution Count:394
evaluated: opt.state & QStyle::State_Active
TRUEFALSE
yes
Evaluation Count:2840
yes
Evaluation Count:1751
394-2840
1231 cg = QPalette::Active; -
1232 } else {
executed: }
Execution Count:2840
2840
1233 cg = QPalette::Inactive; -
1234 }
executed: }
Execution Count:1751
1751
1235 opt.palette.setCurrentColorGroup(cg); -
1236 }
executed: }
Execution Count:4985
4985
1237 -
1238 if (alternate) {
evaluated: alternate
TRUEFALSE
yes
Evaluation Count:127
yes
Evaluation Count:4858
127-4858
1239 if (d->current & 1) {
evaluated: d->current & 1
TRUEFALSE
yes
Evaluation Count:58
yes
Evaluation Count:69
58-69
1240 opt.features |= QStyleOptionViewItem::Alternate; -
1241 } else {
executed: }
Execution Count:58
58
1242 opt.features &= ~QStyleOptionViewItem::Alternate; -
1243 }
executed: }
Execution Count:69
69
1244 } -
1245 -
1246 -
1247 -
1248 -
1249 -
1250 if (headerSection == 0) {
evaluated: headerSection == 0
TRUEFALSE
yes
Evaluation Count:1975
yes
Evaluation Count:3010
1975-3010
1251 const int i = d->indentationForItem(d->current); -
1252 QRect branches(reverse ? position + width - i : position, y, i, height); -
1253 const bool setClipRect = branches.width() > width; -
1254 if (setClipRect) {
partially evaluated: setClipRect
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1975
0-1975
1255 painter->save(); -
1256 painter->setClipRect(QRect(position, y, width, height)); -
1257 }
never executed: }
0
1258 -
1259 opt.rect = branches; -
1260 style()->drawPrimitive(QStyle::PE_PanelItemViewRow, &opt, painter, this); -
1261 -
1262 -
1263 -
1264 QStyle::State oldState = opt.state; -
1265 opt.state &= ~QStyle::State_Selected; -
1266 opt.rect.setRect(reverse ? position : i + position, y, width - i, height); -
1267 style()->drawPrimitive(QStyle::PE_PanelItemViewRow, &opt, painter, this); -
1268 opt.state = oldState; -
1269 -
1270 if (d->indent != 0)
partially evaluated: d->indent != 0
TRUEFALSE
yes
Evaluation Count:1975
no
Evaluation Count:0
0-1975
1271 drawBranches(painter, branches, index);
executed: drawBranches(painter, branches, index);
Execution Count:1975
1975
1272 if (setClipRect)
partially evaluated: setClipRect
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1975
0-1975
1273 painter->restore();
never executed: painter->restore();
0
1274 } else {
executed: }
Execution Count:1975
1975
1275 QStyle::State oldState = opt.state; -
1276 opt.state &= ~QStyle::State_Selected; -
1277 opt.rect.setRect(position, y, width, height); -
1278 style()->drawPrimitive(QStyle::PE_PanelItemViewRow, &opt, painter, this); -
1279 opt.state = oldState; -
1280 }
executed: }
Execution Count:3010
3010
1281 -
1282 d->delegateForIndex(modelIndex)->paint(painter, opt, modelIndex); -
1283 }
executed: }
Execution Count:4985
4985
1284 -
1285 if (currentRowHasFocus) {
partially evaluated: currentRowHasFocus
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1992
0-1992
1286 QStyleOptionFocusRect o; -
1287 o.QStyleOption::operator=(option); -
1288 o.state |= QStyle::State_KeyboardFocusChange; -
1289 QPalette::ColorGroup cg = (option.state & QStyle::State_Enabled)
never evaluated: (option.state & QStyle::State_Enabled)
0
1290 ? QPalette::Normal : QPalette::Disabled; -
1291 o.backgroundColor = option.palette.color(cg, d->selectionModel->isSelected(index) -
1292 ? QPalette::Highlight : QPalette::Background); -
1293 int x = 0; -
1294 if (!option.showDecorationSelected)
never evaluated: !option.showDecorationSelected
0
1295 x = header->sectionPosition(0) + d->indentationForItem(d->current);
never executed: x = header->sectionPosition(0) + d->indentationForItem(d->current);
0
1296 QRect focusRect(x - header->offset(), y, header->length() - x, height); -
1297 o.rect = style()->visualRect(layoutDirection(), d->viewport->rect(), focusRect); -
1298 style()->drawPrimitive(QStyle::PE_FrameFocusRect, &o, painter); -
1299 -
1300 -
1301 if (allColumnsShowFocus && !option.showDecorationSelected
never evaluated: allColumnsShowFocus
never evaluated: !option.showDecorationSelected
0
1302 && header->sectionsMoved() && (header->visualIndex(0) != 0)) {
never evaluated: header->sectionsMoved()
never evaluated: (header->visualIndex(0) != 0)
0
1303 QRect sectionRect(0, y, header->sectionPosition(0), height); -
1304 o.rect = style()->visualRect(layoutDirection(), d->viewport->rect(), sectionRect); -
1305 style()->drawPrimitive(QStyle::PE_FrameFocusRect, &o, painter); -
1306 }
never executed: }
0
1307 }
never executed: }
0
1308}
executed: }
Execution Count:1992
1992
1309 -
1310 -
1311 -
1312 -
1313 -
1314 -
1315void QTreeView::drawBranches(QPainter *painter, const QRect &rect, -
1316 const QModelIndex &index) const -
1317{ -
1318 const QTreeViewPrivate * const d = d_func(); -
1319 const bool reverse = isRightToLeft(); -
1320 const int indent = d->indent; -
1321 const int outer = d->rootDecoration ? 0 : 1;
evaluated: d->rootDecoration
TRUEFALSE
yes
Evaluation Count:1878
yes
Evaluation Count:97
97-1878
1322 const int item = d->current; -
1323 const QTreeViewItem &viewItem = d->viewItems.at(item); -
1324 int level = viewItem.level; -
1325 QRect primitive(reverse ? rect.left() : rect.right() + 1, rect.top(), indent, rect.height()); -
1326 -
1327 QModelIndex parent = index.parent(); -
1328 QModelIndex current = parent; -
1329 QModelIndex ancestor = current.parent(); -
1330 -
1331 QStyleOptionViewItem opt = viewOptions(); -
1332 QStyle::State extraFlags = QStyle::State_None; -
1333 if (isEnabled())
partially evaluated: isEnabled()
TRUEFALSE
yes
Evaluation Count:1975
no
Evaluation Count:0
0-1975
1334 extraFlags |= QStyle::State_Enabled;
executed: extraFlags |= QStyle::State_Enabled;
Execution Count:1975
1975
1335 if (window()->isActiveWindow())
evaluated: window()->isActiveWindow()
TRUEFALSE
yes
Evaluation Count:1441
yes
Evaluation Count:534
534-1441
1336 extraFlags |= QStyle::State_Active;
executed: extraFlags |= QStyle::State_Active;
Execution Count:1441
1441
1337 QPoint oldBO = painter->brushOrigin(); -
1338 if (verticalScrollMode() == QAbstractItemView::ScrollPerPixel)
evaluated: verticalScrollMode() == QAbstractItemView::ScrollPerPixel
TRUEFALSE
yes
Evaluation Count:180
yes
Evaluation Count:1795
180-1795
1339 painter->setBrushOrigin(QPoint(0, verticalOffset()));
executed: painter->setBrushOrigin(QPoint(0, verticalOffset()));
Execution Count:180
180
1340 -
1341 if (d->alternatingColors) {
evaluated: d->alternatingColors
TRUEFALSE
yes
Evaluation Count:70
yes
Evaluation Count:1905
70-1905
1342 if (d->current & 1) {
evaluated: d->current & 1
TRUEFALSE
yes
Evaluation Count:31
yes
Evaluation Count:39
31-39
1343 opt.features |= QStyleOptionViewItem::Alternate; -
1344 } else {
executed: }
Execution Count:31
31
1345 opt.features &= ~QStyleOptionViewItem::Alternate; -
1346 }
executed: }
Execution Count:39
39
1347 } -
1348 -
1349 -
1350 -
1351 bool hoverRow = selectionBehavior() == QAbstractItemView::SelectRows
evaluated: selectionBehavior() == QAbstractItemView::SelectRows
TRUEFALSE
yes
Evaluation Count:1621
yes
Evaluation Count:354
354-1621
1352 && opt.showDecorationSelected
partially evaluated: opt.showDecorationSelected
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1621
0-1621
1353 && index.parent() == d->hover.parent()
never evaluated: index.parent() == d->hover.parent()
0
1354 && index.row() == d->hover.row();
never evaluated: index.row() == d->hover.row()
0
1355 -
1356 if (d->selectionModel->isSelected(index))
evaluated: d->selectionModel->isSelected(index)
TRUEFALSE
yes
Evaluation Count:107
yes
Evaluation Count:1868
107-1868
1357 extraFlags |= QStyle::State_Selected;
executed: extraFlags |= QStyle::State_Selected;
Execution Count:107
107
1358 -
1359 if (level >= outer) {
evaluated: level >= outer
TRUEFALSE
yes
Evaluation Count:1878
yes
Evaluation Count:97
97-1878
1360 -
1361 primitive.moveLeft(reverse ? primitive.left() : primitive.left() - indent); -
1362 opt.rect = primitive; -
1363 -
1364 const bool expanded = viewItem.expanded; -
1365 const bool children = viewItem.hasChildren; -
1366 bool moreSiblings = viewItem.hasMoreSiblings; -
1367 -
1368 opt.state = QStyle::State_Item | extraFlags -
1369 | (moreSiblings ? QStyle::State_Sibling : QStyle::State_None) -
1370 | (children ? QStyle::State_Children : QStyle::State_None) -
1371 | (expanded ? QStyle::State_Open : QStyle::State_None); -
1372 if (hoverRow || item == d->hoverBranch)
partially evaluated: hoverRow
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1878
partially evaluated: item == d->hoverBranch
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1878
0-1878
1373 opt.state |= QStyle::State_MouseOver;
never executed: opt.state |= QStyle::State_MouseOver;
0
1374 else -
1375 opt.state &= ~QStyle::State_MouseOver;
executed: opt.state &= ~QStyle::State_MouseOver;
Execution Count:1878
1878
1376 style()->drawPrimitive(QStyle::PE_IndicatorBranch, &opt, painter, this); -
1377 }
executed: }
Execution Count:1878
1878
1378 -
1379 for (--level; level >= outer; --level) {
evaluated: level >= outer
TRUEFALSE
yes
Evaluation Count:986
yes
Evaluation Count:1975
986-1975
1380 primitive.moveLeft(reverse ? primitive.left() + indent : primitive.left() - indent); -
1381 opt.rect = primitive; -
1382 opt.state = extraFlags; -
1383 bool moreSiblings = false; -
1384 if (d->hiddenIndexes.isEmpty()) {
evaluated: d->hiddenIndexes.isEmpty()
TRUEFALSE
yes
Evaluation Count:972
yes
Evaluation Count:14
14-972
1385 moreSiblings = (d->model->rowCount(ancestor) - 1 > current.row()); -
1386 } else {
executed: }
Execution Count:972
972
1387 int successor = item + viewItem.total + 1; -
1388 while (successor < d->viewItems.size()
partially evaluated: successor < d->viewItems.size()
TRUEFALSE
yes
Evaluation Count:23
no
Evaluation Count:0
0-23
1389 && d->viewItems.at(successor).level >= uint(level)) {
partially evaluated: d->viewItems.at(successor).level >= uint(level)
TRUEFALSE
yes
Evaluation Count:23
no
Evaluation Count:0
0-23
1390 const QTreeViewItem &successorItem = d->viewItems.at(successor); -
1391 if (successorItem.level == uint(level)) {
evaluated: successorItem.level == uint(level)
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:9
9-14
1392 moreSiblings = true; -
1393 break;
executed: break;
Execution Count:14
14
1394 } -
1395 successor += successorItem.total + 1; -
1396 }
executed: }
Execution Count:9
9
1397 }
executed: }
Execution Count:14
14
1398 if (moreSiblings)
evaluated: moreSiblings
TRUEFALSE
yes
Evaluation Count:639
yes
Evaluation Count:347
347-639
1399 opt.state |= QStyle::State_Sibling;
executed: opt.state |= QStyle::State_Sibling;
Execution Count:639
639
1400 if (hoverRow || item == d->hoverBranch)
partially evaluated: hoverRow
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:986
partially evaluated: item == d->hoverBranch
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:986
0-986
1401 opt.state |= QStyle::State_MouseOver;
never executed: opt.state |= QStyle::State_MouseOver;
0
1402 else -
1403 opt.state &= ~QStyle::State_MouseOver;
executed: opt.state &= ~QStyle::State_MouseOver;
Execution Count:986
986
1404 style()->drawPrimitive(QStyle::PE_IndicatorBranch, &opt, painter, this); -
1405 current = ancestor; -
1406 ancestor = current.parent(); -
1407 }
executed: }
Execution Count:986
986
1408 painter->setBrushOrigin(oldBO); -
1409}
executed: }
Execution Count:1975
1975
1410 -
1411 -
1412 -
1413 -
1414void QTreeView::mousePressEvent(QMouseEvent *event) -
1415{ -
1416 QTreeViewPrivate * const d = d_func(); -
1417 bool handled = false; -
1418 if (style()->styleHint(QStyle::SH_ListViewExpand_SelectMouseType, 0, this) == QEvent::MouseButtonPress)
partially evaluated: style()->styleHint(QStyle::SH_ListViewExpand_SelectMouseType, 0, this) == QEvent::MouseButtonPress
TRUEFALSE
yes
Evaluation Count:4578
no
Evaluation Count:0
0-4578
1419 handled = d->expandOrCollapseItemAtPos(event->pos());
executed: handled = d->expandOrCollapseItemAtPos(event->pos());
Execution Count:4578
4578
1420 if (!handled && d->itemDecorationAt(event->pos()) == -1)
evaluated: !handled
TRUEFALSE
yes
Evaluation Count:278
yes
Evaluation Count:4300
partially evaluated: d->itemDecorationAt(event->pos()) == -1
TRUEFALSE
yes
Evaluation Count:278
no
Evaluation Count:0
0-4300
1421 QAbstractItemView::mousePressEvent(event);
executed: QAbstractItemView::mousePressEvent(event);
Execution Count:278
278
1422}
executed: }
Execution Count:4578
4578
1423 -
1424 -
1425 -
1426 -
1427void QTreeView::mouseReleaseEvent(QMouseEvent *event) -
1428{ -
1429 QTreeViewPrivate * const d = d_func(); -
1430 if (d->itemDecorationAt(event->pos()) == -1) {
evaluated: d->itemDecorationAt(event->pos()) == -1
TRUEFALSE
yes
Evaluation Count:4497
yes
Evaluation Count:1
1-4497
1431 QAbstractItemView::mouseReleaseEvent(event); -
1432 } else {
executed: }
Execution Count:4497
4497
1433 if (state() == QAbstractItemView::DragSelectingState)
partially evaluated: state() == QAbstractItemView::DragSelectingState
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
1434 setState(QAbstractItemView::NoState);
never executed: setState(QAbstractItemView::NoState);
0
1435 if (style()->styleHint(QStyle::SH_ListViewExpand_SelectMouseType, 0, this) == QEvent::MouseButtonRelease)
partially evaluated: style()->styleHint(QStyle::SH_ListViewExpand_SelectMouseType, 0, this) == QEvent::MouseButtonRelease
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
1436 d->expandOrCollapseItemAtPos(event->pos());
never executed: d->expandOrCollapseItemAtPos(event->pos());
0
1437 }
executed: }
Execution Count:1
1
1438} -
1439 -
1440 -
1441 -
1442 -
1443void QTreeView::mouseDoubleClickEvent(QMouseEvent *event) -
1444{ -
1445 QTreeViewPrivate * const d = d_func(); -
1446 if (state() != NoState || !d->viewport->rect().contains(event->pos()))
partially evaluated: state() != NoState
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:90
partially evaluated: !d->viewport->rect().contains(event->pos())
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:90
0-90
1447 return;
never executed: return;
0
1448 -
1449 int i = d->itemDecorationAt(event->pos()); -
1450 if (i == -1) {
partially evaluated: i == -1
TRUEFALSE
yes
Evaluation Count:90
no
Evaluation Count:0
0-90
1451 i = d->itemAtCoordinate(event->y()); -
1452 if (i == -1)
partially evaluated: i == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:90
0-90
1453 return;
never executed: return;
0
1454 -
1455 const QPersistentModelIndex firstColumnIndex = d->viewItems.at(i).index; -
1456 const QPersistentModelIndex persistent = indexAt(event->pos()); -
1457 -
1458 if (d->pressedIndex != persistent) {
evaluated: d->pressedIndex != persistent
TRUEFALSE
yes
Evaluation Count:75
yes
Evaluation Count:15
15-75
1459 mousePressEvent(event); -
1460 return;
executed: return;
Execution Count:75
75
1461 } -
1462 -
1463 -
1464 doubleClicked(persistent); -
1465 -
1466 if (!persistent.isValid())
partially evaluated: !persistent.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15
0-15
1467 return;
never executed: return;
0
1468 -
1469 if (edit(persistent, DoubleClicked, event) || state() != NoState)
evaluated: edit(persistent, DoubleClicked, event)
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:5
partially evaluated: state() != NoState
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-10
1470 return;
executed: return;
Execution Count:10
10
1471 -
1472 if (!style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, 0, this))
partially evaluated: !style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, 0, this)
TRUEFALSE
yes
Evaluation Count:5
no
Evaluation Count:0
0-5
1473 activated(persistent);
executed: activated(persistent);
Execution Count:5
5
1474 -
1475 d->executePostedLayout(); -
1476 if (d->itemsExpandable
partially evaluated: d->itemsExpandable
TRUEFALSE
yes
Evaluation Count:5
no
Evaluation Count:0
0-5
1477 && d->expandsOnDoubleClick
partially evaluated: d->expandsOnDoubleClick
TRUEFALSE
yes
Evaluation Count:5
no
Evaluation Count:0
0-5
1478 && d->hasVisibleChildren(persistent)) {
partially evaluated: d->hasVisibleChildren(persistent)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
1479 if (!((i < d->viewItems.count()) && (d->viewItems.at(i).index == firstColumnIndex))) {
never evaluated: (i < d->viewItems.count())
never evaluated: (d->viewItems.at(i).index == firstColumnIndex)
0
1480 -
1481 for (i = 0; i < d->viewItems.count(); ++i) {
never evaluated: i < d->viewItems.count()
0
1482 if (d->viewItems.at(i).index == firstColumnIndex)
never evaluated: d->viewItems.at(i).index == firstColumnIndex
0
1483 break;
never executed: break;
0
1484 }
never executed: }
0
1485 if (i == d->viewItems.count())
never evaluated: i == d->viewItems.count()
0
1486 return;
never executed: return;
0
1487 }
never executed: }
0
1488 if (d->viewItems.at(i).expanded)
never evaluated: d->viewItems.at(i).expanded
0
1489 d->collapse(i, true);
never executed: d->collapse(i, true);
0
1490 else -
1491 d->expand(i, true);
never executed: d->expand(i, true);
0
1492 updateGeometries(); -
1493 viewport()->update(); -
1494 }
never executed: }
0
1495 }
executed: }
Execution Count:5
5
1496}
executed: }
Execution Count:5
5
1497 -
1498 -
1499 -
1500 -
1501void QTreeView::mouseMoveEvent(QMouseEvent *event) -
1502{ -
1503 QTreeViewPrivate * const d = d_func(); -
1504 if (d->itemDecorationAt(event->pos()) == -1)
never evaluated: d->itemDecorationAt(event->pos()) == -1
0
1505 QAbstractItemView::mouseMoveEvent(event);
never executed: QAbstractItemView::mouseMoveEvent(event);
0
1506}
never executed: }
0
1507 -
1508 -
1509 -
1510 -
1511void QTreeView::keyPressEvent(QKeyEvent *event) -
1512{ -
1513 QTreeViewPrivate * const d = d_func(); -
1514 QModelIndex current = currentIndex(); -
1515 -
1516 if (d->isIndexValid(current) && d->model && d->itemsExpandable) {
evaluated: d->isIndexValid(current)
TRUEFALSE
yes
Evaluation Count:204
yes
Evaluation Count:3
partially evaluated: d->model
TRUEFALSE
yes
Evaluation Count:204
no
Evaluation Count:0
evaluated: d->itemsExpandable
TRUEFALSE
yes
Evaluation Count:202
yes
Evaluation Count:2
0-204
1517 switch (event->key()) { -
1518 case Qt::Key_Asterisk: { -
1519 QStack<QModelIndex> parents; -
1520 parents.push(current); -
1521 while (!parents.isEmpty()) {
never evaluated: !parents.isEmpty()
0
1522 QModelIndex parent = parents.pop(); -
1523 for (int row = 0; row < d->model->rowCount(parent); ++row) {
never evaluated: row < d->model->rowCount(parent)
0
1524 QModelIndex child = d->model->index(row, 0, parent); -
1525 if (!d->isIndexValid(child))
never evaluated: !d->isIndexValid(child)
0
1526 break;
never executed: break;
0
1527 parents.push(child); -
1528 expand(child); -
1529 }
never executed: }
0
1530 }
never executed: }
0
1531 expand(current); -
1532 break; }
never executed: break;
0
1533 case Qt::Key_Plus: -
1534 expand(current); -
1535 break;
executed: break;
Execution Count:1
1
1536 case Qt::Key_Minus: -
1537 collapse(current); -
1538 break;
executed: break;
Execution Count:1
1
1539 } -
1540 }
executed: }
Execution Count:202
202
1541 -
1542 QAbstractItemView::keyPressEvent(event); -
1543}
executed: }
Execution Count:207
207
1544 -
1545 -
1546 -
1547 -
1548QModelIndex QTreeView::indexAt(const QPoint &point) const -
1549{ -
1550 const QTreeViewPrivate * const d = d_func(); -
1551 d->executePostedLayout(); -
1552 -
1553 int visualIndex = d->itemAtCoordinate(point.y()); -
1554 QModelIndex idx = d->modelIndex(visualIndex); -
1555 if (!idx.isValid())
evaluated: !idx.isValid()
TRUEFALSE
yes
Evaluation Count:42
yes
Evaluation Count:7081
42-7081
1556 return QModelIndex();
executed: return QModelIndex();
Execution Count:42
42
1557 -
1558 if (d->viewItems.at(visualIndex).spanning)
evaluated: d->viewItems.at(visualIndex).spanning
TRUEFALSE
yes
Evaluation Count:20
yes
Evaluation Count:7061
20-7061
1559 return idx;
executed: return idx;
Execution Count:20
20
1560 -
1561 int column = d->columnAt(point.x()); -
1562 if (column == idx.column())
evaluated: column == idx.column()
TRUEFALSE
yes
Evaluation Count:5182
yes
Evaluation Count:1879
1879-5182
1563 return idx;
executed: return idx;
Execution Count:5182
5182
1564 if (column < 0)
evaluated: column < 0
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1877
2-1877
1565 return QModelIndex();
executed: return QModelIndex();
Execution Count:2
2
1566 return idx.sibling(idx.row(), column);
executed: return idx.sibling(idx.row(), column);
Execution Count:1877
1877
1567} -
1568 -
1569 -
1570 -
1571 -
1572QModelIndex QTreeView::indexAbove(const QModelIndex &index) const -
1573{ -
1574 const QTreeViewPrivate * const d = d_func(); -
1575 if (!d->isIndexValid(index))
evaluated: !d->isIndexValid(index)
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:25
3-25
1576 return QModelIndex();
executed: return QModelIndex();
Execution Count:3
3
1577 d->executePostedLayout(); -
1578 int i = d->viewIndex(index); -
1579 if (--i < 0)
evaluated: --i < 0
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:22
3-22
1580 return QModelIndex();
executed: return QModelIndex();
Execution Count:3
3
1581 const QModelIndex firstColumnIndex = d->viewItems.at(i).index; -
1582 return firstColumnIndex.sibling(firstColumnIndex.row(), index.column());
executed: return firstColumnIndex.sibling(firstColumnIndex.row(), index.column());
Execution Count:22
22
1583} -
1584 -
1585 -
1586 -
1587 -
1588QModelIndex QTreeView::indexBelow(const QModelIndex &index) const -
1589{ -
1590 const QTreeViewPrivate * const d = d_func(); -
1591 if (!d->isIndexValid(index))
evaluated: !d->isIndexValid(index)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:14
1-14
1592 return QModelIndex();
executed: return QModelIndex();
Execution Count:1
1
1593 d->executePostedLayout(); -
1594 int i = d->viewIndex(index); -
1595 if (++i >= d->viewItems.count())
evaluated: ++i >= d->viewItems.count()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:11
3-11
1596 return QModelIndex();
executed: return QModelIndex();
Execution Count:3
3
1597 const QModelIndex firstColumnIndex = d->viewItems.at(i).index; -
1598 return firstColumnIndex.sibling(firstColumnIndex.row(), index.column());
executed: return firstColumnIndex.sibling(firstColumnIndex.row(), index.column());
Execution Count:11
11
1599} -
1600 -
1601 -
1602 -
1603 -
1604 -
1605 -
1606void QTreeView::doItemsLayout() -
1607{ -
1608 QTreeViewPrivate * const d = d_func(); -
1609 if (d->hasRemovedItems) {
evaluated: d->hasRemovedItems
TRUEFALSE
yes
Evaluation Count:107
yes
Evaluation Count:616
107-616
1610 -
1611 d->hasRemovedItems = false; -
1612 QSet<QPersistentModelIndex>::iterator it = d->expandedIndexes.begin(); -
1613 while (it != d->expandedIndexes.end()) {
evaluated: it != d->expandedIndexes.end()
TRUEFALSE
yes
Evaluation Count:35
yes
Evaluation Count:107
35-107
1614 if (!it->isValid())
evaluated: !it->isValid()
TRUEFALSE
yes
Evaluation Count:17
yes
Evaluation Count:18
17-18
1615 it = d->expandedIndexes.erase(it);
executed: it = d->expandedIndexes.erase(it);
Execution Count:17
17
1616 else -
1617 ++it;
executed: ++it;
Execution Count:18
18
1618 } -
1619 it = d->hiddenIndexes.begin(); -
1620 while (it != d->hiddenIndexes.end()) {
evaluated: it != d->hiddenIndexes.end()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:107
3-107
1621 if (!it->isValid())
partially evaluated: !it->isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
1622 it = d->hiddenIndexes.erase(it);
never executed: it = d->hiddenIndexes.erase(it);
0
1623 else -
1624 ++it;
executed: ++it;
Execution Count:3
3
1625 } -
1626 }
executed: }
Execution Count:107
107
1627 d->viewItems.clear(); -
1628 QModelIndex parent = d->root; -
1629 if (d->model->hasChildren(parent)) {
evaluated: d->model->hasChildren(parent)
TRUEFALSE
yes
Evaluation Count:421
yes
Evaluation Count:302
302-421
1630 d->layout(-1); -
1631 }
executed: }
Execution Count:421
421
1632 QAbstractItemView::doItemsLayout(); -
1633 d->header->doItemsLayout(); -
1634}
executed: }
Execution Count:723
723
1635 -
1636 -
1637 -
1638 -
1639void QTreeView::reset() -
1640{ -
1641 QTreeViewPrivate * const d = d_func(); -
1642 d->expandedIndexes.clear(); -
1643 d->hiddenIndexes.clear(); -
1644 d->spanningIndexes.clear(); -
1645 d->viewItems.clear(); -
1646 QAbstractItemView::reset(); -
1647}
executed: }
Execution Count:909
909
1648int QTreeView::horizontalOffset() const -
1649{ -
1650 const QTreeViewPrivate * const d = d_func(); -
1651 return d->header->offset();
executed: return d->header->offset();
Execution Count:979
979
1652} -
1653 -
1654 -
1655 -
1656 -
1657 -
1658 -
1659int QTreeView::verticalOffset() const -
1660{ -
1661 const QTreeViewPrivate * const d = d_func(); -
1662 if (d->verticalScrollMode == QAbstractItemView::ScrollPerItem) {
evaluated: d->verticalScrollMode == QAbstractItemView::ScrollPerItem
TRUEFALSE
yes
Evaluation Count:768
yes
Evaluation Count:391
391-768
1663 if (d->uniformRowHeights)
evaluated: d->uniformRowHeights
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:755
13-755
1664 return verticalScrollBar()->value() * d->defaultItemHeight;
executed: return verticalScrollBar()->value() * d->defaultItemHeight;
Execution Count:13
13
1665 -
1666 -
1667 -
1668 d->executePostedLayout(); -
1669 int offset = 0; -
1670 for (int i = 0; i < d->viewItems.count(); ++i) {
evaluated: i < d->viewItems.count()
TRUEFALSE
yes
Evaluation Count:1447
yes
Evaluation Count:45
45-1447
1671 if (i == verticalScrollBar()->value())
evaluated: i == verticalScrollBar()->value()
TRUEFALSE
yes
Evaluation Count:710
yes
Evaluation Count:737
710-737
1672 return offset;
executed: return offset;
Execution Count:710
710
1673 offset += d->itemHeight(i); -
1674 }
executed: }
Execution Count:737
737
1675 return 0;
executed: return 0;
Execution Count:45
45
1676 } -
1677 -
1678 return verticalScrollBar()->value();
executed: return verticalScrollBar()->value();
Execution Count:391
391
1679} -
1680 -
1681 -
1682 -
1683 -
1684 -
1685QModelIndex QTreeView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers) -
1686{ -
1687 QTreeViewPrivate * const d = d_func(); -
1688 (void)modifiers;; -
1689 -
1690 d->executePostedLayout(); -
1691 -
1692 QModelIndex current = currentIndex(); -
1693 if (!current.isValid()) {
evaluated: !current.isValid()
TRUEFALSE
yes
Evaluation Count:42
yes
Evaluation Count:155
42-155
1694 int i = d->below(-1); -
1695 int c = 0; -
1696 while (c < d->header->count() && d->header->isSectionHidden(c))
evaluated: c < d->header->count()
TRUEFALSE
yes
Evaluation Count:44
yes
Evaluation Count:3
evaluated: d->header->isSectionHidden(c)
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:39
3-44
1697 ++c;
executed: ++c;
Execution Count:5
5
1698 if (i < d->viewItems.count() && c < d->header->count()) {
partially evaluated: i < d->viewItems.count()
TRUEFALSE
yes
Evaluation Count:42
no
Evaluation Count:0
evaluated: c < d->header->count()
TRUEFALSE
yes
Evaluation Count:39
yes
Evaluation Count:3
0-42
1699 return d->modelIndex(i, c);
executed: return d->modelIndex(i, c);
Execution Count:39
39
1700 } -
1701 return QModelIndex();
executed: return QModelIndex();
Execution Count:3
3
1702 } -
1703 int vi = -1; -
1704 if (vi < 0)
partially evaluated: vi < 0
TRUEFALSE
yes
Evaluation Count:155
no
Evaluation Count:0
0-155
1705 vi = qMax(0, d->viewIndex(current));
executed: vi = qMax(0, d->viewIndex(current));
Execution Count:155
155
1706 -
1707 if (isRightToLeft()) {
partially evaluated: isRightToLeft()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:155
0-155
1708 if (cursorAction == MoveRight)
never evaluated: cursorAction == MoveRight
0
1709 cursorAction = MoveLeft;
never executed: cursorAction = MoveLeft;
0
1710 else if (cursorAction == MoveLeft)
never evaluated: cursorAction == MoveLeft
0
1711 cursorAction = MoveRight;
never executed: cursorAction = MoveRight;
0
1712 } -
1713 switch (cursorAction) { -
1714 case MoveNext: -
1715 case MoveDown: -
1716 -
1717 -
1718 -
1719 -
1720 return d->modelIndex(d->below(vi), current.column());
executed: return d->modelIndex(d->below(vi), current.column());
Execution Count:33
33
1721 case MovePrevious: -
1722 case MoveUp: -
1723 -
1724 -
1725 -
1726 -
1727 return d->modelIndex(d->above(vi), current.column());
executed: return d->modelIndex(d->above(vi), current.column());
Execution Count:51
51
1728 case MoveLeft: { -
1729 QScrollBar *sb = horizontalScrollBar(); -
1730 if (vi < d->viewItems.count() && d->viewItems.at(vi).expanded && d->itemsExpandable && sb->value() == sb->minimum()) {
partially evaluated: vi < d->viewItems.count()
TRUEFALSE
yes
Evaluation Count:46
no
Evaluation Count:0
evaluated: d->viewItems.at(vi).expanded
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:38
partially evaluated: d->itemsExpandable
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
partially evaluated: sb->value() == sb->minimum()
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
0-46
1731 d->collapse(vi, true); -
1732 d->moveCursorUpdatedView = true; -
1733 } else {
executed: }
Execution Count:8
8
1734 bool descend = style()->styleHint(QStyle::SH_ItemView_ArrowKeysNavigateIntoChildren, 0, this); -
1735 if (descend) {
partially evaluated: descend
TRUEFALSE
yes
Evaluation Count:38
no
Evaluation Count:0
0-38
1736 QModelIndex par = current.parent(); -
1737 if (par.isValid() && par != rootIndex())
evaluated: par.isValid()
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:32
evaluated: par != rootIndex()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:1
1-32
1738 return par;
executed: return par;
Execution Count:5
5
1739 else -
1740 descend = false;
executed: descend = false;
Execution Count:33
33
1741 } -
1742 if (!descend) {
partially evaluated: !descend
TRUEFALSE
yes
Evaluation Count:33
no
Evaluation Count:0
0-33
1743 if (d->selectionBehavior == SelectItems || d->selectionBehavior == SelectColumns) {
evaluated: d->selectionBehavior == SelectItems
TRUEFALSE
yes
Evaluation Count:28
yes
Evaluation Count:5
partially evaluated: d->selectionBehavior == SelectColumns
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-28
1744 int visualColumn = d->header->visualIndex(current.column()) - 1; -
1745 while (visualColumn >= 0 && isColumnHidden(d->header->logicalIndex(visualColumn)))
evaluated: visualColumn >= 0
TRUEFALSE
yes
Evaluation Count:21
yes
Evaluation Count:11
evaluated: isColumnHidden(d->header->logicalIndex(visualColumn))
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:17
4-21
1746 visualColumn--;
executed: visualColumn--;
Execution Count:4
4
1747 int newColumn = d->header->logicalIndex(visualColumn); -
1748 QModelIndex next = current.sibling(current.row(), newColumn); -
1749 if (next.isValid())
evaluated: next.isValid()
TRUEFALSE
yes
Evaluation Count:17
yes
Evaluation Count:11
11-17
1750 return next;
executed: return next;
Execution Count:17
17
1751 }
executed: }
Execution Count:11
11
1752 -
1753 int oldValue = sb->value(); -
1754 sb->setValue(sb->value() - sb->singleStep()); -
1755 if (oldValue != sb->value())
partially evaluated: oldValue != sb->value()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:16
0-16
1756 d->moveCursorUpdatedView = true;
never executed: d->moveCursorUpdatedView = true;
0
1757 }
executed: }
Execution Count:16
16
1758 -
1759 }
executed: }
Execution Count:16
16
1760 updateGeometries(); -
1761 viewport()->update(); -
1762 break;
executed: break;
Execution Count:24
24
1763 } -
1764 case MoveRight: -
1765 if (vi < d->viewItems.count() && !d->viewItems.at(vi).expanded && d->itemsExpandable
partially evaluated: vi < d->viewItems.count()
TRUEFALSE
yes
Evaluation Count:19
no
Evaluation Count:0
evaluated: !d->viewItems.at(vi).expanded
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:5
evaluated: d->itemsExpandable
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:1
0-19
1766 && d->hasVisibleChildren(d->viewItems.at(vi).index)) {
evaluated: d->hasVisibleChildren(d->viewItems.at(vi).index)
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:1
1-12
1767 d->expand(vi, true); -
1768 d->moveCursorUpdatedView = true; -
1769 } else {
executed: }
Execution Count:12
12
1770 bool descend = style()->styleHint(QStyle::SH_ItemView_ArrowKeysNavigateIntoChildren, 0, this); -
1771 if (descend) {
partially evaluated: descend
TRUEFALSE
yes
Evaluation Count:7
no
Evaluation Count:0
0-7
1772 QModelIndex idx = d->modelIndex(d->below(vi)); -
1773 if (idx.parent() == current)
evaluated: idx.parent() == current
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:2
2-5
1774 return idx;
executed: return idx;
Execution Count:5
5
1775 else -
1776 descend = false;
executed: descend = false;
Execution Count:2
2
1777 } -
1778 if (!descend) {
partially evaluated: !descend
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
1779 if (d->selectionBehavior == SelectItems || d->selectionBehavior == SelectColumns) {
partially evaluated: d->selectionBehavior == SelectItems
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
partially evaluated: d->selectionBehavior == SelectColumns
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
1780 int visualColumn = d->header->visualIndex(current.column()) + 1; -
1781 while (visualColumn < d->model->columnCount(current.parent()) && isColumnHidden(d->header->logicalIndex(visualColumn)))
never evaluated: visualColumn < d->model->columnCount(current.parent())
never evaluated: isColumnHidden(d->header->logicalIndex(visualColumn))
0
1782 visualColumn++;
never executed: visualColumn++;
0
1783 -
1784 QModelIndex next = current.sibling(current.row(), visualColumn); -
1785 if (next.isValid())
never evaluated: next.isValid()
0
1786 return next;
never executed: return next;
0
1787 }
never executed: }
0
1788 -
1789 -
1790 QScrollBar *sb = horizontalScrollBar(); -
1791 int oldValue = sb->value(); -
1792 sb->setValue(sb->value() + sb->singleStep()); -
1793 if (oldValue != sb->value())
partially evaluated: oldValue != sb->value()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
1794 d->moveCursorUpdatedView = true;
never executed: d->moveCursorUpdatedView = true;
0
1795 }
executed: }
Execution Count:2
2
1796 }
executed: }
Execution Count:2
2
1797 updateGeometries(); -
1798 viewport()->update(); -
1799 break;
executed: break;
Execution Count:14
14
1800 case MovePageUp: -
1801 return d->modelIndex(d->pageUp(vi), current.column());
executed: return d->modelIndex(d->pageUp(vi), current.column());
Execution Count:5
5
1802 case MovePageDown: -
1803 return d->modelIndex(d->pageDown(vi), current.column());
executed: return d->modelIndex(d->pageDown(vi), current.column());
Execution Count:1
1
1804 case MoveHome: -
1805 return d->model->index(0, current.column(), d->root);
never executed: return d->model->index(0, current.column(), d->root);
0
1806 case MoveEnd: -
1807 return d->modelIndex(d->viewItems.count() - 1, current.column());
never executed: return d->modelIndex(d->viewItems.count() - 1, current.column());
0
1808 } -
1809 return current;
executed: return current;
Execution Count:38
38
1810} -
1811 -
1812 -
1813 -
1814 -
1815 -
1816 -
1817 -
1818void QTreeView::setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags command) -
1819{ -
1820 QTreeViewPrivate * const d = d_func(); -
1821 if (!selectionModel() || rect.isNull())
evaluated: !selectionModel()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:318
partially evaluated: rect.isNull()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:318
0-318
1822 return;
executed: return;
Execution Count:2
2
1823 -
1824 d->executePostedLayout(); -
1825 QPoint tl(isRightToLeft() ? qMax(rect.left(), rect.right()) -
1826 : qMin(rect.left(), rect.right()), qMin(rect.top(), rect.bottom())); -
1827 QPoint br(isRightToLeft() ? qMin(rect.left(), rect.right()) : -
1828 qMax(rect.left(), rect.right()), qMax(rect.top(), rect.bottom())); -
1829 QModelIndex topLeft = indexAt(tl); -
1830 QModelIndex bottomRight = indexAt(br); -
1831 if (!topLeft.isValid() && !bottomRight.isValid()) {
evaluated: !topLeft.isValid()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:317
partially evaluated: !bottomRight.isValid()
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-317
1832 if (command & QItemSelectionModel::Clear)
partially evaluated: command & QItemSelectionModel::Clear
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
1833 selectionModel()->clear();
executed: selectionModel()->clear();
Execution Count:1
1
1834 return;
executed: return;
Execution Count:1
1
1835 } -
1836 if (!topLeft.isValid() && !d->viewItems.isEmpty())
partially evaluated: !topLeft.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:317
never evaluated: !d->viewItems.isEmpty()
0-317
1837 topLeft = d->viewItems.first().index;
never executed: topLeft = d->viewItems.first().index;
0
1838 if (!bottomRight.isValid() && !d->viewItems.isEmpty()) {
partially evaluated: !bottomRight.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:317
never evaluated: !d->viewItems.isEmpty()
0-317
1839 const int column = d->header->logicalIndex(d->header->count() - 1); -
1840 const QModelIndex index = d->viewItems.last().index; -
1841 bottomRight = index.sibling(index.row(), column); -
1842 }
never executed: }
0
1843 -
1844 if (!d->isIndexEnabled(topLeft) || !d->isIndexEnabled(bottomRight))
partially evaluated: !d->isIndexEnabled(topLeft)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:317
partially evaluated: !d->isIndexEnabled(bottomRight)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:317
0-317
1845 return;
never executed: return;
0
1846 -
1847 d->select(topLeft, bottomRight, command); -
1848}
executed: }
Execution Count:317
317
1849QRegion QTreeView::visualRegionForSelection(const QItemSelection &selection) const -
1850{ -
1851 const QTreeViewPrivate * const d = d_func(); -
1852 if (selection.isEmpty())
evaluated: selection.isEmpty()
TRUEFALSE
yes
Evaluation Count:161
yes
Evaluation Count:757
161-757
1853 return QRegion();
executed: return QRegion();
Execution Count:161
161
1854 -
1855 QRegion selectionRegion; -
1856 const QRect &viewportRect = d->viewport->rect(); -
1857 for (int i = 0; i < selection.count(); ++i) {
evaluated: i < selection.count()
TRUEFALSE
yes
Evaluation Count:765
yes
Evaluation Count:757
757-765
1858 QItemSelectionRange range = selection.at(i); -
1859 if (!range.isValid())
partially evaluated: !range.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:765
0-765
1860 continue;
never executed: continue;
0
1861 QModelIndex parent = range.parent(); -
1862 QModelIndex leftIndex = range.topLeft(); -
1863 int columnCount = d->model->columnCount(parent); -
1864 while (leftIndex.isValid() && isIndexHidden(leftIndex)) {
evaluated: leftIndex.isValid()
TRUEFALSE
yes
Evaluation Count:769
yes
Evaluation Count:4
evaluated: isIndexHidden(leftIndex)
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:761
4-769
1865 if (leftIndex.column() + 1 < columnCount)
evaluated: leftIndex.column() + 1 < columnCount
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:4
4
1866 leftIndex = d->model->index(leftIndex.row(), leftIndex.column() + 1, parent);
executed: leftIndex = d->model->index(leftIndex.row(), leftIndex.column() + 1, parent);
Execution Count:4
4
1867 else -
1868 leftIndex = QModelIndex();
executed: leftIndex = QModelIndex();
Execution Count:4
4
1869 } -
1870 if (!leftIndex.isValid())
evaluated: !leftIndex.isValid()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:761
4-761
1871 continue;
executed: continue;
Execution Count:4
4
1872 const QRect leftRect = visualRect(leftIndex); -
1873 int top = leftRect.top(); -
1874 QModelIndex rightIndex = range.bottomRight(); -
1875 while (rightIndex.isValid() && isIndexHidden(rightIndex)) {
partially evaluated: rightIndex.isValid()
TRUEFALSE
yes
Evaluation Count:761
no
Evaluation Count:0
partially evaluated: isIndexHidden(rightIndex)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:761
0-761
1876 if (rightIndex.column() - 1 >= 0)
never evaluated: rightIndex.column() - 1 >= 0
0
1877 rightIndex = d->model->index(rightIndex.row(), rightIndex.column() - 1, parent);
never executed: rightIndex = d->model->index(rightIndex.row(), rightIndex.column() - 1, parent);
0
1878 else -
1879 rightIndex = QModelIndex();
never executed: rightIndex = QModelIndex();
0
1880 } -
1881 if (!rightIndex.isValid())
partially evaluated: !rightIndex.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:761
0-761
1882 continue;
never executed: continue;
0
1883 const QRect rightRect = visualRect(rightIndex); -
1884 int bottom = rightRect.bottom(); -
1885 if (top > bottom)
evaluated: top > bottom
TRUEFALSE
yes
Evaluation Count:48
yes
Evaluation Count:713
48-713
1886 qSwap<int>(top, bottom);
executed: qSwap<int>(top, bottom);
Execution Count:48
48
1887 int height = bottom - top + 1; -
1888 if (d->header->sectionsMoved()) {
partially evaluated: d->header->sectionsMoved()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:761
0-761
1889 for (int c = range.left(); c <= range.right(); ++c) {
never evaluated: c <= range.right()
0
1890 const QRect rangeRect(columnViewportPosition(c), top, columnWidth(c), height); -
1891 if (viewportRect.intersects(rangeRect))
never evaluated: viewportRect.intersects(rangeRect)
0
1892 selectionRegion += rangeRect;
never executed: selectionRegion += rangeRect;
0
1893 }
never executed: }
0
1894 } else {
never executed: }
0
1895 QRect combined = leftRect|rightRect; -
1896 combined.setX(columnViewportPosition(isRightToLeft() ? range.right() : range.left())); -
1897 if (viewportRect.intersects(combined))
evaluated: viewportRect.intersects(combined)
TRUEFALSE
yes
Evaluation Count:700
yes
Evaluation Count:61
61-700
1898 selectionRegion += combined;
executed: selectionRegion += combined;
Execution Count:700
700
1899 }
executed: }
Execution Count:761
761
1900 } -
1901 return selectionRegion;
executed: return selectionRegion;
Execution Count:757
757
1902} -
1903 -
1904 -
1905 -
1906 -
1907QModelIndexList QTreeView::selectedIndexes() const -
1908{ -
1909 QModelIndexList viewSelected; -
1910 QModelIndexList modelSelected; -
1911 if (selectionModel())
evaluated: selectionModel()
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:2
2-8
1912 modelSelected = selectionModel()->selectedIndexes();
executed: modelSelected = selectionModel()->selectedIndexes();
Execution Count:8
8
1913 for (int i = 0; i < modelSelected.count(); ++i) {
evaluated: i < modelSelected.count()
TRUEFALSE
yes
Evaluation Count:25
yes
Evaluation Count:10
10-25
1914 -
1915 QModelIndex index = modelSelected.at(i); -
1916 while (index.isValid() && !isIndexHidden(index))
evaluated: index.isValid()
TRUEFALSE
yes
Evaluation Count:25
yes
Evaluation Count:25
partially evaluated: !isIndexHidden(index)
TRUEFALSE
yes
Evaluation Count:25
no
Evaluation Count:0
0-25
1917 index = index.parent();
executed: index = index.parent();
Execution Count:25
25
1918 if (index.isValid())
partially evaluated: index.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:25
0-25
1919 continue;
never executed: continue;
0
1920 viewSelected.append(modelSelected.at(i)); -
1921 }
executed: }
Execution Count:25
25
1922 return viewSelected;
executed: return viewSelected;
Execution Count:10
10
1923} -
1924 -
1925 -
1926 -
1927 -
1928void QTreeView::scrollContentsBy(int dx, int dy) -
1929{ -
1930 QTreeViewPrivate * const d = d_func(); -
1931 -
1932 d->delayedAutoScroll.stop(); -
1933 -
1934 dx = isRightToLeft() ? -dx : dx;
partially evaluated: isRightToLeft()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1540
0-1540
1935 if (dx) {
evaluated: dx
TRUEFALSE
yes
Evaluation Count:1438
yes
Evaluation Count:102
102-1438
1936 if (horizontalScrollMode() == QAbstractItemView::ScrollPerItem) {
evaluated: horizontalScrollMode() == QAbstractItemView::ScrollPerItem
TRUEFALSE
yes
Evaluation Count:104
yes
Evaluation Count:1334
104-1334
1937 int oldOffset = d->header->offset(); -
1938 if (horizontalScrollBar()->value() == horizontalScrollBar()->maximum())
evaluated: horizontalScrollBar()->value() == horizontalScrollBar()->maximum()
TRUEFALSE
yes
Evaluation Count:52
yes
Evaluation Count:52
52
1939 d->header->setOffsetToLastSection();
executed: d->header->setOffsetToLastSection();
Execution Count:52
52
1940 else -
1941 d->header->setOffsetToSectionPosition(horizontalScrollBar()->value());
executed: d->header->setOffsetToSectionPosition(horizontalScrollBar()->value());
Execution Count:52
52
1942 int newOffset = d->header->offset(); -
1943 dx = isRightToLeft() ? newOffset - oldOffset : oldOffset - newOffset;
partially evaluated: isRightToLeft()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:104
0-104
1944 } else {
executed: }
Execution Count:104
104
1945 d->header->setOffset(horizontalScrollBar()->value()); -
1946 }
executed: }
Execution Count:1334
1334
1947 } -
1948 -
1949 const int itemHeight = d->defaultItemHeight <= 0 ? sizeHintForRow(0) : d->defaultItemHeight;
evaluated: d->defaultItemHeight <= 0
TRUEFALSE
yes
Evaluation Count:1533
yes
Evaluation Count:7
7-1533
1950 if (d->viewItems.isEmpty() || itemHeight == 0)
evaluated: d->viewItems.isEmpty()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1539
partially evaluated: itemHeight == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1539
0-1539
1951 return;
executed: return;
Execution Count:1
1
1952 -
1953 -
1954 int viewCount = d->viewport->height() / itemHeight; -
1955 int maxDeltaY = qMin(d->viewItems.count(), viewCount); -
1956 -
1957 if (qAbs(dy) > qAbs(maxDeltaY) && d->editorIndexHash.isEmpty()) {
evaluated: qAbs(dy) > qAbs(maxDeltaY)
TRUEFALSE
yes
Evaluation Count:55
yes
Evaluation Count:1484
partially evaluated: d->editorIndexHash.isEmpty()
TRUEFALSE
yes
Evaluation Count:55
no
Evaluation Count:0
0-1484
1958 verticalScrollBar()->update(); -
1959 d->viewport->update(); -
1960 return;
executed: return;
Execution Count:55
55
1961 } -
1962 -
1963 if (dy && verticalScrollMode() == QAbstractItemView::ScrollPerItem) {
evaluated: dy
TRUEFALSE
yes
Evaluation Count:46
yes
Evaluation Count:1438
evaluated: verticalScrollMode() == QAbstractItemView::ScrollPerItem
TRUEFALSE
yes
Evaluation Count:43
yes
Evaluation Count:3
3-1438
1964 int currentScrollbarValue = verticalScrollBar()->value(); -
1965 int previousScrollbarValue = currentScrollbarValue + dy; -
1966 int currentViewIndex = currentScrollbarValue; -
1967 int previousViewIndex = previousScrollbarValue; -
1968 const QVector<QTreeViewItem> viewItems = d->viewItems; -
1969 dy = 0; -
1970 if (previousViewIndex < currentViewIndex) {
evaluated: previousViewIndex < currentViewIndex
TRUEFALSE
yes
Evaluation Count:40
yes
Evaluation Count:3
3-40
1971 for (int i = previousViewIndex; i < currentViewIndex; ++i) {
evaluated: i < currentViewIndex
TRUEFALSE
yes
Evaluation Count:49
yes
Evaluation Count:40
40-49
1972 if (i < d->viewItems.count())
partially evaluated: i < d->viewItems.count()
TRUEFALSE
yes
Evaluation Count:49
no
Evaluation Count:0
0-49
1973 dy -= d->itemHeight(i);
executed: dy -= d->itemHeight(i);
Execution Count:49
49
1974 }
executed: }
Execution Count:49
49
1975 } else if (previousViewIndex > currentViewIndex) {
executed: }
Execution Count:40
partially evaluated: previousViewIndex > currentViewIndex
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-40
1976 for (int i = previousViewIndex - 1; i >= currentViewIndex; --i) {
evaluated: i >= currentViewIndex
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:3
3-12
1977 if (i < d->viewItems.count())
partially evaluated: i < d->viewItems.count()
TRUEFALSE
yes
Evaluation Count:12
no
Evaluation Count:0
0-12
1978 dy += d->itemHeight(i);
executed: dy += d->itemHeight(i);
Execution Count:12
12
1979 }
executed: }
Execution Count:12
12
1980 }
executed: }
Execution Count:3
3
1981 } -
1982 -
1983 d->scrollContentsBy(dx, dy); -
1984}
executed: }
Execution Count:1484
1484
1985 -
1986 -
1987 -
1988 -
1989void QTreeView::columnMoved() -
1990{ -
1991 QTreeViewPrivate * const d = d_func(); -
1992 updateEditorGeometries(); -
1993 d->viewport->update(); -
1994}
executed: }
Execution Count:3
3
1995 -
1996 -
1997 -
1998 -
1999void QTreeView::reexpand() -
2000{ -
2001 -
2002} -
2003 -
2004 -
2005 -
2006 -
2007 -
2008void QTreeView::rowsInserted(const QModelIndex &parent, int start, int end) -
2009{ -
2010 QTreeViewPrivate * const d = d_func(); -
2011 -
2012 if (d->delayedPendingLayout) {
evaluated: d->delayedPendingLayout
TRUEFALSE
yes
Evaluation Count:69498
yes
Evaluation Count:399
399-69498
2013 QAbstractItemView::rowsInserted(parent, start, end); -
2014 return;
executed: return;
Execution Count:69498
69498
2015 } -
2016 -
2017 -
2018 if (parent.column() != 0 && parent.isValid()) {
evaluated: parent.column() != 0
TRUEFALSE
yes
Evaluation Count:137
yes
Evaluation Count:262
partially evaluated: parent.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:137
0-262
2019 QAbstractItemView::rowsInserted(parent, start, end); -
2020 return;
never executed: return;
0
2021 } -
2022 -
2023 const int parentRowCount = d->model->rowCount(parent); -
2024 const int delta = end - start + 1; -
2025 if (parent != d->root && !d->isIndexExpanded(parent) && parentRowCount > delta) {
evaluated: parent != d->root
TRUEFALSE
yes
Evaluation Count:257
yes
Evaluation Count:142
evaluated: !d->isIndexExpanded(parent)
TRUEFALSE
yes
Evaluation Count:244
yes
Evaluation Count:13
evaluated: parentRowCount > delta
TRUEFALSE
yes
Evaluation Count:240
yes
Evaluation Count:4
4-257
2026 QAbstractItemView::rowsInserted(parent, start, end); -
2027 return;
executed: return;
Execution Count:240
240
2028 } -
2029 -
2030 const int parentItem = d->viewIndex(parent); -
2031 if (((parentItem != -1) && d->viewItems.at(parentItem).expanded)
evaluated: (parentItem != -1)
TRUEFALSE
yes
Evaluation Count:17
yes
Evaluation Count:142
evaluated: d->viewItems.at(parentItem).expanded
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:4
4-142
2032 || (parent == d->root)) {
evaluated: (parent == d->root)
TRUEFALSE
yes
Evaluation Count:142
yes
Evaluation Count:4
4-142
2033 d->doDelayedItemsLayout(); -
2034 } else if (parentItem != -1 && (d->model->rowCount(parent) == end - start + 1)) {
partially evaluated: parentItem != -1
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
partially evaluated: (d->model->rowCount(parent) == end - start + 1)
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
executed: }
Execution Count:155
0-155
2035 -
2036 d->viewItems[parentItem].hasChildren = true; -
2037 viewport()->update(); -
2038 }
executed: }
Execution Count:4
4
2039 QAbstractItemView::rowsInserted(parent, start, end); -
2040}
executed: }
Execution Count:159
159
2041 -
2042 -
2043 -
2044 -
2045 -
2046void QTreeView::rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end) -
2047{ -
2048 QTreeViewPrivate * const d = d_func(); -
2049 QAbstractItemView::rowsAboutToBeRemoved(parent, start, end); -
2050 d->viewItems.clear(); -
2051}
executed: }
Execution Count:1290
1290
2052 -
2053 -
2054 -
2055 -
2056 -
2057 -
2058 -
2059void QTreeView::rowsRemoved(const QModelIndex &parent, int start, int end) -
2060{ -
2061 QTreeViewPrivate * const d = d_func(); -
2062 d->viewItems.clear(); -
2063 d->doDelayedItemsLayout(); -
2064 d->hasRemovedItems = true; -
2065 d->_q_rowsRemoved(parent, start, end); -
2066}
executed: }
Execution Count:1288
1288
2067 -
2068 -
2069 -
2070 -
2071 -
2072void QTreeView::columnCountChanged(int oldCount, int newCount) -
2073{ -
2074 QTreeViewPrivate * const d = d_func(); -
2075 if (oldCount == 0 && newCount > 0) {
evaluated: oldCount == 0
TRUEFALSE
yes
Evaluation Count:812
yes
Evaluation Count:87
evaluated: newCount > 0
TRUEFALSE
yes
Evaluation Count:626
yes
Evaluation Count:186
87-812
2076 -
2077 d->doDelayedItemsLayout(); -
2078 }
executed: }
Execution Count:626
626
2079 -
2080 if (isVisible())
evaluated: isVisible()
TRUEFALSE
yes
Evaluation Count:136
yes
Evaluation Count:763
136-763
2081 updateGeometries();
executed: updateGeometries();
Execution Count:136
136
2082 viewport()->update(); -
2083}
executed: }
Execution Count:899
899
2084 -
2085 -
2086 -
2087 -
2088 -
2089 -
2090void QTreeView::resizeColumnToContents(int column) -
2091{ -
2092 QTreeViewPrivate * const d = d_func(); -
2093 d->executePostedLayout(); -
2094 if (column < 0 || column >= d->header->count())
partially evaluated: column < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
partially evaluated: column >= d->header->count()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
2095 return;
never executed: return;
0
2096 int contents = sizeHintForColumn(column); -
2097 int header = d->header->isHidden() ? 0 : d->header->sectionSizeHint(column);
partially evaluated: d->header->isHidden()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
2098 d->header->resizeSection(column, qMax(contents, header)); -
2099}
executed: }
Execution Count:2
2
2100 -
2101 -
2102 -
2103 -
2104 -
2105 -
2106 -
2107void QTreeView::sortByColumn(int column) -
2108{ -
2109 QTreeViewPrivate * const d = d_func(); -
2110 sortByColumn(column, d->header->sortIndicatorOrder()); -
2111}
executed: }
Execution Count:4
4
2112void QTreeView::sortByColumn(int column, Qt::SortOrder order) -
2113{ -
2114 QTreeViewPrivate * const d = d_func(); -
2115 -
2116 -
2117 d->header->setSortIndicator(column, order); -
2118 -
2119 if (!d->sortingEnabled)
evaluated: !d->sortingEnabled
TRUEFALSE
yes
Evaluation Count:291
yes
Evaluation Count:4
4-291
2120 d->model->sort(column, order);
executed: d->model->sort(column, order);
Execution Count:291
291
2121}
executed: }
Execution Count:295
295
2122 -
2123 -
2124 -
2125 -
2126void QTreeView::selectAll() -
2127{ -
2128 QTreeViewPrivate * const d = d_func(); -
2129 if (!selectionModel())
evaluated: !selectionModel()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:9
5-9
2130 return;
executed: return;
Execution Count:5
5
2131 SelectionMode mode = d->selectionMode; -
2132 d->executePostedLayout(); -
2133 if (mode != SingleSelection && mode != NoSelection && !d->viewItems.isEmpty()) {
evaluated: mode != SingleSelection
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:1
evaluated: mode != NoSelection
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:2
partially evaluated: !d->viewItems.isEmpty()
TRUEFALSE
yes
Evaluation Count:6
no
Evaluation Count:0
0-8
2134 const QModelIndex &idx = d->viewItems.last().index; -
2135 QModelIndex lastItemIndex = idx.sibling(idx.row(), d->model->columnCount(idx.parent()) - 1); -
2136 d->select(d->viewItems.first().index, lastItemIndex, -
2137 QItemSelectionModel::ClearAndSelect -
2138 |QItemSelectionModel::Rows); -
2139 }
executed: }
Execution Count:6
6
2140}
executed: }
Execution Count:9
9
2141void QTreeView::expandAll() -
2142{ -
2143 QTreeViewPrivate * const d = d_func(); -
2144 d->viewItems.clear(); -
2145 d->interruptDelayedItemsLayout(); -
2146 d->layout(-1, true); -
2147 updateGeometries(); -
2148 d->viewport->update(); -
2149}
executed: }
Execution Count:17
17
2150void QTreeView::collapseAll() -
2151{ -
2152 QTreeViewPrivate * const d = d_func(); -
2153 d->expandedIndexes.clear(); -
2154 doItemsLayout(); -
2155}
executed: }
Execution Count:1
1
2156 -
2157 -
2158 -
2159 -
2160 -
2161 -
2162 -
2163void QTreeView::expandToDepth(int depth) -
2164{ -
2165 QTreeViewPrivate * const d = d_func(); -
2166 d->viewItems.clear(); -
2167 d->expandedIndexes.clear(); -
2168 d->interruptDelayedItemsLayout(); -
2169 d->layout(-1); -
2170 for (int i = 0; i < d->viewItems.count(); ++i) {
never evaluated: i < d->viewItems.count()
0
2171 if (d->viewItems.at(i).level <= (uint)depth) {
never evaluated: d->viewItems.at(i).level <= (uint)depth
0
2172 d->viewItems[i].expanded = true; -
2173 d->layout(i); -
2174 d->storeExpanded(d->viewItems.at(i).index); -
2175 }
never executed: }
0
2176 }
never executed: }
0
2177 updateGeometries(); -
2178 d->viewport->update(); -
2179}
never executed: }
0
2180void QTreeView::columnResized(int column, int , int ) -
2181{ -
2182 QTreeViewPrivate * const d = d_func(); -
2183 d->columnsToUpdate.append(column); -
2184 if (d->columnResizeTimerID == 0)
evaluated: d->columnResizeTimerID == 0
TRUEFALSE
yes
Evaluation Count:345
yes
Evaluation Count:631
345-631
2185 d->columnResizeTimerID = startTimer(0);
executed: d->columnResizeTimerID = startTimer(0);
Execution Count:345
345
2186}
executed: }
Execution Count:976
976
2187 -
2188 -
2189 -
2190 -
2191void QTreeView::updateGeometries() -
2192{ -
2193 QTreeViewPrivate * const d = d_func(); -
2194 if (d->header) {
evaluated: d->header
TRUEFALSE
yes
Evaluation Count:1674
yes
Evaluation Count:670
670-1674
2195 if (d->geometryRecursionBlock)
evaluated: d->geometryRecursionBlock
TRUEFALSE
yes
Evaluation Count:632
yes
Evaluation Count:1042
632-1042
2196 return;
executed: return;
Execution Count:632
632
2197 d->geometryRecursionBlock = true; -
2198 QSize hint = d->header->isHidden() ? QSize(0, 0) : d->header->sizeHint();
partially evaluated: d->header->isHidden()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1042
0-1042
2199 setViewportMargins(0, hint.height(), 0, 0); -
2200 QRect vg = d->viewport->geometry(); -
2201 QRect geometryRect(vg.left(), vg.top() - hint.height(), vg.width(), hint.height()); -
2202 d->header->setGeometry(geometryRect); -
2203 -
2204 QMetaObject::invokeMethod(d->header, "updateGeometries"); -
2205 d->updateScrollBars(); -
2206 d->geometryRecursionBlock = false; -
2207 }
executed: }
Execution Count:1042
1042
2208 QAbstractItemView::updateGeometries(); -
2209}
executed: }
Execution Count:1712
1712
2210int QTreeView::sizeHintForColumn(int column) const -
2211{ -
2212 const QTreeViewPrivate * const d = d_func(); -
2213 d->executePostedLayout(); -
2214 if (d->viewItems.isEmpty())
evaluated: d->viewItems.isEmpty()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:38
5-38
2215 return -1;
executed: return -1;
Execution Count:5
5
2216 ensurePolished(); -
2217 int w = 0; -
2218 QStyleOptionViewItem option = d->viewOptions(); -
2219 const QVector<QTreeViewItem> viewItems = d->viewItems; -
2220 -
2221 int start = 0; -
2222 int end = viewItems.count(); -
2223 if(end > 1000) {
evaluated: end > 1000
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:32
6-32
2224 -
2225 start = qMax(0, d->firstVisibleItem() - 100); -
2226 end = qMin(end, start + 900); -
2227 }
executed: }
Execution Count:6
6
2228 -
2229 for (int i = start; i < end; ++i) {
evaluated: i < end
TRUEFALSE
yes
Evaluation Count:6576
yes
Evaluation Count:38
38-6576
2230 if (viewItems.at(i).spanning)
evaluated: viewItems.at(i).spanning
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:6571
5-6571
2231 continue;
executed: continue;
Execution Count:5
5
2232 QModelIndex index = viewItems.at(i).index; -
2233 index = index.sibling(index.row(), column); -
2234 QWidget *editor = d->editorForIndex(index).widget.data(); -
2235 if (editor && d->persistent.contains(editor)) {
partially evaluated: editor
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6571
never evaluated: d->persistent.contains(editor)
0-6571
2236 w = qMax(w, editor->sizeHint().width()); -
2237 int min = editor->minimumSize().width(); -
2238 int max = editor->maximumSize().width(); -
2239 w = qBound(min, w, max); -
2240 }
never executed: }
0
2241 int hint = d->delegateForIndex(index)->sizeHint(option, index).width(); -
2242 w = qMax(w, hint + (column == 0 ? d->indentationForItem(i) : 0)); -
2243 }
executed: }
Execution Count:6571
6571
2244 return w;
executed: return w;
Execution Count:38
38
2245} -
2246 -
2247 -
2248 -
2249 -
2250 -
2251 -
2252int QTreeView::indexRowSizeHint(const QModelIndex &index) const -
2253{ -
2254 const QTreeViewPrivate * const d = d_func(); -
2255 if (!d->isIndexValid(index) || !d->itemDelegate)
partially evaluated: !d->isIndexValid(index)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2777
partially evaluated: !d->itemDelegate
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2777
0-2777
2256 return 0;
never executed: return 0;
0
2257 -
2258 int start = -1; -
2259 int end = -1; -
2260 int indexRow = index.row(); -
2261 int count = d->header->count(); -
2262 bool emptyHeader = (count == 0); -
2263 QModelIndex parent = index.parent(); -
2264 -
2265 if (count && isVisible()) {
evaluated: count
TRUEFALSE
yes
Evaluation Count:2773
yes
Evaluation Count:4
evaluated: isVisible()
TRUEFALSE
yes
Evaluation Count:2436
yes
Evaluation Count:337
4-2773
2266 -
2267 start = d->header->visualIndexAt(0); -
2268 } else {
executed: }
Execution Count:2436
2436
2269 -
2270 count = d->model->columnCount(parent); -
2271 }
executed: }
Execution Count:341
341
2272 -
2273 if (isRightToLeft()) {
evaluated: isRightToLeft()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:2774
3-2774
2274 start = (start == -1 ? count - 1 : start);
partially evaluated: start == -1
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
2275 end = 0; -
2276 } else {
executed: }
Execution Count:3
3
2277 start = (start == -1 ? 0 : start);
evaluated: start == -1
TRUEFALSE
yes
Evaluation Count:341
yes
Evaluation Count:2433
341-2433
2278 end = count - 1; -
2279 }
executed: }
Execution Count:2774
2774
2280 -
2281 if (end < start)
partially evaluated: end < start
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2777
0-2777
2282 qSwap(end, start);
never executed: qSwap(end, start);
0
2283 -
2284 int height = -1; -
2285 QStyleOptionViewItem option = d->viewOptions(); -
2286 -
2287 -
2288 -
2289 -
2290 -
2291 option.rect.setWidth(-1); -
2292 -
2293 for (int column = start; column <= end; ++column) {
evaluated: column <= end
TRUEFALSE
yes
Evaluation Count:14891
yes
Evaluation Count:2777
2777-14891
2294 int logicalColumn = emptyHeader ? column : d->header->logicalIndex(column);
evaluated: emptyHeader
TRUEFALSE
yes
Evaluation Count:56
yes
Evaluation Count:14835
56-14835
2295 if (d->header->isSectionHidden(logicalColumn))
evaluated: d->header->isSectionHidden(logicalColumn)
TRUEFALSE
yes
Evaluation Count:31
yes
Evaluation Count:14860
31-14860
2296 continue;
executed: continue;
Execution Count:31
31
2297 QModelIndex idx = d->model->index(indexRow, logicalColumn, parent); -
2298 if (idx.isValid()) {
partially evaluated: idx.isValid()
TRUEFALSE
yes
Evaluation Count:14860
no
Evaluation Count:0
0-14860
2299 QWidget *editor = d->editorForIndex(idx).widget.data(); -
2300 if (editor && d->persistent.contains(editor)) {
evaluated: editor
TRUEFALSE
yes
Evaluation Count:42
yes
Evaluation Count:14818
evaluated: d->persistent.contains(editor)
TRUEFALSE
yes
Evaluation Count:28
yes
Evaluation Count:14
14-14818
2301 height = qMax(height, editor->sizeHint().height()); -
2302 int min = editor->minimumSize().height(); -
2303 int max = editor->maximumSize().height(); -
2304 height = qBound(min, height, max); -
2305 }
executed: }
Execution Count:28
28
2306 int hint = d->delegateForIndex(idx)->sizeHint(option, idx).height(); -
2307 height = qMax(height, hint); -
2308 }
executed: }
Execution Count:14860
14860
2309 }
executed: }
Execution Count:14860
14860
2310 -
2311 return height;
executed: return height;
Execution Count:2777
2777
2312} -
2313 -
2314 -
2315 -
2316 -
2317 -
2318 -
2319int QTreeView::rowHeight(const QModelIndex &index) const -
2320{ -
2321 const QTreeViewPrivate * const d = d_func(); -
2322 d->executePostedLayout(); -
2323 int i = d->viewIndex(index); -
2324 if (i == -1)
never evaluated: i == -1
0
2325 return 0;
never executed: return 0;
0
2326 return d->itemHeight(i);
never executed: return d->itemHeight(i);
0
2327} -
2328 -
2329 -
2330 -
2331 -
2332void QTreeView::horizontalScrollbarAction(int action) -
2333{ -
2334 QAbstractItemView::horizontalScrollbarAction(action); -
2335}
executed: }
Execution Count:2
2
2336 -
2337 -
2338 -
2339 -
2340bool QTreeView::isIndexHidden(const QModelIndex &index) const -
2341{ -
2342 return (isColumnHidden(index.column()) || isRowHidden(index.row(), index.parent()));
executed: return (isColumnHidden(index.column()) || isRowHidden(index.row(), index.parent()));
Execution Count:18580
18580
2343} -
2344 -
2345 -
2346 -
2347 -
2348void QTreeViewPrivate::initialize() -
2349{ -
2350 QTreeView * const q = q_func(); -
2351 updateStyledFrameWidths(); -
2352 q->setSelectionBehavior(QAbstractItemView::SelectRows); -
2353 q->setSelectionMode(QAbstractItemView::SingleSelection); -
2354 q->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel); -
2355 q->setAttribute(Qt::WA_MacShowFocusRect); -
2356 -
2357 QHeaderView *header = new QHeaderView(Qt::Horizontal, q); -
2358 header->setSectionsMovable(true); -
2359 header->setStretchLastSection(true); -
2360 header->setDefaultAlignment(Qt::AlignLeft|Qt::AlignVCenter); -
2361 q->setHeader(header); -
2362 -
2363 QObject::connect(&animatedOperation, "2""finished()", q, "1""_q_endAnimatedOperation()"); -
2364 -
2365}
executed: }
Execution Count:670
670
2366 -
2367void QTreeViewPrivate::expand(int item, bool emitSignal) -
2368{ -
2369 QTreeView * const q = q_func(); -
2370 -
2371 if (item == -1 || viewItems.at(item).expanded)
partially evaluated: item == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:63
evaluated: viewItems.at(item).expanded
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:53
0-63
2372 return;
executed: return;
Execution Count:10
10
2373 -
2374 -
2375 if (emitSignal && animationsEnabled)
partially evaluated: emitSignal
TRUEFALSE
yes
Evaluation Count:53
no
Evaluation Count:0
evaluated: animationsEnabled
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:41
0-53
2376 prepareAnimatedOperation(item, QVariantAnimation::Forward);
executed: prepareAnimatedOperation(item, QVariantAnimation::Forward);
Execution Count:12
12
2377 -
2378 -
2379 if (state != QAbstractItemView::AnimatingState)
evaluated: state != QAbstractItemView::AnimatingState
TRUEFALSE
yes
Evaluation Count:45
yes
Evaluation Count:8
8-45
2380 stateBeforeAnimation = state;
executed: stateBeforeAnimation = state;
Execution Count:45
45
2381 q->setState(QAbstractItemView::ExpandingState); -
2382 const QModelIndex index = viewItems.at(item).index; -
2383 storeExpanded(index); -
2384 viewItems[item].expanded = true; -
2385 layout(item); -
2386 q->setState(stateBeforeAnimation); -
2387 -
2388 if (model->canFetchMore(index))
partially evaluated: model->canFetchMore(index)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:53
0-53
2389 model->fetchMore(index);
never executed: model->fetchMore(index);
0
2390 if (emitSignal) {
partially evaluated: emitSignal
TRUEFALSE
yes
Evaluation Count:53
no
Evaluation Count:0
0-53
2391 q->expanded(index); -
2392 -
2393 if (animationsEnabled)
evaluated: animationsEnabled
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:41
12-41
2394 beginAnimatedOperation();
executed: beginAnimatedOperation();
Execution Count:12
12
2395 -
2396 }
executed: }
Execution Count:53
53
2397}
executed: }
Execution Count:53
53
2398 -
2399void QTreeViewPrivate::insertViewItems(int pos, int count, const QTreeViewItem &viewItem) -
2400{ -
2401 QTreeView * const q = q_func(); -
2402 (void)q; -
2403 viewItems.insert(pos, count, viewItem); -
2404 QTreeViewItem *items = viewItems.data(); -
2405 for (int i = pos + count; i < viewItems.count(); i++)
evaluated: i < viewItems.count()
TRUEFALSE
yes
Evaluation Count:469
yes
Evaluation Count:55
55-469
2406 if (items[i].parentItem >= pos)
evaluated: items[i].parentItem >= pos
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:461
8-461
2407 items[i].parentItem += count;
executed: items[i].parentItem += count;
Execution Count:8
8
2408}
executed: }
Execution Count:55
55
2409 -
2410void QTreeViewPrivate::removeViewItems(int pos, int count) -
2411{ -
2412 QTreeView * const q = q_func(); -
2413 (void)q; -
2414 viewItems.remove(pos, count); -
2415 QTreeViewItem *items = viewItems.data(); -
2416 for (int i = pos; i < viewItems.count(); i++)
evaluated: i < viewItems.count()
TRUEFALSE
yes
Evaluation Count:244
yes
Evaluation Count:26
26-244
2417 if (items[i].parentItem >= pos)
evaluated: items[i].parentItem >= pos
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:238
6-238
2418 items[i].parentItem -= count;
executed: items[i].parentItem -= count;
Execution Count:6
6
2419}
executed: }
Execution Count:26
26
2420void QTreeViewPrivate::collapse(int item, bool emitSignal) -
2421{ -
2422 QTreeView * const q = q_func(); -
2423 -
2424 if (item == -1 || expandedIndexes.isEmpty())
partially evaluated: item == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:56
evaluated: expandedIndexes.isEmpty()
TRUEFALSE
yes
Evaluation Count:26
yes
Evaluation Count:30
0-56
2425 return;
executed: return;
Execution Count:26
26
2426 -
2427 -
2428 delayedAutoScroll.stop(); -
2429 -
2430 int total = viewItems.at(item).total; -
2431 const QModelIndex &modelIndex = viewItems.at(item).index; -
2432 if (!isPersistent(modelIndex))
evaluated: !isPersistent(modelIndex)
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:26
4-26
2433 return;
executed: return;
Execution Count:4
4
2434 QSet<QPersistentModelIndex>::iterator it = expandedIndexes.find(modelIndex); -
2435 if (it == expandedIndexes.end() || viewItems.at(item).expanded == false)
partially evaluated: it == expandedIndexes.end()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:26
partially evaluated: viewItems.at(item).expanded == false
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:26
0-26
2436 return;
never executed: return;
0
2437 -
2438 -
2439 if (emitSignal && animationsEnabled)
partially evaluated: emitSignal
TRUEFALSE
yes
Evaluation Count:26
no
Evaluation Count:0
evaluated: animationsEnabled
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:19
0-26
2440 prepareAnimatedOperation(item, QVariantAnimation::Backward);
executed: prepareAnimatedOperation(item, QVariantAnimation::Backward);
Execution Count:7
7
2441 -
2442 -
2443 -
2444 if (state != QAbstractItemView::AnimatingState)
evaluated: state != QAbstractItemView::AnimatingState
TRUEFALSE
yes
Evaluation Count:19
yes
Evaluation Count:7
7-19
2445 stateBeforeAnimation = state;
executed: stateBeforeAnimation = state;
Execution Count:19
19
2446 q->setState(QAbstractItemView::CollapsingState); -
2447 expandedIndexes.erase(it); -
2448 viewItems[item].expanded = false; -
2449 int index = item; -
2450 while (index > -1) {
evaluated: index > -1
TRUEFALSE
yes
Evaluation Count:38
yes
Evaluation Count:26
26-38
2451 viewItems[index].total -= total; -
2452 index = viewItems[index].parentItem; -
2453 }
executed: }
Execution Count:38
38
2454 removeViewItems(item + 1, total); -
2455 q->setState(stateBeforeAnimation); -
2456 -
2457 if (emitSignal) {
partially evaluated: emitSignal
TRUEFALSE
yes
Evaluation Count:26
no
Evaluation Count:0
0-26
2458 q->collapsed(modelIndex); -
2459 -
2460 if (animationsEnabled)
evaluated: animationsEnabled
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:19
7-19
2461 beginAnimatedOperation();
executed: beginAnimatedOperation();
Execution Count:7
7
2462 -
2463 }
executed: }
Execution Count:26
26
2464}
executed: }
Execution Count:26
26
2465 -
2466 -
2467void QTreeViewPrivate::prepareAnimatedOperation(int item, QVariantAnimation::Direction direction) -
2468{ -
2469 animatedOperation.item = item; -
2470 animatedOperation.viewport = viewport; -
2471 animatedOperation.setDirection(direction); -
2472 -
2473 int top = coordinateForItem(item) + itemHeight(item); -
2474 QRect rect = viewport->rect(); -
2475 rect.setTop(top); -
2476 if (direction == QVariantAnimation::Backward) {
evaluated: direction == QVariantAnimation::Backward
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:12
7-12
2477 const int limit = rect.height() * 2; -
2478 int h = 0; -
2479 int c = item + viewItems.at(item).total + 1; -
2480 for (int i = item + 1; i < c && h < limit; ++i)
evaluated: i < c
TRUEFALSE
yes
Evaluation Count:70
yes
Evaluation Count:6
evaluated: h < limit
TRUEFALSE
yes
Evaluation Count:69
yes
Evaluation Count:1
1-70
2481 h += itemHeight(i);
executed: h += itemHeight(i);
Execution Count:69
69
2482 rect.setHeight(h); -
2483 animatedOperation.setEndValue(top + h); -
2484 }
executed: }
Execution Count:7
7
2485 animatedOperation.setStartValue(top); -
2486 animatedOperation.before = renderTreeToPixmapForAnimation(rect); -
2487}
executed: }
Execution Count:19
19
2488 -
2489void QTreeViewPrivate::beginAnimatedOperation() -
2490{ -
2491 QTreeView * const q = q_func(); -
2492 -
2493 QRect rect = viewport->rect(); -
2494 rect.setTop(animatedOperation.top()); -
2495 if (animatedOperation.direction() == QVariantAnimation::Forward) {
evaluated: animatedOperation.direction() == QVariantAnimation::Forward
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:7
7-12
2496 const int limit = rect.height() * 2; -
2497 int h = 0; -
2498 int c = animatedOperation.item + viewItems.at(animatedOperation.item).total + 1; -
2499 for (int i = animatedOperation.item + 1; i < c && h < limit; ++i)
evaluated: i < c
TRUEFALSE
yes
Evaluation Count:106
yes
Evaluation Count:11
evaluated: h < limit
TRUEFALSE
yes
Evaluation Count:105
yes
Evaluation Count:1
1-106
2500 h += itemHeight(i);
executed: h += itemHeight(i);
Execution Count:105
105
2501 rect.setHeight(h); -
2502 animatedOperation.setEndValue(animatedOperation.top() + h); -
2503 }
executed: }
Execution Count:12
12
2504 -
2505 if (!rect.isEmpty()) {
evaluated: !rect.isEmpty()
TRUEFALSE
yes
Evaluation Count:18
yes
Evaluation Count:1
1-18
2506 animatedOperation.after = renderTreeToPixmapForAnimation(rect); -
2507 -
2508 q->setState(QAbstractItemView::AnimatingState); -
2509 animatedOperation.start(); -
2510 }
executed: }
Execution Count:18
18
2511}
executed: }
Execution Count:19
19
2512 -
2513void QTreeViewPrivate::drawAnimatedOperation(QPainter *painter) const -
2514{ -
2515 const int start = animatedOperation.startValue().toInt(), -
2516 end = animatedOperation.endValue().toInt(), -
2517 current = animatedOperation.currentValue().toInt(); -
2518 bool collapsing = animatedOperation.direction() == QVariantAnimation::Backward; -
2519 const QPixmap top = collapsing ? animatedOperation.before : animatedOperation.after;
partially evaluated: collapsing
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
2520 painter->drawPixmap(0, start, top, 0, end - current - 1, top.width(), top.height()); -
2521 const QPixmap bottom = collapsing ? animatedOperation.after : animatedOperation.before;
partially evaluated: collapsing
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
2522 painter->drawPixmap(0, current, bottom); -
2523}
executed: }
Execution Count:1
1
2524 -
2525QPixmap QTreeViewPrivate::renderTreeToPixmapForAnimation(const QRect &rect) const -
2526{ -
2527 const QTreeView * const q = q_func(); -
2528 QPixmap pixmap(rect.size()); -
2529 if (rect.size().isEmpty())
partially evaluated: rect.size().isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:37
0-37
2530 return pixmap;
never executed: return pixmap;
0
2531 pixmap.fill(Qt::transparent); -
2532 QPainter painter(&pixmap); -
2533 painter.fillRect(QRect(QPoint(0,0), rect.size()), q->palette().base()); -
2534 painter.translate(0, -rect.top()); -
2535 q->drawTree(&painter, QRegion(rect)); -
2536 painter.end(); -
2537 -
2538 -
2539 QStyleOptionViewItem option = viewOptions(); -
2540 for (QEditorIndexHash::const_iterator it = editorIndexHash.constBegin(); it != editorIndexHash.constEnd(); ++it) {
partially evaluated: it != editorIndexHash.constEnd()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:37
0-37
2541 QWidget *editor = it.key(); -
2542 const QModelIndex &index = it.value(); -
2543 option.rect = q->visualRect(index); -
2544 if (option.rect.isValid()) {
never evaluated: option.rect.isValid()
0
2545 -
2546 if (QAbstractItemDelegate *delegate = delegateForIndex(index))
never evaluated: QAbstractItemDelegate *delegate = delegateForIndex(index)
0
2547 delegate->updateEditorGeometry(editor, option, index);
never executed: delegate->updateEditorGeometry(editor, option, index);
0
2548 -
2549 const QPoint pos = editor->pos(); -
2550 if (rect.contains(pos)) {
never evaluated: rect.contains(pos)
0
2551 editor->render(&pixmap, pos - rect.topLeft()); -
2552 -
2553 -
2554 editor->hide(); -
2555 }
never executed: }
0
2556 }
never executed: }
0
2557 }
never executed: }
0
2558 -
2559 -
2560 return pixmap;
executed: return pixmap;
Execution Count:37
37
2561} -
2562 -
2563void QTreeViewPrivate::_q_endAnimatedOperation() -
2564{ -
2565 QTreeView * const q = q_func(); -
2566 q->setState(stateBeforeAnimation); -
2567 q->updateGeometries(); -
2568 viewport->update(); -
2569}
executed: }
Execution Count:1
1
2570 -
2571 -
2572void QTreeViewPrivate::_q_modelAboutToBeReset() -
2573{ -
2574 viewItems.clear(); -
2575}
executed: }
Execution Count:270
270
2576 -
2577void QTreeViewPrivate::_q_columnsAboutToBeRemoved(const QModelIndex &parent, int start, int end) -
2578{ -
2579 if (start <= 0 && 0 <= end)
evaluated: start <= 0
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:7
partially evaluated: 0 <= end
TRUEFALSE
yes
Evaluation Count:7
no
Evaluation Count:0
0-7
2580 viewItems.clear();
executed: viewItems.clear();
Execution Count:7
7
2581 QAbstractItemViewPrivate::_q_columnsAboutToBeRemoved(parent, start, end); -
2582}
executed: }
Execution Count:14
14
2583 -
2584void QTreeViewPrivate::_q_columnsRemoved(const QModelIndex &parent, int start, int end) -
2585{ -
2586 if (start <= 0 && 0 <= end)
evaluated: start <= 0
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:7
partially evaluated: 0 <= end
TRUEFALSE
yes
Evaluation Count:7
no
Evaluation Count:0
0-7
2587 doDelayedItemsLayout();
executed: doDelayedItemsLayout();
Execution Count:7
7
2588 QAbstractItemViewPrivate::_q_columnsRemoved(parent, start, end); -
2589}
executed: }
Execution Count:14
14
2590void QTreeViewPrivate::layout(int i, bool recursiveExpanding, bool afterIsUninitialized) -
2591{ -
2592 QTreeView * const q = q_func(); -
2593 QModelIndex current; -
2594 QModelIndex parent = (i < 0) ? (QModelIndex)root : modelIndex(i);
evaluated: (i < 0)
TRUEFALSE
yes
Evaluation Count:438
yes
Evaluation Count:332
332-438
2595 -
2596 if (i>=0 && !parent.isValid()) {
evaluated: i>=0
TRUEFALSE
yes
Evaluation Count:332
yes
Evaluation Count:438
partially evaluated: !parent.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:332
0-438
2597 -
2598 -
2599 -
2600 return;
never executed: return;
0
2601 } -
2602 -
2603 int count = 0; -
2604 if (model->hasChildren(parent)) {
evaluated: model->hasChildren(parent)
TRUEFALSE
yes
Evaluation Count:609
yes
Evaluation Count:161
161-609
2605 if (model->canFetchMore(parent))
evaluated: model->canFetchMore(parent)
TRUEFALSE
yes
Evaluation Count:35
yes
Evaluation Count:574
35-574
2606 model->fetchMore(parent);
executed: model->fetchMore(parent);
Execution Count:35
35
2607 count = model->rowCount(parent); -
2608 }
executed: }
Execution Count:609
609
2609 -
2610 bool expanding = true; -
2611 if (i == -1) {
evaluated: i == -1
TRUEFALSE
yes
Evaluation Count:438
yes
Evaluation Count:332
332-438
2612 if (uniformRowHeights) {
evaluated: uniformRowHeights
TRUEFALSE
yes
Evaluation Count:17
yes
Evaluation Count:421
17-421
2613 QModelIndex index = model->index(0, 0, parent); -
2614 defaultItemHeight = q->indexRowSizeHint(index); -
2615 }
executed: }
Execution Count:17
17
2616 viewItems.resize(count); -
2617 afterIsUninitialized = true; -
2618 } else if (viewItems[i].total != (uint)count) {
executed: }
Execution Count:438
evaluated: viewItems[i].total != (uint)count
TRUEFALSE
yes
Evaluation Count:165
yes
Evaluation Count:167
165-438
2619 if (!afterIsUninitialized)
evaluated: !afterIsUninitialized
TRUEFALSE
yes
Evaluation Count:55
yes
Evaluation Count:110
55-110
2620 insertViewItems(i + 1, count, QTreeViewItem());
executed: insertViewItems(i + 1, count, QTreeViewItem());
Execution Count:55
55
2621 else if (count > 0)
partially evaluated: count > 0
TRUEFALSE
yes
Evaluation Count:110
no
Evaluation Count:0
0-110
2622 viewItems.resize(viewItems.count() + count);
executed: viewItems.resize(viewItems.count() + count);
Execution Count:110
110
2623 } else { -
2624 expanding = false; -
2625 }
executed: }
Execution Count:167
167
2626 -
2627 int first = i + 1; -
2628 int level = (i >= 0 ? viewItems.at(i).level + 1 : 0);
evaluated: i >= 0
TRUEFALSE
yes
Evaluation Count:332
yes
Evaluation Count:438
332-438
2629 int hidden = 0; -
2630 int last = 0; -
2631 int children = 0; -
2632 QTreeViewItem *item = 0; -
2633 for (int j = first; j < first + count; ++j) {
evaluated: j < first + count
TRUEFALSE
yes
Evaluation Count:9296
yes
Evaluation Count:770
770-9296
2634 current = model->index(j - first, 0, parent); -
2635 if (isRowHidden(current)) {
evaluated: isRowHidden(current)
TRUEFALSE
yes
Evaluation Count:40
yes
Evaluation Count:9256
40-9256
2636 ++hidden; -
2637 last = j - hidden + children; -
2638 } else {
executed: }
Execution Count:40
40
2639 last = j - hidden + children; -
2640 if (item)
evaluated: item
TRUEFALSE
yes
Evaluation Count:8680
yes
Evaluation Count:576
576-8680
2641 item->hasMoreSiblings = true;
executed: item->hasMoreSiblings = true;
Execution Count:8680
8680
2642 item = &viewItems[last]; -
2643 item->index = current; -
2644 item->parentItem = i; -
2645 item->level = level; -
2646 item->height = 0; -
2647 item->spanning = q->isFirstColumnSpanned(current.row(), parent); -
2648 item->expanded = false; -
2649 item->total = 0; -
2650 item->hasMoreSiblings = false; -
2651 if (recursiveExpanding || isIndexExpanded(current)) {
evaluated: recursiveExpanding
TRUEFALSE
yes
Evaluation Count:190
yes
Evaluation Count:9066
evaluated: isIndexExpanded(current)
TRUEFALSE
yes
Evaluation Count:89
yes
Evaluation Count:8977
89-9066
2652 if (recursiveExpanding)
evaluated: recursiveExpanding
TRUEFALSE
yes
Evaluation Count:190
yes
Evaluation Count:89
89-190
2653 expandedIndexes.insert(current);
executed: expandedIndexes.insert(current);
Execution Count:190
190
2654 item->expanded = true; -
2655 layout(last, recursiveExpanding, afterIsUninitialized); -
2656 item = &viewItems[last]; -
2657 children += item->total; -
2658 item->hasChildren = item->total > 0; -
2659 last = j - hidden + children; -
2660 } else {
executed: }
Execution Count:279
279
2661 item->hasChildren = hasVisibleChildren(current); -
2662 }
executed: }
Execution Count:8977
8977
2663 } -
2664 } -
2665 -
2666 -
2667 if (hidden > 0) {
evaluated: hidden > 0
TRUEFALSE
yes
Evaluation Count:38
yes
Evaluation Count:732
38-732
2668 if (!afterIsUninitialized)
partially evaluated: !afterIsUninitialized
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:38
0-38
2669 removeViewItems(last + 1, hidden);
never executed: removeViewItems(last + 1, hidden);
0
2670 else -
2671 viewItems.resize(viewItems.size() - hidden);
executed: viewItems.resize(viewItems.size() - hidden);
Execution Count:38
38
2672 } -
2673 -
2674 if (!expanding)
evaluated: !expanding
TRUEFALSE
yes
Evaluation Count:167
yes
Evaluation Count:603
167-603
2675 return;
executed: return;
Execution Count:167
167
2676 -
2677 while (i > -1) {
evaluated: i > -1
TRUEFALSE
yes
Evaluation Count:295
yes
Evaluation Count:603
295-603
2678 viewItems[i].total += count - hidden; -
2679 i = viewItems[i].parentItem; -
2680 }
executed: }
Execution Count:295
295
2681}
executed: }
Execution Count:603
603
2682 -
2683int QTreeViewPrivate::pageUp(int i) const -
2684{ -
2685 int index = itemAtCoordinate(coordinateForItem(i) - viewport->height()); -
2686 while (isItemHiddenOrDisabled(index))
evaluated: isItemHiddenOrDisabled(index)
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:5
3-5
2687 index--;
executed: index--;
Execution Count:3
3
2688 return index == -1 ? 0 : index;
executed: return index == -1 ? 0 : index;
Execution Count:5
5
2689} -
2690 -
2691int QTreeViewPrivate::pageDown(int i) const -
2692{ -
2693 int index = itemAtCoordinate(coordinateForItem(i) + viewport->height()); -
2694 while (isItemHiddenOrDisabled(index))
evaluated: isItemHiddenOrDisabled(index)
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:1
1-4
2695 index++;
executed: index++;
Execution Count:4
4
2696 return index == -1 ? viewItems.count() - 1 : index;
executed: return index == -1 ? viewItems.count() - 1 : index;
Execution Count:1
1
2697} -
2698 -
2699int QTreeViewPrivate::indentationForItem(int item) const -
2700{ -
2701 if (item < 0 || item >= viewItems.count())
partially evaluated: item < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15656
partially evaluated: item >= viewItems.count()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15656
0-15656
2702 return 0;
never executed: return 0;
0
2703 int level = viewItems.at(item).level; -
2704 if (rootDecoration)
evaluated: rootDecoration
TRUEFALSE
yes
Evaluation Count:15543
yes
Evaluation Count:113
113-15543
2705 ++level;
executed: ++level;
Execution Count:15543
15543
2706 return level * indent;
executed: return level * indent;
Execution Count:15656
15656
2707} -
2708 -
2709int QTreeViewPrivate::itemHeight(int item) const -
2710{ -
2711 if (uniformRowHeights)
evaluated: uniformRowHeights
TRUEFALSE
yes
Evaluation Count:745
yes
Evaluation Count:302521
745-302521
2712 return defaultItemHeight;
executed: return defaultItemHeight;
Execution Count:745
745
2713 if (viewItems.isEmpty())
partially evaluated: viewItems.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:302521
0-302521
2714 return 0;
never executed: return 0;
0
2715 const QModelIndex &index = viewItems.at(item).index; -
2716 if (!index.isValid())
evaluated: !index.isValid()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:302520
1-302520
2717 return 0;
executed: return 0;
Execution Count:1
1
2718 int height = viewItems.at(item).height; -
2719 if (height <= 0) {
evaluated: height <= 0
TRUEFALSE
yes
Evaluation Count:2747
yes
Evaluation Count:299773
2747-299773
2720 height = q_func()->indexRowSizeHint(index); -
2721 viewItems[item].height = height; -
2722 }
executed: }
Execution Count:2747
2747
2723 return qMax(height, 0);
executed: return qMax(height, 0);
Execution Count:302520
302520
2724} -
2725 -
2726 -
2727 -
2728 -
2729 -
2730 -
2731int QTreeViewPrivate::coordinateForItem(int item) const -
2732{ -
2733 if (verticalScrollMode == QAbstractItemView::ScrollPerPixel) {
evaluated: verticalScrollMode == QAbstractItemView::ScrollPerPixel
TRUEFALSE
yes
Evaluation Count:9140
yes
Evaluation Count:10058
9140-10058
2734 if (uniformRowHeights)
evaluated: uniformRowHeights
TRUEFALSE
yes
Evaluation Count:52
yes
Evaluation Count:9088
52-9088
2735 return (item * defaultItemHeight) - vbar->value();
executed: return (item * defaultItemHeight) - vbar->value();
Execution Count:52
52
2736 -
2737 int y = 0; -
2738 for (int i = 0; i < viewItems.count(); ++i) {
partially evaluated: i < viewItems.count()
TRUEFALSE
yes
Evaluation Count:107221
no
Evaluation Count:0
0-107221
2739 if (i == item)
evaluated: i == item
TRUEFALSE
yes
Evaluation Count:9088
yes
Evaluation Count:98133
9088-98133
2740 return y - vbar->value();
executed: return y - vbar->value();
Execution Count:9088
9088
2741 y += itemHeight(i); -
2742 }
executed: }
Execution Count:98133
98133
2743 } else {
never executed: }
0
2744 int topViewItemIndex = vbar->value(); -
2745 if (uniformRowHeights)
evaluated: uniformRowHeights
TRUEFALSE
yes
Evaluation Count:112
yes
Evaluation Count:9946
112-9946
2746 return defaultItemHeight * (item - topViewItemIndex);
executed: return defaultItemHeight * (item - topViewItemIndex);
Execution Count:112
112
2747 if (item >= topViewItemIndex) {
evaluated: item >= topViewItemIndex
TRUEFALSE
yes
Evaluation Count:9936
yes
Evaluation Count:10
10-9936
2748 -
2749 -
2750 int viewItemCoordinate = 0; -
2751 int viewItemIndex = topViewItemIndex; -
2752 while (viewItemIndex < viewItems.count()) {
partially evaluated: viewItemIndex < viewItems.count()
TRUEFALSE
yes
Evaluation Count:33505
no
Evaluation Count:0
0-33505
2753 if (viewItemIndex == item)
evaluated: viewItemIndex == item
TRUEFALSE
yes
Evaluation Count:9936
yes
Evaluation Count:23569
9936-23569
2754 return viewItemCoordinate;
executed: return viewItemCoordinate;
Execution Count:9936
9936
2755 viewItemCoordinate += itemHeight(viewItemIndex); -
2756 ++viewItemIndex; -
2757 }
executed: }
Execution Count:23569
23569
2758 -
2759 qt_noop(); -
2760 return viewItemCoordinate;
never executed: return viewItemCoordinate;
0
2761 } else { -
2762 -
2763 int viewItemCoordinate = 0; -
2764 for (int viewItemIndex = topViewItemIndex; viewItemIndex > 0; --viewItemIndex) {
evaluated: viewItemIndex > 0
TRUEFALSE
yes
Evaluation Count:270
yes
Evaluation Count:3
3-270
2765 if (viewItemIndex == item)
evaluated: viewItemIndex == item
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:263
7-263
2766 return viewItemCoordinate;
executed: return viewItemCoordinate;
Execution Count:7
7
2767 viewItemCoordinate -= itemHeight(viewItemIndex - 1); -
2768 }
executed: }
Execution Count:263
263
2769 return viewItemCoordinate;
executed: return viewItemCoordinate;
Execution Count:3
3
2770 } -
2771 } -
2772 return 0;
never executed: return 0;
0
2773} -
2774int QTreeViewPrivate::itemAtCoordinate(int coordinate) const -
2775{ -
2776 const int itemCount = viewItems.count(); -
2777 if (itemCount == 0)
evaluated: itemCount == 0
TRUEFALSE
yes
Evaluation Count:38
yes
Evaluation Count:12173
38-12173
2778 return -1;
executed: return -1;
Execution Count:38
38
2779 if (uniformRowHeights && defaultItemHeight <= 0)
evaluated: uniformRowHeights
TRUEFALSE
yes
Evaluation Count:66
yes
Evaluation Count:12107
partially evaluated: defaultItemHeight <= 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:66
0-12107
2780 return -1;
never executed: return -1;
0
2781 if (verticalScrollMode == QAbstractItemView::ScrollPerPixel) {
evaluated: verticalScrollMode == QAbstractItemView::ScrollPerPixel
TRUEFALSE
yes
Evaluation Count:2004
yes
Evaluation Count:10169
2004-10169
2782 if (uniformRowHeights) {
evaluated: uniformRowHeights
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:1995
9-1995
2783 const int viewItemIndex = (coordinate + vbar->value()) / defaultItemHeight; -
2784 return ((viewItemIndex >= itemCount || viewItemIndex < 0) ? -1 : viewItemIndex);
executed: return ((viewItemIndex >= itemCount || viewItemIndex < 0) ? -1 : viewItemIndex);
Execution Count:9
9
2785 } -
2786 -
2787 int viewItemCoordinate = 0; -
2788 const int contentsCoordinate = coordinate + vbar->value(); -
2789 for (int viewItemIndex = 0; viewItemIndex < viewItems.count(); ++viewItemIndex) {
partially evaluated: viewItemIndex < viewItems.count()
TRUEFALSE
yes
Evaluation Count:17867
no
Evaluation Count:0
0-17867
2790 viewItemCoordinate += itemHeight(viewItemIndex); -
2791 if (viewItemCoordinate >= contentsCoordinate)
evaluated: viewItemCoordinate >= contentsCoordinate
TRUEFALSE
yes
Evaluation Count:1995
yes
Evaluation Count:15872
1995-15872
2792 return (viewItemIndex >= itemCount ? -1 : viewItemIndex);
executed: return (viewItemIndex >= itemCount ? -1 : viewItemIndex);
Execution Count:1995
1995
2793 }
executed: }
Execution Count:15872
15872
2794 } else {
never executed: }
0
2795 int topViewItemIndex = vbar->value(); -
2796 if (uniformRowHeights) {
evaluated: uniformRowHeights
TRUEFALSE
yes
Evaluation Count:57
yes
Evaluation Count:10112
57-10112
2797 if (coordinate < 0)
evaluated: coordinate < 0
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:54
3-54
2798 coordinate -= defaultItemHeight - 1;
executed: coordinate -= defaultItemHeight - 1;
Execution Count:3
3
2799 const int viewItemIndex = topViewItemIndex + (coordinate / defaultItemHeight); -
2800 return ((viewItemIndex >= itemCount || viewItemIndex < 0) ? -1 : viewItemIndex);
executed: return ((viewItemIndex >= itemCount || viewItemIndex < 0) ? -1 : viewItemIndex);
Execution Count:57
57
2801 } -
2802 if (coordinate >= 0) {
evaluated: coordinate >= 0
TRUEFALSE
yes
Evaluation Count:10102
yes
Evaluation Count:10
10-10102
2803 -
2804 int viewItemCoordinate = 0; -
2805 for (int viewItemIndex = topViewItemIndex; viewItemIndex < viewItems.count(); ++viewItemIndex) {
evaluated: viewItemIndex < viewItems.count()
TRUEFALSE
yes
Evaluation Count:14198
yes
Evaluation Count:55
55-14198
2806 viewItemCoordinate += itemHeight(viewItemIndex); -
2807 if (viewItemCoordinate > coordinate)
evaluated: viewItemCoordinate > coordinate
TRUEFALSE
yes
Evaluation Count:10047
yes
Evaluation Count:4151
4151-10047
2808 return (viewItemIndex >= itemCount ? -1 : viewItemIndex);
executed: return (viewItemIndex >= itemCount ? -1 : viewItemIndex);
Execution Count:10047
10047
2809 }
executed: }
Execution Count:4151
4151
2810 } else {
executed: }
Execution Count:55
55
2811 -
2812 int viewItemCoordinate = 0; -
2813 for (int viewItemIndex = topViewItemIndex; viewItemIndex >= 0; --viewItemIndex) {
evaluated: viewItemIndex >= 0
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:9
9-12
2814 if (viewItemCoordinate <= coordinate)
evaluated: viewItemCoordinate <= coordinate
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:11
1-11
2815 return (viewItemIndex >= itemCount ? -1 : viewItemIndex);
executed: return (viewItemIndex >= itemCount ? -1 : viewItemIndex);
Execution Count:1
1
2816 viewItemCoordinate -= itemHeight(viewItemIndex); -
2817 }
executed: }
Execution Count:11
11
2818 }
executed: }
Execution Count:9
9
2819 } -
2820 return -1;
executed: return -1;
Execution Count:64
64
2821} -
2822 -
2823int QTreeViewPrivate::viewIndex(const QModelIndex &_index) const -
2824{ -
2825 if (!_index.isValid() || viewItems.isEmpty())
evaluated: !_index.isValid()
TRUEFALSE
yes
Evaluation Count:195
yes
Evaluation Count:28908
evaluated: viewItems.isEmpty()
TRUEFALSE
yes
Evaluation Count:65
yes
Evaluation Count:28843
65-28908
2826 return -1;
executed: return -1;
Execution Count:260
260
2827 -
2828 const int totalCount = viewItems.count(); -
2829 const QModelIndex index = _index.sibling(_index.row(), 0); -
2830 const int row = index.row(); -
2831 const quintptr internalId = index.internalId(); -
2832 -
2833 -
2834 int localCount = qMin(lastViewedItem - 1, totalCount - lastViewedItem); -
2835 for (int i = 0; i < localCount; ++i) {
evaluated: i < localCount
TRUEFALSE
yes
Evaluation Count:24582
yes
Evaluation Count:13700
13700-24582
2836 const QModelIndex &idx1 = viewItems.at(lastViewedItem + i).index; -
2837 if (idx1.row() == row && idx1.internalId() == internalId) {
evaluated: idx1.row() == row
TRUEFALSE
yes
Evaluation Count:13557
yes
Evaluation Count:11025
evaluated: idx1.internalId() == internalId
TRUEFALSE
yes
Evaluation Count:13526
yes
Evaluation Count:31
31-13557
2838 lastViewedItem = lastViewedItem + i; -
2839 return lastViewedItem;
executed: return lastViewedItem;
Execution Count:13526
13526
2840 } -
2841 const QModelIndex &idx2 = viewItems.at(lastViewedItem - i - 1).index; -
2842 if (idx2.row() == row && idx2.internalId() == internalId) {
evaluated: idx2.row() == row
TRUEFALSE
yes
Evaluation Count:1655
yes
Evaluation Count:9401
evaluated: idx2.internalId() == internalId
TRUEFALSE
yes
Evaluation Count:1617
yes
Evaluation Count:38
38-9401
2843 lastViewedItem = lastViewedItem - i - 1; -
2844 return lastViewedItem;
executed: return lastViewedItem;
Execution Count:1617
1617
2845 } -
2846 }
executed: }
Execution Count:9439
9439
2847 -
2848 for (int j = qMax(0, lastViewedItem + localCount); j < totalCount; ++j) {
evaluated: j < totalCount
TRUEFALSE
yes
Evaluation Count:27187
yes
Evaluation Count:1501
1501-27187
2849 const QModelIndex &idx = viewItems.at(j).index; -
2850 if (idx.row() == row && idx.internalId() == internalId) {
evaluated: idx.row() == row
TRUEFALSE
yes
Evaluation Count:12784
yes
Evaluation Count:14403
evaluated: idx.internalId() == internalId
TRUEFALSE
yes
Evaluation Count:12199
yes
Evaluation Count:585
585-14403
2851 lastViewedItem = j; -
2852 return j;
executed: return j;
Execution Count:12199
12199
2853 } -
2854 }
executed: }
Execution Count:14988
14988
2855 for (int j = qMin(totalCount, lastViewedItem - localCount) - 1; j >= 0; --j) {
evaluated: j >= 0
TRUEFALSE
yes
Evaluation Count:2221
yes
Evaluation Count:987
987-2221
2856 const QModelIndex &idx = viewItems.at(j).index; -
2857 if (idx.row() == row && idx.internalId() == internalId) {
evaluated: idx.row() == row
TRUEFALSE
yes
Evaluation Count:562
yes
Evaluation Count:1659
evaluated: idx.internalId() == internalId
TRUEFALSE
yes
Evaluation Count:514
yes
Evaluation Count:48
48-1659
2858 lastViewedItem = j; -
2859 return j;
executed: return j;
Execution Count:514
514
2860 } -
2861 }
executed: }
Execution Count:1707
1707
2862 -
2863 -
2864 return -1;
executed: return -1;
Execution Count:987
987
2865} -
2866 -
2867QModelIndex QTreeViewPrivate::modelIndex(int i, int column) const -
2868{ -
2869 if (i < 0 || i >= viewItems.count())
evaluated: i < 0
TRUEFALSE
yes
Evaluation Count:105
yes
Evaluation Count:12831
partially evaluated: i >= viewItems.count()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12831
0-12831
2870 return QModelIndex();
executed: return QModelIndex();
Execution Count:105
105
2871 -
2872 QModelIndex ret = viewItems.at(i).index; -
2873 if (column)
evaluated: column
TRUEFALSE
yes
Evaluation Count:31
yes
Evaluation Count:12800
31-12800
2874 ret = ret.sibling(ret.row(), column);
executed: ret = ret.sibling(ret.row(), column);
Execution Count:31
31
2875 return ret;
executed: return ret;
Execution Count:12831
12831
2876} -
2877 -
2878int QTreeViewPrivate::firstVisibleItem(int *offset) const -
2879{ -
2880 const int value = vbar->value(); -
2881 if (verticalScrollMode == QAbstractItemView::ScrollPerItem) {
evaluated: verticalScrollMode == QAbstractItemView::ScrollPerItem
TRUEFALSE
yes
Evaluation Count:324
yes
Evaluation Count:42
42-324
2882 if (offset)
evaluated: offset
TRUEFALSE
yes
Evaluation Count:318
yes
Evaluation Count:6
6-318
2883 *offset = 0;
executed: *offset = 0;
Execution Count:318
318
2884 return (value < 0 || value >= viewItems.count()) ? -1 : value;
executed: return (value < 0 || value >= viewItems.count()) ? -1 : value;
Execution Count:324
324
2885 } -
2886 -
2887 if (uniformRowHeights) {
partially evaluated: uniformRowHeights
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:42
0-42
2888 if (!defaultItemHeight)
never evaluated: !defaultItemHeight
0
2889 return -1;
never executed: return -1;
0
2890 -
2891 if (offset)
never evaluated: offset
0
2892 *offset = -(value % defaultItemHeight);
never executed: *offset = -(value % defaultItemHeight);
0
2893 return value / defaultItemHeight;
never executed: return value / defaultItemHeight;
0
2894 } -
2895 int y = 0; -
2896 for (int i = 0; i < viewItems.count(); ++i) {
partially evaluated: i < viewItems.count()
TRUEFALSE
yes
Evaluation Count:42
no
Evaluation Count:0
0-42
2897 y += itemHeight(i); -
2898 if (y > value) {
partially evaluated: y > value
TRUEFALSE
yes
Evaluation Count:42
no
Evaluation Count:0
0-42
2899 if (offset)
partially evaluated: offset
TRUEFALSE
yes
Evaluation Count:42
no
Evaluation Count:0
0-42
2900 *offset = y - value - itemHeight(i);
executed: *offset = y - value - itemHeight(i);
Execution Count:42
42
2901 return i;
executed: return i;
Execution Count:42
42
2902 } -
2903 }
never executed: }
0
2904 return -1;
never executed: return -1;
0
2905} -
2906 -
2907int QTreeViewPrivate::columnAt(int x) const -
2908{ -
2909 return header->logicalIndexAt(x);
executed: return header->logicalIndexAt(x);
Execution Count:7061
7061
2910} -
2911 -
2912void QTreeViewPrivate::updateScrollBars() -
2913{ -
2914 QTreeView * const q = q_func(); -
2915 QSize viewportSize = viewport->size(); -
2916 if (!viewportSize.isValid())
partially evaluated: !viewportSize.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6695
0-6695
2917 viewportSize = QSize(0, 0);
never executed: viewportSize = QSize(0, 0);
0
2918 -
2919 if (viewItems.isEmpty()) {
evaluated: viewItems.isEmpty()
TRUEFALSE
yes
Evaluation Count:441
yes
Evaluation Count:6254
441-6254
2920 q->doItemsLayout(); -
2921 }
executed: }
Execution Count:441
441
2922 -
2923 int itemsInViewport = 0; -
2924 if (uniformRowHeights) {
evaluated: uniformRowHeights
TRUEFALSE
yes
Evaluation Count:80
yes
Evaluation Count:6615
80-6615
2925 if (defaultItemHeight <= 0)
partially evaluated: defaultItemHeight <= 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:80
0-80
2926 itemsInViewport = viewItems.count();
never executed: itemsInViewport = viewItems.count();
0
2927 else -
2928 itemsInViewport = viewportSize.height() / defaultItemHeight;
executed: itemsInViewport = viewportSize.height() / defaultItemHeight;
Execution Count:80
80
2929 } else { -
2930 const int itemsCount = viewItems.count(); -
2931 const int viewportHeight = viewportSize.height(); -
2932 for (int height = 0, item = itemsCount - 1; item >= 0; --item) {
evaluated: item >= 0
TRUEFALSE
yes
Evaluation Count:53675
yes
Evaluation Count:795
795-53675
2933 height += itemHeight(item); -
2934 if (height > viewportHeight)
evaluated: height > viewportHeight
TRUEFALSE
yes
Evaluation Count:5820
yes
Evaluation Count:47855
5820-47855
2935 break;
executed: break;
Execution Count:5820
5820
2936 ++itemsInViewport; -
2937 }
executed: }
Execution Count:47855
47855
2938 }
executed: }
Execution Count:6615
6615
2939 if (verticalScrollMode == QAbstractItemView::ScrollPerItem) {
evaluated: verticalScrollMode == QAbstractItemView::ScrollPerItem
TRUEFALSE
yes
Evaluation Count:3892
yes
Evaluation Count:2803
2803-3892
2940 if (!viewItems.isEmpty())
evaluated: !viewItems.isEmpty()
TRUEFALSE
yes
Evaluation Count:3625
yes
Evaluation Count:267
267-3625
2941 itemsInViewport = qMax(1, itemsInViewport);
executed: itemsInViewport = qMax(1, itemsInViewport);
Execution Count:3625
3625
2942 vbar->setRange(0, viewItems.count() - itemsInViewport); -
2943 vbar->setPageStep(itemsInViewport); -
2944 vbar->setSingleStep(1); -
2945 } else {
executed: }
Execution Count:3892
3892
2946 int contentsHeight = 0; -
2947 if (uniformRowHeights) {
evaluated: uniformRowHeights
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:2791
12-2791
2948 contentsHeight = defaultItemHeight * viewItems.count(); -
2949 } else {
executed: }
Execution Count:12
12
2950 for (int i = 0; i < viewItems.count(); ++i)
evaluated: i < viewItems.count()
TRUEFALSE
yes
Evaluation Count:71546
yes
Evaluation Count:2791
2791-71546
2951 contentsHeight += itemHeight(i);
executed: contentsHeight += itemHeight(i);
Execution Count:71546
71546
2952 }
executed: }
Execution Count:2791
2791
2953 vbar->setRange(0, contentsHeight - viewportSize.height()); -
2954 vbar->setPageStep(viewportSize.height()); -
2955 vbar->setSingleStep(qMax(viewportSize.height() / (itemsInViewport + 1), 2)); -
2956 }
executed: }
Execution Count:2803
2803
2957 -
2958 const int columnCount = header->count(); -
2959 const int viewportWidth = viewportSize.width(); -
2960 int columnsInViewport = 0; -
2961 for (int width = 0, column = columnCount - 1; column >= 0; --column) {
evaluated: column >= 0
TRUEFALSE
yes
Evaluation Count:18444
yes
Evaluation Count:720
720-18444
2962 int logical = header->logicalIndex(column); -
2963 width += header->sectionSize(logical); -
2964 if (width > viewportWidth)
evaluated: width > viewportWidth
TRUEFALSE
yes
Evaluation Count:5975
yes
Evaluation Count:12469
5975-12469
2965 break;
executed: break;
Execution Count:5975
5975
2966 ++columnsInViewport; -
2967 }
executed: }
Execution Count:12469
12469
2968 if (columnCount > 0)
evaluated: columnCount > 0
TRUEFALSE
yes
Evaluation Count:6543
yes
Evaluation Count:152
152-6543
2969 columnsInViewport = qMax(1, columnsInViewport);
executed: columnsInViewport = qMax(1, columnsInViewport);
Execution Count:6543
6543
2970 if (horizontalScrollMode == QAbstractItemView::ScrollPerItem) {
evaluated: horizontalScrollMode == QAbstractItemView::ScrollPerItem
TRUEFALSE
yes
Evaluation Count:2778
yes
Evaluation Count:3917
2778-3917
2971 hbar->setRange(0, columnCount - columnsInViewport); -
2972 hbar->setPageStep(columnsInViewport); -
2973 hbar->setSingleStep(1); -
2974 } else {
executed: }
Execution Count:2778
2778
2975 const int horizontalLength = header->length(); -
2976 const QSize maxSize = q->maximumViewportSize(); -
2977 if (maxSize.width() >= horizontalLength && vbar->maximum() <= 0)
evaluated: maxSize.width() >= horizontalLength
TRUEFALSE
yes
Evaluation Count:681
yes
Evaluation Count:3236
evaluated: vbar->maximum() <= 0
TRUEFALSE
yes
Evaluation Count:586
yes
Evaluation Count:95
95-3236
2978 viewportSize = maxSize;
executed: viewportSize = maxSize;
Execution Count:586
586
2979 hbar->setPageStep(viewportSize.width()); -
2980 hbar->setRange(0, qMax(horizontalLength - viewportSize.width(), 0)); -
2981 hbar->setSingleStep(qMax(viewportSize.width() / (columnsInViewport + 1), 2)); -
2982 }
executed: }
Execution Count:3917
3917
2983} -
2984 -
2985int QTreeViewPrivate::itemDecorationAt(const QPoint &pos) const -
2986{ -
2987 executePostedLayout(); -
2988 int x = pos.x(); -
2989 int column = header->logicalIndexAt(x); -
2990 if (column != 0)
evaluated: column != 0
TRUEFALSE
yes
Evaluation Count:514
yes
Evaluation Count:4992
514-4992
2991 return -1;
executed: return -1;
Execution Count:514
514
2992 -
2993 int viewItemIndex = itemAtCoordinate(pos.y()); -
2994 QRect returning = itemDecorationRect(modelIndex(viewItemIndex)); -
2995 if (!returning.contains(pos))
evaluated: !returning.contains(pos)
TRUEFALSE
yes
Evaluation Count:4989
yes
Evaluation Count:3
3-4989
2996 return -1;
executed: return -1;
Execution Count:4989
4989
2997 -
2998 return viewItemIndex;
executed: return viewItemIndex;
Execution Count:3
3
2999} -
3000 -
3001QRect QTreeViewPrivate::itemDecorationRect(const QModelIndex &index) const -
3002{ -
3003 const QTreeView * const q = q_func(); -
3004 if (!rootDecoration && index.parent() == root)
evaluated: !rootDecoration
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:4977
evaluated: index.parent() == root
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:6
6-4977
3005 return QRect();
executed: return QRect();
Execution Count:9
9
3006 -
3007 int viewItemIndex = viewIndex(index); -
3008 if (viewItemIndex < 0 || !hasVisibleChildren(viewItems.at(viewItemIndex).index))
evaluated: viewItemIndex < 0
TRUEFALSE
yes
Evaluation Count:56
yes
Evaluation Count:4927
evaluated: !hasVisibleChildren(viewItems.at(viewItemIndex).index)
TRUEFALSE
yes
Evaluation Count:4748
yes
Evaluation Count:179
56-4927
3009 return QRect();
executed: return QRect();
Execution Count:4804
4804
3010 -
3011 int itemIndentation = indentationForItem(viewItemIndex); -
3012 int position = header->sectionViewportPosition(0); -
3013 int size = header->sectionSize(0); -
3014 -
3015 QRect rect; -
3016 if (q->isRightToLeft())
partially evaluated: q->isRightToLeft()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:179
0-179
3017 rect = QRect(position + size - itemIndentation, coordinateForItem(viewItemIndex), 0
3018 indent, itemHeight(viewItemIndex));
never executed: rect = QRect(position + size - itemIndentation, coordinateForItem(viewItemIndex), indent, itemHeight(viewItemIndex));
0
3019 else -
3020 rect = QRect(position + itemIndentation - indent, coordinateForItem(viewItemIndex), 179
3021 indent, itemHeight(viewItemIndex));
executed: rect = QRect(position + itemIndentation - indent, coordinateForItem(viewItemIndex), indent, itemHeight(viewItemIndex));
Execution Count:179
179
3022 QStyleOption opt; -
3023 opt.initFrom(q); -
3024 opt.rect = rect; -
3025 return q->style()->subElementRect(QStyle::SE_TreeViewDisclosureItem, &opt, q);
executed: return q->style()->subElementRect(QStyle::SE_TreeViewDisclosureItem, &opt, q);
Execution Count:179
179
3026} -
3027 -
3028QList<QPair<int, int> > QTreeViewPrivate::columnRanges(const QModelIndex &topIndex, -
3029 const QModelIndex &bottomIndex) const -
3030{ -
3031 const int topVisual = header->visualIndex(topIndex.column()), -
3032 bottomVisual = header->visualIndex(bottomIndex.column()); -
3033 -
3034 const int start = qMin(topVisual, bottomVisual); -
3035 const int end = qMax(topVisual, bottomVisual); -
3036 -
3037 QList<int> logicalIndexes; -
3038 -
3039 -
3040 for (int c = start; c <= end; c++) {
evaluated: c <= end
TRUEFALSE
yes
Evaluation Count:327
yes
Evaluation Count:323
323-327
3041 const int logical = header->logicalIndex(c); -
3042 if (!header->isSectionHidden(logical)) {
evaluated: !header->isSectionHidden(logical)
TRUEFALSE
yes
Evaluation Count:326
yes
Evaluation Count:1
1-326
3043 logicalIndexes << logical; -
3044 }
executed: }
Execution Count:326
326
3045 }
executed: }
Execution Count:327
327
3046 -
3047 qSort(logicalIndexes.begin(), logicalIndexes.end()); -
3048 -
3049 QList<QPair<int, int> > ret; -
3050 QPair<int, int> current; -
3051 current.first = -2; -
3052 current.second = -2; -
3053 for(int i = 0; i < logicalIndexes.count(); ++i) {
evaluated: i < logicalIndexes.count()
TRUEFALSE
yes
Evaluation Count:326
yes
Evaluation Count:323
323-326
3054 const int logicalColumn = logicalIndexes.at(i); -
3055 if (current.second + 1 != logicalColumn) {
evaluated: current.second + 1 != logicalColumn
TRUEFALSE
yes
Evaluation Count:323
yes
Evaluation Count:3
3-323
3056 if (current.first != -2) {
partially evaluated: current.first != -2
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:323
0-323
3057 -
3058 ret += current; -
3059 }
never executed: }
0
3060 -
3061 current.first = current.second = logicalColumn; -
3062 } else {
executed: }
Execution Count:323
323
3063 current.second++; -
3064 }
executed: }
Execution Count:3
3
3065 } -
3066 -
3067 -
3068 if (current.first != -2) {
partially evaluated: current.first != -2
TRUEFALSE
yes
Evaluation Count:323
no
Evaluation Count:0
0-323
3069 ret += current; -
3070 }
executed: }
Execution Count:323
323
3071 -
3072 return ret;
executed: return ret;
Execution Count:323
323
3073} -
3074 -
3075void QTreeViewPrivate::select(const QModelIndex &topIndex, const QModelIndex &bottomIndex, -
3076 QItemSelectionModel::SelectionFlags command) -
3077{ -
3078 QTreeView * const q = q_func(); -
3079 QItemSelection selection; -
3080 const int top = viewIndex(topIndex), -
3081 bottom = viewIndex(bottomIndex); -
3082 -
3083 const QList< QPair<int, int> > colRanges = columnRanges(topIndex, bottomIndex); -
3084 QList< QPair<int, int> >::const_iterator it; -
3085 for (it = colRanges.begin(); it != colRanges.end(); ++it) {
evaluated: it != colRanges.end()
TRUEFALSE
yes
Evaluation Count:323
yes
Evaluation Count:323
323
3086 const int left = (*it).first, -
3087 right = (*it).second; -
3088 -
3089 QModelIndex previous; -
3090 QItemSelectionRange currentRange; -
3091 QStack<QItemSelectionRange> rangeStack; -
3092 for (int i = top; i <= bottom; ++i) {
evaluated: i <= bottom
TRUEFALSE
yes
Evaluation Count:353
yes
Evaluation Count:323
323-353
3093 QModelIndex index = modelIndex(i); -
3094 QModelIndex parent = index.parent(); -
3095 QModelIndex previousParent = previous.parent(); -
3096 if (previous.isValid() && parent == previousParent) {
evaluated: previous.isValid()
TRUEFALSE
yes
Evaluation Count:30
yes
Evaluation Count:323
evaluated: parent == previousParent
TRUEFALSE
yes
Evaluation Count:26
yes
Evaluation Count:4
4-323
3097 -
3098 if (qAbs(previous.row() - index.row()) > 1) {
evaluated: qAbs(previous.row() - index.row()) > 1
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:24
2-24
3099 -
3100 if (currentRange.isValid()) {
partially evaluated: currentRange.isValid()
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
3101 selection.append(currentRange); -
3102 }
executed: }
Execution Count:2
2
3103 -
3104 currentRange = QItemSelectionRange(index.sibling(index.row(), left), index.sibling(index.row(), right)); -
3105 } else {
executed: }
Execution Count:2
2
3106 QModelIndex tl = model->index(currentRange.top(), currentRange.left(), -
3107 currentRange.parent()); -
3108 currentRange = QItemSelectionRange(tl, index.sibling(index.row(), right)); -
3109 }
executed: }
Execution Count:24
24
3110 } else if (previous.isValid() && parent == model->index(previous.row(), 0, previousParent)) {
evaluated: previous.isValid()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:323
evaluated: parent == model->index(previous.row(), 0, previousParent)
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2
2-323
3111 -
3112 rangeStack.push(currentRange); -
3113 currentRange = QItemSelectionRange(index.sibling(index.row(), left), index.sibling(index.row(), right)); -
3114 } else {
executed: }
Execution Count:2
2
3115 if (currentRange.isValid())
evaluated: currentRange.isValid()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:323
2-323
3116 selection.append(currentRange);
executed: selection.append(currentRange);
Execution Count:2
2
3117 if (rangeStack.isEmpty()) {
evaluated: rangeStack.isEmpty()
TRUEFALSE
yes
Evaluation Count:323
yes
Evaluation Count:2
2-323
3118 currentRange = QItemSelectionRange(index.sibling(index.row(), left), index.sibling(index.row(), right)); -
3119 } else {
executed: }
Execution Count:323
323
3120 currentRange = rangeStack.pop(); -
3121 index = currentRange.bottomRight(); -
3122 --i; -
3123 }
executed: }
Execution Count:2
2
3124 } -
3125 previous = index; -
3126 }
executed: }
Execution Count:353
353
3127 if (currentRange.isValid())
partially evaluated: currentRange.isValid()
TRUEFALSE
yes
Evaluation Count:323
no
Evaluation Count:0
0-323
3128 selection.append(currentRange);
executed: selection.append(currentRange);
Execution Count:323
323
3129 for (int i = 0; i < rangeStack.count(); ++i)
partially evaluated: i < rangeStack.count()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:323
0-323
3130 selection.append(rangeStack.at(i));
never executed: selection.append(rangeStack.at(i));
0
3131 }
executed: }
Execution Count:323
323
3132 q->selectionModel()->select(selection, command); -
3133}
executed: }
Execution Count:323
323
3134 -
3135QPair<int,int> QTreeViewPrivate::startAndEndColumns(const QRect &rect) const -
3136{ -
3137 const QTreeView * const q = q_func(); -
3138 int start = header->visualIndexAt(rect.left()); -
3139 int end = header->visualIndexAt(rect.right()); -
3140 if (q->isRightToLeft()) {
evaluated: q->isRightToLeft()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:466
5-466
3141 start = (start == -1 ? header->count() - 1 : start);
evaluated: start == -1
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:2
2-3
3142 end = (end == -1 ? 0 : end);
partially evaluated: end == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
3143 } else {
executed: }
Execution Count:5
5
3144 start = (start == -1 ? 0 : start);
partially evaluated: start == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:466
0-466
3145 end = (end == -1 ? header->count() - 1 : end);
evaluated: end == -1
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:454
12-454
3146 }
executed: }
Execution Count:466
466
3147 return qMakePair<int,int>(qMin(start, end), qMax(start, end));
executed: return qMakePair<int,int>(qMin(start, end), qMax(start, end));
Execution Count:471
471
3148} -
3149 -
3150bool QTreeViewPrivate::hasVisibleChildren(const QModelIndex& parent) const -
3151{ -
3152 const QTreeView * const q = q_func(); -
3153 if (model->hasChildren(parent)) {
evaluated: model->hasChildren(parent)
TRUEFALSE
yes
Evaluation Count:2199
yes
Evaluation Count:11754
2199-11754
3154 if (hiddenIndexes.isEmpty())
evaluated: hiddenIndexes.isEmpty()
TRUEFALSE
yes
Evaluation Count:2008
yes
Evaluation Count:191
191-2008
3155 return true;
executed: return true;
Execution Count:2008
2008
3156 if (q->isIndexHidden(parent))
evaluated: q->isIndexHidden(parent)
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:177
14-177
3157 return false;
executed: return false;
Execution Count:14
14
3158 int rowCount = model->rowCount(parent); -
3159 for (int i = 0; i < rowCount; ++i) {
evaluated: i < rowCount
TRUEFALSE
yes
Evaluation Count:459
yes
Evaluation Count:17
17-459
3160 if (!q->isRowHidden(i, parent))
evaluated: !q->isRowHidden(i, parent)
TRUEFALSE
yes
Evaluation Count:160
yes
Evaluation Count:299
160-299
3161 return true;
executed: return true;
Execution Count:160
160
3162 }
executed: }
Execution Count:299
299
3163 if (rowCount == 0)
partially evaluated: rowCount == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:17
0-17
3164 return true;
never executed: return true;
0
3165 }
executed: }
Execution Count:17
17
3166 return false;
executed: return false;
Execution Count:11771
11771
3167} -
3168 -
3169void QTreeViewPrivate::_q_sortIndicatorChanged(int column, Qt::SortOrder order) -
3170{ -
3171 model->sort(column, order); -
3172}
executed: }
Execution Count:548
548
3173 -
3174 -
3175 -
3176 -
3177void QTreeView::currentChanged(const QModelIndex &current, const QModelIndex &previous) -
3178{ -
3179 QAbstractItemView::currentChanged(current, previous); -
3180 -
3181 if (allColumnsShowFocus()) {
partially evaluated: allColumnsShowFocus()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:468
0-468
3182 if (previous.isValid()) {
never evaluated: previous.isValid()
0
3183 QRect previousRect = visualRect(previous); -
3184 previousRect.setX(0); -
3185 previousRect.setWidth(viewport()->width()); -
3186 viewport()->update(previousRect); -
3187 }
never executed: }
0
3188 if (current.isValid()) {
never evaluated: current.isValid()
0
3189 QRect currentRect = visualRect(current); -
3190 currentRect.setX(0); -
3191 currentRect.setWidth(viewport()->width()); -
3192 viewport()->update(currentRect); -
3193 }
never executed: }
0
3194 }
never executed: }
0
3195 -
3196 if (QAccessible::isActive() && current.isValid()) {
evaluated: QAccessible::isActive()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:467
partially evaluated: current.isValid()
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-467
3197 int entry = (visualIndex(current) + (header()?1:0))*current.model()->columnCount()+current.column();
partially evaluated: header()
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
3198 QAccessibleEvent event(this, QAccessible::Focus); -
3199 event.setChild(entry); -
3200 QAccessible::updateAccessibility(&event); -
3201 }
executed: }
Execution Count:1
1
3202 -
3203}
executed: }
Execution Count:468
468
3204 -
3205 -
3206 -
3207 -
3208void QTreeView::selectionChanged(const QItemSelection &selected, -
3209 const QItemSelection &deselected) -
3210{ -
3211 QAbstractItemView::selectionChanged(selected, deselected); -
3212 -
3213 if (QAccessible::isActive()) {
partially evaluated: QAccessible::isActive()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:556
0-556
3214 -
3215 QModelIndex sel = selected.indexes().value(0); -
3216 if (sel.isValid()) {
never evaluated: sel.isValid()
0
3217 int entry = (visualIndex(sel) + (header()?1:0))*sel.model()->columnCount()+sel.column();
never evaluated: header()
0
3218 qt_noop(); -
3219 QAccessibleEvent event(this, QAccessible::Selection); -
3220 event.setChild(entry); -
3221 QAccessible::updateAccessibility(&event); -
3222 }
never executed: }
0
3223 QModelIndex desel = deselected.indexes().value(0); -
3224 if (desel.isValid()) {
never evaluated: desel.isValid()
0
3225 int entry = (visualIndex(desel) + (header()?1:0))*desel.model()->columnCount()+desel.column();
never evaluated: header()
0
3226 qt_noop(); -
3227 QAccessibleEvent event(this, QAccessible::SelectionRemove); -
3228 event.setChild(entry); -
3229 QAccessible::updateAccessibility(&event); -
3230 }
never executed: }
0
3231 }
never executed: }
0
3232 -
3233}
executed: }
Execution Count:556
556
3234 -
3235int QTreeView::visualIndex(const QModelIndex &index) const -
3236{ -
3237 const QTreeViewPrivate * const d = d_func(); -
3238 d->executePostedLayout(); -
3239 return d->viewIndex(index);
executed: return d->viewIndex(index);
Execution Count:1
1
3240} -
3241 -
3242 -
3243 -
3244 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial