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

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