qcolumnview.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/widgets/itemviews/qcolumnview.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7QColumnView::QColumnView(QWidget * parent)-
8: QAbstractItemView(*new QColumnViewPrivate, parent)-
9{-
10 QColumnViewPrivate * const d = d_func();-
11 d->initialize();-
12}
never executed: end of block
0
13-
14-
15-
16-
17QColumnView::QColumnView(QColumnViewPrivate & dd, QWidget * parent)-
18: QAbstractItemView(dd, parent)-
19{-
20 QColumnViewPrivate * const d = d_func();-
21 d->initialize();-
22}
never executed: end of block
0
23-
24void QColumnViewPrivate::initialize()-
25{-
26 QColumnView * const q = q_func();-
27 q->setTextElideMode(Qt::ElideMiddle);-
28-
29 QObject::connect(&currentAnimation, qFlagLocation("2""finished()" "\0" __FILE__ ":" "109"), q, qFlagLocation("1""_q_changeCurrentColumn()" "\0" __FILE__ ":" "109"));-
30 currentAnimation.setDuration(150);-
31 currentAnimation.setTargetObject(hbar);-
32 currentAnimation.setPropertyName("value");-
33 currentAnimation.setEasingCurve(QEasingCurve::InOutQuad);-
34-
35 delete itemDelegate;-
36 q->setItemDelegate(new QColumnViewDelegate(q));-
37}
never executed: end of block
0
38-
39-
40-
41-
42QColumnView::~QColumnView()-
43{-
44}-
45void QColumnView::setResizeGripsVisible(bool visible)-
46{-
47 QColumnViewPrivate * const d = d_func();-
48 if (d->showResizeGrips == visible
d->showResizeGrips == visibleDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
49 return;
never executed: return;
0
50 d->showResizeGrips = visible;-
51 for (int i = 0; i < d->columns.count()
i < d->columns.count()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
52 QAbstractItemView *view = d->columns[i];-
53 if (visible
visibleDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
54 QColumnViewGrip *grip = new QColumnViewGrip(view);-
55 view->setCornerWidget(grip);-
56 connect(grip, qFlagLocation("2""gripMoved(int)" "\0" __FILE__ ":" "145"), this, qFlagLocation("1""_q_gripMoved(int)" "\0" __FILE__ ":" "145"));-
57 }
never executed: end of block
else {
0
58 QWidget *widget = view->cornerWidget();-
59 view->setCornerWidget(0);-
60 widget->deleteLater();-
61 }
never executed: end of block
0
62 }-
63}
never executed: end of block
0
64-
65bool QColumnView::resizeGripsVisible() const-
66{-
67 const QColumnViewPrivate * const d = d_func();-
68 return
never executed: return d->showResizeGrips;
d->showResizeGrips;
never executed: return d->showResizeGrips;
0
69}-
70-
71-
72-
73-
74void QColumnView::setModel(QAbstractItemModel *model)-
75{-
76 QColumnViewPrivate * const d = d_func();-
77 if (model == d->model
model == d->modelDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
78 return;
never executed: return;
0
79 d->closeColumns();-
80 QAbstractItemView::setModel(model);-
81}
never executed: end of block
0
82-
83-
84-
85-
86void QColumnView::setRootIndex(const QModelIndex &index)-
87{-
88 QColumnViewPrivate * const d = d_func();-
89 if (!model()
!model()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
90 return;
never executed: return;
0
91-
92 d->closeColumns();-
93 ((!(d->columns.count() == 0)) ? qt_assert("d->columns.count() == 0",__FILE__,182) : qt_noop());-
94-
95 QAbstractItemView *view = d->createColumn(index, true);-
96 if (view->selectionModel()
view->selectionModel()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
97 view->selectionModel()->deleteLater();
never executed: view->selectionModel()->deleteLater();
0
98 if (view->model()
view->model()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
99 view->setSelectionModel(selectionModel());
never executed: view->setSelectionModel(selectionModel());
0
100-
101 QAbstractItemView::setRootIndex(index);-
102 d->updateScrollbars();-
103}
never executed: end of block
0
104-
105-
106-
107-
108bool QColumnView::isIndexHidden(const QModelIndex &index) const-
109{-
110 (void)index;;-
111 return
never executed: return false;
false;
never executed: return false;
0
112}-
113-
114-
115-
116-
117QModelIndex QColumnView::indexAt(const QPoint &point) const-
118{-
119 const QColumnViewPrivate * const d = d_func();-
120 for (int i = 0; i < d->columns.size()
i < d->columns.size()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
121 QPoint topLeft = d->columns.at(i)->frameGeometry().topLeft();-
122 QPoint adjustedPoint(point.x() - topLeft.x(), point.y() - topLeft.y());-
123 QModelIndex index = d->columns.at(i)->indexAt(adjustedPoint);-
124 if (index.isValid()
index.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
125 return
never executed: return index;
index;
never executed: return index;
0
126 }
never executed: end of block
0
127 return
never executed: return QModelIndex();
QModelIndex();
never executed: return QModelIndex();
0
128}-
129-
130-
131-
132-
133QRect QColumnView::visualRect(const QModelIndex &index) const-
134{-
135 if (!index.isValid()
!index.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
136 return
never executed: return QRect();
QRect();
never executed: return QRect();
0
137-
138 const QColumnViewPrivate * const d = d_func();-
139 for (int i = 0; i < d->columns.size()
i < d->columns.size()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
140 QRect rect = d->columns.at(i)->visualRect(index);-
141 if (!rect.isNull()
!rect.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
142 rect.translate(d->columns.at(i)->frameGeometry().topLeft());-
143 return
never executed: return rect;
rect;
never executed: return rect;
0
144 }-
145 }
never executed: end of block
0
146 return
never executed: return QRect();
QRect();
never executed: return QRect();
0
147}-
148-
149-
150-
151-
152void QColumnView::scrollContentsBy(int dx, int dy)-
153{-
154 QColumnViewPrivate * const d = d_func();-
155 if (d->columns.isEmpty()
d->columns.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
|| dx == 0
dx == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
156 return;
never executed: return;
0
157-
158 dx = isRightToLeft()
isRightToLeft()Description
TRUEnever evaluated
FALSEnever evaluated
? -dx : dx;
0
159 for (int i = 0; i < d->columns.count()
i < d->columns.count()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i)
0
160 d->columns.at(i)->move(d->columns.at(i)->x() + dx, 0);
never executed: d->columns.at(i)->move(d->columns.at(i)->x() + dx, 0);
0
161 d->offset += dx;-
162 QAbstractItemView::scrollContentsBy(dx, dy);-
163}
never executed: end of block
0
164-
165-
166-
167-
168void QColumnView::scrollTo(const QModelIndex &index, ScrollHint hint)-
169{-
170 QColumnViewPrivate * const d = d_func();-
171 (void)hint;;-
172 if (!index.isValid()
!index.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
|| d->columns.isEmpty()
d->columns.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
173 return;
never executed: return;
0
174-
175-
176 if (d->currentAnimation.state() == QPropertyAnimation::Running
d->currentAnim...ation::RunningDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
177 return;
never executed: return;
0
178-
179 d->currentAnimation.stop();-
180-
181-
182-
183 d->closeColumns(index, true);-
184-
185 QModelIndex indexParent = index.parent();-
186-
187 int currentColumn = 0;-
188 int leftEdge = 0;-
189 while (currentColumn < d->columns.size()
currentColumn ...columns.size()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
190 if (indexParent == d->columns.at(currentColumn)->rootIndex()
indexParent ==...)->rootIndex()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
191 break;
never executed: break;
0
192 leftEdge += d->columns.at(currentColumn)->width();-
193 ++currentColumn;-
194 }
never executed: end of block
0
195-
196-
197 if (currentColumn == d->columns.size()
currentColumn ...columns.size()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
198 return;
never executed: return;
0
199-
200 int indexColumn = currentColumn;-
201-
202 int visibleWidth = d->columns.at(currentColumn)->width();-
203-
204 if (currentColumn + 1 < d->columns.size()
currentColumn ...columns.size()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
205 ++currentColumn;-
206 visibleWidth += d->columns.at(currentColumn)->width();-
207 }
never executed: end of block
0
208-
209 int rightEdge = leftEdge + visibleWidth;-
210 if (isRightToLeft()
isRightToLeft()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
211 leftEdge = viewport()->width() - leftEdge;-
212 rightEdge = leftEdge - visibleWidth;-
213 qSwap(rightEdge, leftEdge);-
214 }
never executed: end of block
0
215-
216-
217 if (leftEdge > -horizontalOffset()
leftEdge > -horizontalOffset()Description
TRUEnever evaluated
FALSEnever evaluated
0
218 && rightEdge <= ( -horizontalOffset() + viewport()->size().width())
rightEdge <= (...ize().width())Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
219 d->columns.at(indexColumn)->scrollTo(index);-
220 d->_q_changeCurrentColumn();-
221 return;
never executed: return;
0
222 }-
223-
224 int newScrollbarValue = 0;-
225 if (isRightToLeft()
isRightToLeft()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
226 if (leftEdge < 0
leftEdge < 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
227-
228 newScrollbarValue = viewport()->size().width() - leftEdge;-
229 }
never executed: end of block
else {
0
230-
231 newScrollbarValue = rightEdge + horizontalOffset();-
232 }
never executed: end of block
0
233 } else {-
234 if (leftEdge > -horizontalOffset()
leftEdge > -horizontalOffset()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
235-
236 newScrollbarValue = rightEdge - viewport()->size().width();-
237 }
never executed: end of block
else {
0
238-
239 newScrollbarValue = leftEdge;-
240 }
never executed: end of block
0
241 }-
242-
243-
244 if (style()->styleHint(QStyle::SH_Widget_Animate, 0, this)
style()->style...mate, 0, this)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
245 d->currentAnimation.setEndValue(newScrollbarValue);-
246 d->currentAnimation.start();-
247 }
never executed: end of block
else
0
248-
249 {-
250 horizontalScrollBar()->setValue(newScrollbarValue);-
251 }
never executed: end of block
0
252}-
253-
254-
255-
256-
257-
258-
259QModelIndex QColumnView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers)-
260{-
261-
262-
263 (void)modifiers;;-
264 if (!model()
!model()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
265 return
never executed: return QModelIndex();
QModelIndex();
never executed: return QModelIndex();
0
266-
267 QModelIndex current = currentIndex();-
268 if (isRightToLeft()
isRightToLeft()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
269 if (cursorAction == MoveLeft
cursorAction == MoveLeftDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
270 cursorAction = MoveRight;
never executed: cursorAction = MoveRight;
0
271 else if (cursorAction == MoveRight
cursorAction == MoveRightDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
272 cursorAction = MoveLeft;
never executed: cursorAction = MoveLeft;
0
273 }
never executed: end of block
0
274 switch (cursorAction) {-
275 case
never executed: case MoveLeft:
MoveLeft:
never executed: case MoveLeft:
0
276 if (current.parent().isValid()
current.parent().isValid()Description
TRUEnever evaluated
FALSEnever evaluated
&& current.parent() != rootIndex()
current.parent...!= rootIndex()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
277 return
never executed: return (current.parent());
(current.parent());
never executed: return (current.parent());
0
278 else-
279 return
never executed: return current;
current;
never executed: return current;
0
280-
281 case
never executed: case MoveRight:
MoveRight:
never executed: case MoveRight:
0
282 if (model()->hasChildren(current)
model()->hasChildren(current)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
283 return
never executed: return model()->index(0, 0, current);
model()->index(0, 0, current);
never executed: return model()->index(0, 0, current);
0
284 else-
285 return
never executed: return current.sibling(current.row() + 1, current.column());
current.sibling(current.row() + 1, current.column());
never executed: return current.sibling(current.row() + 1, current.column());
0
286-
287 default
never executed: default:
:
never executed: default:
0
288 break;
never executed: break;
0
289 }-
290-
291 return
never executed: return QModelIndex();
QModelIndex();
never executed: return QModelIndex();
0
292}-
293-
294-
295-
296-
297void QColumnView::resizeEvent(QResizeEvent *event)-
298{-
299 QColumnViewPrivate * const d = d_func();-
300 d->doLayout();-
301 d->updateScrollbars();-
302 if (!isRightToLeft()
!isRightToLeft()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
303 int diff = event->oldSize().width() - event->size().width();-
304 if (diff < 0
diff < 0Description
TRUEnever evaluated
FALSEnever evaluated
&& horizontalScrollBar()->isVisible()
horizontalScro...)->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
0
305 && horizontalScrollBar()->value() == horizontalScrollBar()->maximum()
horizontalScro...r()->maximum()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
306 horizontalScrollBar()->setMaximum(horizontalScrollBar()->maximum() + diff);-
307 }
never executed: end of block
0
308 }
never executed: end of block
0
309 QAbstractItemView::resizeEvent(event);-
310}
never executed: end of block
0
311-
312-
313-
314-
315void QColumnViewPrivate::updateScrollbars()-
316{-
317 QColumnView * const q = q_func();-
318-
319 if (currentAnimation.state() == QPropertyAnimation::Running
currentAnimati...ation::RunningDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
320 return;
never executed: return;
0
321-
322-
323-
324 int horizontalLength = 0;-
325 if (!columns.isEmpty()
!columns.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
326 horizontalLength = (columns.constLast()->x() + columns.constLast()->width()) - columns.constFirst()->x();-
327 if (horizontalLength <= 0
horizontalLength <= 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
328 horizontalLength = (columns.constFirst()->x() + columns.constFirst()->width()) - columns.constLast()->x();
never executed: horizontalLength = (columns.constFirst()->x() + columns.constFirst()->width()) - columns.constLast()->x();
0
329 }
never executed: end of block
0
330-
331 QSize viewportSize = viewport->size();-
332 if (horizontalLength < viewportSize.width()
horizontalLeng...rtSize.width()Description
TRUEnever evaluated
FALSEnever evaluated
&& hbar->value() == 0
hbar->value() == 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
333 hbar->setRange(0, 0);-
334 }
never executed: end of block
else {
0
335 int visibleLength = qMin(horizontalLength + q->horizontalOffset(), viewportSize.width());-
336 int hiddenLength = horizontalLength - visibleLength;-
337 if (hiddenLength != hbar->maximum()
hiddenLength !...bar->maximum()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
338 hbar->setRange(0, hiddenLength);
never executed: hbar->setRange(0, hiddenLength);
0
339 }
never executed: end of block
0
340 if (!columns.isEmpty()
!columns.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
341 int pageStepSize = columns.at(0)->width();-
342 if (pageStepSize != hbar->pageStep()
pageStepSize !...ar->pageStep()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
343 hbar->setPageStep(pageStepSize);
never executed: hbar->setPageStep(pageStepSize);
0
344 }
never executed: end of block
0
345 bool visible = (hbar->maximum() > 0);-
346 if (visible != hbar->isVisible()
visible != hbar->isVisible()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
347 hbar->setVisible(visible);
never executed: hbar->setVisible(visible);
0
348}
never executed: end of block
0
349-
350-
351-
352-
353int QColumnView::horizontalOffset() const-
354{-
355 const QColumnViewPrivate * const d = d_func();-
356 return
never executed: return d->offset;
d->offset;
never executed: return d->offset;
0
357}-
358-
359-
360-
361-
362int QColumnView::verticalOffset() const-
363{-
364 return
never executed: return 0;
0;
never executed: return 0;
0
365}-
366-
367-
368-
369-
370QRegion QColumnView::visualRegionForSelection(const QItemSelection &selection) const-
371{-
372 int ranges = selection.count();-
373-
374 if (ranges == 0
ranges == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
375 return
never executed: return QRect();
QRect();
never executed: return QRect();
0
376-
377-
378-
379 int firstRow = selection.at(0).top();-
380 int lastRow = selection.at(0).top();-
381 for (int i = 0; i < ranges
i < rangesDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
382 firstRow = qMin(firstRow, selection.at(i).top());-
383 lastRow = qMax(lastRow, selection.at(i).bottom());-
384 }
never executed: end of block
0
385-
386 QModelIndex firstIdx = model()->index(qMin(firstRow, lastRow), 0, rootIndex());-
387 QModelIndex lastIdx = model()->index(qMax(firstRow, lastRow), 0, rootIndex());-
388-
389 if (firstIdx == lastIdx
firstIdx == lastIdxDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
390 return
never executed: return visualRect(firstIdx);
visualRect(firstIdx);
never executed: return visualRect(firstIdx);
0
391-
392 QRegion firstRegion = visualRect(firstIdx);-
393 QRegion lastRegion = visualRect(lastIdx);-
394 return
never executed: return firstRegion.united(lastRegion);
firstRegion.united(lastRegion);
never executed: return firstRegion.united(lastRegion);
0
395}-
396-
397-
398-
399-
400void QColumnView::setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags command)-
401{-
402 (void)rect;;-
403 (void)command;;-
404}
never executed: end of block
0
405-
406-
407-
408-
409void QColumnView::setSelectionModel(QItemSelectionModel *newSelectionModel)-
410{-
411 const QColumnViewPrivate * const d = d_func();-
412 for (int i = 0; i < d->columns.size()
i < d->columns.size()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
413 if (d->columns.at(i)->selectionModel() == selectionModel()
d->columns.at(...lectionModel()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
414 d->columns.at(i)->setSelectionModel(newSelectionModel);-
415 break;
never executed: break;
0
416 }-
417 }
never executed: end of block
0
418 QAbstractItemView::setSelectionModel(newSelectionModel);-
419}
never executed: end of block
0
420-
421-
422-
423-
424QSize QColumnView::sizeHint() const-
425{-
426 const QColumnViewPrivate * const d = d_func();-
427 QSize sizeHint;-
428 for (int i = 0; i < d->columns.size()
i < d->columns.size()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
429 sizeHint += d->columns.at(i)->sizeHint();-
430 }
never executed: end of block
0
431 return
never executed: return sizeHint.expandedTo(QAbstractItemView::sizeHint());
sizeHint.expandedTo(QAbstractItemView::sizeHint());
never executed: return sizeHint.expandedTo(QAbstractItemView::sizeHint());
0
432}-
433-
434-
435-
436-
437-
438void QColumnViewPrivate::_q_gripMoved(int offset)-
439{-
440 QColumnView * const q = q_func();-
441-
442 QObject *grip = q->sender();-
443 ((!(grip)) ? qt_assert("grip",__FILE__,532) : qt_noop());-
444-
445 if (q->isRightToLeft()
q->isRightToLeft()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
446 offset = -1 * offset;
never executed: offset = -1 * offset;
0
447-
448 bool found = false;-
449 for (int i = 0; i < columns.size()
i < columns.size()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
450 if (!found
!foundDescription
TRUEnever evaluated
FALSEnever evaluated
&& columns.at(i)->cornerWidget() == grip
columns.at(i)-...dget() == gripDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
451 found = true;-
452 columnSizes[i] = columns.at(i)->width();-
453 if (q->isRightToLeft()
q->isRightToLeft()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
454 columns.at(i)->move(columns.at(i)->x() + offset, 0);
never executed: columns.at(i)->move(columns.at(i)->x() + offset, 0);
0
455 continue;
never executed: continue;
0
456 }-
457 if (!found
!foundDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
458 continue;
never executed: continue;
0
459-
460 int currentX = columns.at(i)->x();-
461 columns.at(i)->move(currentX + offset, 0);-
462 }
never executed: end of block
0
463-
464 updateScrollbars();-
465}
never executed: end of block
0
466void QColumnViewPrivate::closeColumns(const QModelIndex &parent, bool build)-
467{-
468 if (columns.isEmpty()
columns.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
469 return;
never executed: return;
0
470-
471 bool clearAll = !parent.isValid();-
472 bool passThroughRoot = false;-
473-
474 QVector<QModelIndex> dirsToAppend;-
475-
476-
477 int currentColumn = -1;-
478 QModelIndex parentIndex = parent;-
479 while (currentColumn == -1
currentColumn == -1Description
TRUEnever evaluated
FALSEnever evaluated
&& parentIndex.isValid()
parentIndex.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
480 if (columns.isEmpty()
columns.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
481 break;
never executed: break;
0
482 parentIndex = parentIndex.parent();-
483 if (root == parentIndex
root == parentIndexDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
484 passThroughRoot = true;
never executed: passThroughRoot = true;
0
485 if (!parentIndex.isValid()
!parentIndex.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
486 break;
never executed: break;
0
487 for (int i = columns.size() - 1; i >= 0
i >= 0Description
TRUEnever evaluated
FALSEnever evaluated
; --i) {
0
488 if (columns.at(i)->rootIndex() == parentIndex
columns.at(i)-...== parentIndexDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
489 currentColumn = i;-
490 break;
never executed: break;
0
491 }-
492 }
never executed: end of block
0
493 if (currentColumn == -1
currentColumn == -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
494 dirsToAppend.append(parentIndex);
never executed: dirsToAppend.append(parentIndex);
0
495 }
never executed: end of block
0
496-
497-
498-
499 if (!clearAll
!clearAllDescription
TRUEnever evaluated
FALSEnever evaluated
&& !passThroughRoot
!passThroughRootDescription
TRUEnever evaluated
FALSEnever evaluated
&& currentColumn == -1
currentColumn == -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
500 return;
never executed: return;
0
501-
502 if (currentColumn == -1
currentColumn == -1Description
TRUEnever evaluated
FALSEnever evaluated
&& parent.isValid()
parent.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
503 currentColumn = 0;
never executed: currentColumn = 0;
0
504-
505-
506 bool alreadyExists = false;-
507 if (build
buildDescription
TRUEnever evaluated
FALSEnever evaluated
&& columns.size() > currentColumn + 1
columns.size()...rentColumn + 1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
508 bool viewingParent = (columns.at(currentColumn + 1)->rootIndex() == parent);-
509 bool viewingChild = (!model->hasChildren(parent)
!model->hasChildren(parent)Description
TRUEnever evaluated
FALSEnever evaluated
0
510 && !columns.at(currentColumn + 1)->rootIndex().isValid()
!columns.at(cu...ex().isValid()Description
TRUEnever evaluated
FALSEnever evaluated
);
0
511 if (viewingParent
viewingParentDescription
TRUEnever evaluated
FALSEnever evaluated
|| viewingChild
viewingChildDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
512 currentColumn++;-
513 alreadyExists = true;-
514 }
never executed: end of block
0
515 }
never executed: end of block
0
516-
517-
518 for (int i = columns.size() - 1; i > currentColumn
i > currentColumnDescription
TRUEnever evaluated
FALSEnever evaluated
; --i) {
0
519 QAbstractItemView* notShownAnymore = columns.at(i);-
520 columns.removeAt(i);-
521 notShownAnymore->setVisible(false);-
522 if (notShownAnymore != previewColumn
notShownAnymor... previewColumnDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
523 notShownAnymore->deleteLater();
never executed: notShownAnymore->deleteLater();
0
524 }
never executed: end of block
0
525-
526 if (columns.isEmpty()
columns.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
527 offset = 0;-
528 updateScrollbars();-
529 }
never executed: end of block
0
530-
531-
532 while (!dirsToAppend.isEmpty()
!dirsToAppend.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
533 QAbstractItemView *newView = createColumn(dirsToAppend.takeLast(), true);-
534 if (!dirsToAppend.isEmpty()
!dirsToAppend.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
535 newView->setCurrentIndex(dirsToAppend.constLast());
never executed: newView->setCurrentIndex(dirsToAppend.constLast());
0
536 }
never executed: end of block
0
537-
538 if (build
buildDescription
TRUEnever evaluated
FALSEnever evaluated
&& !alreadyExists
!alreadyExistsDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
539 createColumn(parent, false);
never executed: createColumn(parent, false);
0
540}
never executed: end of block
0
541-
542void QColumnViewPrivate::_q_clicked(const QModelIndex &index)-
543{-
544 QColumnView * const q = q_func();-
545 QModelIndex parent = index.parent();-
546 QAbstractItemView *columnClicked = 0;-
547 for (int column = 0; column < columns.count()
column < columns.count()Description
TRUEnever evaluated
FALSEnever evaluated
; ++column) {
0
548 if (columns.at(column)->rootIndex() == parent
columns.at(col...ex() == parentDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
549 columnClicked = columns[column];-
550 break;
never executed: break;
0
551 }-
552 }
never executed: end of block
0
553 if (q->selectionModel()
q->selectionModel()Description
TRUEnever evaluated
FALSEnever evaluated
&& columnClicked
columnClickedDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
554 QItemSelectionModel::SelectionFlags flags = QItemSelectionModel::Current;-
555 if (columnClicked->selectionModel()->isSelected(index)
columnClicked-...elected(index)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
556 flags |= QItemSelectionModel::Select;
never executed: flags |= QItemSelectionModel::Select;
0
557 q->selectionModel()->setCurrentIndex(index, flags);-
558 }
never executed: end of block
0
559}
never executed: end of block
0
560QAbstractItemView *QColumnViewPrivate::createColumn(const QModelIndex &index, bool show)-
561{-
562 QColumnView * const q = q_func();-
563 QAbstractItemView *view = 0;-
564 if (model->hasChildren(index)
model->hasChildren(index)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
565 view = q->createColumn(index);-
566 q->connect(view, qFlagLocation("2""clicked(QModelIndex)" "\0" __FILE__ ":" "674"),-
567 q, qFlagLocation("1""_q_clicked(QModelIndex)" "\0" __FILE__ ":" "675"));-
568 }
never executed: end of block
else {
0
569 if (!previewColumn
!previewColumnDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
570 setPreviewWidget(new QWidget(q));
never executed: setPreviewWidget(new QWidget(q));
0
571 view = previewColumn;-
572 view->setMinimumWidth(qMax(view->minimumWidth(), previewWidget->minimumWidth()));-
573 }
never executed: end of block
0
574-
575 q->connect(view, qFlagLocation("2""activated(QModelIndex)" "\0" __FILE__ ":" "683"),-
576 q, qFlagLocation("2""activated(QModelIndex)" "\0" __FILE__ ":" "684"));-
577 q->connect(view, qFlagLocation("2""clicked(QModelIndex)" "\0" __FILE__ ":" "685"),-
578 q, qFlagLocation("2""clicked(QModelIndex)" "\0" __FILE__ ":" "686"));-
579 q->connect(view, qFlagLocation("2""doubleClicked(QModelIndex)" "\0" __FILE__ ":" "687"),-
580 q, qFlagLocation("2""doubleClicked(QModelIndex)" "\0" __FILE__ ":" "688"));-
581 q->connect(view, qFlagLocation("2""entered(QModelIndex)" "\0" __FILE__ ":" "689"),-
582 q, qFlagLocation("2""entered(QModelIndex)" "\0" __FILE__ ":" "690"));-
583 q->connect(view, qFlagLocation("2""pressed(QModelIndex)" "\0" __FILE__ ":" "691"),-
584 q, qFlagLocation("2""pressed(QModelIndex)" "\0" __FILE__ ":" "692"));-
585-
586 view->setFocusPolicy(Qt::NoFocus);-
587 view->setParent(viewport);-
588 ((!(view)) ? qt_assert("view",__FILE__,696) : qt_noop());-
589-
590-
591 if (showResizeGrips
showResizeGripsDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
592 QColumnViewGrip *grip = new QColumnViewGrip(view);-
593 view->setCornerWidget(grip);-
594 q->connect(grip, qFlagLocation("2""gripMoved(int)" "\0" __FILE__ ":" "702"), q, qFlagLocation("1""_q_gripMoved(int)" "\0" __FILE__ ":" "702"));-
595 }
never executed: end of block
0
596-
597 if (columnSizes.count() > columns.count()
columnSizes.co...olumns.count()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
598 view->setGeometry(0, 0, columnSizes.at(columns.count()), viewport->height());-
599 }
never executed: end of block
else {
0
600 int initialWidth = view->sizeHint().width();-
601 if (q->isRightToLeft()
q->isRightToLeft()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
602 view->setGeometry(viewport->width() - initialWidth, 0, initialWidth, viewport->height());
never executed: view->setGeometry(viewport->width() - initialWidth, 0, initialWidth, viewport->height());
0
603 else-
604 view->setGeometry(0, 0, initialWidth, viewport->height());
never executed: view->setGeometry(0, 0, initialWidth, viewport->height());
0
605 columnSizes.resize(qMax(columnSizes.count(), columns.count() + 1));-
606 columnSizes[columns.count()] = initialWidth;-
607 }
never executed: end of block
0
608 if (!columns.isEmpty()
!columns.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
&& columns.constLast()->isHidden()
columns.constL...()->isHidden()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
609 columns.constLast()->setVisible(true);
never executed: columns.constLast()->setVisible(true);
0
610-
611 columns.append(view);-
612 doLayout();-
613 updateScrollbars();-
614 if (show
showDescription
TRUEnever evaluated
FALSEnever evaluated
&& view->isHidden()
view->isHidden()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
615 view->setVisible(true);
never executed: view->setVisible(true);
0
616 return
never executed: return view;
view;
never executed: return view;
0
617}-
618QAbstractItemView *QColumnView::createColumn(const QModelIndex &index)-
619{-
620 QListView *view = new QListView(viewport());-
621-
622 initializeColumn(view);-
623-
624 view->setRootIndex(index);-
625 if (model()->canFetchMore(index)
model()->canFetchMore(index)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
626 model()->fetchMore(index);
never executed: model()->fetchMore(index);
0
627-
628 return
never executed: return view;
view;
never executed: return view;
0
629}-
630void QColumnView::initializeColumn(QAbstractItemView *column) const-
631{-
632 const QColumnViewPrivate * const d = d_func();-
633-
634 column->setFrameShape(QFrame::NoFrame);-
635 column->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);-
636 column->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);-
637 column->setMinimumWidth(100);-
638 column->setAttribute(Qt::WA_MacShowFocusRect, false);-
639-
640-
641 column->setDragDropMode(dragDropMode());-
642 column->setDragDropOverwriteMode(dragDropOverwriteMode());-
643 column->setDropIndicatorShown(showDropIndicator());-
644-
645 column->setAlternatingRowColors(alternatingRowColors());-
646 column->setAutoScroll(hasAutoScroll());-
647 column->setEditTriggers(editTriggers());-
648 column->setHorizontalScrollMode(horizontalScrollMode());-
649 column->setIconSize(iconSize());-
650 column->setSelectionBehavior(selectionBehavior());-
651 column->setSelectionMode(selectionMode());-
652 column->setTabKeyNavigation(tabKeyNavigation());-
653 column->setTextElideMode(textElideMode());-
654 column->setVerticalScrollMode(verticalScrollMode());-
655-
656 column->setModel(model());-
657-
658-
659 for (auto i = d->rowDelegates.cbegin(), end = d->rowDelegates.cend(); i != end
i != endDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i)
0
660 column->setItemDelegateForRow(i.key(), i.value());
never executed: column->setItemDelegateForRow(i.key(), i.value());
0
661-
662-
663 QAbstractItemDelegate *delegate = column->itemDelegate();-
664 column->setItemDelegate(d->itemDelegate);-
665 delete delegate;-
666}
never executed: end of block
0
667-
668-
669-
670-
671-
672-
673QWidget *QColumnView::previewWidget() const-
674{-
675 const QColumnViewPrivate * const d = d_func();-
676 return
never executed: return d->previewWidget;
d->previewWidget;
never executed: return d->previewWidget;
0
677}-
678void QColumnView::setPreviewWidget(QWidget *widget)-
679{-
680 QColumnViewPrivate * const d = d_func();-
681 d->setPreviewWidget(widget);-
682}
never executed: end of block
0
683-
684-
685-
686-
687void QColumnViewPrivate::setPreviewWidget(QWidget *widget)-
688{-
689 QColumnView * const q = q_func();-
690 if (previewColumn
previewColumnDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
691 if (!columns.isEmpty()
!columns.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
&& columns.constLast() == previewColumn
columns.constL... previewColumnDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
692 columns.removeLast();
never executed: columns.removeLast();
0
693 previewColumn->deleteLater();-
694 }
never executed: end of block
0
695 QColumnViewPreviewColumn *column = new QColumnViewPreviewColumn(q);-
696 column->setPreviewWidget(widget);-
697 previewColumn = column;-
698 previewColumn->hide();-
699 previewColumn->setFrameShape(QFrame::NoFrame);-
700 previewColumn->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);-
701 previewColumn->setSelectionMode(QAbstractItemView::NoSelection);-
702 previewColumn->setMinimumWidth(qMax(previewColumn->verticalScrollBar()->width(),-
703 previewColumn->minimumWidth()));-
704 previewWidget = widget;-
705 previewWidget->setParent(previewColumn->viewport());-
706}
never executed: end of block
0
707void QColumnView::setColumnWidths(const QList<int> &list)-
708{-
709 QColumnViewPrivate * const d = d_func();-
710 int i = 0;-
711 const int listCount = list.count();-
712 const int count = qMin(listCount, d->columns.count());-
713 for (; i < count
i < countDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
714 d->columns.at(i)->resize(list.at(i), d->columns.at(i)->height());-
715 d->columnSizes[i] = list.at(i);-
716 }
never executed: end of block
0
717-
718 d->columnSizes.reserve(listCount);-
719 for (; i < listCount
i < listCountDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i)
0
720 d->columnSizes.append(list.at(i));
never executed: d->columnSizes.append(list.at(i));
0
721}
never executed: end of block
0
722-
723-
724-
725-
726-
727-
728QList<int> QColumnView::columnWidths() const-
729{-
730 const QColumnViewPrivate * const d = d_func();-
731 QList<int> list;-
732 const int columnCount = d->columns.count();-
733 list.reserve(columnCount);-
734 for (int i = 0; i < columnCount
i < columnCountDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i)
0
735 list.append(d->columnSizes.at(i));
never executed: list.append(d->columnSizes.at(i));
0
736 return
never executed: return list;
list;
never executed: return list;
0
737}-
738-
739-
740-
741-
742void QColumnView::rowsInserted(const QModelIndex &parent, int start, int end)-
743{-
744 QAbstractItemView::rowsInserted(parent, start, end);-
745 d_func()->checkColumnCreation(parent);-
746}
never executed: end of block
0
747-
748-
749-
750-
751void QColumnView::currentChanged(const QModelIndex &current, const QModelIndex &previous)-
752{-
753 QColumnViewPrivate * const d = d_func();-
754 if (!current.isValid()
!current.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
755 QAbstractItemView::currentChanged(current, previous);-
756 return;
never executed: return;
0
757 }-
758-
759 QModelIndex currentParent = current.parent();-
760-
761 if (currentParent == previous.parent()
currentParent ...vious.parent()Description
TRUEnever evaluated
FALSEnever evaluated
0
762 && model()->hasChildren(current)
model()->hasChildren(current)Description
TRUEnever evaluated
FALSEnever evaluated
&& model()->hasChildren(previous)
model()->hasChildren(previous)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
763 for (int i = 0; i < d->columns.size()
i < d->columns.size()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
764 if (currentParent == d->columns.at(i)->rootIndex()
currentParent ...)->rootIndex()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
765 if (d->columns.size() > i + 1
d->columns.size() > i + 1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
766 QAbstractItemView::currentChanged(current, previous);-
767 return;
never executed: return;
0
768 }-
769 break;
never executed: break;
0
770 }-
771 }
never executed: end of block
0
772 }
never executed: end of block
0
773-
774-
775 bool found = false;-
776 if (currentParent == previous
currentParent == previousDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
777 for (int i = 0; i < d->columns.size()
i < d->columns.size()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
778 if (currentParent == d->columns.at(i)->rootIndex()
currentParent ...)->rootIndex()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
779 found = true;-
780 if (d->columns.size() < i + 2
d->columns.size() < i + 2Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
781 d->createColumn(current, false);-
782 }
never executed: end of block
0
783 break;
never executed: break;
0
784 }-
785 }
never executed: end of block
0
786 }
never executed: end of block
0
787 if (!found
!foundDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
788 d->closeColumns(current, true);
never executed: d->closeColumns(current, true);
0
789-
790 if (!model()->hasChildren(current)
!model()->hasChildren(current)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
791 updatePreviewWidget(current);
never executed: updatePreviewWidget(current);
0
792-
793 QAbstractItemView::currentChanged(current, previous);-
794}
never executed: end of block
0
795-
796-
797-
798-
799-
800void QColumnViewPrivate::_q_changeCurrentColumn()-
801{-
802 QColumnView * const q = q_func();-
803 if (columns.isEmpty()
columns.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
804 return;
never executed: return;
0
805-
806 QModelIndex current = q->currentIndex();-
807 if (!current.isValid()
!current.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
808 return;
never executed: return;
0
809-
810-
811 closeColumns(current, true);-
812-
813-
814 int currentColumn = qMax(0, columns.size() - 2);-
815 QAbstractItemView *parentColumn = columns.at(currentColumn);-
816 if (q->hasFocus()
q->hasFocus()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
817 parentColumn->setFocus(Qt::OtherFocusReason);
never executed: parentColumn->setFocus(Qt::OtherFocusReason);
0
818 q->setFocusProxy(parentColumn);-
819-
820-
821 for (int i = 0; i < columns.size()
i < columns.size()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
822 if (columns.at(i)->selectionModel() == q->selectionModel()
columns.at(i)-...lectionModel()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
823 QItemSelectionModel *replacementSelectionModel =-
824 new QItemSelectionModel(parentColumn->model());-
825 replacementSelectionModel->setCurrentIndex(-
826 q->selectionModel()->currentIndex(), QItemSelectionModel::Current);-
827 replacementSelectionModel->select(-
828 q->selectionModel()->selection(), QItemSelectionModel::Select);-
829 QAbstractItemView *view = columns.at(i);-
830 view->setSelectionModel(replacementSelectionModel);-
831 view->setFocusPolicy(Qt::NoFocus);-
832 if (columns.size() > i + 1
columns.size() > i + 1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
833 const QModelIndex newRootIndex = columns.at(i + 1)->rootIndex();-
834 if (newRootIndex.isValid()
newRootIndex.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
835 view->setCurrentIndex(newRootIndex);
never executed: view->setCurrentIndex(newRootIndex);
0
836 }
never executed: end of block
0
837 break;
never executed: break;
0
838 }-
839 }
never executed: end of block
0
840 parentColumn->selectionModel()->deleteLater();-
841 parentColumn->setFocusPolicy(Qt::StrongFocus);-
842 parentColumn->setSelectionModel(q->selectionModel());-
843-
844 if (currentColumn > 0
currentColumn > 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
845 parentColumn = columns.at(currentColumn - 1);-
846 if (parentColumn->currentIndex() != current.parent()
parentColumn->...rrent.parent()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
847 parentColumn->setCurrentIndex(current.parent());
never executed: parentColumn->setCurrentIndex(current.parent());
0
848 }
never executed: end of block
0
849-
850 if (columns.constLast()->isHidden()
columns.constL...()->isHidden()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
851 columns.constLast()->setVisible(true);-
852 }
never executed: end of block
0
853 if (columns.constLast()->selectionModel()
columns.constL...lectionModel()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
854 columns.constLast()->selectionModel()->clear();
never executed: columns.constLast()->selectionModel()->clear();
0
855 updateScrollbars();-
856}
never executed: end of block
0
857-
858-
859-
860-
861void QColumnView::selectAll()-
862{-
863 if (!model()
!model()Description
TRUEnever evaluated
FALSEnever evaluated
|| !selectionModel()
!selectionModel()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
864 return;
never executed: return;
0
865-
866 QModelIndexList indexList = selectionModel()->selectedIndexes();-
867 QModelIndex parent = rootIndex();-
868 QItemSelection selection;-
869 if (indexList.count() >= 1
indexList.count() >= 1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
870 parent = indexList.at(0).parent();
never executed: parent = indexList.at(0).parent();
0
871 if (indexList.count() == 1
indexList.count() == 1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
872 parent = indexList.at(0);-
873 if (!model()->hasChildren(parent)
!model()->hasChildren(parent)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
874 parent = parent.parent();
never executed: parent = parent.parent();
0
875 else-
876 selection.append(QItemSelectionRange(parent, parent));
never executed: selection.append(QItemSelectionRange(parent, parent));
0
877 }-
878-
879 QModelIndex tl = model()->index(0, 0, parent);-
880 QModelIndex br = model()->index(model()->rowCount(parent) - 1,-
881 model()->columnCount(parent) - 1,-
882 parent);-
883 selection.append(QItemSelectionRange(tl, br));-
884 selectionModel()->select(selection, QItemSelectionModel::ClearAndSelect);-
885}
never executed: end of block
0
886-
887-
888-
889-
890QColumnViewPrivate::QColumnViewPrivate()-
891: QAbstractItemViewPrivate()-
892,showResizeGrips(true)-
893,offset(0)-
894,previewWidget(0)-
895,previewColumn(0)-
896{-
897}
never executed: end of block
0
898-
899QColumnViewPrivate::~QColumnViewPrivate()-
900{-
901}-
902-
903-
904-
905-
906-
907void QColumnViewPrivate::_q_columnsInserted(const QModelIndex &parent, int start, int end)-
908{-
909 QAbstractItemViewPrivate::_q_columnsInserted(parent, start, end);-
910 checkColumnCreation(parent);-
911}
never executed: end of block
0
912-
913-
914-
915-
916-
917-
918-
919void QColumnViewPrivate::checkColumnCreation(const QModelIndex &parent)-
920{-
921 if (parent == q_func()->currentIndex()
parent == q_fu...currentIndex()Description
TRUEnever evaluated
FALSEnever evaluated
&& model->hasChildren(parent)
model->hasChildren(parent)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
922-
923-
924 for (int i = 0; i < columns.count()
i < columns.count()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
925 QAbstractItemView *view = columns.at(i);-
926 if (view->rootIndex() == parent
view->rootIndex() == parentDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
927 if (view == previewColumn
view == previewColumnDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
928-
929 closeColumns(parent, false);-
930 createColumn(parent, true );-
931 }
never executed: end of block
0
932 break;
never executed: break;
0
933 }-
934 }
never executed: end of block
0
935 }
never executed: end of block
0
936}
never executed: end of block
0
937-
938-
939-
940-
941-
942void QColumnViewPrivate::doLayout()-
943{-
944 QColumnView * const q = q_func();-
945 if (!model
!modelDescription
TRUEnever evaluated
FALSEnever evaluated
|| columns.isEmpty()
columns.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
946 return;
never executed: return;
0
947-
948 int viewportHeight = viewport->height();-
949 int x = columns.at(0)->x();-
950-
951 if (q->isRightToLeft()
q->isRightToLeft()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
952 x = viewport->width() + q->horizontalOffset();-
953 for (int i = 0; i < columns.size()
i < columns.size()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
954 QAbstractItemView *view = columns.at(i);-
955 x -= view->width();-
956 if (x != view->x()
x != view->x()Description
TRUEnever evaluated
FALSEnever evaluated
|| viewportHeight != view->height()
viewportHeight...view->height()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
957 view->setGeometry(x, 0, view->width(), viewportHeight);
never executed: view->setGeometry(x, 0, view->width(), viewportHeight);
0
958 }
never executed: end of block
0
959 }
never executed: end of block
else {
0
960 for (int i = 0; i < columns.size()
i < columns.size()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
961 QAbstractItemView *view = columns.at(i);-
962 int currentColumnWidth = view->width();-
963 if (x != view->x()
x != view->x()Description
TRUEnever evaluated
FALSEnever evaluated
|| viewportHeight != view->height()
viewportHeight...view->height()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
964 view->setGeometry(x, 0, currentColumnWidth, viewportHeight);
never executed: view->setGeometry(x, 0, currentColumnWidth, viewportHeight);
0
965 x += currentColumnWidth;-
966 }
never executed: end of block
0
967 }
never executed: end of block
0
968}-
969void QColumnViewDelegate::paint(QPainter *painter,-
970 const QStyleOptionViewItem &option,-
971 const QModelIndex &index) const-
972{-
973 drawBackground(painter, option, index );-
974-
975 bool reverse = (option.direction == Qt::RightToLeft);-
976 int width = ((option.rect.height() * 2) / 3);-
977-
978 QStyleOptionViewItem opt = option;-
979 if (reverse
reverseDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
980 opt.rect.adjust(width,0,0,0);
never executed: opt.rect.adjust(width,0,0,0);
0
981 else-
982 opt.rect.adjust(0,0,-width,0);
never executed: opt.rect.adjust(0,0,-width,0);
0
983-
984 if (!(index.model()->flags(index) & Qt::ItemIsEnabled)
!(index.model(...ItemIsEnabled)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
985 opt.showDecorationSelected = true;-
986 opt.state |= QStyle::State_Selected;-
987 }
never executed: end of block
0
988-
989 QItemDelegate::paint(painter, opt, index);-
990-
991 if (reverse
reverseDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
992 opt.rect = QRect(option.rect.x(), option.rect.y(), width, option.rect.height());
never executed: opt.rect = QRect(option.rect.x(), option.rect.y(), width, option.rect.height());
0
993 else-
994 opt.rect = QRect(option.rect.x() + option.rect.width() - width, option.rect.y(),
never executed: opt.rect = QRect(option.rect.x() + option.rect.width() - width, option.rect.y(), width, option.rect.height());
0
995 width, option.rect.height());
never executed: opt.rect = QRect(option.rect.x() + option.rect.width() - width, option.rect.y(), width, option.rect.height());
0
996-
997-
998 if (index.model()->hasChildren(index)
index.model()-...hildren(index)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
999 const QWidget *view = opt.widget;-
1000 QStyle *style = view
viewDescription
TRUEnever evaluated
FALSEnever evaluated
? view->style() : QApplication::style();
0
1001 style->drawPrimitive(QStyle::PE_IndicatorColumnViewArrow, &opt, painter, view);-
1002 }
never executed: end of block
0
1003}
never executed: end of block
0
1004-
1005-
1006-
Switch to Source codePreprocessed file

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