qlistview.cpp

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

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