qtreeview.cpp

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

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9