itemviews/qlistview.cpp

Source codeSwitch to Preprocessed file
LineSource CodeCoverage
1/**************************************************************************** -
2** -
3** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -
4** Contact: http://www.qt-project.org/legal -
5** -
6** This file is part of the QtGui module of the Qt Toolkit. -
7** -
8** $QT_BEGIN_LICENSE:LGPL$ -
9** Commercial License Usage -
10** Licensees holding valid commercial Qt licenses may use this file in -
11** accordance with the commercial license agreement provided with the -
12** Software or, alternatively, in accordance with the terms contained in -
13** a written agreement between you and Digia. For licensing terms and -
14** conditions see http://qt.digia.com/licensing. For further information -
15** use the contact form at http://qt.digia.com/contact-us. -
16** -
17** GNU Lesser General Public License Usage -
18** Alternatively, this file may be used under the terms of the GNU Lesser -
19** General Public License version 2.1 as published by the Free Software -
20** Foundation and appearing in the file LICENSE.LGPL included in the -
21** packaging of this file. Please review the following information to -
22** ensure the GNU Lesser General Public License version 2.1 requirements -
23** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -
24** -
25** In addition, as a special exception, Digia gives you certain additional -
26** rights. These rights are described in the Digia Qt LGPL Exception -
27** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -
28** -
29** GNU General Public License Usage -
30** Alternatively, this file may be used under the terms of the GNU -
31** General Public License version 3.0 as published by the Free Software -
32** Foundation and appearing in the file LICENSE.GPL included in the -
33** packaging of this file. Please review the following information to -
34** ensure the GNU General Public License version 3.0 requirements will be -
35** met: http://www.gnu.org/copyleft/gpl.html. -
36** -
37** -
38** $QT_END_LICENSE$ -
39** -
40****************************************************************************/ -
41 -
42#include "qlistview.h" -
43 -
44#ifndef QT_NO_LISTVIEW -
45#include <qabstractitemdelegate.h> -
46#include <qapplication.h> -
47#include <qpainter.h> -
48#include <qbitmap.h> -
49#include <qdrag.h> -
50#include <qvector.h> -
51#include <qstyle.h> -
52#include <qevent.h> -
53#include <qscrollbar.h> -
54#include <qrubberband.h> -
55#include <private/qlistview_p.h> -
56#include <qdebug.h> -
57#ifndef QT_NO_ACCESSIBILITY -
58#include <qaccessible.h> -
59#endif -
60 -
61QT_BEGIN_NAMESPACE -
62 -
63/*! -
64 \class QListView -
65 -
66 \brief The QListView class provides a list or icon view onto a model. -
67 -
68 \ingroup model-view -
69 \ingroup advanced -
70 \inmodule QtWidgets -
71 -
72 A QListView presents items stored in a model, either as a simple -
73 non-hierarchical list, or as a collection of icons. This class is used -
74 to provide lists and icon views that were previously provided by the -
75 \c QListBox and \c QIconView classes, but using the more flexible -
76 approach provided by Qt's model/view architecture. -
77 -
78 The QListView class is one of the \l{Model/View Classes} -
79 and is part of Qt's \l{Model/View Programming}{model/view framework}. -
80 -
81 This view does not display horizontal or vertical headers; to display -
82 a list of items with a horizontal header, use QTreeView instead. -
83 -
84 QListView implements the interfaces defined by the -
85 QAbstractItemView class to allow it to display data provided by -
86 models derived from the QAbstractItemModel class. -
87 -
88 Items in a list view can be displayed using one of two view modes: -
89 In \l ListMode, the items are displayed in the form of a simple list; -
90 in \l IconMode, the list view takes the form of an \e{icon view} in -
91 which the items are displayed with icons like files in a file manager. -
92 By default, the list view is in \l ListMode. To change the view mode, -
93 use the setViewMode() function, and to determine the current view mode, -
94 use viewMode(). -
95 -
96 Items in these views are laid out in the direction specified by the -
97 flow() of the list view. The items may be fixed in place, or allowed -
98 to move, depending on the view's movement() state. -
99 -
100 If the items in the model cannot be completely laid out in the -
101 direction of flow, they can be wrapped at the boundary of the view -
102 widget; this depends on isWrapping(). This property is useful when the -
103 items are being represented by an icon view. -
104 -
105 The resizeMode() and layoutMode() govern how and when the items are -
106 laid out. Items are spaced according to their spacing(), and can exist -
107 within a notional grid of size specified by gridSize(). The items can -
108 be rendered as large or small icons depending on their iconSize(). -
109 -
110 \table 100% -
111 \row \li \inlineimage windowsvista-listview.png Screenshot of a Windows Vista style list view -
112 \li \inlineimage macintosh-listview.png Screenshot of a Macintosh style table view -
113 \li \inlineimage fusion-listview.png Screenshot of a Fusion style table view -
114 \row \li A \l{Windows Vista Style Widget Gallery}{Windows Vista style} list view. -
115 \li A \l{Macintosh Style Widget Gallery}{Macintosh style} list view. -
116 \li A \l{Fusion Style Widget Gallery}{Fusion style} list view. -
117 \endtable -
118 -
119 \section1 Improving Performance -
120 -
121 It is possible to give the view hints about the data it is handling in order -
122 to improve its performance when displaying large numbers of items. One approach -
123 that can be taken for views that are intended to display items with equal sizes -
124 is to set the \l uniformItemSizes property to true. -
125 -
126 \sa {View Classes}, {Item Views Puzzle Example}, QTreeView, QTableView, QListWidget -
127*/ -
128 -
129/*! -
130 \enum QListView::ViewMode -
131 -
132 \value ListMode The items are laid out using TopToBottom flow, with Small size and Static movement -
133 \value IconMode The items are laid out using LeftToRight flow, with Large size and Free movement -
134*/ -
135 -
136/*! -
137 \enum QListView::Movement -
138 -
139 \value Static The items cannot be moved by the user. -
140 \value Free The items can be moved freely by the user. -
141 \value Snap The items snap to the specified grid when moved; see -
142 setGridSize(). -
143*/ -
144 -
145/*! -
146 \enum QListView::Flow -
147 -
148 \value LeftToRight The items are laid out in the view from the left -
149 to the right. -
150 \value TopToBottom The items are laid out in the view from the top -
151 to the bottom. -
152*/ -
153 -
154/*! -
155 \enum QListView::ResizeMode -
156 -
157 \value Fixed The items will only be laid out the first time the view is shown. -
158 \value Adjust The items will be laid out every time the view is resized. -
159*/ -
160 -
161/*! -
162 \enum QListView::LayoutMode -
163 -
164 \value SinglePass The items are laid out all at once. -
165 \value Batched The items are laid out in batches of \l batchSize items. -
166 \sa batchSize -
167*/ -
168 -
169/*! -
170 \since 4.2 -
171 \fn void QListView::indexesMoved(const QModelIndexList &indexes) -
172 -
173 This signal is emitted when the specified \a indexes are moved in the view. -
174*/ -
175 -
176/*! -
177 Creates a new QListView with the given \a parent to view a model. -
178 Use setModel() to set the model. -
179*/ -
180QListView::QListView(QWidget *parent) -
181 : QAbstractItemView(*new QListViewPrivate, parent) -
182{ -
183 setViewMode(ListMode);
executed (the execution status of this line is deduced): setViewMode(ListMode);
-
184 setSelectionMode(SingleSelection);
executed (the execution status of this line is deduced): setSelectionMode(SingleSelection);
-
185 setAttribute(Qt::WA_MacShowFocusRect);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_MacShowFocusRect);
-
186 Q_D(QListView); // We rely on a qobject_cast for PM_DefaultFrameWidth to change
executed (the execution status of this line is deduced): QListViewPrivate * const d = d_func();
-
187 d->updateStyledFrameWidths(); // hence we have to force an update now that the object has been constructed
executed (the execution status of this line is deduced): d->updateStyledFrameWidths();
-
188}
executed: }
Execution Count:900
900
189 -
190/*! -
191 \internal -
192*/ -
193QListView::QListView(QListViewPrivate &dd, QWidget *parent) -
194 : QAbstractItemView(dd, parent) -
195{ -
196 setViewMode(ListMode);
executed (the execution status of this line is deduced): setViewMode(ListMode);
-
197 setSelectionMode(SingleSelection);
executed (the execution status of this line is deduced): setSelectionMode(SingleSelection);
-
198 setAttribute(Qt::WA_MacShowFocusRect);
executed (the execution status of this line is deduced): setAttribute(Qt::WA_MacShowFocusRect);
-
199 Q_D(QListView); // We rely on a qobject_cast for PM_DefaultFrameWidth to change
executed (the execution status of this line is deduced): QListViewPrivate * const d = d_func();
-
200 d->updateStyledFrameWidths(); // hence we have to force an update now that the object has been constructed
executed (the execution status of this line is deduced): d->updateStyledFrameWidths();
-
201}
executed: }
Execution Count:108
108
202 -
203/*! -
204 Destroys the view. -
205*/ -
206QListView::~QListView() -
207{ -
208} -
209 -
210/*! -
211 \property QListView::movement -
212 \brief whether the items can be moved freely, are snapped to a -
213 grid, or cannot be moved at all. -
214 -
215 This property determines how the user can move the items in the -
216 view. \l Static means that the items can't be moved the user. \l -
217 Free means that the user can drag and drop the items to any -
218 position in the view. \l Snap means that the user can drag and -
219 drop the items, but only to the positions in a notional grid -
220 signified by the gridSize property. -
221 -
222 Setting this property when the view is visible will cause the -
223 items to be laid out again. -
224 -
225 By default, this property is set to \l Static. -
226 -
227 \sa gridSize, resizeMode, viewMode -
228*/ -
229void QListView::setMovement(Movement movement) -
230{ -
231 Q_D(QListView);
executed (the execution status of this line is deduced): QListViewPrivate * const d = d_func();
-
232 d->modeProperties |= uint(QListViewPrivate::Movement);
executed (the execution status of this line is deduced): d->modeProperties |= uint(QListViewPrivate::Movement);
-
233 d->movement = movement;
executed (the execution status of this line is deduced): d->movement = movement;
-
234 -
235#ifndef QT_NO_DRAGANDDROP -
236 bool movable = (movement != Static);
executed (the execution status of this line is deduced): bool movable = (movement != Static);
-
237 setDragEnabled(movable);
executed (the execution status of this line is deduced): setDragEnabled(movable);
-
238 d->viewport->setAcceptDrops(movable);
executed (the execution status of this line is deduced): d->viewport->setAcceptDrops(movable);
-
239#endif -
240 d->doDelayedItemsLayout();
executed (the execution status of this line is deduced): d->doDelayedItemsLayout();
-
241}
executed: }
Execution Count:5
5
242 -
243QListView::Movement QListView::movement() const -
244{ -
245 Q_D(const QListView);
executed (the execution status of this line is deduced): const QListViewPrivate * const d = d_func();
-
246 return d->movement;
executed: return d->movement;
Execution Count:3
3
247} -
248 -
249/*! -
250 \property QListView::flow -
251 \brief which direction the items layout should flow. -
252 -
253 If this property is \l LeftToRight, the items will be laid out left -
254 to right. If the \l isWrapping property is true, the layout will wrap -
255 when it reaches the right side of the visible area. If this -
256 property is \l TopToBottom, the items will be laid out from the top -
257 of the visible area, wrapping when it reaches the bottom. -
258 -
259 Setting this property when the view is visible will cause the -
260 items to be laid out again. -
261 -
262 By default, this property is set to \l TopToBottom. -
263 -
264 \sa viewMode -
265*/ -
266void QListView::setFlow(Flow flow) -
267{ -
268 Q_D(QListView);
executed (the execution status of this line is deduced): QListViewPrivate * const d = d_func();
-
269 d->modeProperties |= uint(QListViewPrivate::Flow);
executed (the execution status of this line is deduced): d->modeProperties |= uint(QListViewPrivate::Flow);
-
270 d->flow = flow;
executed (the execution status of this line is deduced): d->flow = flow;
-
271 d->doDelayedItemsLayout();
executed (the execution status of this line is deduced): d->doDelayedItemsLayout();
-
272}
executed: }
Execution Count:44
44
273 -
274QListView::Flow QListView::flow() const -
275{ -
276 Q_D(const QListView);
executed (the execution status of this line is deduced): const QListViewPrivate * const d = d_func();
-
277 return d->flow;
executed: return d->flow;
Execution Count:9114
9114
278} -
279 -
280/*! -
281 \property QListView::isWrapping -
282 \brief whether the items layout should wrap. -
283 -
284 This property holds whether the layout should wrap when there is -
285 no more space in the visible area. The point at which the layout wraps -
286 depends on the \l flow property. -
287 -
288 Setting this property when the view is visible will cause the -
289 items to be laid out again. -
290 -
291 By default, this property is false. -
292 -
293 \sa viewMode -
294*/ -
295void QListView::setWrapping(bool enable) -
296{ -
297 Q_D(QListView);
executed (the execution status of this line is deduced): QListViewPrivate * const d = d_func();
-
298 d->modeProperties |= uint(QListViewPrivate::Wrap);
executed (the execution status of this line is deduced): d->modeProperties |= uint(QListViewPrivate::Wrap);
-
299 d->setWrapping(enable);
executed (the execution status of this line is deduced): d->setWrapping(enable);
-
300 d->doDelayedItemsLayout();
executed (the execution status of this line is deduced): d->doDelayedItemsLayout();
-
301}
executed: }
Execution Count:206
206
302 -
303bool QListView::isWrapping() const -
304{ -
305 Q_D(const QListView);
never executed (the execution status of this line is deduced): const QListViewPrivate * const d = d_func();
-
306 return d->isWrapping();
never executed: return d->isWrapping();
0
307} -
308 -
309/*! -
310 \property QListView::resizeMode -
311 \brief whether the items are laid out again when the view is resized. -
312 -
313 If this property is \l Adjust, the items will be laid out again -
314 when the view is resized. If the value is \l Fixed, the items will -
315 not be laid out when the view is resized. -
316 -
317 By default, this property is set to \l Fixed. -
318 -
319 \sa movement, gridSize, viewMode -
320*/ -
321void QListView::setResizeMode(ResizeMode mode) -
322{ -
323 Q_D(QListView);
executed (the execution status of this line is deduced): QListViewPrivate * const d = d_func();
-
324 d->modeProperties |= uint(QListViewPrivate::ResizeMode);
executed (the execution status of this line is deduced): d->modeProperties |= uint(QListViewPrivate::ResizeMode);
-
325 d->resizeMode = mode;
executed (the execution status of this line is deduced): d->resizeMode = mode;
-
326}
executed: }
Execution Count:207
207
327 -
328QListView::ResizeMode QListView::resizeMode() const -
329{ -
330 Q_D(const QListView);
executed (the execution status of this line is deduced): const QListViewPrivate * const d = d_func();
-
331 return d->resizeMode;
executed: return d->resizeMode;
Execution Count:3
3
332} -
333 -
334/*! -
335 \property QListView::layoutMode -
336 \brief determines whether the layout of items should happen immediately or be delayed. -
337 -
338 This property holds the layout mode for the items. When the mode -
339 is \l SinglePass (the default), the items are laid out all in one go. -
340 When the mode is \l Batched, the items are laid out in batches of \l batchSize -
341 items, while processing events. This makes it possible to -
342 instantly view and interact with the visible items while the rest -
343 are being laid out. -
344 -
345 \sa viewMode -
346*/ -
347void QListView::setLayoutMode(LayoutMode mode) -
348{ -
349 Q_D(QListView);
executed (the execution status of this line is deduced): QListViewPrivate * const d = d_func();
-
350 d->layoutMode = mode;
executed (the execution status of this line is deduced): d->layoutMode = mode;
-
351}
executed: }
Execution Count:7
7
352 -
353QListView::LayoutMode QListView::layoutMode() const -
354{ -
355 Q_D(const QListView);
executed (the execution status of this line is deduced): const QListViewPrivate * const d = d_func();
-
356 return d->layoutMode;
executed: return d->layoutMode;
Execution Count:1128
1128
357} -
358 -
359/*! -
360 \property QListView::spacing -
361 \brief the space around the items in the layout -
362 -
363 This property is the size of the empty space that is padded around -
364 an item in the layout. -
365 -
366 Setting this property when the view is visible will cause the -
367 items to be laid out again. -
368 -
369 By default, this property contains a value of 0. -
370 -
371 \sa viewMode -
372*/ -
373void QListView::setSpacing(int space) -
374{ -
375 Q_D(QListView);
executed (the execution status of this line is deduced): QListViewPrivate * const d = d_func();
-
376 d->modeProperties |= uint(QListViewPrivate::Spacing);
executed (the execution status of this line is deduced): d->modeProperties |= uint(QListViewPrivate::Spacing);
-
377 d->setSpacing(space);
executed (the execution status of this line is deduced): d->setSpacing(space);
-
378 d->doDelayedItemsLayout();
executed (the execution status of this line is deduced): d->doDelayedItemsLayout();
-
379}
executed: }
Execution Count:26
26
380 -
381int QListView::spacing() const -
382{ -
383 Q_D(const QListView);
executed (the execution status of this line is deduced): const QListViewPrivate * const d = d_func();
-
384 return d->spacing();
executed: return d->spacing();
Execution Count:7
7
385} -
386 -
387/*! -
388 \property QListView::batchSize -
389 \brief the number of items laid out in each batch if \l layoutMode is -
390 set to \l Batched -
391 -
392 The default value is 100. -
393 -
394 \since 4.2 -
395*/ -
396 -
397void QListView::setBatchSize(int batchSize) -
398{ -
399 Q_D(QListView);
executed (the execution status of this line is deduced): QListViewPrivate * const d = d_func();
-
400 if (batchSize <= 0) {
partially evaluated: batchSize <= 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
401 qWarning("Invalid batchSize (%d)", batchSize);
never executed (the execution status of this line is deduced): QMessageLogger("itemviews/qlistview.cpp", 401, __PRETTY_FUNCTION__).warning("Invalid batchSize (%d)", batchSize);
-
402 return;
never executed: return;
0
403 } -
404 d->batchSize = batchSize;
executed (the execution status of this line is deduced): d->batchSize = batchSize;
-
405}
executed: }
Execution Count:2
2
406 -
407int QListView::batchSize() const -
408{ -
409 Q_D(const QListView);
executed (the execution status of this line is deduced): const QListViewPrivate * const d = d_func();
-
410 return d->batchSize;
executed: return d->batchSize;
Execution Count:204
204
411} -
412 -
413/*! -
414 \property QListView::gridSize -
415 \brief the size of the layout grid -
416 -
417 This property is the size of the grid in which the items are laid -
418 out. The default is an empty size which means that there is no -
419 grid and the layout is not done in a grid. Setting this property -
420 to a non-empty size switches on the grid layout. (When a grid -
421 layout is in force the \l spacing property is ignored.) -
422 -
423 Setting this property when the view is visible will cause the -
424 items to be laid out again. -
425 -
426 \sa viewMode -
427*/ -
428void QListView::setGridSize(const QSize &size) -
429{ -
430 Q_D(QListView);
executed (the execution status of this line is deduced): QListViewPrivate * const d = d_func();
-
431 d->modeProperties |= uint(QListViewPrivate::GridSize);
executed (the execution status of this line is deduced): d->modeProperties |= uint(QListViewPrivate::GridSize);
-
432 d->setGridSize(size);
executed (the execution status of this line is deduced): d->setGridSize(size);
-
433 d->doDelayedItemsLayout();
executed (the execution status of this line is deduced): d->doDelayedItemsLayout();
-
434}
executed: }
Execution Count:10
10
435 -
436QSize QListView::gridSize() const -
437{ -
438 Q_D(const QListView);
executed (the execution status of this line is deduced): const QListViewPrivate * const d = d_func();
-
439 return d->gridSize();
executed: return d->gridSize();
Execution Count:17
17
440} -
441 -
442/*! -
443 \property QListView::viewMode -
444 \brief the view mode of the QListView. -
445 -
446 This property will change the other unset properties to conform -
447 with the set view mode. QListView-specific properties that have already been set -
448 will not be changed, unless clearPropertyFlags() has been called. -
449 -
450 Setting the view mode will enable or disable drag and drop based on the -
451 selected movement. For ListMode, the default movement is \l Static -
452 (drag and drop disabled); for IconMode, the default movement is -
453 \l Free (drag and drop enabled). -
454 -
455 \sa isWrapping, spacing, gridSize, flow, movement, resizeMode -
456*/ -
457void QListView::setViewMode(ViewMode mode) -
458{ -
459 Q_D(QListView);
executed (the execution status of this line is deduced): QListViewPrivate * const d = d_func();
-
460 if (d->commonListView && d->viewMode == mode)
evaluated: d->commonListView
TRUEFALSE
yes
Evaluation Count:36
yes
Evaluation Count:1008
evaluated: d->viewMode == mode
TRUEFALSE
yes
Evaluation Count:20
yes
Evaluation Count:16
16-1008
461 return;
executed: return;
Execution Count:20
20
462 d->viewMode = mode;
executed (the execution status of this line is deduced): d->viewMode = mode;
-
463 -
464 delete d->commonListView;
executed (the execution status of this line is deduced): delete d->commonListView;
-
465 if (mode == ListMode) {
evaluated: mode == ListMode
TRUEFALSE
yes
Evaluation Count:1008
yes
Evaluation Count:16
16-1008
466 d->commonListView = new QListModeViewBase(this, d);
executed (the execution status of this line is deduced): d->commonListView = new QListModeViewBase(this, d);
-
467 if (!(d->modeProperties & QListViewPrivate::Wrap))
partially evaluated: !(d->modeProperties & QListViewPrivate::Wrap)
TRUEFALSE
yes
Evaluation Count:1008
no
Evaluation Count:0
0-1008
468 d->setWrapping(false);
executed: d->setWrapping(false);
Execution Count:1008
1008
469 if (!(d->modeProperties & QListViewPrivate::Spacing))
partially evaluated: !(d->modeProperties & QListViewPrivate::Spacing)
TRUEFALSE
yes
Evaluation Count:1008
no
Evaluation Count:0
0-1008
470 d->setSpacing(0);
executed: d->setSpacing(0);
Execution Count:1008
1008
471 if (!(d->modeProperties & QListViewPrivate::GridSize))
partially evaluated: !(d->modeProperties & QListViewPrivate::GridSize)
TRUEFALSE
yes
Evaluation Count:1008
no
Evaluation Count:0
0-1008
472 d->setGridSize(QSize());
executed: d->setGridSize(QSize());
Execution Count:1008
1008
473 if (!(d->modeProperties & QListViewPrivate::Flow))
partially evaluated: !(d->modeProperties & QListViewPrivate::Flow)
TRUEFALSE
yes
Evaluation Count:1008
no
Evaluation Count:0
0-1008
474 d->flow = TopToBottom;
executed: d->flow = TopToBottom;
Execution Count:1008
1008
475 if (!(d->modeProperties & QListViewPrivate::Movement))
partially evaluated: !(d->modeProperties & QListViewPrivate::Movement)
TRUEFALSE
yes
Evaluation Count:1008
no
Evaluation Count:0
0-1008
476 d->movement = Static;
executed: d->movement = Static;
Execution Count:1008
1008
477 if (!(d->modeProperties & QListViewPrivate::ResizeMode))
partially evaluated: !(d->modeProperties & QListViewPrivate::ResizeMode)
TRUEFALSE
yes
Evaluation Count:1008
no
Evaluation Count:0
0-1008
478 d->resizeMode = Fixed;
executed: d->resizeMode = Fixed;
Execution Count:1008
1008
479 if (!(d->modeProperties & QListViewPrivate::SelectionRectVisible))
partially evaluated: !(d->modeProperties & QListViewPrivate::SelectionRectVisible)
TRUEFALSE
yes
Evaluation Count:1008
no
Evaluation Count:0
0-1008
480 d->showElasticBand = false;
executed: d->showElasticBand = false;
Execution Count:1008
1008
481 } else {
executed: }
Execution Count:1008
1008
482 d->commonListView = new QIconModeViewBase(this, d);
executed (the execution status of this line is deduced): d->commonListView = new QIconModeViewBase(this, d);
-
483 if (!(d->modeProperties & QListViewPrivate::Wrap))
evaluated: !(d->modeProperties & QListViewPrivate::Wrap)
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:1
1-15
484 d->setWrapping(true);
executed: d->setWrapping(true);
Execution Count:15
15
485 if (!(d->modeProperties & QListViewPrivate::Spacing))
evaluated: !(d->modeProperties & QListViewPrivate::Spacing)
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:1
1-15
486 d->setSpacing(0);
executed: d->setSpacing(0);
Execution Count:15
15
487 if (!(d->modeProperties & QListViewPrivate::GridSize))
evaluated: !(d->modeProperties & QListViewPrivate::GridSize)
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:7
7-9
488 d->setGridSize(QSize());
executed: d->setGridSize(QSize());
Execution Count:9
9
489 if (!(d->modeProperties & QListViewPrivate::Flow))
evaluated: !(d->modeProperties & QListViewPrivate::Flow)
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:7
7-9
490 d->flow = LeftToRight;
executed: d->flow = LeftToRight;
Execution Count:9
9
491 if (!(d->modeProperties & QListViewPrivate::Movement))
evaluated: !(d->modeProperties & QListViewPrivate::Movement)
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:2
2-14
492 d->movement = Free;
executed: d->movement = Free;
Execution Count:14
14
493 if (!(d->modeProperties & QListViewPrivate::ResizeMode))
evaluated: !(d->modeProperties & QListViewPrivate::ResizeMode)
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:2
2-14
494 d->resizeMode = Fixed;
executed: d->resizeMode = Fixed;
Execution Count:14
14
495 if (!(d->modeProperties & QListViewPrivate::SelectionRectVisible))
partially evaluated: !(d->modeProperties & QListViewPrivate::SelectionRectVisible)
TRUEFALSE
yes
Evaluation Count:16
no
Evaluation Count:0
0-16
496 d->showElasticBand = true;
executed: d->showElasticBand = true;
Execution Count:16
16
497 }
executed: }
Execution Count:16
16
498 -
499#ifndef QT_NO_DRAGANDDROP -
500 bool movable = (d->movement != Static);
executed (the execution status of this line is deduced): bool movable = (d->movement != Static);
-
501 setDragEnabled(movable);
executed (the execution status of this line is deduced): setDragEnabled(movable);
-
502 setAcceptDrops(movable);
executed (the execution status of this line is deduced): setAcceptDrops(movable);
-
503#endif -
504 d->clear();
executed (the execution status of this line is deduced): d->clear();
-
505 d->doDelayedItemsLayout();
executed (the execution status of this line is deduced): d->doDelayedItemsLayout();
-
506}
executed: }
Execution Count:1024
1024
507 -
508QListView::ViewMode QListView::viewMode() const -
509{ -
510 Q_D(const QListView);
executed (the execution status of this line is deduced): const QListViewPrivate * const d = d_func();
-
511 return d->viewMode;
executed: return d->viewMode;
Execution Count:2
2
512} -
513 -
514/*! -
515 Clears the QListView-specific property flags. See \l{viewMode}. -
516 -
517 Properties inherited from QAbstractItemView are not covered by the -
518 property flags. Specifically, \l{QAbstractItemView::dragEnabled} -
519 {dragEnabled} and \l{QAbstractItemView::acceptDrops} -
520 {acceptsDrops} are computed by QListView when calling -
521 setMovement() or setViewMode(). -
522*/ -
523void QListView::clearPropertyFlags() -
524{ -
525 Q_D(QListView);
executed (the execution status of this line is deduced): QListViewPrivate * const d = d_func();
-
526 d->modeProperties = 0;
executed (the execution status of this line is deduced): d->modeProperties = 0;
-
527}
executed: }
Execution Count:1
1
528 -
529/*! -
530 Returns true if the \a row is hidden; otherwise returns false. -
531*/ -
532bool QListView::isRowHidden(int row) const -
533{ -
534 Q_D(const QListView);
executed (the execution status of this line is deduced): const QListViewPrivate * const d = d_func();
-
535 return d->isHidden(row);
executed: return d->isHidden(row);
Execution Count:15
15
536} -
537 -
538/*! -
539 If \a hide is true, the given \a row will be hidden; otherwise -
540 the \a row will be shown. -
541*/ -
542void QListView::setRowHidden(int row, bool hide) -
543{ -
544 Q_D(QListView);
executed (the execution status of this line is deduced): QListViewPrivate * const d = d_func();
-
545 const bool hidden = d->isHidden(row);
executed (the execution status of this line is deduced): const bool hidden = d->isHidden(row);
-
546 if (hide && !hidden)
evaluated: hide
TRUEFALSE
yes
Evaluation Count:736
yes
Evaluation Count:6
evaluated: !hidden
TRUEFALSE
yes
Evaluation Count:637
yes
Evaluation Count:99
6-736
547 d->commonListView->appendHiddenRow(row);
executed: d->commonListView->appendHiddenRow(row);
Execution Count:637
637
548 else if (!hide && hidden)
evaluated: !hide
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:99
evaluated: hidden
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:1
1-99
549 d->commonListView->removeHiddenRow(row);
executed: d->commonListView->removeHiddenRow(row);
Execution Count:5
5
550 d->doDelayedItemsLayout();
executed (the execution status of this line is deduced): d->doDelayedItemsLayout();
-
551 d->viewport->update();
executed (the execution status of this line is deduced): d->viewport->update();
-
552}
executed: }
Execution Count:742
742
553 -
554/*! -
555 \reimp -
556*/ -
557QRect QListView::visualRect(const QModelIndex &index) const -
558{ -
559 Q_D(const QListView);
executed (the execution status of this line is deduced): const QListViewPrivate * const d = d_func();
-
560 return d->mapToViewport(rectForIndex(index));
executed: return d->mapToViewport(rectForIndex(index));
Execution Count:24131
24131
561} -
562 -
563/*! -
564 \reimp -
565*/ -
566void QListView::scrollTo(const QModelIndex &index, ScrollHint hint) -
567{ -
568 Q_D(QListView);
executed (the execution status of this line is deduced): QListViewPrivate * const d = d_func();
-
569 -
570 if (index.parent() != d->root || index.column() != d->column)
partially evaluated: index.parent() != d->root
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6072
evaluated: index.column() != d->column
TRUEFALSE
yes
Evaluation Count:5230
yes
Evaluation Count:842
0-6072
571 return;
executed: return;
Execution Count:5230
5230
572 -
573 const QRect rect = visualRect(index);
executed (the execution status of this line is deduced): const QRect rect = visualRect(index);
-
574 if (hint == EnsureVisible && d->viewport->rect().contains(rect)) {
evaluated: hint == EnsureVisible
TRUEFALSE
yes
Evaluation Count:829
yes
Evaluation Count:13
evaluated: d->viewport->rect().contains(rect)
TRUEFALSE
yes
Evaluation Count:418
yes
Evaluation Count:411
13-829
575 d->viewport->update(rect);
executed (the execution status of this line is deduced): d->viewport->update(rect);
-
576 return;
executed: return;
Execution Count:418
418
577 } -
578 -
579 if (d->flow == QListView::TopToBottom || d->isWrapping()) // vertical
evaluated: d->flow == QListView::TopToBottom
TRUEFALSE
yes
Evaluation Count:285
yes
Evaluation Count:139
evaluated: d->isWrapping()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:137
2-285
580 verticalScrollBar()->setValue(d->verticalScrollToValue(index, rect, hint));
executed: verticalScrollBar()->setValue(d->verticalScrollToValue(index, rect, hint));
Execution Count:287
287
581 -
582 if (d->flow == QListView::LeftToRight || d->isWrapping()) // horizontal
evaluated: d->flow == QListView::LeftToRight
TRUEFALSE
yes
Evaluation Count:139
yes
Evaluation Count:285
evaluated: d->isWrapping()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:282
3-285
583 horizontalScrollBar()->setValue(d->horizontalScrollToValue(index, rect, hint));
executed: horizontalScrollBar()->setValue(d->horizontalScrollToValue(index, rect, hint));
Execution Count:142
142
584}
executed: }
Execution Count:424
424
585 -
586int QListViewPrivate::horizontalScrollToValue(const QModelIndex &index, const QRect &rect, -
587 QListView::ScrollHint hint) const -
588{ -
589 Q_Q(const QListView);
executed (the execution status of this line is deduced): const QListView * const q = q_func();
-
590 const QRect area = viewport->rect();
executed (the execution status of this line is deduced): const QRect area = viewport->rect();
-
591 const bool leftOf = q->isRightToLeft()
partially evaluated: q->isRightToLeft()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:142
0-142
592 ? (rect.left() < area.left()) && (rect.right() < area.right())
executed (the execution status of this line is deduced): ? (rect.left() < area.left()) && (rect.right() < area.right())
-
593 : rect.left() < area.left();
executed (the execution status of this line is deduced): : rect.left() < area.left();
-
594 const bool rightOf = q->isRightToLeft()
partially evaluated: q->isRightToLeft()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:142
0-142
595 ? rect.right() > area.right()
executed (the execution status of this line is deduced): ? rect.right() > area.right()
-
596 : (rect.right() > area.right()) && (rect.left() > area.left());
executed (the execution status of this line is deduced): : (rect.right() > area.right()) && (rect.left() > area.left());
-
597 return commonListView->horizontalScrollToValue(q->visualIndex(index), hint, leftOf, rightOf, area, rect);
executed: return commonListView->horizontalScrollToValue(q->visualIndex(index), hint, leftOf, rightOf, area, rect);
Execution Count:142
142
598} -
599 -
600int QListViewPrivate::verticalScrollToValue(const QModelIndex &index, const QRect &rect, -
601 QListView::ScrollHint hint) const -
602{ -
603 Q_Q(const QListView);
executed (the execution status of this line is deduced): const QListView * const q = q_func();
-
604 const QRect area = viewport->rect();
executed (the execution status of this line is deduced): const QRect area = viewport->rect();
-
605 const bool above = (hint == QListView::EnsureVisible && rect.top() < area.top());
evaluated: hint == QListView::EnsureVisible
TRUEFALSE
yes
Evaluation Count:276
yes
Evaluation Count:11
evaluated: rect.top() < area.top()
TRUEFALSE
yes
Evaluation Count:92
yes
Evaluation Count:184
11-276
606 const bool below = (hint == QListView::EnsureVisible && rect.bottom() > area.bottom());
evaluated: hint == QListView::EnsureVisible
TRUEFALSE
yes
Evaluation Count:276
yes
Evaluation Count:11
evaluated: rect.bottom() > area.bottom()
TRUEFALSE
yes
Evaluation Count:182
yes
Evaluation Count:94
11-276
607 return commonListView->verticalScrollToValue(q->visualIndex(index), hint, above, below, area, rect);
executed: return commonListView->verticalScrollToValue(q->visualIndex(index), hint, above, below, area, rect);
Execution Count:287
287
608} -
609 -
610void QListViewPrivate::selectAll(QItemSelectionModel::SelectionFlags command) -
611{ -
612 if (!selectionModel)
evaluated: !selectionModel
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:6
5-6
613 return;
executed: return;
Execution Count:5
5
614 -
615 QItemSelection selection;
executed (the execution status of this line is deduced): QItemSelection selection;
-
616 QModelIndex topLeft;
executed (the execution status of this line is deduced): QModelIndex topLeft;
-
617 int row = 0;
executed (the execution status of this line is deduced): int row = 0;
-
618 const int colCount = model->columnCount(root);
executed (the execution status of this line is deduced): const int colCount = model->columnCount(root);
-
619 for(; row < model->rowCount(root); ++row) {
evaluated: row < model->rowCount(root)
TRUEFALSE
yes
Evaluation Count:31
yes
Evaluation Count:6
6-31
620 if (isHidden(row)) {
evaluated: isHidden(row)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:30
1-30
621 //it might be the end of a selection range -
622 if (topLeft.isValid()) {
partially evaluated: topLeft.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
623 QModelIndex bottomRight = model->index(row - 1, colCount - 1, root);
never executed (the execution status of this line is deduced): QModelIndex bottomRight = model->index(row - 1, colCount - 1, root);
-
624 selection.append(QItemSelectionRange(topLeft, bottomRight));
never executed (the execution status of this line is deduced): selection.append(QItemSelectionRange(topLeft, bottomRight));
-
625 topLeft = QModelIndex();
never executed (the execution status of this line is deduced): topLeft = QModelIndex();
-
626 }
never executed: }
0
627 continue;
executed: continue;
Execution Count:1
1
628 } -
629 -
630 if (!topLeft.isValid()) //start of a new selection range
evaluated: !topLeft.isValid()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:25
5-25
631 topLeft = model->index(row, 0, root);
executed: topLeft = model->index(row, 0, root);
Execution Count:5
5
632 }
executed: }
Execution Count:30
30
633 -
634 if (topLeft.isValid()) {
evaluated: topLeft.isValid()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:1
1-5
635 //last selected range -
636 QModelIndex bottomRight = model->index(row - 1, colCount - 1, root);
executed (the execution status of this line is deduced): QModelIndex bottomRight = model->index(row - 1, colCount - 1, root);
-
637 selection.append(QItemSelectionRange(topLeft, bottomRight));
executed (the execution status of this line is deduced): selection.append(QItemSelectionRange(topLeft, bottomRight));
-
638 }
executed: }
Execution Count:5
5
639 -
640 if (!selection.isEmpty())
evaluated: !selection.isEmpty()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:1
1-5
641 selectionModel->select(selection, command);
executed: selectionModel->select(selection, command);
Execution Count:5
5
642}
executed: }
Execution Count:6
6
643 -
644/*! -
645 \reimp -
646 -
647 We have a QListView way of knowing what elements are on the viewport -
648 through the intersectingSet function -
649*/ -
650QItemViewPaintPairs QListViewPrivate::draggablePaintPairs(const QModelIndexList &indexes, QRect *r) const -
651{ -
652 Q_ASSERT(r);
executed (the execution status of this line is deduced): qt_noop();
-
653 Q_Q(const QListView);
executed (the execution status of this line is deduced): const QListView * const q = q_func();
-
654 QRect &rect = *r;
executed (the execution status of this line is deduced): QRect &rect = *r;
-
655 const QRect viewportRect = viewport->rect();
executed (the execution status of this line is deduced): const QRect viewportRect = viewport->rect();
-
656 QItemViewPaintPairs ret;
executed (the execution status of this line is deduced): QItemViewPaintPairs ret;
-
657 const QSet<QModelIndex> visibleIndexes = intersectingSet(viewportRect.translated(q->horizontalOffset(), q->verticalOffset())).toList().toSet();
executed (the execution status of this line is deduced): const QSet<QModelIndex> visibleIndexes = intersectingSet(viewportRect.translated(q->horizontalOffset(), q->verticalOffset())).toList().toSet();
-
658 for (int i = 0; i < indexes.count(); ++i) {
evaluated: i < indexes.count()
TRUEFALSE
yes
Evaluation Count:30
yes
Evaluation Count:30
30
659 const QModelIndex &index = indexes.at(i);
executed (the execution status of this line is deduced): const QModelIndex &index = indexes.at(i);
-
660 if (visibleIndexes.contains(index)) {
partially evaluated: visibleIndexes.contains(index)
TRUEFALSE
yes
Evaluation Count:30
no
Evaluation Count:0
0-30
661 const QRect current = q->visualRect(index);
executed (the execution status of this line is deduced): const QRect current = q->visualRect(index);
-
662 ret += qMakePair(current, index);
executed (the execution status of this line is deduced): ret += qMakePair(current, index);
-
663 rect |= current;
executed (the execution status of this line is deduced): rect |= current;
-
664 }
executed: }
Execution Count:30
30
665 }
executed: }
Execution Count:30
30
666 rect &= viewportRect;
executed (the execution status of this line is deduced): rect &= viewportRect;
-
667 return ret;
executed: return ret;
Execution Count:30
30
668} -
669 -
670/*! -
671 \internal -
672*/ -
673void QListView::reset() -
674{ -
675 Q_D(QListView);
executed (the execution status of this line is deduced): QListViewPrivate * const d = d_func();
-
676 d->clear();
executed (the execution status of this line is deduced): d->clear();
-
677 d->hiddenRows.clear();
executed (the execution status of this line is deduced): d->hiddenRows.clear();
-
678 QAbstractItemView::reset();
executed (the execution status of this line is deduced): QAbstractItemView::reset();
-
679}
executed: }
Execution Count:1749
1749
680 -
681/*! -
682 \internal -
683*/ -
684void QListView::setRootIndex(const QModelIndex &index) -
685{ -
686 Q_D(QListView);
executed (the execution status of this line is deduced): QListViewPrivate * const d = d_func();
-
687 d->column = qBound(0, d->column, d->model->columnCount(index) - 1);
executed (the execution status of this line is deduced): d->column = qBound(0, d->column, d->model->columnCount(index) - 1);
-
688 QAbstractItemView::setRootIndex(index);
executed (the execution status of this line is deduced): QAbstractItemView::setRootIndex(index);
-
689 // sometimes we get an update before reset() is called -
690 d->clear();
executed (the execution status of this line is deduced): d->clear();
-
691 d->hiddenRows.clear();
executed (the execution status of this line is deduced): d->hiddenRows.clear();
-
692}
executed: }
Execution Count:1995
1995
693 -
694/*! -
695 \internal -
696 -
697 Scroll the view contents by \a dx and \a dy. -
698*/ -
699 -
700void QListView::scrollContentsBy(int dx, int dy) -
701{ -
702 Q_D(QListView);
executed (the execution status of this line is deduced): QListViewPrivate * const d = d_func();
-
703 d->delayedAutoScroll.stop(); // auto scroll was canceled by the user scrolling
executed (the execution status of this line is deduced): d->delayedAutoScroll.stop();
-
704 d->commonListView->scrollContentsBy(dx, dy, d->state == QListView::DragSelectingState);
executed (the execution status of this line is deduced): d->commonListView->scrollContentsBy(dx, dy, d->state == QListView::DragSelectingState);
-
705}
executed: }
Execution Count:445
445
706 -
707/*! -
708 \internal -
709 -
710 Resize the internal contents to \a width and \a height and set the -
711 scroll bar ranges accordingly. -
712*/ -
713void QListView::resizeContents(int width, int height) -
714{ -
715 Q_D(QListView);
executed (the execution status of this line is deduced): QListViewPrivate * const d = d_func();
-
716 d->setContentsSize(width, height);
executed (the execution status of this line is deduced): d->setContentsSize(width, height);
-
717}
executed: }
Execution Count:1
1
718 -
719/*! -
720 \internal -
721*/ -
722QSize QListView::contentsSize() const -
723{ -
724 Q_D(const QListView);
executed (the execution status of this line is deduced): const QListViewPrivate * const d = d_func();
-
725 return d->contentsSize();
executed: return d->contentsSize();
Execution Count:67
67
726} -
727 -
728/*! -
729 \reimp -
730*/ -
731void QListView::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles) -
732{ -
733 d_func()->commonListView->dataChanged(topLeft, bottomRight);
executed (the execution status of this line is deduced): d_func()->commonListView->dataChanged(topLeft, bottomRight);
-
734 QAbstractItemView::dataChanged(topLeft, bottomRight, roles);
executed (the execution status of this line is deduced): QAbstractItemView::dataChanged(topLeft, bottomRight, roles);
-
735}
executed: }
Execution Count:3979
3979
736 -
737/*! -
738 \reimp -
739*/ -
740void QListView::rowsInserted(const QModelIndex &parent, int start, int end) -
741{ -
742 Q_D(QListView);
executed (the execution status of this line is deduced): QListViewPrivate * const d = d_func();
-
743 // ### be smarter about inserted items -
744 d->clear();
executed (the execution status of this line is deduced): d->clear();
-
745 d->doDelayedItemsLayout();
executed (the execution status of this line is deduced): d->doDelayedItemsLayout();
-
746 QAbstractItemView::rowsInserted(parent, start, end);
executed (the execution status of this line is deduced): QAbstractItemView::rowsInserted(parent, start, end);
-
747}
executed: }
Execution Count:16401
16401
748 -
749/*! -
750 \reimp -
751*/ -
752void QListView::rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end) -
753{ -
754 Q_D(QListView);
executed (the execution status of this line is deduced): QListViewPrivate * const d = d_func();
-
755 // if the parent is above d->root in the tree, nothing will happen -
756 QAbstractItemView::rowsAboutToBeRemoved(parent, start, end);
executed (the execution status of this line is deduced): QAbstractItemView::rowsAboutToBeRemoved(parent, start, end);
-
757 if (parent == d->root) {
partially evaluated: parent == d->root
TRUEFALSE
yes
Evaluation Count:176
no
Evaluation Count:0
0-176
758 QSet<QPersistentModelIndex>::iterator it = d->hiddenRows.begin();
executed (the execution status of this line is deduced): QSet<QPersistentModelIndex>::iterator it = d->hiddenRows.begin();
-
759 while (it != d->hiddenRows.end()) {
partially evaluated: it != d->hiddenRows.end()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:176
0-176
760 int hiddenRow = it->row();
never executed (the execution status of this line is deduced): int hiddenRow = it->row();
-
761 if (hiddenRow >= start && hiddenRow <= end) {
never evaluated: hiddenRow >= start
never evaluated: hiddenRow <= end
0
762 it = d->hiddenRows.erase(it);
never executed (the execution status of this line is deduced): it = d->hiddenRows.erase(it);
-
763 } else {
never executed: }
0
764 ++it;
never executed (the execution status of this line is deduced): ++it;
-
765 }
never executed: }
0
766 } -
767 }
executed: }
Execution Count:176
176
768 d->clear();
executed (the execution status of this line is deduced): d->clear();
-
769 d->doDelayedItemsLayout();
executed (the execution status of this line is deduced): d->doDelayedItemsLayout();
-
770}
executed: }
Execution Count:176
176
771 -
772/*! -
773 \reimp -
774*/ -
775void QListView::mouseMoveEvent(QMouseEvent *e) -
776{ -
777 if (!isVisible())
partially evaluated: !isVisible()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
778 return;
never executed: return;
0
779 Q_D(QListView);
executed (the execution status of this line is deduced): QListViewPrivate * const d = d_func();
-
780 QAbstractItemView::mouseMoveEvent(e);
executed (the execution status of this line is deduced): QAbstractItemView::mouseMoveEvent(e);
-
781 if (state() == DragSelectingState
partially evaluated: state() == DragSelectingState
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
782 && d->showElasticBand
partially evaluated: d->showElasticBand
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
783 && d->selectionMode != SingleSelection
partially evaluated: d->selectionMode != SingleSelection
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
784 && d->selectionMode != NoSelection) {
partially evaluated: d->selectionMode != NoSelection
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
785 QRect rect(d->pressedPosition, e->pos() + QPoint(horizontalOffset(), verticalOffset()));
executed (the execution status of this line is deduced): QRect rect(d->pressedPosition, e->pos() + QPoint(horizontalOffset(), verticalOffset()));
-
786 rect = rect.normalized();
executed (the execution status of this line is deduced): rect = rect.normalized();
-
787 d->viewport->update(d->mapToViewport(rect.united(d->elasticBand)));
executed (the execution status of this line is deduced): d->viewport->update(d->mapToViewport(rect.united(d->elasticBand)));
-
788 d->elasticBand = rect;
executed (the execution status of this line is deduced): d->elasticBand = rect;
-
789 }
executed: }
Execution Count:3
3
790}
executed: }
Execution Count:3
3
791 -
792/*! -
793 \reimp -
794*/ -
795void QListView::mouseReleaseEvent(QMouseEvent *e) -
796{ -
797 Q_D(QListView);
executed (the execution status of this line is deduced): QListViewPrivate * const d = d_func();
-
798 QAbstractItemView::mouseReleaseEvent(e);
executed (the execution status of this line is deduced): QAbstractItemView::mouseReleaseEvent(e);
-
799 // #### move this implementation into a dynamic class -
800 if (d->showElasticBand && d->elasticBand.isValid()) {
evaluated: d->showElasticBand
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:184
evaluated: d->elasticBand.isValid()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:1
1-184
801 d->viewport->update(d->mapToViewport(d->elasticBand));
executed (the execution status of this line is deduced): d->viewport->update(d->mapToViewport(d->elasticBand));
-
802 d->elasticBand = QRect();
executed (the execution status of this line is deduced): d->elasticBand = QRect();
-
803 }
executed: }
Execution Count:3
3
804}
executed: }
Execution Count:188
188
805 -
806/*! -
807 \reimp -
808*/ -
809void QListView::timerEvent(QTimerEvent *e) -
810{ -
811 Q_D(QListView);
executed (the execution status of this line is deduced): QListViewPrivate * const d = d_func();
-
812 if (e->timerId() == d->batchLayoutTimer.timerId()) {
evaluated: e->timerId() == d->batchLayoutTimer.timerId()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:993
4-993
813 if (d->doItemsLayout(d->batchSize)) { // layout is done
partially evaluated: d->doItemsLayout(d->batchSize)
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
0-4
814 d->batchLayoutTimer.stop();
executed (the execution status of this line is deduced): d->batchLayoutTimer.stop();
-
815 updateGeometries();
executed (the execution status of this line is deduced): updateGeometries();
-
816 d->viewport->update();
executed (the execution status of this line is deduced): d->viewport->update();
-
817 }
executed: }
Execution Count:4
4
818 }
executed: }
Execution Count:4
4
819 QAbstractItemView::timerEvent(e);
executed (the execution status of this line is deduced): QAbstractItemView::timerEvent(e);
-
820}
executed: }
Execution Count:997
997
821 -
822/*! -
823 \reimp -
824*/ -
825void QListView::resizeEvent(QResizeEvent *e) -
826{ -
827 Q_D(QListView);
executed (the execution status of this line is deduced): QListViewPrivate * const d = d_func();
-
828 if (d->delayedPendingLayout)
evaluated: d->delayedPendingLayout
TRUEFALSE
yes
Evaluation Count:213
yes
Evaluation Count:356
213-356
829 return;
executed: return;
Execution Count:213
213
830 -
831 QSize delta = e->size() - e->oldSize();
executed (the execution status of this line is deduced): QSize delta = e->size() - e->oldSize();
-
832 -
833 if (delta.isNull())
partially evaluated: delta.isNull()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:356
0-356
834 return;
never executed: return;
0
835 -
836 bool listWrap = (d->viewMode == ListMode) && d->wrapItemText;
evaluated: (d->viewMode == ListMode)
TRUEFALSE
yes
Evaluation Count:352
yes
Evaluation Count:4
evaluated: d->wrapItemText
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:350
2-352
837 bool flowDimensionChanged = (d->flow == LeftToRight && delta.width() != 0)
evaluated: d->flow == LeftToRight
TRUEFALSE
yes
Evaluation Count:17
yes
Evaluation Count:339
evaluated: delta.width() != 0
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:12
5-339
838 || (d->flow == TopToBottom && delta.height() != 0);
evaluated: d->flow == TopToBottom
TRUEFALSE
yes
Evaluation Count:339
yes
Evaluation Count:12
evaluated: delta.height() != 0
TRUEFALSE
yes
Evaluation Count:276
yes
Evaluation Count:63
12-339
839 -
840 // We post a delayed relayout in the following cases : -
841 // - we're wrapping -
842 // - the state is NoState, we're adjusting and the size has changed in the flowing direction -
843 if (listWrap
evaluated: listWrap
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:354
2-354
844 || (state() == NoState && d->resizeMode == Adjust && flowDimensionChanged)) {
evaluated: state() == NoState
TRUEFALSE
yes
Evaluation Count:353
yes
Evaluation Count:1
evaluated: d->resizeMode == Adjust
TRUEFALSE
yes
Evaluation Count:35
yes
Evaluation Count:318
partially evaluated: flowDimensionChanged
TRUEFALSE
yes
Evaluation Count:35
no
Evaluation Count:0
0-353
845 d->doDelayedItemsLayout(100); // wait 1/10 sec before starting the layout
executed (the execution status of this line is deduced): d->doDelayedItemsLayout(100);
-
846 } else {
executed: }
Execution Count:37
37
847 QAbstractItemView::resizeEvent(e);
executed (the execution status of this line is deduced): QAbstractItemView::resizeEvent(e);
-
848 }
executed: }
Execution Count:319
319
849} -
850 -
851#ifndef QT_NO_DRAGANDDROP -
852 -
853/*! -
854 \reimp -
855*/ -
856void QListView::dragMoveEvent(QDragMoveEvent *e) -
857{ -
858 Q_D(QListView);
never executed (the execution status of this line is deduced): QListViewPrivate * const d = d_func();
-
859 if (!d->commonListView->filterDragMoveEvent(e)) {
never evaluated: !d->commonListView->filterDragMoveEvent(e)
0
860 if (viewMode() == QListView::ListMode && flow() == QListView::LeftToRight)
never evaluated: viewMode() == QListView::ListMode
never evaluated: flow() == QListView::LeftToRight
0
861 static_cast<QListModeViewBase *>(d->commonListView)->dragMoveEvent(e);
never executed: static_cast<QListModeViewBase *>(d->commonListView)->dragMoveEvent(e);
0
862 else -
863 QAbstractItemView::dragMoveEvent(e);
never executed: QAbstractItemView::dragMoveEvent(e);
0
864 } -
865}
never executed: }
0
866 -
867 -
868/*! -
869 \reimp -
870*/ -
871void QListView::dragLeaveEvent(QDragLeaveEvent *e) -
872{ -
873 if (!d_func()->commonListView->filterDragLeaveEvent(e))
never evaluated: !d_func()->commonListView->filterDragLeaveEvent(e)
0
874 QAbstractItemView::dragLeaveEvent(e);
never executed: QAbstractItemView::dragLeaveEvent(e);
0
875}
never executed: }
0
876 -
877/*! -
878 \reimp -
879*/ -
880void QListView::dropEvent(QDropEvent *e) -
881{ -
882 if (!d_func()->commonListView->filterDropEvent(e))
never evaluated: !d_func()->commonListView->filterDropEvent(e)
0
883 QAbstractItemView::dropEvent(e);
never executed: QAbstractItemView::dropEvent(e);
0
884}
never executed: }
0
885 -
886/*! -
887 \reimp -
888*/ -
889void QListView::startDrag(Qt::DropActions supportedActions) -
890{ -
891 if (!d_func()->commonListView->filterStartDrag(supportedActions))
partially evaluated: !d_func()->commonListView->filterStartDrag(supportedActions)
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
892 QAbstractItemView::startDrag(supportedActions);
executed: QAbstractItemView::startDrag(supportedActions);
Execution Count:1
1
893}
executed: }
Execution Count:1
1
894 -
895#endif // QT_NO_DRAGANDDROP -
896 -
897/*! -
898 \reimp -
899*/ -
900QStyleOptionViewItem QListView::viewOptions() const -
901{ -
902 Q_D(const QListView);
executed (the execution status of this line is deduced): const QListViewPrivate * const d = d_func();
-
903 return d->viewOptions();
executed: return d->viewOptions();
Execution Count:4
4
904} -
905 -
906QStyleOptionViewItem QListViewPrivate::viewOptions() const -
907{ -
908 Q_Q(const QListView);
executed (the execution status of this line is deduced): const QListView * const q = q_func();
-
909 QStyleOptionViewItem option = QAbstractItemViewPrivate::viewOptions();
executed (the execution status of this line is deduced): QStyleOptionViewItem option = QAbstractItemViewPrivate::viewOptions();
-
910 if (!iconSize.isValid()) { // otherwise it was already set in abstractitemview
evaluated: !iconSize.isValid()
TRUEFALSE
yes
Evaluation Count:22381
yes
Evaluation Count:503
503-22381
911 int pm = (viewMode == QListView::ListMode
evaluated: viewMode == QListView::ListMode
TRUEFALSE
yes
Evaluation Count:22301
yes
Evaluation Count:80
80-22301
912 ? q->style()->pixelMetric(QStyle::PM_ListViewIconSize, 0, q)
executed (the execution status of this line is deduced): ? q->style()->pixelMetric(QStyle::PM_ListViewIconSize, 0, q)
-
913 : q->style()->pixelMetric(QStyle::PM_IconViewIconSize, 0, q));
executed (the execution status of this line is deduced): : q->style()->pixelMetric(QStyle::PM_IconViewIconSize, 0, q));
-
914 option.decorationSize = QSize(pm, pm);
executed (the execution status of this line is deduced): option.decorationSize = QSize(pm, pm);
-
915 }
executed: }
Execution Count:22381
22381
916 if (viewMode == QListView::IconMode) {
evaluated: viewMode == QListView::IconMode
TRUEFALSE
yes
Evaluation Count:83
yes
Evaluation Count:22801
83-22801
917 option.showDecorationSelected = false;
executed (the execution status of this line is deduced): option.showDecorationSelected = false;
-
918 option.decorationPosition = QStyleOptionViewItem::Top;
executed (the execution status of this line is deduced): option.decorationPosition = QStyleOptionViewItem::Top;
-
919 option.displayAlignment = Qt::AlignCenter;
executed (the execution status of this line is deduced): option.displayAlignment = Qt::AlignCenter;
-
920 } else {
executed: }
Execution Count:83
83
921 option.decorationPosition = QStyleOptionViewItem::Left;
executed (the execution status of this line is deduced): option.decorationPosition = QStyleOptionViewItem::Left;
-
922 }
executed: }
Execution Count:22801
22801
923 return option;
executed: return option;
Execution Count:22884
22884
924} -
925 -
926 -
927/*! -
928 \reimp -
929*/ -
930void QListView::paintEvent(QPaintEvent *e) -
931{ -
932 Q_D(QListView);
executed (the execution status of this line is deduced): QListViewPrivate * const d = d_func();
-
933 if (!d->itemDelegate)
partially evaluated: !d->itemDelegate
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1057
0-1057
934 return;
never executed: return;
0
935 QStyleOptionViewItem option = d->viewOptions();
executed (the execution status of this line is deduced): QStyleOptionViewItem option = d->viewOptions();
-
936 QPainter painter(d->viewport);
executed (the execution status of this line is deduced): QPainter painter(d->viewport);
-
937 -
938 const QVector<QModelIndex> toBeRendered = d->intersectingSet(e->rect().translated(horizontalOffset(), verticalOffset()), false);
executed (the execution status of this line is deduced): const QVector<QModelIndex> toBeRendered = d->intersectingSet(e->rect().translated(horizontalOffset(), verticalOffset()), false);
-
939 -
940 const QModelIndex current = currentIndex();
executed (the execution status of this line is deduced): const QModelIndex current = currentIndex();
-
941 const QModelIndex hover = d->hover;
executed (the execution status of this line is deduced): const QModelIndex hover = d->hover;
-
942 const QAbstractItemModel *itemModel = d->model;
executed (the execution status of this line is deduced): const QAbstractItemModel *itemModel = d->model;
-
943 const QItemSelectionModel *selections = d->selectionModel;
executed (the execution status of this line is deduced): const QItemSelectionModel *selections = d->selectionModel;
-
944 const bool focus = (hasFocus() || d->viewport->hasFocus()) && current.isValid();
evaluated: hasFocus()
TRUEFALSE
yes
Evaluation Count:755
yes
Evaluation Count:302
partially evaluated: d->viewport->hasFocus()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:302
evaluated: current.isValid()
TRUEFALSE
yes
Evaluation Count:701
yes
Evaluation Count:54
0-755
945 const bool alternate = d->alternatingColors;
executed (the execution status of this line is deduced): const bool alternate = d->alternatingColors;
-
946 const QStyle::State state = option.state;
executed (the execution status of this line is deduced): const QStyle::State state = option.state;
-
947 const QAbstractItemView::State viewState = this->state();
executed (the execution status of this line is deduced): const QAbstractItemView::State viewState = this->state();
-
948 const bool enabled = (state & QStyle::State_Enabled) != 0;
executed (the execution status of this line is deduced): const bool enabled = (state & QStyle::State_Enabled) != 0;
-
949 -
950 bool alternateBase = false;
executed (the execution status of this line is deduced): bool alternateBase = false;
-
951 int previousRow = -2; // trigger the alternateBase adjustment on first pass
executed (the execution status of this line is deduced): int previousRow = -2;
-
952 -
953 int maxSize = (flow() == TopToBottom)
evaluated: (flow() == TopToBottom)
TRUEFALSE
yes
Evaluation Count:800
yes
Evaluation Count:257
257-800
954 ? qMax(viewport()->size().width(), d->contentsSize().width()) - 2 * d->spacing()
executed (the execution status of this line is deduced): ? qMax(viewport()->size().width(), d->contentsSize().width()) - 2 * d->spacing()
-
955 : qMax(viewport()->size().height(), d->contentsSize().height()) - 2 * d->spacing();
executed (the execution status of this line is deduced): : qMax(viewport()->size().height(), d->contentsSize().height()) - 2 * d->spacing();
-
956 -
957 QVector<QModelIndex>::const_iterator end = toBeRendered.constEnd();
executed (the execution status of this line is deduced): QVector<QModelIndex>::const_iterator end = toBeRendered.constEnd();
-
958 for (QVector<QModelIndex>::const_iterator it = toBeRendered.constBegin(); it != end; ++it) {
evaluated: it != end
TRUEFALSE
yes
Evaluation Count:8033
yes
Evaluation Count:1057
1057-8033
959 Q_ASSERT((*it).isValid());
executed (the execution status of this line is deduced): qt_noop();
-
960 option.rect = visualRect(*it);
executed (the execution status of this line is deduced): option.rect = visualRect(*it);
-
961 -
962 if (flow() == TopToBottom)
evaluated: flow() == TopToBottom
TRUEFALSE
yes
Evaluation Count:6391
yes
Evaluation Count:1642
1642-6391
963 option.rect.setWidth(qMin(maxSize, option.rect.width()));
executed: option.rect.setWidth(qMin(maxSize, option.rect.width()));
Execution Count:6391
6391
964 else -
965 option.rect.setHeight(qMin(maxSize, option.rect.height()));
executed: option.rect.setHeight(qMin(maxSize, option.rect.height()));
Execution Count:1642
1642
966 -
967 option.state = state;
executed (the execution status of this line is deduced): option.state = state;
-
968 if (selections && selections->isSelected(*it))
partially evaluated: selections
TRUEFALSE
yes
Evaluation Count:8033
no
Evaluation Count:0
evaluated: selections->isSelected(*it)
TRUEFALSE
yes
Evaluation Count:514
yes
Evaluation Count:7519
0-8033
969 option.state |= QStyle::State_Selected;
executed: option.state |= QStyle::State_Selected;
Execution Count:514
514
970 if (enabled) {
partially evaluated: enabled
TRUEFALSE
yes
Evaluation Count:8033
no
Evaluation Count:0
0-8033
971 QPalette::ColorGroup cg;
executed (the execution status of this line is deduced): QPalette::ColorGroup cg;
-
972 if ((itemModel->flags(*it) & Qt::ItemIsEnabled) == 0) {
evaluated: (itemModel->flags(*it) & Qt::ItemIsEnabled) == 0
TRUEFALSE
yes
Evaluation Count:54
yes
Evaluation Count:7979
54-7979
973 option.state &= ~QStyle::State_Enabled;
executed (the execution status of this line is deduced): option.state &= ~QStyle::State_Enabled;
-
974 cg = QPalette::Disabled;
executed (the execution status of this line is deduced): cg = QPalette::Disabled;
-
975 } else {
executed: }
Execution Count:54
54
976 cg = QPalette::Normal;
executed (the execution status of this line is deduced): cg = QPalette::Normal;
-
977 }
executed: }
Execution Count:7979
7979
978 option.palette.setCurrentColorGroup(cg);
executed (the execution status of this line is deduced): option.palette.setCurrentColorGroup(cg);
-
979 }
executed: }
Execution Count:8033
8033
980 if (focus && current == *it) {
evaluated: focus
TRUEFALSE
yes
Evaluation Count:4643
yes
Evaluation Count:3390
evaluated: current == *it
TRUEFALSE
yes
Evaluation Count:685
yes
Evaluation Count:3958
685-4643
981 option.state |= QStyle::State_HasFocus;
executed (the execution status of this line is deduced): option.state |= QStyle::State_HasFocus;
-
982 if (viewState == EditingState)
partially evaluated: viewState == EditingState
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:685
0-685
983 option.state |= QStyle::State_Editing;
never executed: option.state |= QStyle::State_Editing;
0
984 }
executed: }
Execution Count:685
685
985 if (*it == hover)
evaluated: *it == hover
TRUEFALSE
yes
Evaluation Count:243
yes
Evaluation Count:7790
243-7790
986 option.state |= QStyle::State_MouseOver;
executed: option.state |= QStyle::State_MouseOver;
Execution Count:243
243
987 else -
988 option.state &= ~QStyle::State_MouseOver;
executed: option.state &= ~QStyle::State_MouseOver;
Execution Count:7790
7790
989 -
990 if (alternate) {
partially evaluated: alternate
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8033
0-8033
991 int row = (*it).row();
never executed (the execution status of this line is deduced): int row = (*it).row();
-
992 if (row != previousRow + 1) {
never evaluated: row != previousRow + 1
0
993 // adjust alternateBase according to rows in the "gap" -
994 if (!d->hiddenRows.isEmpty()) {
never evaluated: !d->hiddenRows.isEmpty()
0
995 for (int r = qMax(previousRow + 1, 0); r < row; ++r) {
never evaluated: r < row
0
996 if (!d->isHidden(r))
never evaluated: !d->isHidden(r)
0
997 alternateBase = !alternateBase;
never executed: alternateBase = !alternateBase;
0
998 }
never executed: }
0
999 } else {
never executed: }
0
1000 alternateBase = (row & 1) != 0;
never executed (the execution status of this line is deduced): alternateBase = (row & 1) != 0;
-
1001 }
never executed: }
0
1002 } -
1003 if (alternateBase) {
never evaluated: alternateBase
0
1004 option.features |= QStyleOptionViewItem::Alternate;
never executed (the execution status of this line is deduced): option.features |= QStyleOptionViewItem::Alternate;
-
1005 } else {
never executed: }
0
1006 option.features &= ~QStyleOptionViewItem::Alternate;
never executed (the execution status of this line is deduced): option.features &= ~QStyleOptionViewItem::Alternate;
-
1007 }
never executed: }
0
1008 -
1009 // draw background of the item (only alternate row). rest of the background -
1010 // is provided by the delegate -
1011 QStyle::State oldState = option.state;
never executed (the execution status of this line is deduced): QStyle::State oldState = option.state;
-
1012 option.state &= ~QStyle::State_Selected;
never executed (the execution status of this line is deduced): option.state &= ~QStyle::State_Selected;
-
1013 style()->drawPrimitive(QStyle::PE_PanelItemViewRow, &option, &painter, this);
never executed (the execution status of this line is deduced): style()->drawPrimitive(QStyle::PE_PanelItemViewRow, &option, &painter, this);
-
1014 option.state = oldState;
never executed (the execution status of this line is deduced): option.state = oldState;
-
1015 -
1016 alternateBase = !alternateBase;
never executed (the execution status of this line is deduced): alternateBase = !alternateBase;
-
1017 previousRow = row;
never executed (the execution status of this line is deduced): previousRow = row;
-
1018 }
never executed: }
0
1019 -
1020 d->delegateForIndex(*it)->paint(&painter, option, *it);
executed (the execution status of this line is deduced): d->delegateForIndex(*it)->paint(&painter, option, *it);
-
1021 }
executed: }
Execution Count:8033
8033
1022 -
1023#ifndef QT_NO_DRAGANDDROP -
1024 d->commonListView->paintDragDrop(&painter);
executed (the execution status of this line is deduced): d->commonListView->paintDragDrop(&painter);
-
1025#endif -
1026 -
1027#ifndef QT_NO_RUBBERBAND -
1028 // #### move this implementation into a dynamic class -
1029 if (d->showElasticBand && d->elasticBand.isValid()) {
evaluated: d->showElasticBand
TRUEFALSE
yes
Evaluation Count:39
yes
Evaluation Count:1018
partially evaluated: d->elasticBand.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:39
0-1018
1030 QStyleOptionRubberBand opt;
never executed (the execution status of this line is deduced): QStyleOptionRubberBand opt;
-
1031 opt.initFrom(this);
never executed (the execution status of this line is deduced): opt.initFrom(this);
-
1032 opt.shape = QRubberBand::Rectangle;
never executed (the execution status of this line is deduced): opt.shape = QRubberBand::Rectangle;
-
1033 opt.opaque = false;
never executed (the execution status of this line is deduced): opt.opaque = false;
-
1034 opt.rect = d->mapToViewport(d->elasticBand, false).intersected(
never executed (the execution status of this line is deduced): opt.rect = d->mapToViewport(d->elasticBand, false).intersected(
-
1035 d->viewport->rect().adjusted(-16, -16, 16, 16));
never executed (the execution status of this line is deduced): d->viewport->rect().adjusted(-16, -16, 16, 16));
-
1036 painter.save();
never executed (the execution status of this line is deduced): painter.save();
-
1037 style()->drawControl(QStyle::CE_RubberBand, &opt, &painter);
never executed (the execution status of this line is deduced): style()->drawControl(QStyle::CE_RubberBand, &opt, &painter);
-
1038 painter.restore();
never executed (the execution status of this line is deduced): painter.restore();
-
1039 }
never executed: }
0
1040#endif -
1041}
executed: }
Execution Count:1057
1057
1042 -
1043/*! -
1044 \reimp -
1045*/ -
1046QModelIndex QListView::indexAt(const QPoint &p) const -
1047{ -
1048 Q_D(const QListView);
executed (the execution status of this line is deduced): const QListViewPrivate * const d = d_func();
-
1049 QRect rect(p.x() + horizontalOffset(), p.y() + verticalOffset(), 1, 1);
executed (the execution status of this line is deduced): QRect rect(p.x() + horizontalOffset(), p.y() + verticalOffset(), 1, 1);
-
1050 const QVector<QModelIndex> intersectVector = d->intersectingSet(rect);
executed (the execution status of this line is deduced): const QVector<QModelIndex> intersectVector = d->intersectingSet(rect);
-
1051 QModelIndex index = intersectVector.count() > 0
evaluated: intersectVector.count() > 0
TRUEFALSE
yes
Evaluation Count:1257
yes
Evaluation Count:62
62-1257
1052 ? intersectVector.last() : QModelIndex();
executed (the execution status of this line is deduced): ? intersectVector.last() : QModelIndex();
-
1053 if (index.isValid() && visualRect(index).contains(p))
evaluated: index.isValid()
TRUEFALSE
yes
Evaluation Count:1257
yes
Evaluation Count:62
evaluated: visualRect(index).contains(p)
TRUEFALSE
yes
Evaluation Count:1179
yes
Evaluation Count:78
62-1257
1054 return index;
executed: return index;
Execution Count:1179
1179
1055 return QModelIndex();
executed: return QModelIndex();
Execution Count:140
140
1056} -
1057 -
1058/*! -
1059 \reimp -
1060*/ -
1061int QListView::horizontalOffset() const -
1062{ -
1063 return d_func()->commonListView->horizontalOffset();
executed: return d_func()->commonListView->horizontalOffset();
Execution Count:24903
24903
1064} -
1065 -
1066/*! -
1067 \reimp -
1068*/ -
1069int QListView::verticalOffset() const -
1070{ -
1071 return d_func()->commonListView->verticalOffset();
executed: return d_func()->commonListView->verticalOffset();
Execution Count:24903
24903
1072} -
1073 -
1074/*! -
1075 \reimp -
1076*/ -
1077QModelIndex QListView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers) -
1078{ -
1079 Q_D(QListView);
executed (the execution status of this line is deduced): QListViewPrivate * const d = d_func();
-
1080 Q_UNUSED(modifiers);
executed (the execution status of this line is deduced): (void)modifiers;;
-
1081 -
1082 QModelIndex current = currentIndex();
executed (the execution status of this line is deduced): QModelIndex current = currentIndex();
-
1083 if (!current.isValid()) {
evaluated: !current.isValid()
TRUEFALSE
yes
Evaluation Count:107
yes
Evaluation Count:469
107-469
1084 int rowCount = d->model->rowCount(d->root);
executed (the execution status of this line is deduced): int rowCount = d->model->rowCount(d->root);
-
1085 if (!rowCount)
evaluated: !rowCount
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:99
8-99
1086 return QModelIndex();
executed: return QModelIndex();
Execution Count:8
8
1087 int row = 0;
executed (the execution status of this line is deduced): int row = 0;
-
1088 while (row < rowCount && d->isHiddenOrDisabled(row))
evaluated: row < rowCount
TRUEFALSE
yes
Evaluation Count:204
yes
Evaluation Count:1
evaluated: d->isHiddenOrDisabled(row)
TRUEFALSE
yes
Evaluation Count:106
yes
Evaluation Count:98
1-204
1089 ++row;
executed: ++row;
Execution Count:106
106
1090 if (row >= rowCount)
evaluated: row >= rowCount
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:98
1-98
1091 return QModelIndex();
executed: return QModelIndex();
Execution Count:1
1
1092 return d->model->index(row, d->column, d->root);
executed: return d->model->index(row, d->column, d->root);
Execution Count:98
98
1093 } -
1094 -
1095 const QRect initialRect = rectForIndex(current);
executed (the execution status of this line is deduced): const QRect initialRect = rectForIndex(current);
-
1096 QRect rect = initialRect;
executed (the execution status of this line is deduced): QRect rect = initialRect;
-
1097 if (rect.isEmpty()) {
partially evaluated: rect.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:469
0-469
1098 return d->model->index(0, d->column, d->root);
never executed: return d->model->index(0, d->column, d->root);
0
1099 } -
1100 if (d->gridSize().isValid()) rect.setSize(d->gridSize());
executed: rect.setSize(d->gridSize());
Execution Count:25
evaluated: d->gridSize().isValid()
TRUEFALSE
yes
Evaluation Count:25
yes
Evaluation Count:444
25-444
1101 -
1102 QSize contents = d->contentsSize();
executed (the execution status of this line is deduced): QSize contents = d->contentsSize();
-
1103 QVector<QModelIndex> intersectVector;
executed (the execution status of this line is deduced): QVector<QModelIndex> intersectVector;
-
1104 -
1105 switch (cursorAction) { -
1106 case MoveLeft: -
1107 while (intersectVector.isEmpty()) {
evaluated: intersectVector.isEmpty()
TRUEFALSE
yes
Evaluation Count:117
yes
Evaluation Count:94
94-117
1108 rect.translate(-rect.width(), 0);
executed (the execution status of this line is deduced): rect.translate(-rect.width(), 0);
-
1109 if (rect.right() <= 0)
evaluated: rect.right() <= 0
TRUEFALSE
yes
Evaluation Count:22
yes
Evaluation Count:95
22-95
1110 return current;
executed: return current;
Execution Count:22
22
1111 if (rect.left() < 0)
evaluated: rect.left() < 0
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:94
1-94
1112 rect.setLeft(0);
executed: rect.setLeft(0);
Execution Count:1
1
1113 intersectVector = d->intersectingSet(rect);
executed (the execution status of this line is deduced): intersectVector = d->intersectingSet(rect);
-
1114 d->removeCurrentAndDisabled(&intersectVector, current);
executed (the execution status of this line is deduced): d->removeCurrentAndDisabled(&intersectVector, current);
-
1115 }
executed: }
Execution Count:95
95
1116 return d->closestIndex(initialRect, intersectVector);
executed: return d->closestIndex(initialRect, intersectVector);
Execution Count:94
94
1117 case MoveRight: -
1118 while (intersectVector.isEmpty()) {
evaluated: intersectVector.isEmpty()
TRUEFALSE
yes
Evaluation Count:94
yes
Evaluation Count:89
89-94
1119 rect.translate(rect.width(), 0);
executed (the execution status of this line is deduced): rect.translate(rect.width(), 0);
-
1120 if (rect.left() >= contents.width())
evaluated: rect.left() >= contents.width()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:90
4-90
1121 return current;
executed: return current;
Execution Count:4
4
1122 if (rect.right() > contents.width())
evaluated: rect.right() > contents.width()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:88
2-88
1123 rect.setRight(contents.width());
executed: rect.setRight(contents.width());
Execution Count:2
2
1124 intersectVector = d->intersectingSet(rect);
executed (the execution status of this line is deduced): intersectVector = d->intersectingSet(rect);
-
1125 d->removeCurrentAndDisabled(&intersectVector, current);
executed (the execution status of this line is deduced): d->removeCurrentAndDisabled(&intersectVector, current);
-
1126 }
executed: }
Execution Count:90
90
1127 return d->closestIndex(initialRect, intersectVector);
executed: return d->closestIndex(initialRect, intersectVector);
Execution Count:89
89
1128 case MovePageUp: -
1129 // move current by (visibileRowCount - 1) items. -
1130 // rect.translate(0, -rect.height()); will happen in the switch fallthrough for MoveUp. -
1131 rect.moveTop(rect.top() - d->viewport->height() + 2 * rect.height());
executed (the execution status of this line is deduced): rect.moveTop(rect.top() - d->viewport->height() + 2 * rect.height());
-
1132 if (rect.top() < rect.height())
evaluated: rect.top() < rect.height()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:10
2-10
1133 rect.moveTop(rect.height());
executed: rect.moveTop(rect.height());
Execution Count:2
2
1134 case MovePrevious:
code before this statement executed: case MovePrevious:
Execution Count:12
12
1135 case MoveUp: -
1136 while (intersectVector.isEmpty()) {
evaluated: intersectVector.isEmpty()
TRUEFALSE
yes
Evaluation Count:147
yes
Evaluation Count:129
129-147
1137 rect.translate(0, -rect.height());
executed (the execution status of this line is deduced): rect.translate(0, -rect.height());
-
1138 if (rect.bottom() <= 0) {
evaluated: rect.bottom() <= 0
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:137
10-137
1139#ifdef QT_KEYPAD_NAVIGATION -
1140 if (QApplication::keypadNavigationEnabled()) { -
1141 int row = d->batchStartRow() - 1; -
1142 while (row >= 0 && d->isHiddenOrDisabled(row)) -
1143 --row; -
1144 if (row >= 0) -
1145 return d->model->index(row, d->column, d->root); -
1146 } -
1147#endif -
1148 return current;
executed: return current;
Execution Count:10
10
1149 } -
1150 if (rect.top() < 0)
evaluated: rect.top() < 0
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:136
1-136
1151 rect.setTop(0);
executed: rect.setTop(0);
Execution Count:1
1
1152 intersectVector = d->intersectingSet(rect);
executed (the execution status of this line is deduced): intersectVector = d->intersectingSet(rect);
-
1153 d->removeCurrentAndDisabled(&intersectVector, current);
executed (the execution status of this line is deduced): d->removeCurrentAndDisabled(&intersectVector, current);
-
1154 }
executed: }
Execution Count:137
137
1155 return d->closestIndex(initialRect, intersectVector);
executed: return d->closestIndex(initialRect, intersectVector);
Execution Count:129
129
1156 case MovePageDown: -
1157 // move current by (visibileRowCount - 1) items. -
1158 // rect.translate(0, rect.height()); will happen in the switch fallthrough for MoveDown. -
1159 rect.moveTop(rect.top() + d->viewport->height() - 2 * rect.height());
executed (the execution status of this line is deduced): rect.moveTop(rect.top() + d->viewport->height() - 2 * rect.height());
-
1160 if (rect.bottom() > contents.height() - rect.height())
evaluated: rect.bottom() > contents.height() - rect.height()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:10
2-10
1161 rect.moveBottom(contents.height() - rect.height());
executed: rect.moveBottom(contents.height() - rect.height());
Execution Count:2
2
1162 case MoveNext:
code before this statement executed: case MoveNext:
Execution Count:12
12
1163 case MoveDown: -
1164 while (intersectVector.isEmpty()) {
evaluated: intersectVector.isEmpty()
TRUEFALSE
yes
Evaluation Count:121
yes
Evaluation Count:115
115-121
1165 rect.translate(0, rect.height());
executed (the execution status of this line is deduced): rect.translate(0, rect.height());
-
1166 if (rect.top() >= contents.height()) {
evaluated: rect.top() >= contents.height()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:116
5-116
1167#ifdef QT_KEYPAD_NAVIGATION -
1168 if (QApplication::keypadNavigationEnabled()) { -
1169 int rowCount = d->model->rowCount(d->root); -
1170 int row = 0; -
1171 while (row < rowCount && d->isHiddenOrDisabled(row)) -
1172 ++row; -
1173 if (row < rowCount) -
1174 return d->model->index(row, d->column, d->root); -
1175 } -
1176#endif -
1177 return current;
executed: return current;
Execution Count:5
5
1178 } -
1179 if (rect.bottom() > contents.height())
evaluated: rect.bottom() > contents.height()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:113
3-113
1180 rect.setBottom(contents.height());
executed: rect.setBottom(contents.height());
Execution Count:3
3
1181 intersectVector = d->intersectingSet(rect);
executed (the execution status of this line is deduced): intersectVector = d->intersectingSet(rect);
-
1182 d->removeCurrentAndDisabled(&intersectVector, current);
executed (the execution status of this line is deduced): d->removeCurrentAndDisabled(&intersectVector, current);
-
1183 }
executed: }
Execution Count:116
116
1184 return d->closestIndex(initialRect, intersectVector);
executed: return d->closestIndex(initialRect, intersectVector);
Execution Count:115
115
1185 case MoveHome: -
1186 return d->model->index(0, d->column, d->root);
executed: return d->model->index(0, d->column, d->root);
Execution Count:1
1
1187 case MoveEnd: -
1188 return d->model->index(d->batchStartRow() - 1, d->column, d->root);}
never executed: return d->model->index(d->batchStartRow() - 1, d->column, d->root);
0
1189 -
1190 return current;
never executed: return current;
0
1191} -
1192 -
1193/*! -
1194 Returns the rectangle of the item at position \a index in the -
1195 model. The rectangle is in contents coordinates. -
1196 -
1197 \sa visualRect() -
1198*/ -
1199QRect QListView::rectForIndex(const QModelIndex &index) const -
1200{ -
1201 return d_func()->rectForIndex(index);
executed: return d_func()->rectForIndex(index);
Execution Count:24628
24628
1202} -
1203 -
1204/*! -
1205 \since 4.1 -
1206 -
1207 Sets the contents position of the item at \a index in the model to the given -
1208 \a position. -
1209 If the list view's movement mode is Static or its view mode is ListView, -
1210 this function will have no effect. -
1211*/ -
1212void QListView::setPositionForIndex(const QPoint &position, const QModelIndex &index) -
1213{ -
1214 Q_D(QListView);
executed (the execution status of this line is deduced): QListViewPrivate * const d = d_func();
-
1215 if (d->movement == Static
partially evaluated: d->movement == Static
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:17
0-17
1216 || !d->isIndexValid(index)
partially evaluated: !d->isIndexValid(index)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:17
0-17
1217 || index.parent() != d->root
partially evaluated: index.parent() != d->root
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:17
0-17
1218 || index.column() != d->column)
evaluated: index.column() != d->column
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:5
5-12
1219 return;
executed: return;
Execution Count:12
12
1220 -
1221 d->executePostedLayout();
executed (the execution status of this line is deduced): d->executePostedLayout();
-
1222 d->commonListView->setPositionForIndex(position, index);
executed (the execution status of this line is deduced): d->commonListView->setPositionForIndex(position, index);
-
1223}
executed: }
Execution Count:5
5
1224 -
1225/*! -
1226 \reimp -
1227*/ -
1228void QListView::setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags command) -
1229{ -
1230 Q_D(QListView);
executed (the execution status of this line is deduced): QListViewPrivate * const d = d_func();
-
1231 if (!d->selectionModel)
evaluated: !d->selectionModel
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:660
2-660
1232 return;
executed: return;
Execution Count:2
2
1233 -
1234 // if we are wrapping, we can only selecte inside the contents rectangle -
1235 int w = qMax(d->contentsSize().width(), d->viewport->width());
executed (the execution status of this line is deduced): int w = qMax(d->contentsSize().width(), d->viewport->width());
-
1236 int h = qMax(d->contentsSize().height(), d->viewport->height());
executed (the execution status of this line is deduced): int h = qMax(d->contentsSize().height(), d->viewport->height());
-
1237 if (d->wrap && !QRect(0, 0, w, h).intersects(rect))
evaluated: d->wrap
TRUEFALSE
yes
Evaluation Count:40
yes
Evaluation Count:620
evaluated: !QRect(0, 0, w, h).intersects(rect)
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:38
2-620
1238 return;
executed: return;
Execution Count:2
2
1239 -
1240 QItemSelection selection;
executed (the execution status of this line is deduced): QItemSelection selection;
-
1241 -
1242 if (rect.width() == 1 && rect.height() == 1) {
evaluated: rect.width() == 1
TRUEFALSE
yes
Evaluation Count:648
yes
Evaluation Count:10
evaluated: rect.height() == 1
TRUEFALSE
yes
Evaluation Count:638
yes
Evaluation Count:10
10-648
1243 const QVector<QModelIndex> intersectVector = d->intersectingSet(rect.translated(horizontalOffset(), verticalOffset()));
executed (the execution status of this line is deduced): const QVector<QModelIndex> intersectVector = d->intersectingSet(rect.translated(horizontalOffset(), verticalOffset()));
-
1244 QModelIndex tl;
executed (the execution status of this line is deduced): QModelIndex tl;
-
1245 if (!intersectVector.isEmpty())
evaluated: !intersectVector.isEmpty()
TRUEFALSE
yes
Evaluation Count:634
yes
Evaluation Count:4
4-634
1246 tl = intersectVector.last(); // special case for mouse press; only select the top item
executed: tl = intersectVector.last();
Execution Count:634
634
1247 if (tl.isValid() && d->isIndexEnabled(tl))
evaluated: tl.isValid()
TRUEFALSE
yes
Evaluation Count:634
yes
Evaluation Count:4
partially evaluated: d->isIndexEnabled(tl)
TRUEFALSE
yes
Evaluation Count:634
no
Evaluation Count:0
0-634
1248 selection.select(tl, tl);
executed: selection.select(tl, tl);
Execution Count:634
634
1249 } else {
executed: }
Execution Count:638
638
1250 if (state() == DragSelectingState) { // visual selection mode (rubberband selection)
evaluated: state() == DragSelectingState
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:17
3-17
1251 selection = d->selection(rect.translated(horizontalOffset(), verticalOffset()));
executed (the execution status of this line is deduced): selection = d->selection(rect.translated(horizontalOffset(), verticalOffset()));
-
1252 } else { // logical selection mode (key and mouse click selection)
executed: }
Execution Count:3
3
1253 QModelIndex tl, br;
executed (the execution status of this line is deduced): QModelIndex tl, br;
-
1254 // get the first item -
1255 const QRect topLeft(rect.left() + horizontalOffset(), rect.top() + verticalOffset(), 1, 1);
executed (the execution status of this line is deduced): const QRect topLeft(rect.left() + horizontalOffset(), rect.top() + verticalOffset(), 1, 1);
-
1256 QVector<QModelIndex> intersectVector = d->intersectingSet(topLeft);
executed (the execution status of this line is deduced): QVector<QModelIndex> intersectVector = d->intersectingSet(topLeft);
-
1257 if (!intersectVector.isEmpty())
evaluated: !intersectVector.isEmpty()
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:3
3-14
1258 tl = intersectVector.last();
executed: tl = intersectVector.last();
Execution Count:14
14
1259 // get the last item -
1260 const QRect bottomRight(rect.right() + horizontalOffset(), rect.bottom() + verticalOffset(), 1, 1);
executed (the execution status of this line is deduced): const QRect bottomRight(rect.right() + horizontalOffset(), rect.bottom() + verticalOffset(), 1, 1);
-
1261 intersectVector = d->intersectingSet(bottomRight);
executed (the execution status of this line is deduced): intersectVector = d->intersectingSet(bottomRight);
-
1262 if (!intersectVector.isEmpty())
evaluated: !intersectVector.isEmpty()
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:3
3-14
1263 br = intersectVector.last();
executed: br = intersectVector.last();
Execution Count:14
14
1264 -
1265 // get the ranges -
1266 if (tl.isValid() && br.isValid()
evaluated: tl.isValid()
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:3
partially evaluated: br.isValid()
TRUEFALSE
yes
Evaluation Count:14
no
Evaluation Count:0
0-14
1267 && d->isIndexEnabled(tl)
partially evaluated: d->isIndexEnabled(tl)
TRUEFALSE
yes
Evaluation Count:14
no
Evaluation Count:0
0-14
1268 && d->isIndexEnabled(br)) {
partially evaluated: d->isIndexEnabled(br)
TRUEFALSE
yes
Evaluation Count:14
no
Evaluation Count:0
0-14
1269 QRect first = rectForIndex(tl);
executed (the execution status of this line is deduced): QRect first = rectForIndex(tl);
-
1270 QRect last = rectForIndex(br);
executed (the execution status of this line is deduced): QRect last = rectForIndex(br);
-
1271 QRect middle;
executed (the execution status of this line is deduced): QRect middle;
-
1272 if (d->flow == LeftToRight) {
evaluated: d->flow == LeftToRight
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:7
7
1273 QRect &top = first;
executed (the execution status of this line is deduced): QRect &top = first;
-
1274 QRect &bottom = last;
executed (the execution status of this line is deduced): QRect &bottom = last;
-
1275 // if bottom is above top, swap them -
1276 if (top.center().y() > bottom.center().y()) {
evaluated: top.center().y() > bottom.center().y()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:6
1-6
1277 QRect tmp = top;
executed (the execution status of this line is deduced): QRect tmp = top;
-
1278 top = bottom;
executed (the execution status of this line is deduced): top = bottom;
-
1279 bottom = tmp;
executed (the execution status of this line is deduced): bottom = tmp;
-
1280 }
executed: }
Execution Count:1
1
1281 // if the rect are on differnet lines, expand -
1282 if (top.top() != bottom.top()) {
evaluated: top.top() != bottom.top()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:2
2-5
1283 // top rectangle -
1284 if (isRightToLeft())
partially evaluated: isRightToLeft()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
1285 top.setLeft(0);
never executed: top.setLeft(0);
0
1286 else -
1287 top.setRight(contentsSize().width());
executed: top.setRight(contentsSize().width());
Execution Count:5
5
1288 // bottom rectangle -
1289 if (isRightToLeft())
partially evaluated: isRightToLeft()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
1290 bottom.setRight(contentsSize().width());
never executed: bottom.setRight(contentsSize().width());
0
1291 else -
1292 bottom.setLeft(0);
executed: bottom.setLeft(0);
Execution Count:5
5
1293 } else if (top.left() > bottom.right()) {
evaluated: top.left() > bottom.right()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1
1294 if (isRightToLeft())
partially evaluated: isRightToLeft()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
1295 bottom.setLeft(top.right());
never executed: bottom.setLeft(top.right());
0
1296 else -
1297 bottom.setRight(top.left());
executed: bottom.setRight(top.left());
Execution Count:1
1
1298 } else { -
1299 if (isRightToLeft())
partially evaluated: isRightToLeft()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
1300 top.setLeft(bottom.right());
never executed: top.setLeft(bottom.right());
0
1301 else -
1302 top.setRight(bottom.left());
executed: top.setRight(bottom.left());
Execution Count:1
1
1303 } -
1304 // middle rectangle -
1305 if (top.bottom() < bottom.top()) {
evaluated: top.bottom() < bottom.top()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:2
2-5
1306 if (gridSize().isValid() && !gridSize().isNull())
evaluated: gridSize().isValid()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:1
partially evaluated: !gridSize().isNull()
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
0-4
1307 middle.setTop(top.top() + gridSize().height());
executed: middle.setTop(top.top() + gridSize().height());
Execution Count:4
4
1308 else -
1309 middle.setTop(top.bottom() + 1);
executed: middle.setTop(top.bottom() + 1);
Execution Count:1
1
1310 middle.setLeft(qMin(top.left(), bottom.left()));
executed (the execution status of this line is deduced): middle.setLeft(qMin(top.left(), bottom.left()));
-
1311 middle.setBottom(bottom.top() - 1);
executed (the execution status of this line is deduced): middle.setBottom(bottom.top() - 1);
-
1312 middle.setRight(qMax(top.right(), bottom.right()));
executed (the execution status of this line is deduced): middle.setRight(qMax(top.right(), bottom.right()));
-
1313 }
executed: }
Execution Count:5
5
1314 } else { // TopToBottom
executed: }
Execution Count:7
7
1315 QRect &left = first;
executed (the execution status of this line is deduced): QRect &left = first;
-
1316 QRect &right = last;
executed (the execution status of this line is deduced): QRect &right = last;
-
1317 if (left.center().x() > right.center().x())
evaluated: left.center().x() > right.center().x()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:6
1-6
1318 qSwap(left, right);
executed: qSwap(left, right);
Execution Count:1
1
1319 -
1320 int ch = contentsSize().height();
executed (the execution status of this line is deduced): int ch = contentsSize().height();
-
1321 if (left.left() != right.left()) {
evaluated: left.left() != right.left()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:5
2-5
1322 // left rectangle -
1323 if (isRightToLeft())
partially evaluated: isRightToLeft()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
1324 left.setTop(0);
never executed: left.setTop(0);
0
1325 else -
1326 left.setBottom(ch);
executed: left.setBottom(ch);
Execution Count:2
2
1327 -
1328 // top rectangle -
1329 if (isRightToLeft())
partially evaluated: isRightToLeft()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
1330 right.setBottom(ch);
never executed: right.setBottom(ch);
0
1331 else -
1332 right.setTop(0);
executed: right.setTop(0);
Execution Count:2
2
1333 // only set middle if the -
1334 middle.setTop(0);
executed (the execution status of this line is deduced): middle.setTop(0);
-
1335 middle.setBottom(ch);
executed (the execution status of this line is deduced): middle.setBottom(ch);
-
1336 if (gridSize().isValid() && !gridSize().isNull())
evaluated: gridSize().isValid()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
partially evaluated: !gridSize().isNull()
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
1337 middle.setLeft(left.left() + gridSize().width());
executed: middle.setLeft(left.left() + gridSize().width());
Execution Count:1
1
1338 else -
1339 middle.setLeft(left.right() + 1);
executed: middle.setLeft(left.right() + 1);
Execution Count:1
1
1340 middle.setRight(right.left() - 1);
executed (the execution status of this line is deduced): middle.setRight(right.left() - 1);
-
1341 } else if (left.bottom() < right.top()) {
executed: }
Execution Count:2
evaluated: left.bottom() < right.top()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:3
2-3
1342 left.setBottom(right.top() - 1);
executed (the execution status of this line is deduced): left.setBottom(right.top() - 1);
-
1343 } else {
executed: }
Execution Count:2
2
1344 right.setBottom(left.top() - 1);
executed (the execution status of this line is deduced): right.setBottom(left.top() - 1);
-
1345 }
executed: }
Execution Count:3
3
1346 } -
1347 -
1348 // do the selections -
1349 QItemSelection topSelection = d->selection(first);
executed (the execution status of this line is deduced): QItemSelection topSelection = d->selection(first);
-
1350 QItemSelection middleSelection = d->selection(middle);
executed (the execution status of this line is deduced): QItemSelection middleSelection = d->selection(middle);
-
1351 QItemSelection bottomSelection = d->selection(last);
executed (the execution status of this line is deduced): QItemSelection bottomSelection = d->selection(last);
-
1352 // merge -
1353 selection.merge(topSelection, QItemSelectionModel::Select);
executed (the execution status of this line is deduced): selection.merge(topSelection, QItemSelectionModel::Select);
-
1354 selection.merge(middleSelection, QItemSelectionModel::Select);
executed (the execution status of this line is deduced): selection.merge(middleSelection, QItemSelectionModel::Select);
-
1355 selection.merge(bottomSelection, QItemSelectionModel::Select);
executed (the execution status of this line is deduced): selection.merge(bottomSelection, QItemSelectionModel::Select);
-
1356 }
executed: }
Execution Count:14
14
1357 }
executed: }
Execution Count:17
17
1358 } -
1359 -
1360 d->selectionModel->select(selection, command);
executed (the execution status of this line is deduced): d->selectionModel->select(selection, command);
-
1361}
executed: }
Execution Count:658
658
1362 -
1363/*! -
1364 \reimp -
1365 -
1366 Since 4.7, the returned region only contains rectangles intersecting -
1367 (or included in) the viewport. -
1368*/ -
1369QRegion QListView::visualRegionForSelection(const QItemSelection &selection) const -
1370{ -
1371 Q_D(const QListView);
executed (the execution status of this line is deduced): const QListViewPrivate * const d = d_func();
-
1372 // ### NOTE: this is a potential bottleneck in non-static mode -
1373 int c = d->column;
executed (the execution status of this line is deduced): int c = d->column;
-
1374 QRegion selectionRegion;
executed (the execution status of this line is deduced): QRegion selectionRegion;
-
1375 const QRect &viewportRect = d->viewport->rect();
executed (the execution status of this line is deduced): const QRect &viewportRect = d->viewport->rect();
-
1376 for (int i = 0; i < selection.count(); ++i) {
evaluated: i < selection.count()
TRUEFALSE
yes
Evaluation Count:1570
yes
Evaluation Count:1681
1570-1681
1377 if (!selection.at(i).isValid())
partially evaluated: !selection.at(i).isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1570
0-1570
1378 continue;
never executed: continue;
0
1379 QModelIndex parent = selection.at(i).topLeft().parent();
executed (the execution status of this line is deduced): QModelIndex parent = selection.at(i).topLeft().parent();
-
1380 //we only display the children of the root in a listview -
1381 //we're not interested in the other model indexes -
1382 if (parent != d->root)
evaluated: parent != d->root
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:1557
13-1557
1383 continue;
executed: continue;
Execution Count:13
13
1384 int t = selection.at(i).topLeft().row();
executed (the execution status of this line is deduced): int t = selection.at(i).topLeft().row();
-
1385 int b = selection.at(i).bottomRight().row();
executed (the execution status of this line is deduced): int b = selection.at(i).bottomRight().row();
-
1386 if (d->viewMode == IconMode || d->isWrapping()) { // in non-static mode, we have to go through all selected items
evaluated: d->viewMode == IconMode
TRUEFALSE
yes
Evaluation Count:46
yes
Evaluation Count:1511
evaluated: d->isWrapping()
TRUEFALSE
yes
Evaluation Count:51
yes
Evaluation Count:1460
46-1511
1387 for (int r = t; r <= b; ++r) {
evaluated: r <= b
TRUEFALSE
yes
Evaluation Count:142
yes
Evaluation Count:97
97-142
1388 const QRect &rect = visualRect(d->model->index(r, c, parent));
executed (the execution status of this line is deduced): const QRect &rect = visualRect(d->model->index(r, c, parent));
-
1389 if (viewportRect.intersects(rect))
evaluated: viewportRect.intersects(rect)
TRUEFALSE
yes
Evaluation Count:134
yes
Evaluation Count:8
8-134
1390 selectionRegion += rect;
executed: selectionRegion += rect;
Execution Count:134
134
1391 }
executed: }
Execution Count:142
142
1392 } else { // in static mode, we can optimize a bit
executed: }
Execution Count:97
97
1393 while (t <= b && d->isHidden(t)) ++t;
never executed: ++t;
partially evaluated: t <= b
TRUEFALSE
yes
Evaluation Count:1460
no
Evaluation Count:0
partially evaluated: d->isHidden(t)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1460
0-1460
1394 while (b >= t && d->isHidden(b)) --b;
never executed: --b;
partially evaluated: b >= t
TRUEFALSE
yes
Evaluation Count:1460
no
Evaluation Count:0
partially evaluated: d->isHidden(b)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1460
0-1460
1395 const QModelIndex top = d->model->index(t, c, parent);
executed (the execution status of this line is deduced): const QModelIndex top = d->model->index(t, c, parent);
-
1396 const QModelIndex bottom = d->model->index(b, c, parent);
executed (the execution status of this line is deduced): const QModelIndex bottom = d->model->index(b, c, parent);
-
1397 QRect rect(visualRect(top).topLeft(),
executed (the execution status of this line is deduced): QRect rect(visualRect(top).topLeft(),
-
1398 visualRect(bottom).bottomRight());
executed (the execution status of this line is deduced): visualRect(bottom).bottomRight());
-
1399 if (viewportRect.intersects(rect))
evaluated: viewportRect.intersects(rect)
TRUEFALSE
yes
Evaluation Count:1225
yes
Evaluation Count:235
235-1225
1400 selectionRegion += rect;
executed: selectionRegion += rect;
Execution Count:1225
1225
1401 }
executed: }
Execution Count:1460
1460
1402 } -
1403 -
1404 return selectionRegion;
executed: return selectionRegion;
Execution Count:1681
1681
1405} -
1406 -
1407/*! -
1408 \reimp -
1409*/ -
1410QModelIndexList QListView::selectedIndexes() const -
1411{ -
1412 Q_D(const QListView);
executed (the execution status of this line is deduced): const QListViewPrivate * const d = d_func();
-
1413 if (!d->selectionModel)
evaluated: !d->selectionModel
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1
1-2
1414 return QModelIndexList();
executed: return QModelIndexList();
Execution Count:2
2
1415 -
1416 QModelIndexList viewSelected = d->selectionModel->selectedIndexes();
executed (the execution status of this line is deduced): QModelIndexList viewSelected = d->selectionModel->selectedIndexes();
-
1417 for (int i = 0; i < viewSelected.count(); ++i) {
partially evaluated: i < viewSelected.count()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
1418 const QModelIndex &index = viewSelected.at(i);
never executed (the execution status of this line is deduced): const QModelIndex &index = viewSelected.at(i);
-
1419 if (!isIndexHidden(index) && index.parent() == d->root && index.column() == d->column)
never evaluated: !isIndexHidden(index)
never evaluated: index.parent() == d->root
never evaluated: index.column() == d->column
0
1420 ++i;
never executed: ++i;
0
1421 else -
1422 viewSelected.removeAt(i);
never executed: viewSelected.removeAt(i);
0
1423 } -
1424 return viewSelected;
executed: return viewSelected;
Execution Count:1
1
1425} -
1426 -
1427/*! -
1428 \internal -
1429 -
1430 Layout the items according to the flow and wrapping properties. -
1431*/ -
1432void QListView::doItemsLayout() -
1433{ -
1434 Q_D(QListView);
executed (the execution status of this line is deduced): QListViewPrivate * const d = d_func();
-
1435 // showing the scroll bars will trigger a resize event, -
1436 // so we set the state to expanding to avoid -
1437 // triggering another layout -
1438 QAbstractItemView::State oldState = state();
executed (the execution status of this line is deduced): QAbstractItemView::State oldState = state();
-
1439 setState(ExpandingState);
executed (the execution status of this line is deduced): setState(ExpandingState);
-
1440 if (d->model->columnCount(d->root) > 0) { // no columns means no contents
evaluated: d->model->columnCount(d->root) > 0
TRUEFALSE
yes
Evaluation Count:1126
yes
Evaluation Count:39
39-1126
1441 d->resetBatchStartRow();
executed (the execution status of this line is deduced): d->resetBatchStartRow();
-
1442 if (layoutMode() == SinglePass)
evaluated: layoutMode() == SinglePass
TRUEFALSE
yes
Evaluation Count:1121
yes
Evaluation Count:5
5-1121
1443 d->doItemsLayout(d->model->rowCount(d->root)); // layout everything
executed: d->doItemsLayout(d->model->rowCount(d->root));
Execution Count:1121
1121
1444 else if (!d->batchLayoutTimer.isActive()) {
partially evaluated: !d->batchLayoutTimer.isActive()
TRUEFALSE
yes
Evaluation Count:5
no
Evaluation Count:0
0-5
1445 if (!d->doItemsLayout(d->batchSize)) // layout is done
evaluated: !d->doItemsLayout(d->batchSize)
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:1
1-4
1446 d->batchLayoutTimer.start(0, this); // do a new batch as fast as possible
executed: d->batchLayoutTimer.start(0, this);
Execution Count:4
4
1447 }
executed: }
Execution Count:5
5
1448 } -
1449 QAbstractItemView::doItemsLayout();
executed (the execution status of this line is deduced): QAbstractItemView::doItemsLayout();
-
1450 setState(oldState); // restoring the oldState
executed (the execution status of this line is deduced): setState(oldState);
-
1451}
executed: }
Execution Count:1165
1165
1452 -
1453/*! -
1454 \reimp -
1455*/ -
1456void QListView::updateGeometries() -
1457{ -
1458 Q_D(QListView);
executed (the execution status of this line is deduced): QListViewPrivate * const d = d_func();
-
1459 if (d->model->rowCount(d->root) <= 0 || d->model->columnCount(d->root) <= 0) {
evaluated: d->model->rowCount(d->root) <= 0
TRUEFALSE
yes
Evaluation Count:286
yes
Evaluation Count:1275
partially evaluated: d->model->columnCount(d->root) <= 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1275
0-1275
1460 horizontalScrollBar()->setRange(0, 0);
executed (the execution status of this line is deduced): horizontalScrollBar()->setRange(0, 0);
-
1461 verticalScrollBar()->setRange(0, 0);
executed (the execution status of this line is deduced): verticalScrollBar()->setRange(0, 0);
-
1462 } else {
executed: }
Execution Count:286
286
1463 QModelIndex index = d->model->index(0, d->column, d->root);
executed (the execution status of this line is deduced): QModelIndex index = d->model->index(0, d->column, d->root);
-
1464 QStyleOptionViewItem option = d->viewOptions();
executed (the execution status of this line is deduced): QStyleOptionViewItem option = d->viewOptions();
-
1465 QSize step = d->itemSize(option, index);
executed (the execution status of this line is deduced): QSize step = d->itemSize(option, index);
-
1466 d->commonListView->updateHorizontalScrollBar(step);
executed (the execution status of this line is deduced): d->commonListView->updateHorizontalScrollBar(step);
-
1467 d->commonListView->updateVerticalScrollBar(step);
executed (the execution status of this line is deduced): d->commonListView->updateVerticalScrollBar(step);
-
1468 }
executed: }
Execution Count:1275
1275
1469 -
1470 QAbstractItemView::updateGeometries();
executed (the execution status of this line is deduced): QAbstractItemView::updateGeometries();
-
1471 -
1472 // if the scroll bars are turned off, we resize the contents to the viewport -
1473 if (d->movement == Static && !d->isWrapping()) {
evaluated: d->movement == Static
TRUEFALSE
yes
Evaluation Count:1540
yes
Evaluation Count:21
evaluated: !d->isWrapping()
TRUEFALSE
yes
Evaluation Count:1262
yes
Evaluation Count:278
21-1540
1474 const QSize maxSize = maximumViewportSize();
executed (the execution status of this line is deduced): const QSize maxSize = maximumViewportSize();
-
1475 if (d->flow == TopToBottom) {
evaluated: d->flow == TopToBottom
TRUEFALSE
yes
Evaluation Count:1215
yes
Evaluation Count:47
47-1215
1476 if (horizontalScrollBarPolicy() == Qt::ScrollBarAlwaysOff) {
evaluated: horizontalScrollBarPolicy() == Qt::ScrollBarAlwaysOff
TRUEFALSE
yes
Evaluation Count:52
yes
Evaluation Count:1163
52-1163
1477 d->setContentsSize(maxSize.width(), contentsSize().height());
executed (the execution status of this line is deduced): d->setContentsSize(maxSize.width(), contentsSize().height());
-
1478 horizontalScrollBar()->setRange(0, 0); // we see all the contents anyway
executed (the execution status of this line is deduced): horizontalScrollBar()->setRange(0, 0);
-
1479 }
executed: }
Execution Count:52
52
1480 } else { // LeftToRight
executed: }
Execution Count:1215
1215
1481 if (verticalScrollBarPolicy() == Qt::ScrollBarAlwaysOff) {
partially evaluated: verticalScrollBarPolicy() == Qt::ScrollBarAlwaysOff
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:47
0-47
1482 d->setContentsSize(contentsSize().width(), maxSize.height());
never executed (the execution status of this line is deduced): d->setContentsSize(contentsSize().width(), maxSize.height());
-
1483 verticalScrollBar()->setRange(0, 0); // we see all the contents anyway
never executed (the execution status of this line is deduced): verticalScrollBar()->setRange(0, 0);
-
1484 }
never executed: }
0
1485 }
executed: }
Execution Count:47
47
1486 } -
1487 -
1488}
executed: }
Execution Count:1561
1561
1489 -
1490/*! -
1491 \reimp -
1492*/ -
1493bool QListView::isIndexHidden(const QModelIndex &index) const -
1494{ -
1495 Q_D(const QListView);
executed (the execution status of this line is deduced): const QListViewPrivate * const d = d_func();
-
1496 return (d->isHidden(index.row())
executed: return (d->isHidden(index.row()) && (index.parent() == d->root) && index.column() == d->column);
Execution Count:4
4
1497 && (index.parent() == d->root)
executed: return (d->isHidden(index.row()) && (index.parent() == d->root) && index.column() == d->column);
Execution Count:4
4
1498 && index.column() == d->column);
executed: return (d->isHidden(index.row()) && (index.parent() == d->root) && index.column() == d->column);
Execution Count:4
4
1499} -
1500 -
1501/*! -
1502 \property QListView::modelColumn -
1503 \brief the column in the model that is visible -
1504 -
1505 By default, this property contains 0, indicating that the first -
1506 column in the model will be shown. -
1507*/ -
1508void QListView::setModelColumn(int column) -
1509{ -
1510 Q_D(QListView);
executed (the execution status of this line is deduced): QListViewPrivate * const d = d_func();
-
1511 if (column < 0 || column >= d->model->columnCount(d->root))
evaluated: column < 0
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:65
evaluated: column >= d->model->columnCount(d->root)
TRUEFALSE
yes
Evaluation Count:29
yes
Evaluation Count:36
2-65
1512 return;
executed: return;
Execution Count:31
31
1513 d->column = column;
executed (the execution status of this line is deduced): d->column = column;
-
1514 d->doDelayedItemsLayout();
executed (the execution status of this line is deduced): d->doDelayedItemsLayout();
-
1515}
executed: }
Execution Count:36
36
1516 -
1517int QListView::modelColumn() const -
1518{ -
1519 Q_D(const QListView);
executed (the execution status of this line is deduced): const QListViewPrivate * const d = d_func();
-
1520 return d->column;
executed: return d->column;
Execution Count:9
9
1521} -
1522 -
1523/*! -
1524 \property QListView::uniformItemSizes -
1525 \brief whether all items in the listview have the same size -
1526 \since 4.1 -
1527 -
1528 This property should only be set to true if it is guaranteed that all items -
1529 in the view have the same size. This enables the view to do some -
1530 optimizations for performance purposes. -
1531 -
1532 By default, this property is false. -
1533*/ -
1534void QListView::setUniformItemSizes(bool enable) -
1535{ -
1536 Q_D(QListView);
executed (the execution status of this line is deduced): QListViewPrivate * const d = d_func();
-
1537 d->uniformItemSizes = enable;
executed (the execution status of this line is deduced): d->uniformItemSizes = enable;
-
1538}
executed: }
Execution Count:337
337
1539 -
1540bool QListView::uniformItemSizes() const -
1541{ -
1542 Q_D(const QListView);
executed (the execution status of this line is deduced): const QListViewPrivate * const d = d_func();
-
1543 return d->uniformItemSizes;
executed: return d->uniformItemSizes;
Execution Count:2
2
1544} -
1545 -
1546/*! -
1547 \property QListView::wordWrap -
1548 \brief the item text word-wrapping policy -
1549 \since 4.2 -
1550 -
1551 If this property is true then the item text is wrapped where -
1552 necessary at word-breaks; otherwise it is not wrapped at all. -
1553 This property is false by default. -
1554 -
1555 Please note that even if wrapping is enabled, the cell will not be -
1556 expanded to make room for the text. It will print ellipsis for -
1557 text that cannot be shown, according to the view's -
1558 \l{QAbstractItemView::}{textElideMode}. -
1559*/ -
1560void QListView::setWordWrap(bool on) -
1561{ -
1562 Q_D(QListView);
executed (the execution status of this line is deduced): QListViewPrivate * const d = d_func();
-
1563 if (d->wrapItemText == on)
evaluated: d->wrapItemText == on
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:4
1-4
1564 return;
executed: return;
Execution Count:1
1
1565 d->wrapItemText = on;
executed (the execution status of this line is deduced): d->wrapItemText = on;
-
1566 d->doDelayedItemsLayout();
executed (the execution status of this line is deduced): d->doDelayedItemsLayout();
-
1567}
executed: }
Execution Count:4
4
1568 -
1569bool QListView::wordWrap() const -
1570{ -
1571 Q_D(const QListView);
executed (the execution status of this line is deduced): const QListViewPrivate * const d = d_func();
-
1572 return d->wrapItemText;
executed: return d->wrapItemText;
Execution Count:2
2
1573} -
1574 -
1575/*! -
1576 \property QListView::selectionRectVisible -
1577 \brief if the selection rectangle should be visible -
1578 \since 4.3 -
1579 -
1580 If this property is true then the selection rectangle is visible; -
1581 otherwise it will be hidden. -
1582 -
1583 \note The selection rectangle will only be visible if the selection mode -
1584 is in a mode where more than one item can be selected; i.e., it will not -
1585 draw a selection rectangle if the selection mode is -
1586 QAbstractItemView::SingleSelection. -
1587 -
1588 By default, this property is false. -
1589*/ -
1590void QListView::setSelectionRectVisible(bool show) -
1591{ -
1592 Q_D(QListView);
never executed (the execution status of this line is deduced): QListViewPrivate * const d = d_func();
-
1593 d->modeProperties |= uint(QListViewPrivate::SelectionRectVisible);
never executed (the execution status of this line is deduced): d->modeProperties |= uint(QListViewPrivate::SelectionRectVisible);
-
1594 d->setSelectionRectVisible(show);
never executed (the execution status of this line is deduced): d->setSelectionRectVisible(show);
-
1595}
never executed: }
0
1596 -
1597bool QListView::isSelectionRectVisible() const -
1598{ -
1599 Q_D(const QListView);
never executed (the execution status of this line is deduced): const QListViewPrivate * const d = d_func();
-
1600 return d->isSelectionRectVisible();
never executed: return d->isSelectionRectVisible();
0
1601} -
1602 -
1603/*! -
1604 \reimp -
1605*/ -
1606bool QListView::event(QEvent *e) -
1607{ -
1608 return QAbstractItemView::event(e);
executed: return QAbstractItemView::event(e);
Execution Count:15078
15078
1609} -
1610 -
1611/* -
1612 * private object implementation -
1613 */ -
1614 -
1615QListViewPrivate::QListViewPrivate() -
1616 : QAbstractItemViewPrivate(), -
1617 commonListView(0), -
1618 wrap(false), -
1619 space(0), -
1620 flow(QListView::TopToBottom), -
1621 movement(QListView::Static), -
1622 resizeMode(QListView::Fixed), -
1623 layoutMode(QListView::SinglePass), -
1624 viewMode(QListView::ListMode), -
1625 modeProperties(0), -
1626 column(0), -
1627 uniformItemSizes(false), -
1628 batchSize(100), -
1629 showElasticBand(false) -
1630{ -
1631}
executed: }
Execution Count:1008
1008
1632 -
1633QListViewPrivate::~QListViewPrivate() -
1634{ -
1635 delete commonListView;
executed (the execution status of this line is deduced): delete commonListView;
-
1636}
executed: }
Execution Count:902
902
1637 -
1638void QListViewPrivate::clear() -
1639{ -
1640 // initialization of data structs -
1641 cachedItemSize = QSize();
executed (the execution status of this line is deduced): cachedItemSize = QSize();
-
1642 commonListView->clear();
executed (the execution status of this line is deduced): commonListView->clear();
-
1643}
executed: }
Execution Count:22471
22471
1644 -
1645void QListViewPrivate::prepareItemsLayout() -
1646{ -
1647 Q_Q(QListView);
executed (the execution status of this line is deduced): QListView * const q = q_func();
-
1648 clear();
executed (the execution status of this line is deduced): clear();
-
1649 -
1650 //take the size as if there were scrollbar in order to prevent scrollbar to blink -
1651 layoutBounds = QRect(QPoint(), q->maximumViewportSize());
executed (the execution status of this line is deduced): layoutBounds = QRect(QPoint(), q->maximumViewportSize());
-
1652 -
1653 int frameAroundContents = 0;
executed (the execution status of this line is deduced): int frameAroundContents = 0;
-
1654 if (q->style()->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents))
partially evaluated: q->style()->styleHint(QStyle::SH_ScrollView_FrameOnlyAroundContents)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1126
0-1126
1655 frameAroundContents = q->style()->pixelMetric(QStyle::PM_DefaultFrameWidth) * 2;
never executed: frameAroundContents = q->style()->pixelMetric(QStyle::PM_DefaultFrameWidth) * 2;
0
1656 -
1657 // maximumViewportSize() already takes scrollbar into account if policy is -
1658 // Qt::ScrollBarAlwaysOn but scrollbar extent must be deduced if policy -
1659 // is Qt::ScrollBarAsNeeded -
1660 int verticalMargin = vbarpolicy==Qt::ScrollBarAsNeeded
evaluated: vbarpolicy==Qt::ScrollBarAsNeeded
TRUEFALSE
yes
Evaluation Count:1114
yes
Evaluation Count:12
12-1114
1661 ? q->style()->pixelMetric(QStyle::PM_ScrollBarExtent, 0, vbar) + frameAroundContents
executed (the execution status of this line is deduced): ? q->style()->pixelMetric(QStyle::PM_ScrollBarExtent, 0, vbar) + frameAroundContents
-
1662 : 0;
executed (the execution status of this line is deduced): : 0;
-
1663 int horizontalMargin = hbarpolicy==Qt::ScrollBarAsNeeded
evaluated: hbarpolicy==Qt::ScrollBarAsNeeded
TRUEFALSE
yes
Evaluation Count:1071
yes
Evaluation Count:55
55-1071
1664 ? q->style()->pixelMetric(QStyle::PM_ScrollBarExtent, 0, hbar) + frameAroundContents
executed (the execution status of this line is deduced): ? q->style()->pixelMetric(QStyle::PM_ScrollBarExtent, 0, hbar) + frameAroundContents
-
1665 : 0;
executed (the execution status of this line is deduced): : 0;
-
1666 -
1667 layoutBounds.adjust(0, 0, -verticalMargin, -horizontalMargin);
executed (the execution status of this line is deduced): layoutBounds.adjust(0, 0, -verticalMargin, -horizontalMargin);
-
1668 -
1669 int rowCount = model->columnCount(root) <= 0 ? 0 : model->rowCount(root);
partially evaluated: model->columnCount(root) <= 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1126
0-1126
1670 commonListView->setRowCount(rowCount);
executed (the execution status of this line is deduced): commonListView->setRowCount(rowCount);
-
1671}
executed: }
Execution Count:1126
1126
1672 -
1673/*! -
1674 \internal -
1675*/ -
1676bool QListViewPrivate::doItemsLayout(int delta) -
1677{ -
1678 int max = model->rowCount(root) - 1;
executed (the execution status of this line is deduced): int max = model->rowCount(root) - 1;
-
1679 int first = batchStartRow();
executed (the execution status of this line is deduced): int first = batchStartRow();
-
1680 int last = qMin(first + delta - 1, max);
executed (the execution status of this line is deduced): int last = qMin(first + delta - 1, max);
-
1681 -
1682 if (first == 0) {
evaluated: first == 0
TRUEFALSE
yes
Evaluation Count:1126
yes
Evaluation Count:4
4-1126
1683 layoutChildren(); // make sure the viewport has the right size
executed (the execution status of this line is deduced): layoutChildren();
-
1684 prepareItemsLayout();
executed (the execution status of this line is deduced): prepareItemsLayout();
-
1685 }
executed: }
Execution Count:1126
1126
1686 -
1687 if (max < 0 || last < first) {
evaluated: max < 0
TRUEFALSE
yes
Evaluation Count:175
yes
Evaluation Count:955
partially evaluated: last < first
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:955
0-955
1688 return true; // nothing to do
executed: return true;
Execution Count:175
175
1689 } -
1690 -
1691 QListViewLayoutInfo info;
executed (the execution status of this line is deduced): QListViewLayoutInfo info;
-
1692 info.bounds = layoutBounds;
executed (the execution status of this line is deduced): info.bounds = layoutBounds;
-
1693 info.grid = gridSize();
executed (the execution status of this line is deduced): info.grid = gridSize();
-
1694 info.spacing = (info.grid.isValid() ? 0 : spacing());
evaluated: info.grid.isValid()
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:945
10-945
1695 info.first = first;
executed (the execution status of this line is deduced): info.first = first;
-
1696 info.last = last;
executed (the execution status of this line is deduced): info.last = last;
-
1697 info.wrap = isWrapping();
executed (the execution status of this line is deduced): info.wrap = isWrapping();
-
1698 info.flow = flow;
executed (the execution status of this line is deduced): info.flow = flow;
-
1699 info.max = max;
executed (the execution status of this line is deduced): info.max = max;
-
1700 -
1701 return commonListView->doBatchedItemLayout(info, max);
executed: return commonListView->doBatchedItemLayout(info, max);
Execution Count:955
955
1702} -
1703 -
1704QListViewItem QListViewPrivate::indexToListViewItem(const QModelIndex &index) const -
1705{ -
1706 if (!index.isValid() || isHidden(index.row()))
partially evaluated: !index.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:20110
partially evaluated: isHidden(index.row())
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:20110
0-20110
1707 return QListViewItem();
never executed: return QListViewItem();
0
1708 -
1709 return commonListView->indexToListViewItem(index);
executed: return commonListView->indexToListViewItem(index);
Execution Count:20110
20110
1710} -
1711 -
1712QRect QListViewPrivate::mapToViewport(const QRect &rect, bool extend) const -
1713{ -
1714 Q_Q(const QListView);
executed (the execution status of this line is deduced): const QListView * const q = q_func();
-
1715 if (!rect.isValid())
evaluated: !rect.isValid()
TRUEFALSE
yes
Evaluation Count:5435
yes
Evaluation Count:18702
5435-18702
1716 return rect;
executed: return rect;
Execution Count:5435
5435
1717 -
1718 QRect result = extend ? commonListView->mapToViewport(rect) : rect;
partially evaluated: extend
TRUEFALSE
yes
Evaluation Count:18702
no
Evaluation Count:0
0-18702
1719 int dx = -q->horizontalOffset();
executed (the execution status of this line is deduced): int dx = -q->horizontalOffset();
-
1720 int dy = -q->verticalOffset();
executed (the execution status of this line is deduced): int dy = -q->verticalOffset();
-
1721 return result.adjusted(dx, dy, dx, dy);
executed: return result.adjusted(dx, dy, dx, dy);
Execution Count:18702
18702
1722} -
1723 -
1724QModelIndex QListViewPrivate::closestIndex(const QRect &target, -
1725 const QVector<QModelIndex> &candidates) const -
1726{ -
1727 int distance = 0;
executed (the execution status of this line is deduced): int distance = 0;
-
1728 int shortest = INT_MAX;
executed (the execution status of this line is deduced): int shortest = 2147483647;
-
1729 QModelIndex closest;
executed (the execution status of this line is deduced): QModelIndex closest;
-
1730 QVector<QModelIndex>::const_iterator it = candidates.begin();
executed (the execution status of this line is deduced): QVector<QModelIndex>::const_iterator it = candidates.begin();
-
1731 -
1732 for (; it != candidates.end(); ++it) {
evaluated: it != candidates.end()
TRUEFALSE
yes
Evaluation Count:472
yes
Evaluation Count:427
427-472
1733 if (!(*it).isValid())
partially evaluated: !(*it).isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:472
0-472
1734 continue;
never executed: continue;
0
1735 -
1736 const QRect indexRect = indexToListViewItem(*it).rect();
executed (the execution status of this line is deduced): const QRect indexRect = indexToListViewItem(*it).rect();
-
1737 -
1738 //if the center x (or y) position of an item is included in the rect of the other item, -
1739 //we define the distance between them as the difference in x (or y) of their respective center. -
1740 // Otherwise, we use the nahattan length between the 2 items -
1741 if ((target.center().x() >= indexRect.x() && target.center().x() < indexRect.right())
evaluated: target.center().x() >= indexRect.x()
TRUEFALSE
yes
Evaluation Count:375
yes
Evaluation Count:97
evaluated: target.center().x() < indexRect.right()
TRUEFALSE
yes
Evaluation Count:263
yes
Evaluation Count:112
97-375
1742 || (indexRect.center().x() >= target.x() && indexRect.center().x() < target.right())) {
evaluated: indexRect.center().x() >= target.x()
TRUEFALSE
yes
Evaluation Count:113
yes
Evaluation Count:96
evaluated: indexRect.center().x() < target.right()
TRUEFALSE
yes
Evaluation Count:16
yes
Evaluation Count:97
16-113
1743 //one item's center is at the vertical of the other -
1744 distance = qAbs(indexRect.center().y() - target.center().y());
executed (the execution status of this line is deduced): distance = qAbs(indexRect.center().y() - target.center().y());
-
1745 } else if ((target.center().y() >= indexRect.y() && target.center().y() < indexRect.bottom())
executed: }
Execution Count:279
evaluated: target.center().y() >= indexRect.y()
TRUEFALSE
yes
Evaluation Count:192
yes
Evaluation Count:1
evaluated: target.center().y() < indexRect.bottom()
TRUEFALSE
yes
Evaluation Count:184
yes
Evaluation Count:8
1-279
1746 || (indexRect.center().y() >= target.y() && indexRect.center().y() < target.bottom())) {
partially evaluated: indexRect.center().y() >= target.y()
TRUEFALSE
yes
Evaluation Count:9
no
Evaluation Count:0
evaluated: indexRect.center().y() < target.bottom()
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:1
0-9
1747 //one item's center is at the vertical of the other -
1748 distance = qAbs(indexRect.center().x() - target.center().x());
executed (the execution status of this line is deduced): distance = qAbs(indexRect.center().x() - target.center().x());
-
1749 } else {
executed: }
Execution Count:192
192
1750 distance = (indexRect.center() - target.center()).manhattanLength();
executed (the execution status of this line is deduced): distance = (indexRect.center() - target.center()).manhattanLength();
-
1751 }
executed: }
Execution Count:1
1
1752 if (distance < shortest) {
evaluated: distance < shortest
TRUEFALSE
yes
Evaluation Count:439
yes
Evaluation Count:33
33-439
1753 shortest = distance;
executed (the execution status of this line is deduced): shortest = distance;
-
1754 closest = *it;
executed (the execution status of this line is deduced): closest = *it;
-
1755 }
executed: }
Execution Count:439
439
1756 }
executed: }
Execution Count:472
472
1757 return closest;
executed: return closest;
Execution Count:427
427
1758} -
1759 -
1760QSize QListViewPrivate::itemSize(const QStyleOptionViewItem &option, const QModelIndex &index) const -
1761{ -
1762 if (!uniformItemSizes) {
evaluated: !uniformItemSizes
TRUEFALSE
yes
Evaluation Count:55543
yes
Evaluation Count:857
857-55543
1763 const QAbstractItemDelegate *delegate = delegateForIndex(index);
executed (the execution status of this line is deduced): const QAbstractItemDelegate *delegate = delegateForIndex(index);
-
1764 return delegate ? delegate->sizeHint(option, index) : QSize();
executed: return delegate ? delegate->sizeHint(option, index) : QSize();
Execution Count:55543
55543
1765 } -
1766 if (!cachedItemSize.isValid()) { // the last item is probaly the largest, so we use its size
evaluated: !cachedItemSize.isValid()
TRUEFALSE
yes
Evaluation Count:105
yes
Evaluation Count:752
105-752
1767 int row = model->rowCount(root) - 1;
executed (the execution status of this line is deduced): int row = model->rowCount(root) - 1;
-
1768 QModelIndex sample = model->index(row, column, root);
executed (the execution status of this line is deduced): QModelIndex sample = model->index(row, column, root);
-
1769 const QAbstractItemDelegate *delegate = delegateForIndex(sample);
executed (the execution status of this line is deduced): const QAbstractItemDelegate *delegate = delegateForIndex(sample);
-
1770 cachedItemSize = delegate ? delegate->sizeHint(option, sample) : QSize();
partially evaluated: delegate
TRUEFALSE
yes
Evaluation Count:105
no
Evaluation Count:0
0-105
1771 }
executed: }
Execution Count:105
105
1772 return cachedItemSize;
executed: return cachedItemSize;
Execution Count:857
857
1773} -
1774 -
1775QItemSelection QListViewPrivate::selection(const QRect &rect) const -
1776{ -
1777 QItemSelection selection;
executed (the execution status of this line is deduced): QItemSelection selection;
-
1778 QModelIndex tl, br;
executed (the execution status of this line is deduced): QModelIndex tl, br;
-
1779 const QVector<QModelIndex> intersectVector = intersectingSet(rect);
executed (the execution status of this line is deduced): const QVector<QModelIndex> intersectVector = intersectingSet(rect);
-
1780 QVector<QModelIndex>::const_iterator it = intersectVector.begin();
executed (the execution status of this line is deduced): QVector<QModelIndex>::const_iterator it = intersectVector.begin();
-
1781 for (; it != intersectVector.end(); ++it) {
evaluated: it != intersectVector.end()
TRUEFALSE
yes
Evaluation Count:89
yes
Evaluation Count:45
45-89
1782 if (!tl.isValid() && !br.isValid()) {
evaluated: !tl.isValid()
TRUEFALSE
yes
Evaluation Count:33
yes
Evaluation Count:56
partially evaluated: !br.isValid()
TRUEFALSE
yes
Evaluation Count:33
no
Evaluation Count:0
0-56
1783 tl = br = *it;
executed (the execution status of this line is deduced): tl = br = *it;
-
1784 } else if ((*it).row() == (tl.row() - 1)) {
executed: }
Execution Count:33
partially evaluated: (*it).row() == (tl.row() - 1)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:56
0-56
1785 tl = *it; // expand current range
never executed (the execution status of this line is deduced): tl = *it;
-
1786 } else if ((*it).row() == (br.row() + 1)) {
never executed: }
partially evaluated: (*it).row() == (br.row() + 1)
TRUEFALSE
yes
Evaluation Count:56
no
Evaluation Count:0
0-56
1787 br = (*it); // expand current range
executed (the execution status of this line is deduced): br = (*it);
-
1788 } else {
executed: }
Execution Count:56
56
1789 selection.select(tl, br); // select current range
never executed (the execution status of this line is deduced): selection.select(tl, br);
-
1790 tl = br = *it; // start new range
never executed (the execution status of this line is deduced): tl = br = *it;
-
1791 }
never executed: }
0
1792 } -
1793 -
1794 if (tl.isValid() && br.isValid())
evaluated: tl.isValid()
TRUEFALSE
yes
Evaluation Count:33
yes
Evaluation Count:12
partially evaluated: br.isValid()
TRUEFALSE
yes
Evaluation Count:33
no
Evaluation Count:0
0-33
1795 selection.select(tl, br);
executed: selection.select(tl, br);
Execution Count:33
33
1796 else if (tl.isValid())
partially evaluated: tl.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12
0-12
1797 selection.select(tl, tl);
never executed: selection.select(tl, tl);
0
1798 else if (br.isValid())
partially evaluated: br.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12
0-12
1799 selection.select(br, br);
never executed: selection.select(br, br);
0
1800 -
1801 return selection;
executed: return selection;
Execution Count:45
45
1802} -
1803 -
1804#ifndef QT_NO_DRAGANDDROP -
1805QAbstractItemView::DropIndicatorPosition QListViewPrivate::position(const QPoint &pos, const QRect &rect, const QModelIndex &idx) const -
1806{ -
1807 if (viewMode == QListView::ListMode && flow == QListView::LeftToRight)
never evaluated: viewMode == QListView::ListMode
never evaluated: flow == QListView::LeftToRight
0
1808 return static_cast<QListModeViewBase *>(commonListView)->position(pos, rect, idx);
never executed: return static_cast<QListModeViewBase *>(commonListView)->position(pos, rect, idx);
0
1809 else -
1810 return QAbstractItemViewPrivate::position(pos, rect, idx);
never executed: return QAbstractItemViewPrivate::position(pos, rect, idx);
0
1811} -
1812 -
1813bool QListViewPrivate::dropOn(QDropEvent *event, int *dropRow, int *dropCol, QModelIndex *dropIndex) -
1814{ -
1815 if (viewMode == QListView::ListMode && flow == QListView::LeftToRight)
never evaluated: viewMode == QListView::ListMode
never evaluated: flow == QListView::LeftToRight
0
1816 return static_cast<QListModeViewBase *>(commonListView)->dropOn(event, dropRow, dropCol, dropIndex);
never executed: return static_cast<QListModeViewBase *>(commonListView)->dropOn(event, dropRow, dropCol, dropIndex);
0
1817 else -
1818 return QAbstractItemViewPrivate::dropOn(event, dropRow, dropCol, dropIndex);
never executed: return QAbstractItemViewPrivate::dropOn(event, dropRow, dropCol, dropIndex);
0
1819} -
1820#endif -
1821 -
1822/* -
1823 * Common ListView Implementation -
1824*/ -
1825 -
1826void QCommonListViewBase::appendHiddenRow(int row) -
1827{ -
1828 dd->hiddenRows.insert(dd->model->index(row, 0, qq->rootIndex()));
executed (the execution status of this line is deduced): dd->hiddenRows.insert(dd->model->index(row, 0, qq->rootIndex()));
-
1829}
executed: }
Execution Count:637
637
1830 -
1831void QCommonListViewBase::removeHiddenRow(int row) -
1832{ -
1833 dd->hiddenRows.remove(dd->model->index(row, 0, qq->rootIndex()));
executed (the execution status of this line is deduced): dd->hiddenRows.remove(dd->model->index(row, 0, qq->rootIndex()));
-
1834}
executed: }
Execution Count:5
5
1835 -
1836void QCommonListViewBase::updateHorizontalScrollBar(const QSize &step) -
1837{ -
1838 horizontalScrollBar()->setSingleStep(step.width() + spacing());
executed (the execution status of this line is deduced): horizontalScrollBar()->setSingleStep(step.width() + spacing());
-
1839 horizontalScrollBar()->setPageStep(viewport()->width());
executed (the execution status of this line is deduced): horizontalScrollBar()->setPageStep(viewport()->width());
-
1840 horizontalScrollBar()->setRange(0, contentsSize.width() - viewport()->width());
executed (the execution status of this line is deduced): horizontalScrollBar()->setRange(0, contentsSize.width() - viewport()->width());
-
1841}
executed: }
Execution Count:1121
1121
1842 -
1843void QCommonListViewBase::updateVerticalScrollBar(const QSize &step) -
1844{ -
1845 verticalScrollBar()->setSingleStep(step.height() + spacing());
executed (the execution status of this line is deduced): verticalScrollBar()->setSingleStep(step.height() + spacing());
-
1846 verticalScrollBar()->setPageStep(viewport()->height());
executed (the execution status of this line is deduced): verticalScrollBar()->setPageStep(viewport()->height());
-
1847 verticalScrollBar()->setRange(0, contentsSize.height() - viewport()->height());
executed (the execution status of this line is deduced): verticalScrollBar()->setRange(0, contentsSize.height() - viewport()->height());
-
1848}
executed: }
Execution Count:189
189
1849 -
1850void QCommonListViewBase::scrollContentsBy(int dx, int dy, bool /*scrollElasticBand*/) -
1851{ -
1852 dd->scrollContentsBy(isRightToLeft() ? -dx : dx, dy);
executed (the execution status of this line is deduced): dd->scrollContentsBy(isRightToLeft() ? -dx : dx, dy);
-
1853}
executed: }
Execution Count:445
445
1854 -
1855int QCommonListViewBase::verticalScrollToValue(int /*index*/, QListView::ScrollHint hint, -
1856 bool above, bool below, const QRect &area, const QRect &rect) const -
1857{ -
1858 int verticalValue = verticalScrollBar()->value();
executed (the execution status of this line is deduced): int verticalValue = verticalScrollBar()->value();
-
1859 QRect adjusted = rect.adjusted(-spacing(), -spacing(), spacing(), spacing());
executed (the execution status of this line is deduced): QRect adjusted = rect.adjusted(-spacing(), -spacing(), spacing(), spacing());
-
1860 if (hint == QListView::PositionAtTop || above)
partially evaluated: hint == QListView::PositionAtTop
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:36
evaluated: above
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:31
0-36
1861 verticalValue += adjusted.top();
executed: verticalValue += adjusted.top();
Execution Count:5
5
1862 else if (hint == QListView::PositionAtBottom || below)
partially evaluated: hint == QListView::PositionAtBottom
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:31
partially evaluated: below
TRUEFALSE
yes
Evaluation Count:31
no
Evaluation Count:0
0-31
1863 verticalValue += qMin(adjusted.top(), adjusted.bottom() - area.height() + 1);
executed: verticalValue += qMin(adjusted.top(), adjusted.bottom() - area.height() + 1);
Execution Count:31
31
1864 else if (hint == QListView::PositionAtCenter)
never evaluated: hint == QListView::PositionAtCenter
0
1865 verticalValue += adjusted.top() - ((area.height() - adjusted.height()) / 2);
never executed: verticalValue += adjusted.top() - ((area.height() - adjusted.height()) / 2);
0
1866 return verticalValue;
executed: return verticalValue;
Execution Count:36
36
1867} -
1868 -
1869int QCommonListViewBase::horizontalOffset() const -
1870{ -
1871 return (isRightToLeft() ? horizontalScrollBar()->maximum() - horizontalScrollBar()->value() : horizontalScrollBar()->value());
executed: return (isRightToLeft() ? horizontalScrollBar()->maximum() - horizontalScrollBar()->value() : horizontalScrollBar()->value());
Execution Count:17361
17361
1872} -
1873 -
1874int QCommonListViewBase::horizontalScrollToValue(const int /*index*/, QListView::ScrollHint hint, -
1875 bool leftOf, bool rightOf, const QRect &area, const QRect &rect) const -
1876{ -
1877 int horizontalValue = horizontalScrollBar()->value();
executed (the execution status of this line is deduced): int horizontalValue = horizontalScrollBar()->value();
-
1878 if (isRightToLeft()) {
partially evaluated: isRightToLeft()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
1879 if (hint == QListView::PositionAtCenter) {
never evaluated: hint == QListView::PositionAtCenter
0
1880 horizontalValue += ((area.width() - rect.width()) / 2) - rect.left();
never executed (the execution status of this line is deduced): horizontalValue += ((area.width() - rect.width()) / 2) - rect.left();
-
1881 } else {
never executed: }
0
1882 if (leftOf)
never evaluated: leftOf
0
1883 horizontalValue -= rect.left();
never executed: horizontalValue -= rect.left();
0
1884 else if (rightOf)
never evaluated: rightOf
0
1885 horizontalValue += qMin(rect.left(), area.width() - rect.right());
never executed: horizontalValue += qMin(rect.left(), area.width() - rect.right());
0
1886 } -
1887 } else { -
1888 if (hint == QListView::PositionAtCenter) {
partially evaluated: hint == QListView::PositionAtCenter
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
1889 horizontalValue += rect.left() - ((area.width()- rect.width()) / 2);
never executed (the execution status of this line is deduced): horizontalValue += rect.left() - ((area.width()- rect.width()) / 2);
-
1890 } else {
never executed: }
0
1891 if (leftOf)
partially evaluated: leftOf
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
1892 horizontalValue += rect.left();
never executed: horizontalValue += rect.left();
0
1893 else if (rightOf)
partially evaluated: rightOf
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
1894 horizontalValue += qMin(rect.left(), rect.right() - area.width());
never executed: horizontalValue += qMin(rect.left(), rect.right() - area.width());
0
1895 } -
1896 } -
1897 return horizontalValue;
executed: return horizontalValue;
Execution Count:2
2
1898} -
1899 -
1900/* -
1901 * ListMode ListView Implementation -
1902*/ -
1903 -
1904#ifndef QT_NO_DRAGANDDROP -
1905void QListModeViewBase::paintDragDrop(QPainter *painter) -
1906{ -
1907 // FIXME: Until the we can provide a proper drop indicator -
1908 // in IconMode, it makes no sense to show it -
1909 dd->paintDropIndicator(painter);
executed (the execution status of this line is deduced): dd->paintDropIndicator(painter);
-
1910}
executed: }
Execution Count:1018
1018
1911 -
1912QAbstractItemView::DropIndicatorPosition QListModeViewBase::position(const QPoint &pos, const QRect &rect, const QModelIndex &index) const -
1913{ -
1914 QAbstractItemView::DropIndicatorPosition r = QAbstractItemView::OnViewport;
never executed (the execution status of this line is deduced): QAbstractItemView::DropIndicatorPosition r = QAbstractItemView::OnViewport;
-
1915 if (!dd->overwrite) {
never evaluated: !dd->overwrite
0
1916 const int margin = 2;
never executed (the execution status of this line is deduced): const int margin = 2;
-
1917 if (pos.x() - rect.left() < margin) {
never evaluated: pos.x() - rect.left() < margin
0
1918 r = QAbstractItemView::AboveItem; // Visually, on the left
never executed (the execution status of this line is deduced): r = QAbstractItemView::AboveItem;
-
1919 } else if (rect.right() - pos.x() < margin) {
never executed: }
never evaluated: rect.right() - pos.x() < margin
0
1920 r = QAbstractItemView::BelowItem; // Visually, on the right
never executed (the execution status of this line is deduced): r = QAbstractItemView::BelowItem;
-
1921 } else if (rect.contains(pos, true)) {
never executed: }
never evaluated: rect.contains(pos, true)
0
1922 r = QAbstractItemView::OnItem;
never executed (the execution status of this line is deduced): r = QAbstractItemView::OnItem;
-
1923 }
never executed: }
0
1924 } else { -
1925 QRect touchingRect = rect;
never executed (the execution status of this line is deduced): QRect touchingRect = rect;
-
1926 touchingRect.adjust(-1, -1, 1, 1);
never executed (the execution status of this line is deduced): touchingRect.adjust(-1, -1, 1, 1);
-
1927 if (touchingRect.contains(pos, false)) {
never evaluated: touchingRect.contains(pos, false)
0
1928 r = QAbstractItemView::OnItem;
never executed (the execution status of this line is deduced): r = QAbstractItemView::OnItem;
-
1929 }
never executed: }
0
1930 }
never executed: }
0
1931 -
1932 if (r == QAbstractItemView::OnItem && (!(dd->model->flags(index) & Qt::ItemIsDropEnabled)))
never evaluated: r == QAbstractItemView::OnItem
never evaluated: (!(dd->model->flags(index) & Qt::ItemIsDropEnabled))
0
1933 r = pos.x() < rect.center().x() ? QAbstractItemView::AboveItem : QAbstractItemView::BelowItem;
never executed: r = pos.x() < rect.center().x() ? QAbstractItemView::AboveItem : QAbstractItemView::BelowItem;
never evaluated: pos.x() < rect.center().x()
0
1934 -
1935 return r;
never executed: return r;
0
1936} -
1937 -
1938void QListModeViewBase::dragMoveEvent(QDragMoveEvent *event) -
1939{ -
1940 if (qq->dragDropMode() == QAbstractItemView::InternalMove
never evaluated: qq->dragDropMode() == QAbstractItemView::InternalMove
0
1941 && (event->source() != qq || !(event->possibleActions() & Qt::MoveAction)))
never evaluated: event->source() != qq
never evaluated: !(event->possibleActions() & Qt::MoveAction)
0
1942 return;
never executed: return;
0
1943 -
1944 // ignore by default -
1945 event->ignore();
never executed (the execution status of this line is deduced): event->ignore();
-
1946 -
1947 // can't use indexAt, doesn't account for spacing. -
1948 QPoint p = event->pos();
never executed (the execution status of this line is deduced): QPoint p = event->pos();
-
1949 QRect rect(p.x() + horizontalOffset(), p.y() + verticalOffset(), 1, 1);
never executed (the execution status of this line is deduced): QRect rect(p.x() + horizontalOffset(), p.y() + verticalOffset(), 1, 1);
-
1950 rect.adjust(-dd->spacing(), -dd->spacing(), dd->spacing(), dd->spacing());
never executed (the execution status of this line is deduced): rect.adjust(-dd->spacing(), -dd->spacing(), dd->spacing(), dd->spacing());
-
1951 const QVector<QModelIndex> intersectVector = dd->intersectingSet(rect);
never executed (the execution status of this line is deduced): const QVector<QModelIndex> intersectVector = dd->intersectingSet(rect);
-
1952 QModelIndex index = intersectVector.count() > 0
never evaluated: intersectVector.count() > 0
0
1953 ? intersectVector.last() : QModelIndex();
never executed (the execution status of this line is deduced): ? intersectVector.last() : QModelIndex();
-
1954 dd->hover = index;
never executed (the execution status of this line is deduced): dd->hover = index;
-
1955 if (!dd->droppingOnItself(event, index)
never evaluated: !dd->droppingOnItself(event, index)
0
1956 && dd->canDecode(event)) {
never evaluated: dd->canDecode(event)
0
1957 -
1958 if (index.isValid() && dd->showDropIndicator) {
never evaluated: index.isValid()
never evaluated: dd->showDropIndicator
0
1959 QRect rect = qq->visualRect(index);
never executed (the execution status of this line is deduced): QRect rect = qq->visualRect(index);
-
1960 dd->dropIndicatorPosition = position(event->pos(), rect, index);
never executed (the execution status of this line is deduced): dd->dropIndicatorPosition = position(event->pos(), rect, index);
-
1961 // if spacing, should try to draw between items, not just next to item. -
1962 switch (dd->dropIndicatorPosition) { -
1963 case QAbstractItemView::AboveItem: -
1964 if (dd->isIndexDropEnabled(index.parent())) {
never evaluated: dd->isIndexDropEnabled(index.parent())
0
1965 dd->dropIndicatorRect = QRect(rect.left()-dd->spacing(), rect.top(), 0, rect.height());
never executed (the execution status of this line is deduced): dd->dropIndicatorRect = QRect(rect.left()-dd->spacing(), rect.top(), 0, rect.height());
-
1966 event->accept();
never executed (the execution status of this line is deduced): event->accept();
-
1967 } else {
never executed: }
0
1968 dd->dropIndicatorRect = QRect();
never executed (the execution status of this line is deduced): dd->dropIndicatorRect = QRect();
-
1969 }
never executed: }
0
1970 break;
never executed: break;
0
1971 case QAbstractItemView::BelowItem: -
1972 if (dd->isIndexDropEnabled(index.parent())) {
never evaluated: dd->isIndexDropEnabled(index.parent())
0
1973 dd->dropIndicatorRect = QRect(rect.right()+dd->spacing(), rect.top(), 0, rect.height());
never executed (the execution status of this line is deduced): dd->dropIndicatorRect = QRect(rect.right()+dd->spacing(), rect.top(), 0, rect.height());
-
1974 event->accept();
never executed (the execution status of this line is deduced): event->accept();
-
1975 } else {
never executed: }
0
1976 dd->dropIndicatorRect = QRect();
never executed (the execution status of this line is deduced): dd->dropIndicatorRect = QRect();
-
1977 }
never executed: }
0
1978 break;
never executed: break;
0
1979 case QAbstractItemView::OnItem: -
1980 if (dd->isIndexDropEnabled(index)) {
never evaluated: dd->isIndexDropEnabled(index)
0
1981 dd->dropIndicatorRect = rect;
never executed (the execution status of this line is deduced): dd->dropIndicatorRect = rect;
-
1982 event->accept();
never executed (the execution status of this line is deduced): event->accept();
-
1983 } else {
never executed: }
0
1984 dd->dropIndicatorRect = QRect();
never executed (the execution status of this line is deduced): dd->dropIndicatorRect = QRect();
-
1985 }
never executed: }
0
1986 break;
never executed: break;
0
1987 case QAbstractItemView::OnViewport: -
1988 dd->dropIndicatorRect = QRect();
never executed (the execution status of this line is deduced): dd->dropIndicatorRect = QRect();
-
1989 if (dd->isIndexDropEnabled(qq->rootIndex())) {
never evaluated: dd->isIndexDropEnabled(qq->rootIndex())
0
1990 event->accept(); // allow dropping in empty areas
never executed (the execution status of this line is deduced): event->accept();
-
1991 }
never executed: }
0
1992 break;
never executed: break;
0
1993 } -
1994 } else {
never executed: }
0
1995 dd->dropIndicatorRect = QRect();
never executed (the execution status of this line is deduced): dd->dropIndicatorRect = QRect();
-
1996 dd->dropIndicatorPosition = QAbstractItemView::OnViewport;
never executed (the execution status of this line is deduced): dd->dropIndicatorPosition = QAbstractItemView::OnViewport;
-
1997 if (dd->isIndexDropEnabled(qq->rootIndex())) {
never evaluated: dd->isIndexDropEnabled(qq->rootIndex())
0
1998 event->accept(); // allow dropping in empty areas
never executed (the execution status of this line is deduced): event->accept();
-
1999 }
never executed: }
0
2000 }
never executed: }
0
2001 dd->viewport->update();
never executed (the execution status of this line is deduced): dd->viewport->update();
-
2002 } // can decode
never executed: }
0
2003 -
2004 if (dd->shouldAutoScroll(event->pos()))
never evaluated: dd->shouldAutoScroll(event->pos())
0
2005 qq->startAutoScroll();
never executed: qq->startAutoScroll();
0
2006}
never executed: }
0
2007 -
2008/*! -
2009 If the event hasn't already been accepted, determines the index to drop on. -
2010 -
2011 if (row == -1 && col == -1) -
2012 // append to this drop index -
2013 else -
2014 // place at row, col in drop index -
2015 -
2016 If it returns true a drop can be done, and dropRow, dropCol and dropIndex reflects the position of the drop. -
2017 \internal -
2018 */ -
2019bool QListModeViewBase::dropOn(QDropEvent *event, int *dropRow, int *dropCol, QModelIndex *dropIndex) -
2020{ -
2021 if (event->isAccepted())
never evaluated: event->isAccepted()
0
2022 return false;
never executed: return false;
0
2023 -
2024 QModelIndex index;
never executed (the execution status of this line is deduced): QModelIndex index;
-
2025 if (dd->viewport->rect().contains(event->pos())) {
never evaluated: dd->viewport->rect().contains(event->pos())
0
2026 // can't use indexAt, doesn't account for spacing. -
2027 QPoint p = event->pos();
never executed (the execution status of this line is deduced): QPoint p = event->pos();
-
2028 QRect rect(p.x() + horizontalOffset(), p.y() + verticalOffset(), 1, 1);
never executed (the execution status of this line is deduced): QRect rect(p.x() + horizontalOffset(), p.y() + verticalOffset(), 1, 1);
-
2029 rect.adjust(-dd->spacing(), -dd->spacing(), dd->spacing(), dd->spacing());
never executed (the execution status of this line is deduced): rect.adjust(-dd->spacing(), -dd->spacing(), dd->spacing(), dd->spacing());
-
2030 const QVector<QModelIndex> intersectVector = dd->intersectingSet(rect);
never executed (the execution status of this line is deduced): const QVector<QModelIndex> intersectVector = dd->intersectingSet(rect);
-
2031 index = intersectVector.count() > 0
never evaluated: intersectVector.count() > 0
0
2032 ? intersectVector.last() : QModelIndex();
never executed (the execution status of this line is deduced): ? intersectVector.last() : QModelIndex();
-
2033 if (!index.isValid())
never evaluated: !index.isValid()
0
2034 index = dd->root;
never executed: index = dd->root;
0
2035 }
never executed: }
0
2036 -
2037 // If we are allowed to do the drop -
2038 if (dd->model->supportedDropActions() & event->dropAction()) {
never evaluated: dd->model->supportedDropActions() & event->dropAction()
0
2039 int row = -1;
never executed (the execution status of this line is deduced): int row = -1;
-
2040 int col = -1;
never executed (the execution status of this line is deduced): int col = -1;
-
2041 if (index != dd->root) {
never evaluated: index != dd->root
0
2042 dd->dropIndicatorPosition = position(event->pos(), qq->visualRect(index), index);
never executed (the execution status of this line is deduced): dd->dropIndicatorPosition = position(event->pos(), qq->visualRect(index), index);
-
2043 switch (dd->dropIndicatorPosition) { -
2044 case QAbstractItemView::AboveItem: -
2045 row = index.row();
never executed (the execution status of this line is deduced): row = index.row();
-
2046 col = index.column();
never executed (the execution status of this line is deduced): col = index.column();
-
2047 index = index.parent();
never executed (the execution status of this line is deduced): index = index.parent();
-
2048 break;
never executed: break;
0
2049 case QAbstractItemView::BelowItem: -
2050 row = index.row() + 1;
never executed (the execution status of this line is deduced): row = index.row() + 1;
-
2051 col = index.column();
never executed (the execution status of this line is deduced): col = index.column();
-
2052 index = index.parent();
never executed (the execution status of this line is deduced): index = index.parent();
-
2053 break;
never executed: break;
0
2054 case QAbstractItemView::OnItem: -
2055 case QAbstractItemView::OnViewport: -
2056 break;
never executed: break;
0
2057 } -
2058 } else {
never executed: }
0
2059 dd->dropIndicatorPosition = QAbstractItemView::OnViewport;
never executed (the execution status of this line is deduced): dd->dropIndicatorPosition = QAbstractItemView::OnViewport;
-
2060 }
never executed: }
0
2061 *dropIndex = index;
never executed (the execution status of this line is deduced): *dropIndex = index;
-
2062 *dropRow = row;
never executed (the execution status of this line is deduced): *dropRow = row;
-
2063 *dropCol = col;
never executed (the execution status of this line is deduced): *dropCol = col;
-
2064 if (!dd->droppingOnItself(event, index))
never evaluated: !dd->droppingOnItself(event, index)
0
2065 return true;
never executed: return true;
0
2066 }
never executed: }
0
2067 return false;
never executed: return false;
0
2068} -
2069 -
2070#endif //QT_NO_DRAGANDDROP -
2071 -
2072void QListModeViewBase::updateVerticalScrollBar(const QSize &step) -
2073{ -
2074 if (verticalScrollMode() == QAbstractItemView::ScrollPerItem
evaluated: verticalScrollMode() == QAbstractItemView::ScrollPerItem
TRUEFALSE
yes
Evaluation Count:1240
yes
Evaluation Count:10
10-1240
2075 && ((flow() == QListView::TopToBottom && !isWrapping())
evaluated: flow() == QListView::TopToBottom
TRUEFALSE
yes
Evaluation Count:1200
yes
Evaluation Count:40
evaluated: !isWrapping()
TRUEFALSE
yes
Evaluation Count:1083
yes
Evaluation Count:117
40-1200
2076 || (flow() == QListView::LeftToRight && isWrapping()))) {
evaluated: flow() == QListView::LeftToRight
TRUEFALSE
yes
Evaluation Count:40
yes
Evaluation Count:117
evaluated: isWrapping()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:37
3-117
2077 const int steps = (flow() == QListView::TopToBottom ? scrollValueMap : segmentPositions).count() - 1;
evaluated: flow() == QListView::TopToBottom
TRUEFALSE
yes
Evaluation Count:1083
yes
Evaluation Count:3
3-1083
2078 if (steps > 0) {
partially evaluated: steps > 0
TRUEFALSE
yes
Evaluation Count:1086
no
Evaluation Count:0
0-1086
2079 const int pageSteps = perItemScrollingPageSteps(viewport()->height(), contentsSize.height(), isWrapping());
executed (the execution status of this line is deduced): const int pageSteps = perItemScrollingPageSteps(viewport()->height(), contentsSize.height(), isWrapping());
-
2080 verticalScrollBar()->setSingleStep(1);
executed (the execution status of this line is deduced): verticalScrollBar()->setSingleStep(1);
-
2081 verticalScrollBar()->setPageStep(pageSteps);
executed (the execution status of this line is deduced): verticalScrollBar()->setPageStep(pageSteps);
-
2082 verticalScrollBar()->setRange(0, steps - pageSteps);
executed (the execution status of this line is deduced): verticalScrollBar()->setRange(0, steps - pageSteps);
-
2083 } else {
executed: }
Execution Count:1086
1086
2084 verticalScrollBar()->setRange(0, 0);
never executed (the execution status of this line is deduced): verticalScrollBar()->setRange(0, 0);
-
2085 }
never executed: }
0
2086 // } else if (vertical && d->isWrapping() && d->movement == Static) { -
2087 // ### wrapped scrolling in flow direction -
2088 } else { -
2089 QCommonListViewBase::updateVerticalScrollBar(step);
executed (the execution status of this line is deduced): QCommonListViewBase::updateVerticalScrollBar(step);
-
2090 }
executed: }
Execution Count:164
164
2091} -
2092 -
2093void QListModeViewBase::updateHorizontalScrollBar(const QSize &step) -
2094{ -
2095 if (horizontalScrollMode() == QAbstractItemView::ScrollPerItem
evaluated: horizontalScrollMode() == QAbstractItemView::ScrollPerItem
TRUEFALSE
yes
Evaluation Count:1238
yes
Evaluation Count:12
12-1238
2096 && ((flow() == QListView::TopToBottom && isWrapping())
evaluated: flow() == QListView::TopToBottom
TRUEFALSE
yes
Evaluation Count:1198
yes
Evaluation Count:40
evaluated: isWrapping()
TRUEFALSE
yes
Evaluation Count:117
yes
Evaluation Count:1081
40-1198
2097 || (flow() == QListView::LeftToRight && !isWrapping()))) {
evaluated: flow() == QListView::LeftToRight
TRUEFALSE
yes
Evaluation Count:40
yes
Evaluation Count:1081
evaluated: !isWrapping()
TRUEFALSE
yes
Evaluation Count:37
yes
Evaluation Count:3
3-1081
2098 int steps = (flow() == QListView::TopToBottom ? segmentPositions : scrollValueMap).count() - 1;
evaluated: flow() == QListView::TopToBottom
TRUEFALSE
yes
Evaluation Count:117
yes
Evaluation Count:37
37-117
2099 if (steps > 0) {
partially evaluated: steps > 0
TRUEFALSE
yes
Evaluation Count:154
no
Evaluation Count:0
0-154
2100 const int pageSteps = perItemScrollingPageSteps(viewport()->width(), contentsSize.width(), isWrapping());
executed (the execution status of this line is deduced): const int pageSteps = perItemScrollingPageSteps(viewport()->width(), contentsSize.width(), isWrapping());
-
2101 horizontalScrollBar()->setSingleStep(1);
executed (the execution status of this line is deduced): horizontalScrollBar()->setSingleStep(1);
-
2102 horizontalScrollBar()->setPageStep(pageSteps);
executed (the execution status of this line is deduced): horizontalScrollBar()->setPageStep(pageSteps);
-
2103 horizontalScrollBar()->setRange(0, steps - pageSteps);
executed (the execution status of this line is deduced): horizontalScrollBar()->setRange(0, steps - pageSteps);
-
2104 } else {
executed: }
Execution Count:154
154
2105 horizontalScrollBar()->setRange(0, 0);
never executed (the execution status of this line is deduced): horizontalScrollBar()->setRange(0, 0);
-
2106 }
never executed: }
0
2107 } else { -
2108 QCommonListViewBase::updateHorizontalScrollBar(step);
executed (the execution status of this line is deduced): QCommonListViewBase::updateHorizontalScrollBar(step);
-
2109 }
executed: }
Execution Count:1096
1096
2110} -
2111 -
2112int QListModeViewBase::verticalScrollToValue(int index, QListView::ScrollHint hint, -
2113 bool above, bool below, const QRect &area, const QRect &rect) const -
2114{ -
2115 if (verticalScrollMode() == QAbstractItemView::ScrollPerItem) {
evaluated: verticalScrollMode() == QAbstractItemView::ScrollPerItem
TRUEFALSE
yes
Evaluation Count:251
yes
Evaluation Count:34
34-251
2116 int value;
executed (the execution status of this line is deduced): int value;
-
2117 if (scrollValueMap.isEmpty()) {
partially evaluated: scrollValueMap.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:251
0-251
2118 value = 0;
never executed (the execution status of this line is deduced): value = 0;
-
2119 } else {
never executed: }
0
2120 int scrollBarValue = verticalScrollBar()->value();
executed (the execution status of this line is deduced): int scrollBarValue = verticalScrollBar()->value();
-
2121 int numHidden = 0;
executed (the execution status of this line is deduced): int numHidden = 0;
-
2122 for (int i = 0; i < flowPositions.count() - 1 && i <= scrollBarValue; ++i)
evaluated: i < flowPositions.count() - 1
TRUEFALSE
yes
Evaluation Count:2534
yes
Evaluation Count:2
evaluated: i <= scrollBarValue
TRUEFALSE
yes
Evaluation Count:2285
yes
Evaluation Count:249
2-2534
2123 if (isHidden(i))
evaluated: isHidden(i)
TRUEFALSE
yes
Evaluation Count:528
yes
Evaluation Count:1757
528-1757
2124 ++numHidden;
executed: ++numHidden;
Execution Count:528
528
2125 value = qBound(0, scrollValueMap.at(verticalScrollBar()->value()) - numHidden, flowPositions.count() - 1);
executed (the execution status of this line is deduced): value = qBound(0, scrollValueMap.at(verticalScrollBar()->value()) - numHidden, flowPositions.count() - 1);
-
2126 }
executed: }
Execution Count:251
251
2127 if (above)
evaluated: above
TRUEFALSE
yes
Evaluation Count:87
yes
Evaluation Count:164
87-164
2128 hint = QListView::PositionAtTop;
executed: hint = QListView::PositionAtTop;
Execution Count:87
87
2129 else if (below)
evaluated: below
TRUEFALSE
yes
Evaluation Count:151
yes
Evaluation Count:13
13-151
2130 hint = QListView::PositionAtBottom;
executed: hint = QListView::PositionAtBottom;
Execution Count:151
151
2131 if (hint == QListView::EnsureVisible)
evaluated: hint == QListView::EnsureVisible
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:249
2-249
2132 return value;
executed: return value;
Execution Count:2
2
2133 -
2134 return perItemScrollToValue(index, value, area.height(), hint, Qt::Vertical, isWrapping(), rect.height());
executed: return perItemScrollToValue(index, value, area.height(), hint, Qt::Vertical, isWrapping(), rect.height());
Execution Count:249
249
2135 } -
2136 -
2137 return QCommonListViewBase::verticalScrollToValue(index, hint, above, below, area, rect);
executed: return QCommonListViewBase::verticalScrollToValue(index, hint, above, below, area, rect);
Execution Count:34
34
2138} -
2139 -
2140int QListModeViewBase::horizontalOffset() const -
2141{ -
2142 if (horizontalScrollMode() == QAbstractItemView::ScrollPerItem) {
evaluated: horizontalScrollMode() == QAbstractItemView::ScrollPerItem
TRUEFALSE
yes
Evaluation Count:21670
yes
Evaluation Count:2552
2552-21670
2143 if (isWrapping()) {
evaluated: isWrapping()
TRUEFALSE
yes
Evaluation Count:3405
yes
Evaluation Count:18265
3405-18265
2144 if (flow() == QListView::TopToBottom && !segmentPositions.isEmpty()) {
evaluated: flow() == QListView::TopToBottom
TRUEFALSE
yes
Evaluation Count:2930
yes
Evaluation Count:475
evaluated: !segmentPositions.isEmpty()
TRUEFALSE
yes
Evaluation Count:2897
yes
Evaluation Count:33
33-2930
2145 const int max = segmentPositions.count() - 1;
executed (the execution status of this line is deduced): const int max = segmentPositions.count() - 1;
-
2146 int currentValue = qBound(0, horizontalScrollBar()->value(), max);
executed (the execution status of this line is deduced): int currentValue = qBound(0, horizontalScrollBar()->value(), max);
-
2147 int position = segmentPositions.at(currentValue);
executed (the execution status of this line is deduced): int position = segmentPositions.at(currentValue);
-
2148 int maximumValue = qBound(0, horizontalScrollBar()->maximum(), max);
executed (the execution status of this line is deduced): int maximumValue = qBound(0, horizontalScrollBar()->maximum(), max);
-
2149 int maximum = segmentPositions.at(maximumValue);
executed (the execution status of this line is deduced): int maximum = segmentPositions.at(maximumValue);
-
2150 return (isRightToLeft() ? maximum - position : position);
executed: return (isRightToLeft() ? maximum - position : position);
Execution Count:2897
2897
2151 } -
2152 } else if (flow() == QListView::LeftToRight && !flowPositions.isEmpty()) {
executed: }
Execution Count:508
evaluated: flow() == QListView::LeftToRight
TRUEFALSE
yes
Evaluation Count:4668
yes
Evaluation Count:13597
evaluated: !flowPositions.isEmpty()
TRUEFALSE
yes
Evaluation Count:4645
yes
Evaluation Count:23
23-13597
2153 int position = flowPositions.at(scrollValueMap.at(horizontalScrollBar()->value()));
executed (the execution status of this line is deduced): int position = flowPositions.at(scrollValueMap.at(horizontalScrollBar()->value()));
-
2154 int maximum = flowPositions.at(scrollValueMap.at(horizontalScrollBar()->maximum()));
executed (the execution status of this line is deduced): int maximum = flowPositions.at(scrollValueMap.at(horizontalScrollBar()->maximum()));
-
2155 return (isRightToLeft() ? maximum - position : position);
executed: return (isRightToLeft() ? maximum - position : position);
Execution Count:4645
4645
2156 } -
2157 } -
2158 return QCommonListViewBase::horizontalOffset();
executed: return QCommonListViewBase::horizontalOffset();
Execution Count:16680
16680
2159} -
2160 -
2161int QListModeViewBase::verticalOffset() const -
2162{ -
2163 if (verticalScrollMode() == QAbstractItemView::ScrollPerItem) {
evaluated: verticalScrollMode() == QAbstractItemView::ScrollPerItem
TRUEFALSE
yes
Evaluation Count:21743
yes
Evaluation Count:2479
2479-21743
2164 if (isWrapping()) {
evaluated: isWrapping()
TRUEFALSE
yes
Evaluation Count:3405
yes
Evaluation Count:18338
3405-18338
2165 if (flow() == QListView::LeftToRight && !segmentPositions.isEmpty()) {
evaluated: flow() == QListView::LeftToRight
TRUEFALSE
yes
Evaluation Count:475
yes
Evaluation Count:2930
partially evaluated: !segmentPositions.isEmpty()
TRUEFALSE
yes
Evaluation Count:475
no
Evaluation Count:0
0-2930
2166 int value = verticalScrollBar()->value();
executed (the execution status of this line is deduced): int value = verticalScrollBar()->value();
-
2167 if (value >= segmentPositions.count())
partially evaluated: value >= segmentPositions.count()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:475
0-475
2168 return 0;
never executed: return 0;
0
2169 return segmentPositions.at(value) - spacing();
executed: return segmentPositions.at(value) - spacing();
Execution Count:475
475
2170 } -
2171 } else if (flow() == QListView::TopToBottom && !flowPositions.isEmpty()) {
executed: }
Execution Count:2930
evaluated: flow() == QListView::TopToBottom
TRUEFALSE
yes
Evaluation Count:13670
yes
Evaluation Count:4668
evaluated: !flowPositions.isEmpty()
TRUEFALSE
yes
Evaluation Count:13094
yes
Evaluation Count:576
576-13670
2172 int value = verticalScrollBar()->value();
executed (the execution status of this line is deduced): int value = verticalScrollBar()->value();
-
2173 if (value > scrollValueMap.count())
partially evaluated: value > scrollValueMap.count()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13094
0-13094
2174 return 0;
never executed: return 0;
0
2175 return flowPositions.at(scrollValueMap.at(value)) - spacing();
executed: return flowPositions.at(scrollValueMap.at(value)) - spacing();
Execution Count:13094
13094
2176 } -
2177 } -
2178 return QCommonListViewBase::verticalOffset();
executed: return QCommonListViewBase::verticalOffset();
Execution Count:10653
10653
2179} -
2180 -
2181int QListModeViewBase::horizontalScrollToValue(int index, QListView::ScrollHint hint, -
2182 bool leftOf, bool rightOf, const QRect &area, const QRect &rect) const -
2183{ -
2184 if (horizontalScrollMode() != QAbstractItemView::ScrollPerItem)
partially evaluated: horizontalScrollMode() != QAbstractItemView::ScrollPerItem
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:140
0-140
2185 return QCommonListViewBase::horizontalScrollToValue(index, hint, leftOf, rightOf, area, rect);
never executed: return QCommonListViewBase::horizontalScrollToValue(index, hint, leftOf, rightOf, area, rect);
0
2186 -
2187 int value;
executed (the execution status of this line is deduced): int value;
-
2188 if (scrollValueMap.isEmpty())
partially evaluated: scrollValueMap.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:140
0-140
2189 value = 0;
never executed: value = 0;
0
2190 else -
2191 value = qBound(0, scrollValueMap.at(horizontalScrollBar()->value()), flowPositions.count() - 1);
executed: value = qBound(0, scrollValueMap.at(horizontalScrollBar()->value()), flowPositions.count() - 1);
Execution Count:140
140
2192 if (leftOf)
evaluated: leftOf
TRUEFALSE
yes
Evaluation Count:72
yes
Evaluation Count:68
68-72
2193 hint = QListView::PositionAtTop;
executed: hint = QListView::PositionAtTop;
Execution Count:72
72
2194 else if (rightOf)
evaluated: rightOf
TRUEFALSE
yes
Evaluation Count:67
yes
Evaluation Count:1
1-67
2195 hint = QListView::PositionAtBottom;
executed: hint = QListView::PositionAtBottom;
Execution Count:67
67
2196 if (hint == QListView::EnsureVisible)
partially evaluated: hint == QListView::EnsureVisible
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:140
0-140
2197 return value;
never executed: return value;
0
2198 -
2199 return perItemScrollToValue(index, value, area.width(), hint, Qt::Horizontal, isWrapping(), rect.width());
executed: return perItemScrollToValue(index, value, area.width(), hint, Qt::Horizontal, isWrapping(), rect.width());
Execution Count:140
140
2200} -
2201 -
2202void QListModeViewBase::scrollContentsBy(int dx, int dy, bool scrollElasticBand) -
2203{ -
2204 // ### reorder this logic -
2205 const int verticalValue = verticalScrollBar()->value();
executed (the execution status of this line is deduced): const int verticalValue = verticalScrollBar()->value();
-
2206 const int horizontalValue = horizontalScrollBar()->value();
executed (the execution status of this line is deduced): const int horizontalValue = horizontalScrollBar()->value();
-
2207 const bool vertical = (verticalScrollMode() == QAbstractItemView::ScrollPerItem);
executed (the execution status of this line is deduced): const bool vertical = (verticalScrollMode() == QAbstractItemView::ScrollPerItem);
-
2208 const bool horizontal = (horizontalScrollMode() == QAbstractItemView::ScrollPerItem);
executed (the execution status of this line is deduced): const bool horizontal = (horizontalScrollMode() == QAbstractItemView::ScrollPerItem);
-
2209 -
2210 if (isWrapping()) {
evaluated: isWrapping()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:439
4-439
2211 if (segmentPositions.isEmpty())
partially evaluated: segmentPositions.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
2212 return;
never executed: return;
0
2213 const int max = segmentPositions.count() - 1;
executed (the execution status of this line is deduced): const int max = segmentPositions.count() - 1;
-
2214 if (horizontal && flow() == QListView::TopToBottom && dx != 0) {
partially evaluated: horizontal
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
partially evaluated: flow() == QListView::TopToBottom
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
evaluated: dx != 0
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:1
0-4
2215 int currentValue = qBound(0, horizontalValue, max);
executed (the execution status of this line is deduced): int currentValue = qBound(0, horizontalValue, max);
-
2216 int previousValue = qBound(0, currentValue + dx, max);
executed (the execution status of this line is deduced): int previousValue = qBound(0, currentValue + dx, max);
-
2217 int currentCoordinate = segmentPositions.at(currentValue) - spacing();
executed (the execution status of this line is deduced): int currentCoordinate = segmentPositions.at(currentValue) - spacing();
-
2218 int previousCoordinate = segmentPositions.at(previousValue) - spacing();
executed (the execution status of this line is deduced): int previousCoordinate = segmentPositions.at(previousValue) - spacing();
-
2219 dx = previousCoordinate - currentCoordinate;
executed (the execution status of this line is deduced): dx = previousCoordinate - currentCoordinate;
-
2220 } else if (vertical && flow() == QListView::LeftToRight && dy != 0) {
executed: }
Execution Count:3
partially evaluated: vertical
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
partially evaluated: flow() == QListView::LeftToRight
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
never evaluated: dy != 0
0-3
2221 int currentValue = qBound(0, verticalValue, max);
never executed (the execution status of this line is deduced): int currentValue = qBound(0, verticalValue, max);
-
2222 int previousValue = qBound(0, currentValue + dy, max);
never executed (the execution status of this line is deduced): int previousValue = qBound(0, currentValue + dy, max);
-
2223 int currentCoordinate = segmentPositions.at(currentValue) - spacing();
never executed (the execution status of this line is deduced): int currentCoordinate = segmentPositions.at(currentValue) - spacing();
-
2224 int previousCoordinate = segmentPositions.at(previousValue) - spacing();
never executed (the execution status of this line is deduced): int previousCoordinate = segmentPositions.at(previousValue) - spacing();
-
2225 dy = previousCoordinate - currentCoordinate;
never executed (the execution status of this line is deduced): dy = previousCoordinate - currentCoordinate;
-
2226 }
never executed: }
0
2227 } else { -
2228 if (flowPositions.isEmpty())
partially evaluated: flowPositions.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:439
0-439
2229 return;
never executed: return;
0
2230 const int max = scrollValueMap.count() - 1;
executed (the execution status of this line is deduced): const int max = scrollValueMap.count() - 1;
-
2231 if (vertical && flow() == QListView::TopToBottom && dy != 0) {
evaluated: vertical
TRUEFALSE
yes
Evaluation Count:403
yes
Evaluation Count:36
evaluated: flow() == QListView::TopToBottom
TRUEFALSE
yes
Evaluation Count:255
yes
Evaluation Count:148
partially evaluated: dy != 0
TRUEFALSE
yes
Evaluation Count:255
no
Evaluation Count:0
0-403
2232 int currentValue = qBound(0, verticalValue, max);
executed (the execution status of this line is deduced): int currentValue = qBound(0, verticalValue, max);
-
2233 int previousValue = qBound(0, currentValue + dy, max);
executed (the execution status of this line is deduced): int previousValue = qBound(0, currentValue + dy, max);
-
2234 int currentCoordinate = flowPositions.at(scrollValueMap.at(currentValue));
executed (the execution status of this line is deduced): int currentCoordinate = flowPositions.at(scrollValueMap.at(currentValue));
-
2235 int previousCoordinate = flowPositions.at(scrollValueMap.at(previousValue));
executed (the execution status of this line is deduced): int previousCoordinate = flowPositions.at(scrollValueMap.at(previousValue));
-
2236 dy = previousCoordinate - currentCoordinate;
executed (the execution status of this line is deduced): dy = previousCoordinate - currentCoordinate;
-
2237 } else if (horizontal && flow() == QListView::LeftToRight && dx != 0) {
executed: }
Execution Count:255
evaluated: horizontal
TRUEFALSE
yes
Evaluation Count:148
yes
Evaluation Count:36
partially evaluated: flow() == QListView::LeftToRight
TRUEFALSE
yes
Evaluation Count:148
no
Evaluation Count:0
partially evaluated: dx != 0
TRUEFALSE
yes
Evaluation Count:148
no
Evaluation Count:0
0-255
2238 int currentValue = qBound(0, horizontalValue, max);
executed (the execution status of this line is deduced): int currentValue = qBound(0, horizontalValue, max);
-
2239 int previousValue = qBound(0, currentValue + dx, max);
executed (the execution status of this line is deduced): int previousValue = qBound(0, currentValue + dx, max);
-
2240 int currentCoordinate = flowPositions.at(scrollValueMap.at(currentValue));
executed (the execution status of this line is deduced): int currentCoordinate = flowPositions.at(scrollValueMap.at(currentValue));
-
2241 int previousCoordinate = flowPositions.at(scrollValueMap.at(previousValue));
executed (the execution status of this line is deduced): int previousCoordinate = flowPositions.at(scrollValueMap.at(previousValue));
-
2242 dx = previousCoordinate - currentCoordinate;
executed (the execution status of this line is deduced): dx = previousCoordinate - currentCoordinate;
-
2243 }
executed: }
Execution Count:148
148
2244 } -
2245 QCommonListViewBase::scrollContentsBy(dx, dy, scrollElasticBand);
executed (the execution status of this line is deduced): QCommonListViewBase::scrollContentsBy(dx, dy, scrollElasticBand);
-
2246}
executed: }
Execution Count:443
443
2247 -
2248bool QListModeViewBase::doBatchedItemLayout(const QListViewLayoutInfo &info, int max) -
2249{ -
2250 doStaticLayout(info);
executed (the execution status of this line is deduced): doStaticLayout(info);
-
2251 if (batchStartRow > max) { // stop items layout
evaluated: batchStartRow > max
TRUEFALSE
yes
Evaluation Count:936
yes
Evaluation Count:1
1-936
2252 flowPositions.resize(flowPositions.count());
executed (the execution status of this line is deduced): flowPositions.resize(flowPositions.count());
-
2253 segmentPositions.resize(segmentPositions.count());
executed (the execution status of this line is deduced): segmentPositions.resize(segmentPositions.count());
-
2254 segmentStartRows.resize(segmentStartRows.count());
executed (the execution status of this line is deduced): segmentStartRows.resize(segmentStartRows.count());
-
2255 return true; // done
executed: return true;
Execution Count:936
936
2256 } -
2257 return false; // not done
executed: return false;
Execution Count:1
1
2258} -
2259 -
2260QListViewItem QListModeViewBase::indexToListViewItem(const QModelIndex &index) const -
2261{ -
2262 if (flowPositions.isEmpty()
evaluated: flowPositions.isEmpty()
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:19593
6-19593
2263 || segmentPositions.isEmpty()
partially evaluated: segmentPositions.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:19593
0-19593
2264 || index.row() >= flowPositions.count())
partially evaluated: index.row() >= flowPositions.count()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:19593
0-19593
2265 return QListViewItem();
executed: return QListViewItem();
Execution Count:6
6
2266 -
2267 const int segment = qBinarySearch<int>(segmentStartRows, index.row(),
executed (the execution status of this line is deduced): const int segment = qBinarySearch<int>(segmentStartRows, index.row(),
-
2268 0, segmentStartRows.count() - 1);
executed (the execution status of this line is deduced): 0, segmentStartRows.count() - 1);
-
2269 -
2270 -
2271 QStyleOptionViewItem options = viewOptions();
executed (the execution status of this line is deduced): QStyleOptionViewItem options = viewOptions();
-
2272 options.rect.setSize(contentsSize);
executed (the execution status of this line is deduced): options.rect.setSize(contentsSize);
-
2273 QSize size = (uniformItemSizes() && cachedItemSize().isValid())
evaluated: uniformItemSizes()
TRUEFALSE
yes
Evaluation Count:493
yes
Evaluation Count:19100
partially evaluated: cachedItemSize().isValid()
TRUEFALSE
yes
Evaluation Count:493
no
Evaluation Count:0
0-19100
2274 ? cachedItemSize() : itemSize(options, index);
executed (the execution status of this line is deduced): ? cachedItemSize() : itemSize(options, index);
-
2275 -
2276 QPoint pos;
executed (the execution status of this line is deduced): QPoint pos;
-
2277 if (flow() == QListView::LeftToRight) {
evaluated: flow() == QListView::LeftToRight
TRUEFALSE
yes
Evaluation Count:4474
yes
Evaluation Count:15119
4474-15119
2278 pos.setX(flowPositions.at(index.row()));
executed (the execution status of this line is deduced): pos.setX(flowPositions.at(index.row()));
-
2279 pos.setY(segmentPositions.at(segment));
executed (the execution status of this line is deduced): pos.setY(segmentPositions.at(segment));
-
2280 } else { // TopToBottom
executed: }
Execution Count:4474
4474
2281 pos.setY(flowPositions.at(index.row()));
executed (the execution status of this line is deduced): pos.setY(flowPositions.at(index.row()));
-
2282 pos.setX(segmentPositions.at(segment));
executed (the execution status of this line is deduced): pos.setX(segmentPositions.at(segment));
-
2283 if (isWrapping()) { // make the items as wide as the segment
evaluated: isWrapping()
TRUEFALSE
yes
Evaluation Count:2664
yes
Evaluation Count:12455
2664-12455
2284 int right = (segment + 1 >= segmentPositions.count()
partially evaluated: segment + 1 >= segmentPositions.count()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2664
0-2664
2285 ? contentsSize.width()
executed (the execution status of this line is deduced): ? contentsSize.width()
-
2286 : segmentPositions.at(segment + 1));
executed (the execution status of this line is deduced): : segmentPositions.at(segment + 1));
-
2287 size.setWidth(right - pos.x());
executed (the execution status of this line is deduced): size.setWidth(right - pos.x());
-
2288 } else { // make the items as wide as the viewport
executed: }
Execution Count:2664
2664
2289 size.setWidth(qMax(size.width(), viewport()->width() - 2 * spacing()));
executed (the execution status of this line is deduced): size.setWidth(qMax(size.width(), viewport()->width() - 2 * spacing()));
-
2290 }
executed: }
Execution Count:12455
12455
2291 } -
2292 -
2293 return QListViewItem(QRect(pos, size), index.row());
executed: return QListViewItem(QRect(pos, size), index.row());
Execution Count:19593
19593
2294} -
2295 -
2296QPoint QListModeViewBase::initStaticLayout(const QListViewLayoutInfo &info) -
2297{ -
2298 int x, y;
executed (the execution status of this line is deduced): int x, y;
-
2299 if (info.first == 0) {
evaluated: info.first == 0
TRUEFALSE
yes
Evaluation Count:936
yes
Evaluation Count:1
1-936
2300 flowPositions.clear();
executed (the execution status of this line is deduced): flowPositions.clear();
-
2301 segmentPositions.clear();
executed (the execution status of this line is deduced): segmentPositions.clear();
-
2302 segmentStartRows.clear();
executed (the execution status of this line is deduced): segmentStartRows.clear();
-
2303 segmentExtents.clear();
executed (the execution status of this line is deduced): segmentExtents.clear();
-
2304 scrollValueMap.clear();
executed (the execution status of this line is deduced): scrollValueMap.clear();
-
2305 x = info.bounds.left() + info.spacing;
executed (the execution status of this line is deduced): x = info.bounds.left() + info.spacing;
-
2306 y = info.bounds.top() + info.spacing;
executed (the execution status of this line is deduced): y = info.bounds.top() + info.spacing;
-
2307 segmentPositions.append(info.flow == QListView::LeftToRight ? y : x);
executed (the execution status of this line is deduced): segmentPositions.append(info.flow == QListView::LeftToRight ? y : x);
-
2308 segmentStartRows.append(0);
executed (the execution status of this line is deduced): segmentStartRows.append(0);
-
2309 } else if (info.wrap) {
executed: }
Execution Count:936
partially evaluated: info.wrap
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-936
2310 if (info.flow == QListView::LeftToRight) {
never evaluated: info.flow == QListView::LeftToRight
0
2311 x = batchSavedPosition;
never executed (the execution status of this line is deduced): x = batchSavedPosition;
-
2312 y = segmentPositions.last();
never executed (the execution status of this line is deduced): y = segmentPositions.last();
-
2313 } else { // flow == QListView::TopToBottom
never executed: }
0
2314 x = segmentPositions.last();
never executed (the execution status of this line is deduced): x = segmentPositions.last();
-
2315 y = batchSavedPosition;
never executed (the execution status of this line is deduced): y = batchSavedPosition;
-
2316 }
never executed: }
0
2317 } else { // not first and not wrap -
2318 if (info.flow == QListView::LeftToRight) {
partially evaluated: info.flow == QListView::LeftToRight
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
2319 x = batchSavedPosition;
never executed (the execution status of this line is deduced): x = batchSavedPosition;
-
2320 y = info.bounds.top() + info.spacing;
never executed (the execution status of this line is deduced): y = info.bounds.top() + info.spacing;
-
2321 } else { // flow == QListView::TopToBottom
never executed: }
0
2322 x = info.bounds.left() + info.spacing;
executed (the execution status of this line is deduced): x = info.bounds.left() + info.spacing;
-
2323 y = batchSavedPosition;
executed (the execution status of this line is deduced): y = batchSavedPosition;
-
2324 }
executed: }
Execution Count:1
1
2325 } -
2326 return QPoint(x, y);
executed: return QPoint(x, y);
Execution Count:937
937
2327} -
2328 -
2329/*! -
2330 \internal -
2331*/ -
2332void QListModeViewBase::doStaticLayout(const QListViewLayoutInfo &info) -
2333{ -
2334 const bool useItemSize = !info.grid.isValid();
executed (the execution status of this line is deduced): const bool useItemSize = !info.grid.isValid();
-
2335 const QPoint topLeft = initStaticLayout(info);
executed (the execution status of this line is deduced): const QPoint topLeft = initStaticLayout(info);
-
2336 QStyleOptionViewItem option = viewOptions();
executed (the execution status of this line is deduced): QStyleOptionViewItem option = viewOptions();
-
2337 option.rect = info.bounds;
executed (the execution status of this line is deduced): option.rect = info.bounds;
-
2338 option.rect.adjust(info.spacing, info.spacing, -info.spacing, -info.spacing);
executed (the execution status of this line is deduced): option.rect.adjust(info.spacing, info.spacing, -info.spacing, -info.spacing);
-
2339 -
2340 // The static layout data structures are as follows: -
2341 // One vector contains the coordinate in the direction of layout flow. -
2342 // Another vector contains the coordinates of the segments. -
2343 // A third vector contains the index (model row) of the first item -
2344 // of each segment. -
2345 -
2346 int segStartPosition;
executed (the execution status of this line is deduced): int segStartPosition;
-
2347 int segEndPosition;
executed (the execution status of this line is deduced): int segEndPosition;
-
2348 int deltaFlowPosition;
executed (the execution status of this line is deduced): int deltaFlowPosition;
-
2349 int deltaSegPosition;
executed (the execution status of this line is deduced): int deltaSegPosition;
-
2350 int deltaSegHint;
executed (the execution status of this line is deduced): int deltaSegHint;
-
2351 int flowPosition;
executed (the execution status of this line is deduced): int flowPosition;
-
2352 int segPosition;
executed (the execution status of this line is deduced): int segPosition;
-
2353 -
2354 if (info.flow == QListView::LeftToRight) {
evaluated: info.flow == QListView::LeftToRight
TRUEFALSE
yes
Evaluation Count:28
yes
Evaluation Count:909
28-909
2355 segStartPosition = info.bounds.left();
executed (the execution status of this line is deduced): segStartPosition = info.bounds.left();
-
2356 segEndPosition = info.bounds.width();
executed (the execution status of this line is deduced): segEndPosition = info.bounds.width();
-
2357 flowPosition = topLeft.x();
executed (the execution status of this line is deduced): flowPosition = topLeft.x();
-
2358 segPosition = topLeft.y();
executed (the execution status of this line is deduced): segPosition = topLeft.y();
-
2359 deltaFlowPosition = info.grid.width(); // dx
executed (the execution status of this line is deduced): deltaFlowPosition = info.grid.width();
-
2360 deltaSegPosition = useItemSize ? batchSavedDeltaSeg : info.grid.height(); // dy
evaluated: useItemSize
TRUEFALSE
yes
Evaluation Count:27
yes
Evaluation Count:1
1-27
2361 deltaSegHint = info.grid.height();
executed (the execution status of this line is deduced): deltaSegHint = info.grid.height();
-
2362 } else { // flow == QListView::TopToBottom
executed: }
Execution Count:28
28
2363 segStartPosition = info.bounds.top();
executed (the execution status of this line is deduced): segStartPosition = info.bounds.top();
-
2364 segEndPosition = info.bounds.height();
executed (the execution status of this line is deduced): segEndPosition = info.bounds.height();
-
2365 flowPosition = topLeft.y();
executed (the execution status of this line is deduced): flowPosition = topLeft.y();
-
2366 segPosition = topLeft.x();
executed (the execution status of this line is deduced): segPosition = topLeft.x();
-
2367 deltaFlowPosition = info.grid.height(); // dy
executed (the execution status of this line is deduced): deltaFlowPosition = info.grid.height();
-
2368 deltaSegPosition = useItemSize ? batchSavedDeltaSeg : info.grid.width(); // dx
evaluated: useItemSize
TRUEFALSE
yes
Evaluation Count:908
yes
Evaluation Count:1
1-908
2369 deltaSegHint = info.grid.width();
executed (the execution status of this line is deduced): deltaSegHint = info.grid.width();
-
2370 }
executed: }
Execution Count:909
909
2371 -
2372 for (int row = info.first; row <= info.last; ++row) {
evaluated: row <= info.last
TRUEFALSE
yes
Evaluation Count:36280
yes
Evaluation Count:937
937-36280
2373 if (isHidden(row)) { // ###
evaluated: isHidden(row)
TRUEFALSE
yes
Evaluation Count:631
yes
Evaluation Count:35649
631-35649
2374 flowPositions.append(flowPosition);
executed (the execution status of this line is deduced): flowPositions.append(flowPosition);
-
2375 } else {
executed: }
Execution Count:631
631
2376 // if we are not using a grid, we need to find the deltas -
2377 if (useItemSize) {
evaluated: useItemSize
TRUEFALSE
yes
Evaluation Count:35609
yes
Evaluation Count:40
40-35609
2378 QSize hint = itemSize(option, modelIndex(row));
executed (the execution status of this line is deduced): QSize hint = itemSize(option, modelIndex(row));
-
2379 if (info.flow == QListView::LeftToRight) {
evaluated: info.flow == QListView::LeftToRight
TRUEFALSE
yes
Evaluation Count:852
yes
Evaluation Count:34757
852-34757
2380 deltaFlowPosition = hint.width() + info.spacing;
executed (the execution status of this line is deduced): deltaFlowPosition = hint.width() + info.spacing;
-
2381 deltaSegHint = hint.height() + info.spacing;
executed (the execution status of this line is deduced): deltaSegHint = hint.height() + info.spacing;
-
2382 } else { // TopToBottom
executed: }
Execution Count:852
852
2383 deltaFlowPosition = hint.height() + info.spacing;
executed (the execution status of this line is deduced): deltaFlowPosition = hint.height() + info.spacing;
-
2384 deltaSegHint = hint.width() + info.spacing;
executed (the execution status of this line is deduced): deltaSegHint = hint.width() + info.spacing;
-
2385 }
executed: }
Execution Count:34757
34757
2386 } -
2387 // create new segment -
2388 if (info.wrap && (flowPosition + deltaFlowPosition >= segEndPosition)) {
evaluated: info.wrap
TRUEFALSE
yes
Evaluation Count:15032
yes
Evaluation Count:20617
evaluated: (flowPosition + deltaFlowPosition >= segEndPosition)
TRUEFALSE
yes
Evaluation Count:925
yes
Evaluation Count:14107
925-20617
2389 segmentExtents.append(flowPosition);
executed (the execution status of this line is deduced): segmentExtents.append(flowPosition);
-
2390 flowPosition = info.spacing + segStartPosition;
executed (the execution status of this line is deduced): flowPosition = info.spacing + segStartPosition;
-
2391 segPosition += deltaSegPosition;
executed (the execution status of this line is deduced): segPosition += deltaSegPosition;
-
2392 if (info.wrap)
partially evaluated: info.wrap
TRUEFALSE
yes
Evaluation Count:925
no
Evaluation Count:0
0-925
2393 segPosition += info.spacing;
executed: segPosition += info.spacing;
Execution Count:925
925
2394 segmentPositions.append(segPosition);
executed (the execution status of this line is deduced): segmentPositions.append(segPosition);
-
2395 segmentStartRows.append(row);
executed (the execution status of this line is deduced): segmentStartRows.append(row);
-
2396 deltaSegPosition = 0;
executed (the execution status of this line is deduced): deltaSegPosition = 0;
-
2397 }
executed: }
Execution Count:925
925
2398 // save the flow position of this item -
2399 scrollValueMap.append(flowPositions.count());
executed (the execution status of this line is deduced): scrollValueMap.append(flowPositions.count());
-
2400 flowPositions.append(flowPosition);
executed (the execution status of this line is deduced): flowPositions.append(flowPosition);
-
2401 // prepare for the next item -
2402 deltaSegPosition = qMax(deltaSegHint, deltaSegPosition);
executed (the execution status of this line is deduced): deltaSegPosition = qMax(deltaSegHint, deltaSegPosition);
-
2403 flowPosition += info.spacing + deltaFlowPosition;
executed (the execution status of this line is deduced): flowPosition += info.spacing + deltaFlowPosition;
-
2404 }
executed: }
Execution Count:35649
35649
2405 } -
2406 // used when laying out next batch -
2407 batchSavedPosition = flowPosition;
executed (the execution status of this line is deduced): batchSavedPosition = flowPosition;
-
2408 batchSavedDeltaSeg = deltaSegPosition;
executed (the execution status of this line is deduced): batchSavedDeltaSeg = deltaSegPosition;
-
2409 batchStartRow = info.last + 1;
executed (the execution status of this line is deduced): batchStartRow = info.last + 1;
-
2410 if (info.last == info.max)
evaluated: info.last == info.max
TRUEFALSE
yes
Evaluation Count:936
yes
Evaluation Count:1
1-936
2411 flowPosition -= info.spacing; // remove extra spacing
executed: flowPosition -= info.spacing;
Execution Count:936
936
2412 // set the contents size -
2413 QRect rect = info.bounds;
executed (the execution status of this line is deduced): QRect rect = info.bounds;
-
2414 if (info.flow == QListView::LeftToRight) {
evaluated: info.flow == QListView::LeftToRight
TRUEFALSE
yes
Evaluation Count:28
yes
Evaluation Count:909
28-909
2415 rect.setRight(segmentPositions.count() == 1 ? flowPosition : info.bounds.right());
executed (the execution status of this line is deduced): rect.setRight(segmentPositions.count() == 1 ? flowPosition : info.bounds.right());
-
2416 rect.setBottom(segPosition + deltaSegPosition);
executed (the execution status of this line is deduced): rect.setBottom(segPosition + deltaSegPosition);
-
2417 } else { // TopToBottom
executed: }
Execution Count:28
28
2418 rect.setRight(segPosition + deltaSegPosition);
executed (the execution status of this line is deduced): rect.setRight(segPosition + deltaSegPosition);
-
2419 rect.setBottom(segmentPositions.count() == 1 ? flowPosition : info.bounds.bottom());
executed (the execution status of this line is deduced): rect.setBottom(segmentPositions.count() == 1 ? flowPosition : info.bounds.bottom());
-
2420 }
executed: }
Execution Count:909
909
2421 contentsSize = QSize(rect.right(), rect.bottom());
executed (the execution status of this line is deduced): contentsSize = QSize(rect.right(), rect.bottom());
-
2422 // if it is the last batch, save the end of the segments -
2423 if (info.last == info.max) {
evaluated: info.last == info.max
TRUEFALSE
yes
Evaluation Count:936
yes
Evaluation Count:1
1-936
2424 segmentExtents.append(flowPosition);
executed (the execution status of this line is deduced): segmentExtents.append(flowPosition);
-
2425 scrollValueMap.append(flowPositions.count());
executed (the execution status of this line is deduced): scrollValueMap.append(flowPositions.count());
-
2426 flowPositions.append(flowPosition);
executed (the execution status of this line is deduced): flowPositions.append(flowPosition);
-
2427 segmentPositions.append(info.wrap ? segPosition + deltaSegPosition : INT_MAX);
executed (the execution status of this line is deduced): segmentPositions.append(info.wrap ? segPosition + deltaSegPosition : 2147483647);
-
2428 }
executed: }
Execution Count:936
936
2429 // if the new items are visble, update the viewport -
2430 QRect changedRect(topLeft, rect.bottomRight());
executed (the execution status of this line is deduced): QRect changedRect(topLeft, rect.bottomRight());
-
2431 if (clipRect().intersects(changedRect))
evaluated: clipRect().intersects(changedRect)
TRUEFALSE
yes
Evaluation Count:374
yes
Evaluation Count:563
374-563
2432 viewport()->update();
executed: viewport()->update();
Execution Count:374
374
2433}
executed: }
Execution Count:937
937
2434 -
2435/*! -
2436 \internal -
2437 Finds the set of items intersecting with \a area. -
2438 In this function, itemsize is counted from topleft to the start of the next item. -
2439*/ -
2440QVector<QModelIndex> QListModeViewBase::intersectingSet(const QRect &area) const -
2441{ -
2442 QVector<QModelIndex> ret;
executed (the execution status of this line is deduced): QVector<QModelIndex> ret;
-
2443 int segStartPosition;
executed (the execution status of this line is deduced): int segStartPosition;
-
2444 int segEndPosition;
executed (the execution status of this line is deduced): int segEndPosition;
-
2445 int flowStartPosition;
executed (the execution status of this line is deduced): int flowStartPosition;
-
2446 int flowEndPosition;
executed (the execution status of this line is deduced): int flowEndPosition;
-
2447 if (flow() == QListView::LeftToRight) {
evaluated: flow() == QListView::LeftToRight
TRUEFALSE
yes
Evaluation Count:741
yes
Evaluation Count:2652
741-2652
2448 segStartPosition = area.top();
executed (the execution status of this line is deduced): segStartPosition = area.top();
-
2449 segEndPosition = area.bottom();
executed (the execution status of this line is deduced): segEndPosition = area.bottom();
-
2450 flowStartPosition = area.left();
executed (the execution status of this line is deduced): flowStartPosition = area.left();
-
2451 flowEndPosition = area.right();
executed (the execution status of this line is deduced): flowEndPosition = area.right();
-
2452 } else {
executed: }
Execution Count:741
741
2453 segStartPosition = area.left();
executed (the execution status of this line is deduced): segStartPosition = area.left();
-
2454 segEndPosition = area.right();
executed (the execution status of this line is deduced): segEndPosition = area.right();
-
2455 flowStartPosition = area.top();
executed (the execution status of this line is deduced): flowStartPosition = area.top();
-
2456 flowEndPosition = area.bottom();
executed (the execution status of this line is deduced): flowEndPosition = area.bottom();
-
2457 }
executed: }
Execution Count:2652
2652
2458 if (segmentPositions.count() < 2 || flowPositions.isEmpty())
evaluated: segmentPositions.count() < 2
TRUEFALSE
yes
Evaluation Count:83
yes
Evaluation Count:3310
partially evaluated: flowPositions.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3310
0-3310
2459 return ret;
executed: return ret;
Execution Count:83
83
2460 // the last segment position is actually the edge of the last segment -
2461 const int segLast = segmentPositions.count() - 2;
executed (the execution status of this line is deduced): const int segLast = segmentPositions.count() - 2;
-
2462 int seg = qBinarySearch<int>(segmentPositions, segStartPosition, 0, segLast + 1);
executed (the execution status of this line is deduced): int seg = qBinarySearch<int>(segmentPositions, segStartPosition, 0, segLast + 1);
-
2463 for (; seg <= segLast && segmentPositions.at(seg) <= segEndPosition; ++seg) {
evaluated: seg <= segLast
TRUEFALSE
yes
Evaluation Count:3536
yes
Evaluation Count:3246
evaluated: segmentPositions.at(seg) <= segEndPosition
TRUEFALSE
yes
Evaluation Count:3472
yes
Evaluation Count:64
64-3536
2464 int first = segmentStartRows.at(seg);
executed (the execution status of this line is deduced): int first = segmentStartRows.at(seg);
-
2465 int last = (seg < segLast ? segmentStartRows.at(seg + 1) : batchStartRow) - 1;
evaluated: seg < segLast
TRUEFALSE
yes
Evaluation Count:231
yes
Evaluation Count:3241
231-3241
2466 if (segmentExtents.at(seg) < flowStartPosition)
evaluated: segmentExtents.at(seg) < flowStartPosition
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:3461
11-3461
2467 continue;
executed: continue;
Execution Count:11
11
2468 int row = qBinarySearch<int>(flowPositions, flowStartPosition, first, last);
executed (the execution status of this line is deduced): int row = qBinarySearch<int>(flowPositions, flowStartPosition, first, last);
-
2469 for (; row <= last && flowPositions.at(row) <= flowEndPosition; ++row) {
evaluated: row <= last
TRUEFALSE
yes
Evaluation Count:15243
yes
Evaluation Count:560
evaluated: flowPositions.at(row) <= flowEndPosition
TRUEFALSE
yes
Evaluation Count:12342
yes
Evaluation Count:2901
560-15243
2470 if (isHidden(row))
evaluated: isHidden(row)
TRUEFALSE
yes
Evaluation Count:1679
yes
Evaluation Count:10663
1679-10663
2471 continue;
executed: continue;
Execution Count:1679
1679
2472 QModelIndex index = modelIndex(row);
executed (the execution status of this line is deduced): QModelIndex index = modelIndex(row);
-
2473 if (index.isValid())
partially evaluated: index.isValid()
TRUEFALSE
yes
Evaluation Count:10663
no
Evaluation Count:0
0-10663
2474 ret += index;
executed: ret += index;
Execution Count:10663
10663
2475#if 0 // for debugging -
2476 else -
2477 qWarning("intersectingSet: row %d was invalid", row); -
2478#endif -
2479 }
executed: }
Execution Count:10663
10663
2480 }
executed: }
Execution Count:3461
3461
2481 return ret;
executed: return ret;
Execution Count:3310
3310
2482} -
2483 -
2484void QListModeViewBase::dataChanged(const QModelIndex &, const QModelIndex &) -
2485{ -
2486 dd->doDelayedItemsLayout();
executed (the execution status of this line is deduced): dd->doDelayedItemsLayout();
-
2487}
executed: }
Execution Count:3979
3979
2488 -
2489 -
2490QRect QListModeViewBase::mapToViewport(const QRect &rect) const -
2491{ -
2492 if (isWrapping())
evaluated: isWrapping()
TRUEFALSE
yes
Evaluation Count:3096
yes
Evaluation Count:15146
3096-15146
2493 return rect;
executed: return rect;
Execution Count:3096
3096
2494 // If the listview is in "listbox-mode", the items are as wide as the view. -
2495 // But we don't shrink the items. -
2496 QRect result = rect;
executed (the execution status of this line is deduced): QRect result = rect;
-
2497 if (flow() == QListView::TopToBottom) {
evaluated: flow() == QListView::TopToBottom
TRUEFALSE
yes
Evaluation Count:11630
yes
Evaluation Count:3516
3516-11630
2498 result.setLeft(spacing());
executed (the execution status of this line is deduced): result.setLeft(spacing());
-
2499 result.setWidth(qMax(rect.width(), qMax(contentsSize.width(), viewport()->width()) - 2 * spacing()));
executed (the execution status of this line is deduced): result.setWidth(qMax(rect.width(), qMax(contentsSize.width(), viewport()->width()) - 2 * spacing()));
-
2500 } else { // LeftToRight
executed: }
Execution Count:11630
11630
2501 result.setTop(spacing());
executed (the execution status of this line is deduced): result.setTop(spacing());
-
2502 result.setHeight(qMax(rect.height(), qMax(contentsSize.height(), viewport()->height()) - 2 * spacing()));
executed (the execution status of this line is deduced): result.setHeight(qMax(rect.height(), qMax(contentsSize.height(), viewport()->height()) - 2 * spacing()));
-
2503 }
executed: }
Execution Count:3516
3516
2504 return result;
executed: return result;
Execution Count:15146
15146
2505} -
2506 -
2507int QListModeViewBase::perItemScrollingPageSteps(int length, int bounds, bool wrap) const -
2508{ -
2509 QVector<int> positions;
executed (the execution status of this line is deduced): QVector<int> positions;
-
2510 if (wrap)
evaluated: wrap
TRUEFALSE
yes
Evaluation Count:120
yes
Evaluation Count:1120
120-1120
2511 positions = segmentPositions;
executed: positions = segmentPositions;
Execution Count:120
120
2512 else if (!flowPositions.isEmpty()) {
evaluated: !flowPositions.isEmpty()
TRUEFALSE
yes
Evaluation Count:1118
yes
Evaluation Count:2
2-1118
2513 positions.reserve(scrollValueMap.size());
executed (the execution status of this line is deduced): positions.reserve(scrollValueMap.size());
-
2514 foreach (int itemShown, scrollValueMap)
executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(scrollValueMap)> _container_(scrollValueMap); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (int itemShown = *_container_.i;; __extension__ ({--_container_.brk; break;}))
-
2515 positions.append(flowPositions.at(itemShown));
executed: positions.append(flowPositions.at(itemShown));
Execution Count:29227
29227
2516 }
executed: }
Execution Count:1118
1118
2517 if (positions.isEmpty() || bounds <= length)
evaluated: positions.isEmpty()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1238
evaluated: bounds <= length
TRUEFALSE
yes
Evaluation Count:372
yes
Evaluation Count:866
2-1238
2518 return positions.count();
executed: return positions.count();
Execution Count:374
374
2519 if (uniformItemSizes()) {
evaluated: uniformItemSizes()
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:852
14-852
2520 for (int i = 1; i < positions.count(); ++i)
partially evaluated: i < positions.count()
TRUEFALSE
yes
Evaluation Count:14
no
Evaluation Count:0
0-14
2521 if (positions.at(i) > 0)
partially evaluated: positions.at(i) > 0
TRUEFALSE
yes
Evaluation Count:14
no
Evaluation Count:0
0-14
2522 return length / positions.at(i);
executed: return length / positions.at(i);
Execution Count:14
14
2523 return 0; // all items had height 0
never executed: return 0;
0
2524 } -
2525 int pageSteps = 0;
executed (the execution status of this line is deduced): int pageSteps = 0;
-
2526 int steps = positions.count() - 1;
executed (the execution status of this line is deduced): int steps = positions.count() - 1;
-
2527 int max = qMax(length, bounds);
executed (the execution status of this line is deduced): int max = qMax(length, bounds);
-
2528 int min = qMin(length, bounds);
executed (the execution status of this line is deduced): int min = qMin(length, bounds);
-
2529 int pos = min - (max - positions.last());
executed (the execution status of this line is deduced): int pos = min - (max - positions.last());
-
2530 -
2531 while (pos >= 0 && steps > 0) {
evaluated: pos >= 0
TRUEFALSE
yes
Evaluation Count:3691
yes
Evaluation Count:852
partially evaluated: steps > 0
TRUEFALSE
yes
Evaluation Count:3691
no
Evaluation Count:0
0-3691
2532 pos -= (positions.at(steps) - positions.at(steps - 1));
executed (the execution status of this line is deduced): pos -= (positions.at(steps) - positions.at(steps - 1));
-
2533 if (pos >= 0) //this item should be visible
evaluated: pos >= 0
TRUEFALSE
yes
Evaluation Count:2839
yes
Evaluation Count:852
852-2839
2534 ++pageSteps;
executed: ++pageSteps;
Execution Count:2839
2839
2535 --steps;
executed (the execution status of this line is deduced): --steps;
-
2536 }
executed: }
Execution Count:3691
3691
2537 -
2538 // at this point we know that positions has at least one entry -
2539 return qMax(pageSteps, 1);
executed: return qMax(pageSteps, 1);
Execution Count:852
852
2540} -
2541 -
2542int QListModeViewBase::perItemScrollToValue(int index, int scrollValue, int viewportSize, -
2543 QAbstractItemView::ScrollHint hint, -
2544 Qt::Orientation orientation, bool wrap, int itemExtent) const -
2545{ -
2546 if (index < 0)
partially evaluated: index < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:389
0-389
2547 return scrollValue;
never executed: return scrollValue;
0
2548 -
2549 itemExtent += spacing();
executed (the execution status of this line is deduced): itemExtent += spacing();
-
2550 QVector<int> visibleFlowPositions;
executed (the execution status of this line is deduced): QVector<int> visibleFlowPositions;
-
2551 visibleFlowPositions.reserve(flowPositions.count() - 1);
executed (the execution status of this line is deduced): visibleFlowPositions.reserve(flowPositions.count() - 1);
-
2552 for (int i = 0; i < flowPositions.count() - 1; i++) { // flowPositions count is +1 larger than actual row count
evaluated: i < flowPositions.count() - 1
TRUEFALSE
yes
Evaluation Count:17381
yes
Evaluation Count:389
389-17381
2553 if (!isHidden(i))
evaluated: !isHidden(i)
TRUEFALSE
yes
Evaluation Count:11102
yes
Evaluation Count:6279
6279-11102
2554 visibleFlowPositions.append(flowPositions.at(i));
executed: visibleFlowPositions.append(flowPositions.at(i));
Execution Count:11102
11102
2555 }
executed: }
Execution Count:17381
17381
2556 -
2557 if (!wrap) {
evaluated: !wrap
TRUEFALSE
yes
Evaluation Count:384
yes
Evaluation Count:5
5-384
2558 int topIndex = index;
executed (the execution status of this line is deduced): int topIndex = index;
-
2559 const int bottomIndex = topIndex;
executed (the execution status of this line is deduced): const int bottomIndex = topIndex;
-
2560 const int bottomCoordinate = visibleFlowPositions.at(index);
executed (the execution status of this line is deduced): const int bottomCoordinate = visibleFlowPositions.at(index);
-
2561 -
2562 while (topIndex > 0 &&
evaluated: topIndex > 0
TRUEFALSE
yes
Evaluation Count:2609
yes
Evaluation Count:95
95-2609
2563 (bottomCoordinate - visibleFlowPositions.at(topIndex - 1) + itemExtent) <= (viewportSize)) {
evaluated: (bottomCoordinate - visibleFlowPositions.at(topIndex - 1) + itemExtent) <= (viewportSize)
TRUEFALSE
yes
Evaluation Count:2320
yes
Evaluation Count:289
289-2320
2564 topIndex--;
executed (the execution status of this line is deduced): topIndex--;
-
2565 }
executed: }
Execution Count:2320
2320
2566 -
2567 const int itemCount = bottomIndex - topIndex + 1;
executed (the execution status of this line is deduced): const int itemCount = bottomIndex - topIndex + 1;
-
2568 switch (hint) { -
2569 case QAbstractItemView::PositionAtTop: -
2570 return index;
executed: return index;
Execution Count:170
170
2571 case QAbstractItemView::PositionAtBottom: -
2572 return index - itemCount + 1;
executed: return index - itemCount + 1;
Execution Count:214
214
2573 case QAbstractItemView::PositionAtCenter: -
2574 return index - (itemCount / 2);
never executed: return index - (itemCount / 2);
0
2575 default: -
2576 break;
never executed: break;
0
2577 } -
2578 } else { // wrapping
never executed: }
0
2579 Qt::Orientation flowOrientation = (flow() == QListView::LeftToRight
partially evaluated: flow() == QListView::LeftToRight
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
2580 ? Qt::Horizontal : Qt::Vertical);
executed (the execution status of this line is deduced): ? Qt::Horizontal : Qt::Vertical);
-
2581 if (flowOrientation == orientation) { // scrolling in the "flow" direction
evaluated: flowOrientation == orientation
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:3
2-3
2582 // ### wrapped scrolling in the flow direction -
2583 return visibleFlowPositions.at(index); // ### always pixel based for now
executed: return visibleFlowPositions.at(index);
Execution Count:2
2
2584 } else if (!segmentStartRows.isEmpty()) { // we are scrolling in the "segment" direction
partially evaluated: !segmentStartRows.isEmpty()
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
2585 int segment = qBinarySearch<int>(segmentStartRows, index, 0, segmentStartRows.count() - 1);
executed (the execution status of this line is deduced): int segment = qBinarySearch<int>(segmentStartRows, index, 0, segmentStartRows.count() - 1);
-
2586 int leftSegment = segment;
executed (the execution status of this line is deduced): int leftSegment = segment;
-
2587 const int rightSegment = leftSegment;
executed (the execution status of this line is deduced): const int rightSegment = leftSegment;
-
2588 const int bottomCoordinate = segmentPositions.at(segment);
executed (the execution status of this line is deduced): const int bottomCoordinate = segmentPositions.at(segment);
-
2589 -
2590 while (leftSegment > scrollValue &&
evaluated: leftSegment > scrollValue
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1
1-2
2591 (bottomCoordinate - segmentPositions.at(leftSegment-1) + itemExtent) <= (viewportSize)) {
partially evaluated: (bottomCoordinate - segmentPositions.at(leftSegment-1) + itemExtent) <= (viewportSize)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
2592 leftSegment--;
never executed (the execution status of this line is deduced): leftSegment--;
-
2593 }
never executed: }
0
2594 -
2595 const int segmentCount = rightSegment - leftSegment + 1;
executed (the execution status of this line is deduced): const int segmentCount = rightSegment - leftSegment + 1;
-
2596 switch (hint) { -
2597 case QAbstractItemView::PositionAtTop: -
2598 return segment;
executed: return segment;
Execution Count:1
1
2599 case QAbstractItemView::PositionAtBottom: -
2600 return segment - segmentCount + 1;
executed: return segment - segmentCount + 1;
Execution Count:2
2
2601 case QAbstractItemView::PositionAtCenter: -
2602 return segment - (segmentCount / 2);
never executed: return segment - (segmentCount / 2);
0
2603 default: -
2604 break;
never executed: break;
0
2605 } -
2606 }
never executed: }
0
2607 } -
2608 return scrollValue;
never executed: return scrollValue;
0
2609} -
2610 -
2611void QListModeViewBase::clear() -
2612{ -
2613 flowPositions.clear();
executed (the execution status of this line is deduced): flowPositions.clear();
-
2614 segmentPositions.clear();
executed (the execution status of this line is deduced): segmentPositions.clear();
-
2615 segmentStartRows.clear();
executed (the execution status of this line is deduced): segmentStartRows.clear();
-
2616 segmentExtents.clear();
executed (the execution status of this line is deduced): segmentExtents.clear();
-
2617 batchSavedPosition = 0;
executed (the execution status of this line is deduced): batchSavedPosition = 0;
-
2618 batchStartRow = 0;
executed (the execution status of this line is deduced): batchStartRow = 0;
-
2619 batchSavedDeltaSeg = 0;
executed (the execution status of this line is deduced): batchSavedDeltaSeg = 0;
-
2620}
executed: }
Execution Count:22224
22224
2621 -
2622/* -
2623 * IconMode ListView Implementation -
2624*/ -
2625 -
2626void QIconModeViewBase::setPositionForIndex(const QPoint &position, const QModelIndex &index) -
2627{ -
2628 if (index.row() >= items.count())
partially evaluated: index.row() >= items.count()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
2629 return;
never executed: return;
0
2630 const QSize oldContents = contentsSize;
executed (the execution status of this line is deduced): const QSize oldContents = contentsSize;
-
2631 qq->update(index); // update old position
executed (the execution status of this line is deduced): qq->update(index);
-
2632 moveItem(index.row(), position);
executed (the execution status of this line is deduced): moveItem(index.row(), position);
-
2633 qq->update(index); // update new position
executed (the execution status of this line is deduced): qq->update(index);
-
2634 -
2635 if (contentsSize != oldContents)
evaluated: contentsSize != oldContents
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:1
1-4
2636 dd->viewUpdateGeometries(); // update the scroll bars
executed: dd->viewUpdateGeometries();
Execution Count:4
4
2637}
executed: }
Execution Count:5
5
2638 -
2639void QIconModeViewBase::appendHiddenRow(int row) -
2640{ -
2641 if (row >= 0 && row < items.count()) //remove item
partially evaluated: row >= 0
TRUEFALSE
yes
Evaluation Count:182
no
Evaluation Count:0
partially evaluated: row < items.count()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:182
0-182
2642 tree.removeLeaf(items.at(row).rect(), row);
never executed: tree.removeLeaf(items.at(row).rect(), row);
0
2643 QCommonListViewBase::appendHiddenRow(row);
executed (the execution status of this line is deduced): QCommonListViewBase::appendHiddenRow(row);
-
2644}
executed: }
Execution Count:182
182
2645 -
2646void QIconModeViewBase::removeHiddenRow(int row) -
2647{ -
2648 QCommonListViewBase::removeHiddenRow(row);
never executed (the execution status of this line is deduced): QCommonListViewBase::removeHiddenRow(row);
-
2649 if (row >= 0 && row < items.count()) //insert item
never evaluated: row >= 0
never evaluated: row < items.count()
0
2650 tree.insertLeaf(items.at(row).rect(), row);
never executed: tree.insertLeaf(items.at(row).rect(), row);
0
2651}
never executed: }
0
2652 -
2653#ifndef QT_NO_DRAGANDDROP -
2654void QIconModeViewBase::paintDragDrop(QPainter *painter) -
2655{ -
2656 if (!draggedItems.isEmpty() && viewport()->rect().contains(draggedItemsPos)) {
partially evaluated: !draggedItems.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:39
never evaluated: viewport()->rect().contains(draggedItemsPos)
0-39
2657 //we need to draw the items that arre dragged -
2658 painter->translate(draggedItemsDelta());
never executed (the execution status of this line is deduced): painter->translate(draggedItemsDelta());
-
2659 QStyleOptionViewItem option = viewOptions();
never executed (the execution status of this line is deduced): QStyleOptionViewItem option = viewOptions();
-
2660 option.state &= ~QStyle::State_MouseOver;
never executed (the execution status of this line is deduced): option.state &= ~QStyle::State_MouseOver;
-
2661 QVector<QModelIndex>::const_iterator it = draggedItems.constBegin();
never executed (the execution status of this line is deduced): QVector<QModelIndex>::const_iterator it = draggedItems.constBegin();
-
2662 QListViewItem item = indexToListViewItem(*it);
never executed (the execution status of this line is deduced): QListViewItem item = indexToListViewItem(*it);
-
2663 for (; it != draggedItems.constEnd(); ++it) {
never evaluated: it != draggedItems.constEnd()
0
2664 item = indexToListViewItem(*it);
never executed (the execution status of this line is deduced): item = indexToListViewItem(*it);
-
2665 option.rect = viewItemRect(item);
never executed (the execution status of this line is deduced): option.rect = viewItemRect(item);
-
2666 delegate(*it)->paint(painter, option, *it);
never executed (the execution status of this line is deduced): delegate(*it)->paint(painter, option, *it);
-
2667 }
never executed: }
0
2668 }
never executed: }
0
2669}
executed: }
Execution Count:39
39
2670 -
2671bool QIconModeViewBase::filterStartDrag(Qt::DropActions supportedActions) -
2672{ -
2673 // This function does the same thing as in QAbstractItemView::startDrag(), -
2674 // plus adding viewitems to the draggedItems list. -
2675 // We need these items to draw the drag items -
2676 QModelIndexList indexes = dd->selectionModel->selectedIndexes();
never executed (the execution status of this line is deduced): QModelIndexList indexes = dd->selectionModel->selectedIndexes();
-
2677 if (indexes.count() > 0 ) {
never evaluated: indexes.count() > 0
0
2678 if (viewport()->acceptDrops()) {
never evaluated: viewport()->acceptDrops()
0
2679 QModelIndexList::ConstIterator it = indexes.constBegin();
never executed (the execution status of this line is deduced): QModelIndexList::ConstIterator it = indexes.constBegin();
-
2680 for (; it != indexes.constEnd(); ++it)
never evaluated: it != indexes.constEnd()
0
2681 if (dd->model->flags(*it) & Qt::ItemIsDragEnabled
never evaluated: dd->model->flags(*it) & Qt::ItemIsDragEnabled
0
2682 && (*it).column() == dd->column)
never evaluated: (*it).column() == dd->column
0
2683 draggedItems.push_back(*it);
never executed: draggedItems.push_back(*it);
0
2684 }
never executed: }
0
2685 QDrag *drag = new QDrag(qq);
never executed (the execution status of this line is deduced): QDrag *drag = new QDrag(qq);
-
2686 drag->setMimeData(dd->model->mimeData(indexes));
never executed (the execution status of this line is deduced): drag->setMimeData(dd->model->mimeData(indexes));
-
2687 Qt::DropAction action = drag->exec(supportedActions, Qt::CopyAction);
never executed (the execution status of this line is deduced): Qt::DropAction action = drag->exec(supportedActions, Qt::CopyAction);
-
2688 draggedItems.clear();
never executed (the execution status of this line is deduced): draggedItems.clear();
-
2689 if (action == Qt::MoveAction)
never evaluated: action == Qt::MoveAction
0
2690 dd->clearOrRemove();
never executed: dd->clearOrRemove();
0
2691 }
never executed: }
0
2692 return true;
never executed: return true;
0
2693} -
2694 -
2695bool QIconModeViewBase::filterDropEvent(QDropEvent *e) -
2696{ -
2697 if (e->source() != qq)
never evaluated: e->source() != qq
0
2698 return false;
never executed: return false;
0
2699 -
2700 const QSize contents = contentsSize;
never executed (the execution status of this line is deduced): const QSize contents = contentsSize;
-
2701 QPoint offset(horizontalOffset(), verticalOffset());
never executed (the execution status of this line is deduced): QPoint offset(horizontalOffset(), verticalOffset());
-
2702 QPoint end = e->pos() + offset;
never executed (the execution status of this line is deduced): QPoint end = e->pos() + offset;
-
2703 if (qq->acceptDrops()) {
never evaluated: qq->acceptDrops()
0
2704 const Qt::ItemFlags dropableFlags = Qt::ItemIsDropEnabled|Qt::ItemIsEnabled;
never executed (the execution status of this line is deduced): const Qt::ItemFlags dropableFlags = Qt::ItemIsDropEnabled|Qt::ItemIsEnabled;
-
2705 const QVector<QModelIndex> &dropIndices = intersectingSet(QRect(end, QSize(1, 1)));
never executed (the execution status of this line is deduced): const QVector<QModelIndex> &dropIndices = intersectingSet(QRect(end, QSize(1, 1)));
-
2706 foreach (const QModelIndex &index, dropIndices)
never executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(dropIndices)> _container_(dropIndices); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (const QModelIndex &index = *_container_.i;; __extension__ ({--_container_.brk; break;}))
-
2707 if ((index.flags() & dropableFlags) == dropableFlags)
never evaluated: (index.flags() & dropableFlags) == dropableFlags
0
2708 return false;
never executed: return false;
0
2709 }
never executed: }
0
2710 QPoint start = dd->pressedPosition;
never executed (the execution status of this line is deduced): QPoint start = dd->pressedPosition;
-
2711 QPoint delta = (dd->movement == QListView::Snap ? snapToGrid(end) - snapToGrid(start) : end - start);
never evaluated: dd->movement == QListView::Snap
0
2712 QList<QModelIndex> indexes = dd->selectionModel->selectedIndexes();
never executed (the execution status of this line is deduced): QList<QModelIndex> indexes = dd->selectionModel->selectedIndexes();
-
2713 for (int i = 0; i < indexes.count(); ++i) {
never evaluated: i < indexes.count()
0
2714 QModelIndex index = indexes.at(i);
never executed (the execution status of this line is deduced): QModelIndex index = indexes.at(i);
-
2715 QRect rect = dd->rectForIndex(index);
never executed (the execution status of this line is deduced): QRect rect = dd->rectForIndex(index);
-
2716 viewport()->update(dd->mapToViewport(rect, false));
never executed (the execution status of this line is deduced): viewport()->update(dd->mapToViewport(rect, false));
-
2717 QPoint dest = rect.topLeft() + delta;
never executed (the execution status of this line is deduced): QPoint dest = rect.topLeft() + delta;
-
2718 if (qq->isRightToLeft())
never evaluated: qq->isRightToLeft()
0
2719 dest.setX(dd->flipX(dest.x()) - rect.width());
never executed: dest.setX(dd->flipX(dest.x()) - rect.width());
0
2720 moveItem(index.row(), dest);
never executed (the execution status of this line is deduced): moveItem(index.row(), dest);
-
2721 qq->update(index);
never executed (the execution status of this line is deduced): qq->update(index);
-
2722 }
never executed: }
0
2723 dd->stopAutoScroll();
never executed (the execution status of this line is deduced): dd->stopAutoScroll();
-
2724 draggedItems.clear();
never executed (the execution status of this line is deduced): draggedItems.clear();
-
2725 dd->emitIndexesMoved(indexes);
never executed (the execution status of this line is deduced): dd->emitIndexesMoved(indexes);
-
2726 e->accept(); // we have handled the event
never executed (the execution status of this line is deduced): e->accept();
-
2727 // if the size has not grown, we need to check if it has shrinked -
2728 if (contentsSize != contents) {
never evaluated: contentsSize != contents
0
2729 if ((contentsSize.width() <= contents.width()
never evaluated: contentsSize.width() <= contents.width()
0
2730 || contentsSize.height() <= contents.height())) {
never evaluated: contentsSize.height() <= contents.height()
0
2731 updateContentsSize();
never executed (the execution status of this line is deduced): updateContentsSize();
-
2732 }
never executed: }
0
2733 dd->viewUpdateGeometries();
never executed (the execution status of this line is deduced): dd->viewUpdateGeometries();
-
2734 }
never executed: }
0
2735 return true;
never executed: return true;
0
2736} -
2737 -
2738bool QIconModeViewBase::filterDragLeaveEvent(QDragLeaveEvent *e) -
2739{ -
2740 viewport()->update(draggedItemsRect()); // erase the area
never executed (the execution status of this line is deduced): viewport()->update(draggedItemsRect());
-
2741 draggedItemsPos = QPoint(-1, -1); // don't draw the dragged items
never executed (the execution status of this line is deduced): draggedItemsPos = QPoint(-1, -1);
-
2742 return QCommonListViewBase::filterDragLeaveEvent(e);
never executed: return QCommonListViewBase::filterDragLeaveEvent(e);
0
2743} -
2744 -
2745bool QIconModeViewBase::filterDragMoveEvent(QDragMoveEvent *e) -
2746{ -
2747 if (e->source() != qq || !dd->canDecode(e))
never evaluated: e->source() != qq
never evaluated: !dd->canDecode(e)
0
2748 return false;
never executed: return false;
0
2749 -
2750 // ignore by default -
2751 e->ignore();
never executed (the execution status of this line is deduced): e->ignore();
-
2752 // get old dragged items rect -
2753 QRect itemsRect = this->itemsRect(draggedItems);
never executed (the execution status of this line is deduced): QRect itemsRect = this->itemsRect(draggedItems);
-
2754 viewport()->update(itemsRect.translated(draggedItemsDelta()));
never executed (the execution status of this line is deduced): viewport()->update(itemsRect.translated(draggedItemsDelta()));
-
2755 // update position -
2756 draggedItemsPos = e->pos();
never executed (the execution status of this line is deduced): draggedItemsPos = e->pos();
-
2757 // get new items rect -
2758 viewport()->update(itemsRect.translated(draggedItemsDelta()));
never executed (the execution status of this line is deduced): viewport()->update(itemsRect.translated(draggedItemsDelta()));
-
2759 // set the item under the cursor to current -
2760 QModelIndex index;
never executed (the execution status of this line is deduced): QModelIndex index;
-
2761 if (movement() == QListView::Snap) {
never evaluated: movement() == QListView::Snap
0
2762 QRect rect(snapToGrid(e->pos() + offset()), gridSize());
never executed (the execution status of this line is deduced): QRect rect(snapToGrid(e->pos() + offset()), gridSize());
-
2763 const QVector<QModelIndex> intersectVector = intersectingSet(rect);
never executed (the execution status of this line is deduced): const QVector<QModelIndex> intersectVector = intersectingSet(rect);
-
2764 index = intersectVector.count() > 0 ? intersectVector.last() : QModelIndex();
never evaluated: intersectVector.count() > 0
0
2765 } else {
never executed: }
0
2766 index = qq->indexAt(e->pos());
never executed (the execution status of this line is deduced): index = qq->indexAt(e->pos());
-
2767 }
never executed: }
0
2768 // check if we allow drops here -
2769 if (draggedItems.contains(index))
never evaluated: draggedItems.contains(index)
0
2770 e->accept(); // allow changing item position
never executed: e->accept();
0
2771 else if (dd->model->flags(index) & Qt::ItemIsDropEnabled)
never evaluated: dd->model->flags(index) & Qt::ItemIsDropEnabled
0
2772 e->accept(); // allow dropping on dropenabled items
never executed: e->accept();
0
2773 else if (!index.isValid())
never evaluated: !index.isValid()
0
2774 e->accept(); // allow dropping in empty areas
never executed: e->accept();
0
2775 -
2776 // the event was treated. do autoscrolling -
2777 if (dd->shouldAutoScroll(e->pos()))
never evaluated: dd->shouldAutoScroll(e->pos())
0
2778 dd->startAutoScroll();
never executed: dd->startAutoScroll();
0
2779 return true;
never executed: return true;
0
2780} -
2781#endif // QT_NO_DRAGANDDROP -
2782 -
2783void QIconModeViewBase::setRowCount(int rowCount) -
2784{ -
2785 tree.create(qMax(rowCount - hiddenCount(), 0));
executed (the execution status of this line is deduced): tree.create(qMax(rowCount - hiddenCount(), 0));
-
2786}
executed: }
Execution Count:15
15
2787 -
2788void QIconModeViewBase::scrollContentsBy(int dx, int dy, bool scrollElasticBand) -
2789{ -
2790 if (scrollElasticBand)
partially evaluated: scrollElasticBand
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
2791 dd->scrollElasticBandBy(isRightToLeft() ? -dx : dx, dy);
never executed: dd->scrollElasticBandBy(isRightToLeft() ? -dx : dx, dy);
0
2792 -
2793 QCommonListViewBase::scrollContentsBy(dx, dy, scrollElasticBand);
executed (the execution status of this line is deduced): QCommonListViewBase::scrollContentsBy(dx, dy, scrollElasticBand);
-
2794 if (!draggedItems.isEmpty())
partially evaluated: !draggedItems.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
2795 viewport()->update(draggedItemsRect().translated(dx, dy));
never executed: viewport()->update(draggedItemsRect().translated(dx, dy));
0
2796}
executed: }
Execution Count:2
2
2797 -
2798void QIconModeViewBase::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight) -
2799{ -
2800 if (column() >= topLeft.column() && column() <= bottomRight.column()) {
never evaluated: column() >= topLeft.column()
never evaluated: column() <= bottomRight.column()
0
2801 QStyleOptionViewItem option = viewOptions();
never executed (the execution status of this line is deduced): QStyleOptionViewItem option = viewOptions();
-
2802 int bottom = qMin(items.count(), bottomRight.row() + 1);
never executed (the execution status of this line is deduced): int bottom = qMin(items.count(), bottomRight.row() + 1);
-
2803 for (int row = topLeft.row(); row < bottom; ++row)
never evaluated: row < bottom
0
2804 items[row].resize(itemSize(option, modelIndex(row)));
never executed: items[row].resize(itemSize(option, modelIndex(row)));
0
2805 }
never executed: }
0
2806}
never executed: }
0
2807 -
2808bool QIconModeViewBase::doBatchedItemLayout(const QListViewLayoutInfo &info, int max) -
2809{ -
2810 if (info.last >= items.count()) {
partially evaluated: info.last >= items.count()
TRUEFALSE
yes
Evaluation Count:18
no
Evaluation Count:0
0-18
2811 //first we create the items -
2812 QStyleOptionViewItem option = viewOptions();
executed (the execution status of this line is deduced): QStyleOptionViewItem option = viewOptions();
-
2813 for (int row = items.count(); row <= info.last; ++row) {
evaluated: row <= info.last
TRUEFALSE
yes
Evaluation Count:416
yes
Evaluation Count:18
18-416
2814 QSize size = itemSize(option, modelIndex(row));
executed (the execution status of this line is deduced): QSize size = itemSize(option, modelIndex(row));
-
2815 QListViewItem item(QRect(0, 0, size.width(), size.height()), row); // default pos
executed (the execution status of this line is deduced): QListViewItem item(QRect(0, 0, size.width(), size.height()), row);
-
2816 items.append(item);
executed (the execution status of this line is deduced): items.append(item);
-
2817 }
executed: }
Execution Count:416
416
2818 doDynamicLayout(info);
executed (the execution status of this line is deduced): doDynamicLayout(info);
-
2819 }
executed: }
Execution Count:18
18
2820 return (batchStartRow > max); // done
executed: return (batchStartRow > max);
Execution Count:18
18
2821} -
2822 -
2823QListViewItem QIconModeViewBase::indexToListViewItem(const QModelIndex &index) const -
2824{ -
2825 if (index.isValid() && index.row() < items.count())
partially evaluated: index.isValid()
TRUEFALSE
yes
Evaluation Count:511
no
Evaluation Count:0
partially evaluated: index.row() < items.count()
TRUEFALSE
yes
Evaluation Count:511
no
Evaluation Count:0
0-511
2826 return items.at(index.row());
executed: return items.at(index.row());
Execution Count:511
511
2827 return QListViewItem();
never executed: return QListViewItem();
0
2828} -
2829 -
2830void QIconModeViewBase::initBspTree(const QSize &contents) -
2831{ -
2832 // remove all items from the tree -
2833 int leafCount = tree.leafCount();
executed (the execution status of this line is deduced): int leafCount = tree.leafCount();
-
2834 for (int l = 0; l < leafCount; ++l)
evaluated: l < leafCount
TRUEFALSE
yes
Evaluation Count:186
yes
Evaluation Count:17
17-186
2835 tree.leaf(l).clear();
executed: tree.leaf(l).clear();
Execution Count:186
186
2836 // we have to get the bounding rect of the items before we can initialize the tree -
2837 QBspTree::Node::Type type = QBspTree::Node::Both; // 2D
executed (the execution status of this line is deduced): QBspTree::Node::Type type = QBspTree::Node::Both;
-
2838 // simple heuristics to get better bsp -
2839 if (contents.height() / contents.width() >= 3)
evaluated: contents.height() / contents.width() >= 3
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:13
4-13
2840 type = QBspTree::Node::HorizontalPlane;
executed: type = QBspTree::Node::HorizontalPlane;
Execution Count:4
4
2841 else if (contents.width() / contents.height() >= 3)
evaluated: contents.width() / contents.height() >= 3
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:12
1-12
2842 type = QBspTree::Node::VerticalPlane;
executed: type = QBspTree::Node::VerticalPlane;
Execution Count:1
1
2843 // build tree for the bounding rect (not just the contents rect) -
2844 tree.init(QRect(0, 0, contents.width(), contents.height()), type);
executed (the execution status of this line is deduced): tree.init(QRect(0, 0, contents.width(), contents.height()), type);
-
2845}
executed: }
Execution Count:17
17
2846 -
2847QPoint QIconModeViewBase::initDynamicLayout(const QListViewLayoutInfo &info) -
2848{ -
2849 int x, y;
executed (the execution status of this line is deduced): int x, y;
-
2850 if (info.first == 0) {
evaluated: info.first == 0
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:3
3-15
2851 x = info.bounds.x() + info.spacing;
executed (the execution status of this line is deduced): x = info.bounds.x() + info.spacing;
-
2852 y = info.bounds.y() + info.spacing;
executed (the execution status of this line is deduced): y = info.bounds.y() + info.spacing;
-
2853 items.reserve(rowCount() - hiddenCount());
executed (the execution status of this line is deduced): items.reserve(rowCount() - hiddenCount());
-
2854 } else {
executed: }
Execution Count:15
15
2855 int idx = info.first - 1;
executed (the execution status of this line is deduced): int idx = info.first - 1;
-
2856 while (idx > 0 && !items.at(idx).isValid())
evaluated: idx > 0
TRUEFALSE
yes
Evaluation Count:109
yes
Evaluation Count:1
evaluated: !items.at(idx).isValid()
TRUEFALSE
yes
Evaluation Count:107
yes
Evaluation Count:2
1-109
2857 --idx;
executed: --idx;
Execution Count:107
107
2858 const QListViewItem &item = items.at(idx);
executed (the execution status of this line is deduced): const QListViewItem &item = items.at(idx);
-
2859 x = item.x;
executed (the execution status of this line is deduced): x = item.x;
-
2860 y = item.y;
executed (the execution status of this line is deduced): y = item.y;
-
2861 if (info.flow == QListView::LeftToRight)
evaluated: info.flow == QListView::LeftToRight
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1
1-2
2862 x += (info.grid.isValid() ? info.grid.width() : item.w) + info.spacing;
executed: x += (info.grid.isValid() ? info.grid.width() : item.w) + info.spacing;
Execution Count:2
partially evaluated: info.grid.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
2863 else -
2864 y += (info.grid.isValid() ? info.grid.height() : item.h) + info.spacing;
executed: y += (info.grid.isValid() ? info.grid.height() : item.h) + info.spacing;
Execution Count:1
partially evaluated: info.grid.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
2865 } -
2866 return QPoint(x, y);
executed: return QPoint(x, y);
Execution Count:18
18
2867} -
2868 -
2869/*! -
2870 \internal -
2871*/ -
2872void QIconModeViewBase::doDynamicLayout(const QListViewLayoutInfo &info) -
2873{ -
2874 const bool useItemSize = !info.grid.isValid();
executed (the execution status of this line is deduced): const bool useItemSize = !info.grid.isValid();
-
2875 const QPoint topLeft = initDynamicLayout(info);
executed (the execution status of this line is deduced): const QPoint topLeft = initDynamicLayout(info);
-
2876 -
2877 int segStartPosition;
executed (the execution status of this line is deduced): int segStartPosition;
-
2878 int segEndPosition;
executed (the execution status of this line is deduced): int segEndPosition;
-
2879 int deltaFlowPosition;
executed (the execution status of this line is deduced): int deltaFlowPosition;
-
2880 int deltaSegPosition;
executed (the execution status of this line is deduced): int deltaSegPosition;
-
2881 int deltaSegHint;
executed (the execution status of this line is deduced): int deltaSegHint;
-
2882 int flowPosition;
executed (the execution status of this line is deduced): int flowPosition;
-
2883 int segPosition;
executed (the execution status of this line is deduced): int segPosition;
-
2884 -
2885 if (info.flow == QListView::LeftToRight) {
evaluated: info.flow == QListView::LeftToRight
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:3
3-15
2886 segStartPosition = info.bounds.left() + info.spacing;
executed (the execution status of this line is deduced): segStartPosition = info.bounds.left() + info.spacing;
-
2887 segEndPosition = info.bounds.right();
executed (the execution status of this line is deduced): segEndPosition = info.bounds.right();
-
2888 deltaFlowPosition = info.grid.width(); // dx
executed (the execution status of this line is deduced): deltaFlowPosition = info.grid.width();
-
2889 deltaSegPosition = (useItemSize ? batchSavedDeltaSeg : info.grid.height()); // dy
evaluated: useItemSize
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:7
7-8
2890 deltaSegHint = info.grid.height();
executed (the execution status of this line is deduced): deltaSegHint = info.grid.height();
-
2891 flowPosition = topLeft.x();
executed (the execution status of this line is deduced): flowPosition = topLeft.x();
-
2892 segPosition = topLeft.y();
executed (the execution status of this line is deduced): segPosition = topLeft.y();
-
2893 } else { // flow == QListView::TopToBottom
executed: }
Execution Count:15
15
2894 segStartPosition = info.bounds.top() + info.spacing;
executed (the execution status of this line is deduced): segStartPosition = info.bounds.top() + info.spacing;
-
2895 segEndPosition = info.bounds.bottom();
executed (the execution status of this line is deduced): segEndPosition = info.bounds.bottom();
-
2896 deltaFlowPosition = info.grid.height(); // dy
executed (the execution status of this line is deduced): deltaFlowPosition = info.grid.height();
-
2897 deltaSegPosition = (useItemSize ? batchSavedDeltaSeg : info.grid.width()); // dx
evaluated: useItemSize
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1
1-2
2898 deltaSegHint = info.grid.width();
executed (the execution status of this line is deduced): deltaSegHint = info.grid.width();
-
2899 flowPosition = topLeft.y();
executed (the execution status of this line is deduced): flowPosition = topLeft.y();
-
2900 segPosition = topLeft.x();
executed (the execution status of this line is deduced): segPosition = topLeft.x();
-
2901 }
executed: }
Execution Count:3
3
2902 -
2903 if (moved.count() != items.count())
partially evaluated: moved.count() != items.count()
TRUEFALSE
yes
Evaluation Count:18
no
Evaluation Count:0
0-18
2904 moved.resize(items.count());
executed: moved.resize(items.count());
Execution Count:18
18
2905 -
2906 QRect rect(QPoint(), topLeft);
executed (the execution status of this line is deduced): QRect rect(QPoint(), topLeft);
-
2907 QListViewItem *item = 0;
executed (the execution status of this line is deduced): QListViewItem *item = 0;
-
2908 for (int row = info.first; row <= info.last; ++row) {
evaluated: row <= info.last
TRUEFALSE
yes
Evaluation Count:416
yes
Evaluation Count:18
18-416
2909 item = &items[row];
executed (the execution status of this line is deduced): item = &items[row];
-
2910 if (isHidden(row)) {
evaluated: isHidden(row)
TRUEFALSE
yes
Evaluation Count:182
yes
Evaluation Count:234
182-234
2911 item->invalidate();
executed (the execution status of this line is deduced): item->invalidate();
-
2912 } else {
executed: }
Execution Count:182
182
2913 // if we are not using a grid, we need to find the deltas -
2914 if (useItemSize) {
evaluated: useItemSize
TRUEFALSE
yes
Evaluation Count:38
yes
Evaluation Count:196
38-196
2915 if (info.flow == QListView::LeftToRight)
evaluated: info.flow == QListView::LeftToRight
TRUEFALSE
yes
Evaluation Count:35
yes
Evaluation Count:3
3-35
2916 deltaFlowPosition = item->w + info.spacing;
executed: deltaFlowPosition = item->w + info.spacing;
Execution Count:35
35
2917 else -
2918 deltaFlowPosition = item->h + info.spacing;
executed: deltaFlowPosition = item->h + info.spacing;
Execution Count:3
3
2919 } else { -
2920 item->w = qMin<int>(info.grid.width(), item->w);
executed (the execution status of this line is deduced): item->w = qMin<int>(info.grid.width(), item->w);
-
2921 item->h = qMin<int>(info.grid.height(), item->h);
executed (the execution status of this line is deduced): item->h = qMin<int>(info.grid.height(), item->h);
-
2922 }
executed: }
Execution Count:196
196
2923 -
2924 // create new segment -
2925 if (info.wrap
partially evaluated: info.wrap
TRUEFALSE
yes
Evaluation Count:234
no
Evaluation Count:0
0-234
2926 && flowPosition + deltaFlowPosition > segEndPosition
evaluated: flowPosition + deltaFlowPosition > segEndPosition
TRUEFALSE
yes
Evaluation Count:49
yes
Evaluation Count:185
49-185
2927 && flowPosition > segStartPosition) {
evaluated: flowPosition > segStartPosition
TRUEFALSE
yes
Evaluation Count:48
yes
Evaluation Count:1
1-48
2928 flowPosition = segStartPosition;
executed (the execution status of this line is deduced): flowPosition = segStartPosition;
-
2929 segPosition += deltaSegPosition;
executed (the execution status of this line is deduced): segPosition += deltaSegPosition;
-
2930 if (useItemSize)
evaluated: useItemSize
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:37
11-37
2931 deltaSegPosition = 0;
executed: deltaSegPosition = 0;
Execution Count:11
11
2932 }
executed: }
Execution Count:48
48
2933 // We must delay calculation of the seg adjustment, as this item -
2934 // may have caused a wrap to occur -
2935 if (useItemSize) {
evaluated: useItemSize
TRUEFALSE
yes
Evaluation Count:38
yes
Evaluation Count:196
38-196
2936 if (info.flow == QListView::LeftToRight)
evaluated: info.flow == QListView::LeftToRight
TRUEFALSE
yes
Evaluation Count:35
yes
Evaluation Count:3
3-35
2937 deltaSegHint = item->h + info.spacing;
executed: deltaSegHint = item->h + info.spacing;
Execution Count:35
35
2938 else -
2939 deltaSegHint = item->w + info.spacing;
executed: deltaSegHint = item->w + info.spacing;
Execution Count:3
3
2940 deltaSegPosition = qMax(deltaSegPosition, deltaSegHint);
executed (the execution status of this line is deduced): deltaSegPosition = qMax(deltaSegPosition, deltaSegHint);
-
2941 }
executed: }
Execution Count:38
38
2942 -
2943 // set the position of the item -
2944 // ### idealy we should have some sort of alignment hint for the item -
2945 // ### (normally that would be a point between the icon and the text) -
2946 if (!moved.testBit(row)) {
partially evaluated: !moved.testBit(row)
TRUEFALSE
yes
Evaluation Count:234
no
Evaluation Count:0
0-234
2947 if (info.flow == QListView::LeftToRight) {
evaluated: info.flow == QListView::LeftToRight
TRUEFALSE
yes
Evaluation Count:227
yes
Evaluation Count:7
7-227
2948 if (useItemSize) {
evaluated: useItemSize
TRUEFALSE
yes
Evaluation Count:35
yes
Evaluation Count:192
35-192
2949 item->x = flowPosition;
executed (the execution status of this line is deduced): item->x = flowPosition;
-
2950 item->y = segPosition;
executed (the execution status of this line is deduced): item->y = segPosition;
-
2951 } else { // use grid
executed: }
Execution Count:35
35
2952 item->x = flowPosition + ((deltaFlowPosition - item->w) / 2);
executed (the execution status of this line is deduced): item->x = flowPosition + ((deltaFlowPosition - item->w) / 2);
-
2953 item->y = segPosition;
executed (the execution status of this line is deduced): item->y = segPosition;
-
2954 }
executed: }
Execution Count:192
192
2955 } else { // TopToBottom -
2956 if (useItemSize) {
evaluated: useItemSize
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:4
3-4
2957 item->y = flowPosition;
executed (the execution status of this line is deduced): item->y = flowPosition;
-
2958 item->x = segPosition;
executed (the execution status of this line is deduced): item->x = segPosition;
-
2959 } else { // use grid
executed: }
Execution Count:3
3
2960 item->y = flowPosition + ((deltaFlowPosition - item->h) / 2);
executed (the execution status of this line is deduced): item->y = flowPosition + ((deltaFlowPosition - item->h) / 2);
-
2961 item->x = segPosition;
executed (the execution status of this line is deduced): item->x = segPosition;
-
2962 }
executed: }
Execution Count:4
4
2963 } -
2964 } -
2965 -
2966 // let the contents contain the new item -
2967 if (useItemSize)
evaluated: useItemSize
TRUEFALSE
yes
Evaluation Count:38
yes
Evaluation Count:196
38-196
2968 rect |= item->rect();
executed: rect |= item->rect();
Execution Count:38
38
2969 else if (info.flow == QListView::LeftToRight)
evaluated: info.flow == QListView::LeftToRight
TRUEFALSE
yes
Evaluation Count:192
yes
Evaluation Count:4
4-192
2970 rect |= QRect(flowPosition, segPosition, deltaFlowPosition, deltaSegPosition);
executed: rect |= QRect(flowPosition, segPosition, deltaFlowPosition, deltaSegPosition);
Execution Count:192
192
2971 else // flow == TopToBottom -
2972 rect |= QRect(segPosition, flowPosition, deltaSegPosition, deltaFlowPosition);
executed: rect |= QRect(segPosition, flowPosition, deltaSegPosition, deltaFlowPosition);
Execution Count:4
4
2973 -
2974 // prepare for next item -
2975 flowPosition += deltaFlowPosition; // current position + item width + gap
executed (the execution status of this line is deduced): flowPosition += deltaFlowPosition;
-
2976 }
executed: }
Execution Count:234
234
2977 } -
2978 batchSavedDeltaSeg = deltaSegPosition;
executed (the execution status of this line is deduced): batchSavedDeltaSeg = deltaSegPosition;
-
2979 batchStartRow = info.last + 1;
executed (the execution status of this line is deduced): batchStartRow = info.last + 1;
-
2980 bool done = (info.last >= rowCount() - 1);
executed (the execution status of this line is deduced): bool done = (info.last >= rowCount() - 1);
-
2981 // resize the content area -
2982 if (done || !info.bounds.contains(item->rect())) {
evaluated: done
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:3
evaluated: !info.bounds.contains(item->rect())
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1
1-15
2983 contentsSize = rect.size();
executed (the execution status of this line is deduced): contentsSize = rect.size();
-
2984 if (info.flow == QListView::LeftToRight)
evaluated: info.flow == QListView::LeftToRight
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:2
2-15
2985 contentsSize.rheight() += info.spacing;
executed: contentsSize.rheight() += info.spacing;
Execution Count:15
15
2986 else -
2987 contentsSize.rwidth() += info.spacing;
executed: contentsSize.rwidth() += info.spacing;
Execution Count:2
2
2988 } -
2989 if (rect.size().isEmpty())
evaluated: rect.size().isEmpty()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:17
1-17
2990 return;
executed: return;
Execution Count:1
1
2991 // resize tree -
2992 int insertFrom = info.first;
executed (the execution status of this line is deduced): int insertFrom = info.first;
-
2993 if (done || info.first == 0) {
evaluated: done
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:3
partially evaluated: info.first == 0
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-14
2994 initBspTree(rect.size());
executed (the execution status of this line is deduced): initBspTree(rect.size());
-
2995 insertFrom = 0;
executed (the execution status of this line is deduced): insertFrom = 0;
-
2996 }
executed: }
Execution Count:17
17
2997 // insert items in tree -
2998 for (int row = insertFrom; row <= info.last; ++row)
evaluated: row <= info.last
TRUEFALSE
yes
Evaluation Count:517
yes
Evaluation Count:17
17-517
2999 tree.insertLeaf(items.at(row).rect(), row);
executed: tree.insertLeaf(items.at(row).rect(), row);
Execution Count:517
517
3000 // if the new items are visble, update the viewport -
3001 QRect changedRect(topLeft, rect.bottomRight());
executed (the execution status of this line is deduced): QRect changedRect(topLeft, rect.bottomRight());
-
3002 if (clipRect().intersects(changedRect))
evaluated: clipRect().intersects(changedRect)
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:2
2-15
3003 viewport()->update();
executed: viewport()->update();
Execution Count:15
15
3004}
executed: }
Execution Count:17
17
3005 -
3006QVector<QModelIndex> QIconModeViewBase::intersectingSet(const QRect &area) const -
3007{ -
3008 QIconModeViewBase *that = const_cast<QIconModeViewBase*>(this);
executed (the execution status of this line is deduced): QIconModeViewBase *that = const_cast<QIconModeViewBase*>(this);
-
3009 QBspTree::Data data(static_cast<void*>(that));
executed (the execution status of this line is deduced): QBspTree::Data data(static_cast<void*>(that));
-
3010 QVector<QModelIndex> res;
executed (the execution status of this line is deduced): QVector<QModelIndex> res;
-
3011 that->interSectingVector = &res;
executed (the execution status of this line is deduced): that->interSectingVector = &res;
-
3012 that->tree.climbTree(area, &QIconModeViewBase::addLeaf, data);
executed (the execution status of this line is deduced): that->tree.climbTree(area, &QIconModeViewBase::addLeaf, data);
-
3013 that->interSectingVector = 0;
executed (the execution status of this line is deduced): that->interSectingVector = 0;
-
3014 return res;
executed: return res;
Execution Count:168
168
3015} -
3016 -
3017QRect QIconModeViewBase::itemsRect(const QVector<QModelIndex> &indexes) const -
3018{ -
3019 QVector<QModelIndex>::const_iterator it = indexes.begin();
never executed (the execution status of this line is deduced): QVector<QModelIndex>::const_iterator it = indexes.begin();
-
3020 QListViewItem item = indexToListViewItem(*it);
never executed (the execution status of this line is deduced): QListViewItem item = indexToListViewItem(*it);
-
3021 QRect rect(item.x, item.y, item.w, item.h);
never executed (the execution status of this line is deduced): QRect rect(item.x, item.y, item.w, item.h);
-
3022 for (; it != indexes.end(); ++it) {
never evaluated: it != indexes.end()
0
3023 item = indexToListViewItem(*it);
never executed (the execution status of this line is deduced): item = indexToListViewItem(*it);
-
3024 rect |= viewItemRect(item);
never executed (the execution status of this line is deduced): rect |= viewItemRect(item);
-
3025 }
never executed: }
0
3026 return rect;
never executed: return rect;
0
3027} -
3028 -
3029int QIconModeViewBase::itemIndex(const QListViewItem &item) const -
3030{ -
3031 if (!item.isValid())
partially evaluated: !item.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:310
0-310
3032 return -1;
never executed: return -1;
0
3033 int i = item.indexHint;
executed (the execution status of this line is deduced): int i = item.indexHint;
-
3034 if (i < items.count()) {
partially evaluated: i < items.count()
TRUEFALSE
yes
Evaluation Count:310
no
Evaluation Count:0
0-310
3035 if (items.at(i) == item)
partially evaluated: items.at(i) == item
TRUEFALSE
yes
Evaluation Count:310
no
Evaluation Count:0
0-310
3036 return i;
executed: return i;
Execution Count:310
310
3037 } else {
never executed: }
0
3038 i = items.count() - 1;
never executed (the execution status of this line is deduced): i = items.count() - 1;
-
3039 }
never executed: }
0
3040 -
3041 int j = i;
never executed (the execution status of this line is deduced): int j = i;
-
3042 int c = items.count();
never executed (the execution status of this line is deduced): int c = items.count();
-
3043 bool a = true;
never executed (the execution status of this line is deduced): bool a = true;
-
3044 bool b = true;
never executed (the execution status of this line is deduced): bool b = true;
-
3045 -
3046 while (a || b) {
never evaluated: a
never evaluated: b
0
3047 if (a) {
never evaluated: a
0
3048 if (items.at(i) == item) {
never evaluated: items.at(i) == item
0
3049 items.at(i).indexHint = i;
never executed (the execution status of this line is deduced): items.at(i).indexHint = i;
-
3050 return i;
never executed: return i;
0
3051 } -
3052 a = ++i < c;
never executed (the execution status of this line is deduced): a = ++i < c;
-
3053 }
never executed: }
0
3054 if (b) {
never evaluated: b
0
3055 if (items.at(j) == item) {
never evaluated: items.at(j) == item
0
3056 items.at(j).indexHint = j;
never executed (the execution status of this line is deduced): items.at(j).indexHint = j;
-
3057 return j;
never executed: return j;
0
3058 } -
3059 b = --j > -1;
never executed (the execution status of this line is deduced): b = --j > -1;
-
3060 }
never executed: }
0
3061 }
never executed: }
0
3062 return -1;
never executed: return -1;
0
3063} -
3064 -
3065void QIconModeViewBase::addLeaf(QVector<int> &leaf, const QRect &area, -
3066 uint visited, QBspTree::Data data) -
3067{ -
3068 QListViewItem *vi;
executed (the execution status of this line is deduced): QListViewItem *vi;
-
3069 QIconModeViewBase *_this = static_cast<QIconModeViewBase *>(data.ptr);
executed (the execution status of this line is deduced): QIconModeViewBase *_this = static_cast<QIconModeViewBase *>(data.ptr);
-
3070 for (int i = 0; i < leaf.count(); ++i) {
evaluated: i < leaf.count()
TRUEFALSE
yes
Evaluation Count:922
yes
Evaluation Count:330
330-922
3071 int idx = leaf.at(i);
executed (the execution status of this line is deduced): int idx = leaf.at(i);
-
3072 if (idx < 0 || idx >= _this->items.count())
partially evaluated: idx < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:922
partially evaluated: idx >= _this->items.count()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:922
0-922
3073 continue;
never executed: continue;
0
3074 vi = &_this->items[idx];
executed (the execution status of this line is deduced): vi = &_this->items[idx];
-
3075 Q_ASSERT(vi);
executed (the execution status of this line is deduced): qt_noop();
-
3076 if (vi->isValid() && vi->rect().intersects(area) && vi->visited != visited) {
evaluated: vi->isValid()
TRUEFALSE
yes
Evaluation Count:756
yes
Evaluation Count:166
evaluated: vi->rect().intersects(area)
TRUEFALSE
yes
Evaluation Count:486
yes
Evaluation Count:270
evaluated: vi->visited != visited
TRUEFALSE
yes
Evaluation Count:306
yes
Evaluation Count:180
166-756
3077 QModelIndex index = _this->dd->listViewItemToIndex(*vi);
executed (the execution status of this line is deduced): QModelIndex index = _this->dd->listViewItemToIndex(*vi);
-
3078 Q_ASSERT(index.isValid());
executed (the execution status of this line is deduced): qt_noop();
-
3079 _this->interSectingVector->append(index);
executed (the execution status of this line is deduced): _this->interSectingVector->append(index);
-
3080 vi->visited = visited;
executed (the execution status of this line is deduced): vi->visited = visited;
-
3081 }
executed: }
Execution Count:306
306
3082 }
executed: }
Execution Count:922
922
3083}
executed: }
Execution Count:330
330
3084 -
3085void QIconModeViewBase::moveItem(int index, const QPoint &dest) -
3086{ -
3087 // does not impact on the bintree itself or the contents rect -
3088 QListViewItem *item = &items[index];
executed (the execution status of this line is deduced): QListViewItem *item = &items[index];
-
3089 QRect rect = item->rect();
executed (the execution status of this line is deduced): QRect rect = item->rect();
-
3090 -
3091 // move the item without removing it from the tree -
3092 tree.removeLeaf(rect, index);
executed (the execution status of this line is deduced): tree.removeLeaf(rect, index);
-
3093 item->move(dest);
executed (the execution status of this line is deduced): item->move(dest);
-
3094 tree.insertLeaf(QRect(dest, rect.size()), index);
executed (the execution status of this line is deduced): tree.insertLeaf(QRect(dest, rect.size()), index);
-
3095 -
3096 // resize the contents area -
3097 contentsSize = (QRect(QPoint(0, 0), contentsSize)|QRect(dest, rect.size())).size();
executed (the execution status of this line is deduced): contentsSize = (QRect(QPoint(0, 0), contentsSize)|QRect(dest, rect.size())).size();
-
3098 -
3099 // mark the item as moved -
3100 if (moved.count() != items.count())
partially evaluated: moved.count() != items.count()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
3101 moved.resize(items.count());
never executed: moved.resize(items.count());
0
3102 moved.setBit(index, true);
executed (the execution status of this line is deduced): moved.setBit(index, true);
-
3103}
executed: }
Execution Count:5
5
3104 -
3105QPoint QIconModeViewBase::snapToGrid(const QPoint &pos) const -
3106{ -
3107 int x = pos.x() - (pos.x() % gridSize().width());
never executed (the execution status of this line is deduced): int x = pos.x() - (pos.x() % gridSize().width());
-
3108 int y = pos.y() - (pos.y() % gridSize().height());
never executed (the execution status of this line is deduced): int y = pos.y() - (pos.y() % gridSize().height());
-
3109 return QPoint(x, y);
never executed: return QPoint(x, y);
0
3110} -
3111 -
3112QPoint QIconModeViewBase::draggedItemsDelta() const -
3113{ -
3114 if (movement() == QListView::Snap) {
never evaluated: movement() == QListView::Snap
0
3115 QPoint snapdelta = QPoint((offset().x() % gridSize().width()),
never executed (the execution status of this line is deduced): QPoint snapdelta = QPoint((offset().x() % gridSize().width()),
-
3116 (offset().y() % gridSize().height()));
never executed (the execution status of this line is deduced): (offset().y() % gridSize().height()));
-
3117 return snapToGrid(draggedItemsPos + snapdelta) - snapToGrid(pressedPosition()) - snapdelta;
never executed: return snapToGrid(draggedItemsPos + snapdelta) - snapToGrid(pressedPosition()) - snapdelta;
0
3118 } -
3119 return draggedItemsPos - pressedPosition();
never executed: return draggedItemsPos - pressedPosition();
0
3120} -
3121 -
3122QRect QIconModeViewBase::draggedItemsRect() const -
3123{ -
3124 QRect rect = itemsRect(draggedItems);
never executed (the execution status of this line is deduced): QRect rect = itemsRect(draggedItems);
-
3125 rect.translate(draggedItemsDelta());
never executed (the execution status of this line is deduced): rect.translate(draggedItemsDelta());
-
3126 return rect;
never executed: return rect;
0
3127} -
3128 -
3129void QListViewPrivate::scrollElasticBandBy(int dx, int dy) -
3130{ -
3131 if (dx > 0) // right
never evaluated: dx > 0
0
3132 elasticBand.moveRight(elasticBand.right() + dx);
never executed: elasticBand.moveRight(elasticBand.right() + dx);
0
3133 else if (dx < 0) // left
never evaluated: dx < 0
0
3134 elasticBand.moveLeft(elasticBand.left() - dx);
never executed: elasticBand.moveLeft(elasticBand.left() - dx);
0
3135 if (dy > 0) // down
never evaluated: dy > 0
0
3136 elasticBand.moveBottom(elasticBand.bottom() + dy);
never executed: elasticBand.moveBottom(elasticBand.bottom() + dy);
0
3137 else if (dy < 0) // up
never evaluated: dy < 0
0
3138 elasticBand.moveTop(elasticBand.top() - dy);
never executed: elasticBand.moveTop(elasticBand.top() - dy);
0
3139} -
3140 -
3141void QIconModeViewBase::clear() -
3142{ -
3143 tree.destroy();
executed (the execution status of this line is deduced): tree.destroy();
-
3144 items.clear();
executed (the execution status of this line is deduced): items.clear();
-
3145 moved.clear();
executed (the execution status of this line is deduced): moved.clear();
-
3146 batchStartRow = 0;
executed (the execution status of this line is deduced): batchStartRow = 0;
-
3147 batchSavedDeltaSeg = 0;
executed (the execution status of this line is deduced): batchSavedDeltaSeg = 0;
-
3148}
executed: }
Execution Count:247
247
3149 -
3150void QIconModeViewBase::updateContentsSize() -
3151{ -
3152 QRect bounding;
never executed (the execution status of this line is deduced): QRect bounding;
-
3153 for (int i = 0; i < items.count(); ++i)
never evaluated: i < items.count()
0
3154 bounding |= items.at(i).rect();
never executed: bounding |= items.at(i).rect();
0
3155 contentsSize = bounding.size();
never executed (the execution status of this line is deduced): contentsSize = bounding.size();
-
3156}
never executed: }
0
3157 -
3158/*! -
3159 \reimp -
3160*/ -
3161void QListView::currentChanged(const QModelIndex &current, const QModelIndex &previous) -
3162{ -
3163#ifndef QT_NO_ACCESSIBILITY -
3164 if (QAccessible::isActive()) {
evaluated: QAccessible::isActive()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:1888
4-1888
3165 if (current.isValid()) {
partially evaluated: current.isValid()
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
0-4
3166 int entry = visualIndex(current);
executed (the execution status of this line is deduced): int entry = visualIndex(current);
-
3167 QAccessibleEvent event(this, QAccessible::Focus);
executed (the execution status of this line is deduced): QAccessibleEvent event(this, QAccessible::Focus);
-
3168 event.setChild(entry);
executed (the execution status of this line is deduced): event.setChild(entry);
-
3169 QAccessible::updateAccessibility(&event);
executed (the execution status of this line is deduced): QAccessible::updateAccessibility(&event);
-
3170 }
executed: }
Execution Count:4
4
3171 }
executed: }
Execution Count:4
4
3172#endif -
3173 QAbstractItemView::currentChanged(current, previous);
executed (the execution status of this line is deduced): QAbstractItemView::currentChanged(current, previous);
-
3174}
executed: }
Execution Count:1892
1892
3175 -
3176/*! -
3177 \reimp -
3178*/ -
3179void QListView::selectionChanged(const QItemSelection &selected, -
3180 const QItemSelection &deselected) -
3181{ -
3182#ifndef QT_NO_ACCESSIBILITY -
3183 if (QAccessible::isActive()) {
evaluated: QAccessible::isActive()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:2263
5-2263
3184 // ### does not work properly for selection ranges. -
3185 QModelIndex sel = selected.indexes().value(0);
executed (the execution status of this line is deduced): QModelIndex sel = selected.indexes().value(0);
-
3186 if (sel.isValid()) {
evaluated: sel.isValid()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:1
1-4
3187 int entry = visualIndex(sel);
executed (the execution status of this line is deduced): int entry = visualIndex(sel);
-
3188 QAccessibleEvent event(this, QAccessible::Selection);
executed (the execution status of this line is deduced): QAccessibleEvent event(this, QAccessible::Selection);
-
3189 event.setChild(entry);
executed (the execution status of this line is deduced): event.setChild(entry);
-
3190 QAccessible::updateAccessibility(&event);
executed (the execution status of this line is deduced): QAccessible::updateAccessibility(&event);
-
3191 }
executed: }
Execution Count:4
4
3192 QModelIndex desel = deselected.indexes().value(0);
executed (the execution status of this line is deduced): QModelIndex desel = deselected.indexes().value(0);
-
3193 if (desel.isValid()) {
evaluated: desel.isValid()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:3
2-3
3194 int entry = visualIndex(desel);
executed (the execution status of this line is deduced): int entry = visualIndex(desel);
-
3195 QAccessibleEvent event(this, QAccessible::SelectionRemove);
executed (the execution status of this line is deduced): QAccessibleEvent event(this, QAccessible::SelectionRemove);
-
3196 event.setChild(entry);
executed (the execution status of this line is deduced): event.setChild(entry);
-
3197 QAccessible::updateAccessibility(&event);
executed (the execution status of this line is deduced): QAccessible::updateAccessibility(&event);
-
3198 }
executed: }
Execution Count:2
2
3199 }
executed: }
Execution Count:5
5
3200#endif -
3201 QAbstractItemView::selectionChanged(selected, deselected);
executed (the execution status of this line is deduced): QAbstractItemView::selectionChanged(selected, deselected);
-
3202}
executed: }
Execution Count:2268
2268
3203 -
3204int QListView::visualIndex(const QModelIndex &index) const -
3205{ -
3206 Q_D(const QListView);
executed (the execution status of this line is deduced): const QListViewPrivate * const d = d_func();
-
3207 d->executePostedLayout();
executed (the execution status of this line is deduced): d->executePostedLayout();
-
3208 QListViewItem itm = d->indexToListViewItem(index);
executed (the execution status of this line is deduced): QListViewItem itm = d->indexToListViewItem(index);
-
3209 int visualIndex = d->commonListView->itemIndex(itm);
executed (the execution status of this line is deduced): int visualIndex = d->commonListView->itemIndex(itm);
-
3210 for (int row = 0; row <= index.row() && visualIndex >= 0; row++) {
evaluated: row <= index.row()
TRUEFALSE
yes
Evaluation Count:9072
yes
Evaluation Count:439
partially evaluated: visualIndex >= 0
TRUEFALSE
yes
Evaluation Count:9072
no
Evaluation Count:0
0-9072
3211 if (d->isHidden(row))
evaluated: d->isHidden(row)
TRUEFALSE
yes
Evaluation Count:2704
yes
Evaluation Count:6368
2704-6368
3212 visualIndex--;
executed: visualIndex--;
Execution Count:2704
2704
3213 }
executed: }
Execution Count:9072
9072
3214 return visualIndex;
executed: return visualIndex;
Execution Count:439
439
3215} -
3216 -
3217QT_END_NAMESPACE -
3218 -
3219#endif // QT_NO_LISTVIEW -
3220 -
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial