itemviews/qabstractitemview.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 "qabstractitemview.h" -
43 -
44#ifndef QT_NO_ITEMVIEWS -
45#include <qpointer.h> -
46#include <qapplication.h> -
47#include <qclipboard.h> -
48#include <qpainter.h> -
49#include <qstyle.h> -
50#include <qdrag.h> -
51#include <qevent.h> -
52#include <qscrollbar.h> -
53#include <qwhatsthis.h> -
54#include <qtooltip.h> -
55#include <qdatetime.h> -
56#include <qlineedit.h> -
57#include <qspinbox.h> -
58#include <qtreeview.h> -
59#include <qtableview.h> -
60#include <qheaderview.h> -
61#include <qstyleditemdelegate.h> -
62#include <private/qabstractitemview_p.h> -
63#include <private/qabstractitemmodel_p.h> -
64#ifndef QT_NO_ACCESSIBILITY -
65#include <qaccessible.h> -
66#include <qaccessible2.h> -
67#endif -
68#ifndef QT_NO_GESTURES -
69# include <qscroller.h> -
70#endif -
71 -
72QT_BEGIN_NAMESPACE -
73 -
74QAbstractItemViewPrivate::QAbstractItemViewPrivate() -
75 : model(QAbstractItemModelPrivate::staticEmptyModel()), -
76 itemDelegate(0), -
77 selectionModel(0), -
78 ctrlDragSelectionFlag(QItemSelectionModel::NoUpdate), -
79 noSelectionOnMousePress(false), -
80 selectionMode(QAbstractItemView::ExtendedSelection), -
81 selectionBehavior(QAbstractItemView::SelectItems), -
82 currentlyCommittingEditor(0), -
83 pressedModifiers(Qt::NoModifier), -
84 pressedPosition(QPoint(-1, -1)), -
85 pressedAlreadySelected(false), -
86 viewportEnteredNeeded(false), -
87 state(QAbstractItemView::NoState), -
88 stateBeforeAnimation(QAbstractItemView::NoState), -
89 editTriggers(QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed), -
90 lastTrigger(QAbstractItemView::NoEditTriggers), -
91 tabKeyNavigation(false), -
92#ifndef QT_NO_DRAGANDDROP -
93 showDropIndicator(true), -
94 dragEnabled(false), -
95 dragDropMode(QAbstractItemView::NoDragDrop), -
96 overwrite(false), -
97 dropIndicatorPosition(QAbstractItemView::OnItem), -
98 defaultDropAction(Qt::IgnoreAction), -
99#endif -
100 autoScroll(true), -
101 autoScrollMargin(16), -
102 autoScrollCount(0), -
103 shouldScrollToCurrentOnShow(false), -
104 shouldClearStatusTip(false), -
105 alternatingColors(false), -
106 textElideMode(Qt::ElideRight), -
107 verticalScrollMode(QAbstractItemView::ScrollPerItem), -
108 horizontalScrollMode(QAbstractItemView::ScrollPerItem), -
109 currentIndexSet(false), -
110 wrapItemText(false), -
111 delayedPendingLayout(true), -
112 moveCursorUpdatedView(false) -
113{ -
114 keyboardInputTime.invalidate();
executed (the execution status of this line is deduced): keyboardInputTime.invalidate();
-
115}
executed: }
Execution Count:4015
4015
116 -
117QAbstractItemViewPrivate::~QAbstractItemViewPrivate() -
118{ -
119} -
120 -
121void QAbstractItemViewPrivate::init() -
122{ -
123 Q_Q(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemView * const q = q_func();
-
124 q->setItemDelegate(new QStyledItemDelegate(q));
executed (the execution status of this line is deduced): q->setItemDelegate(new QStyledItemDelegate(q));
-
125 -
126 vbar->setRange(0, 0);
executed (the execution status of this line is deduced): vbar->setRange(0, 0);
-
127 hbar->setRange(0, 0);
executed (the execution status of this line is deduced): hbar->setRange(0, 0);
-
128 -
129 QObject::connect(vbar, SIGNAL(actionTriggered(int)),
executed (the execution status of this line is deduced): QObject::connect(vbar, "2""actionTriggered(int)",
-
130 q, SLOT(verticalScrollbarAction(int)));
executed (the execution status of this line is deduced): q, "1""verticalScrollbarAction(int)");
-
131 QObject::connect(hbar, SIGNAL(actionTriggered(int)),
executed (the execution status of this line is deduced): QObject::connect(hbar, "2""actionTriggered(int)",
-
132 q, SLOT(horizontalScrollbarAction(int)));
executed (the execution status of this line is deduced): q, "1""horizontalScrollbarAction(int)");
-
133 QObject::connect(vbar, SIGNAL(valueChanged(int)),
executed (the execution status of this line is deduced): QObject::connect(vbar, "2""valueChanged(int)",
-
134 q, SLOT(verticalScrollbarValueChanged(int)));
executed (the execution status of this line is deduced): q, "1""verticalScrollbarValueChanged(int)");
-
135 QObject::connect(hbar, SIGNAL(valueChanged(int)),
executed (the execution status of this line is deduced): QObject::connect(hbar, "2""valueChanged(int)",
-
136 q, SLOT(horizontalScrollbarValueChanged(int)));
executed (the execution status of this line is deduced): q, "1""horizontalScrollbarValueChanged(int)");
-
137 -
138 viewport->setBackgroundRole(QPalette::Base);
executed (the execution status of this line is deduced): viewport->setBackgroundRole(QPalette::Base);
-
139 -
140 q->setAttribute(Qt::WA_InputMethodEnabled);
executed (the execution status of this line is deduced): q->setAttribute(Qt::WA_InputMethodEnabled);
-
141}
executed: }
Execution Count:4015
4015
142 -
143void QAbstractItemViewPrivate::setHoverIndex(const QPersistentModelIndex &index) -
144{ -
145 Q_Q(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemView * const q = q_func();
-
146 if (hover == index)
evaluated: hover == index
TRUEFALSE
yes
Evaluation Count:131
yes
Evaluation Count:6286
131-6286
147 return;
executed: return;
Execution Count:131
131
148 -
149 if (selectionBehavior != QAbstractItemView::SelectRows) {
evaluated: selectionBehavior != QAbstractItemView::SelectRows
TRUEFALSE
yes
Evaluation Count:6271
yes
Evaluation Count:15
15-6271
150 q->update(hover); //update the old one
executed (the execution status of this line is deduced): q->update(hover);
-
151 q->update(index); //update the new one
executed (the execution status of this line is deduced): q->update(index);
-
152 } else {
executed: }
Execution Count:6271
6271
153 QRect oldHoverRect = q->visualRect(hover);
executed (the execution status of this line is deduced): QRect oldHoverRect = q->visualRect(hover);
-
154 QRect newHoverRect = q->visualRect(index);
executed (the execution status of this line is deduced): QRect newHoverRect = q->visualRect(index);
-
155 viewport->update(QRect(0, newHoverRect.y(), viewport->width(), newHoverRect.height()));
executed (the execution status of this line is deduced): viewport->update(QRect(0, newHoverRect.y(), viewport->width(), newHoverRect.height()));
-
156 viewport->update(QRect(0, oldHoverRect.y(), viewport->width(), oldHoverRect.height()));
executed (the execution status of this line is deduced): viewport->update(QRect(0, oldHoverRect.y(), viewport->width(), oldHoverRect.height()));
-
157 }
executed: }
Execution Count:15
15
158 hover = index;
executed (the execution status of this line is deduced): hover = index;
-
159}
executed: }
Execution Count:6286
6286
160 -
161void QAbstractItemViewPrivate::checkMouseMove(const QPersistentModelIndex &index) -
162{ -
163 //we take a persistent model index because the model might change by emitting signals -
164 Q_Q(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemView * const q = q_func();
-
165 setHoverIndex(index);
executed (the execution status of this line is deduced): setHoverIndex(index);
-
166 if (viewportEnteredNeeded || enteredIndex != index) {
evaluated: viewportEnteredNeeded
TRUEFALSE
yes
Evaluation Count:56
yes
Evaluation Count:6361
evaluated: enteredIndex != index
TRUEFALSE
yes
Evaluation Count:6232
yes
Evaluation Count:129
56-6361
167 viewportEnteredNeeded = false;
executed (the execution status of this line is deduced): viewportEnteredNeeded = false;
-
168 -
169 if (index.isValid()) {
evaluated: index.isValid()
TRUEFALSE
yes
Evaluation Count:6280
yes
Evaluation Count:8
8-6280
170 emit q->entered(index);
executed (the execution status of this line is deduced): q->entered(index);
-
171#ifndef QT_NO_STATUSTIP -
172 QString statustip = model->data(index, Qt::StatusTipRole).toString();
executed (the execution status of this line is deduced): QString statustip = model->data(index, Qt::StatusTipRole).toString();
-
173 if (parent && (shouldClearStatusTip || !statustip.isEmpty())) {
evaluated: parent
TRUEFALSE
yes
Evaluation Count:28
yes
Evaluation Count:6252
partially evaluated: shouldClearStatusTip
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:28
partially evaluated: !statustip.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:28
0-6252
174 QStatusTipEvent tip(statustip);
never executed (the execution status of this line is deduced): QStatusTipEvent tip(statustip);
-
175 QApplication::sendEvent(parent, &tip);
never executed (the execution status of this line is deduced): QApplication::sendEvent(parent, &tip);
-
176 shouldClearStatusTip = !statustip.isEmpty();
never executed (the execution status of this line is deduced): shouldClearStatusTip = !statustip.isEmpty();
-
177 }
never executed: }
0
178#endif -
179 } else {
executed: }
Execution Count:6280
6280
180#ifndef QT_NO_STATUSTIP -
181 if (parent && shouldClearStatusTip) {
evaluated: parent
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:7
partially evaluated: shouldClearStatusTip
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-7
182 QString emptyString;
never executed (the execution status of this line is deduced): QString emptyString;
-
183 QStatusTipEvent tip( emptyString );
never executed (the execution status of this line is deduced): QStatusTipEvent tip( emptyString );
-
184 QApplication::sendEvent(parent, &tip);
never executed (the execution status of this line is deduced): QApplication::sendEvent(parent, &tip);
-
185 }
never executed: }
0
186#endif -
187 emit q->viewportEntered();
executed (the execution status of this line is deduced): q->viewportEntered();
-
188 }
executed: }
Execution Count:8
8
189 enteredIndex = index;
executed (the execution status of this line is deduced): enteredIndex = index;
-
190 }
executed: }
Execution Count:6288
6288
191}
executed: }
Execution Count:6417
6417
192 -
193#ifndef QT_NO_GESTURES -
194 -
195// stores and restores the selection and current item when flicking -
196void QAbstractItemViewPrivate::_q_scrollerStateChanged() -
197{ -
198 Q_Q(QAbstractItemView);
never executed (the execution status of this line is deduced): QAbstractItemView * const q = q_func();
-
199 -
200 if (QScroller *scroller = QScroller::scroller(viewport)) {
never evaluated: QScroller *scroller = QScroller::scroller(viewport)
0
201 switch (scroller->state()) { -
202 case QScroller::Pressed: -
203 // store the current selection in case we start scrolling -
204 if (q->selectionModel()) {
never evaluated: q->selectionModel()
0
205 oldSelection = q->selectionModel()->selection();
never executed (the execution status of this line is deduced): oldSelection = q->selectionModel()->selection();
-
206 oldCurrent = q->selectionModel()->currentIndex();
never executed (the execution status of this line is deduced): oldCurrent = q->selectionModel()->currentIndex();
-
207 }
never executed: }
0
208 break;
never executed: break;
0
209 -
210 case QScroller::Dragging: -
211 // restore the old selection if we really start scrolling -
212 if (q->selectionModel()) {
never evaluated: q->selectionModel()
0
213 q->selectionModel()->select(oldSelection, QItemSelectionModel::ClearAndSelect);
never executed (the execution status of this line is deduced): q->selectionModel()->select(oldSelection, QItemSelectionModel::ClearAndSelect);
-
214 q->selectionModel()->setCurrentIndex(oldCurrent, QItemSelectionModel::NoUpdate);
never executed (the execution status of this line is deduced): q->selectionModel()->setCurrentIndex(oldCurrent, QItemSelectionModel::NoUpdate);
-
215 }
never executed: }
0
216 // fall through -
217 -
218 default:
code before this statement never executed: default:
0
219 oldSelection = QItemSelection();
never executed (the execution status of this line is deduced): oldSelection = QItemSelection();
-
220 oldCurrent = QModelIndex();
never executed (the execution status of this line is deduced): oldCurrent = QModelIndex();
-
221 break;
never executed: break;
0
222 } -
223 }
never executed: }
0
224}
never executed: }
0
225 -
226#endif // QT_NO_GESTURES -
227 -
228/*! -
229 \class QAbstractItemView -
230 -
231 \brief The QAbstractItemView class provides the basic functionality for -
232 item view classes. -
233 -
234 \ingroup model-view -
235 \inmodule QtWidgets -
236 -
237 QAbstractItemView class is the base class for every standard view -
238 that uses a QAbstractItemModel. QAbstractItemView is an abstract -
239 class and cannot itself be instantiated. It provides a standard -
240 interface for interoperating with models through the signals and -
241 slots mechanism, enabling subclasses to be kept up-to-date with -
242 changes to their models. This class provides standard support for -
243 keyboard and mouse navigation, viewport scrolling, item editing, -
244 and selections. The keyboard navigation implements this -
245 functionality: -
246 -
247 \table -
248 \header -
249 \li Keys -
250 \li Functionality -
251 \row -
252 \li Arrow keys -
253 \li Changes the current item and selects it. -
254 \row -
255 \li Ctrl+Arrow keys -
256 \li Changes the current item but does not select it. -
257 \row -
258 \li Shift+Arrow keys -
259 \li Changes the current item and selects it. The previously -
260 selected item(s) is not deselected. -
261 \row -
262 \li Ctr+Space -
263 \li Toggles selection of the current item. -
264 \row -
265 \li Tab/Backtab -
266 \li Changes the current item to the next/previous item. -
267 \row -
268 \li Home/End -
269 \li Selects the first/last item in the model. -
270 \row -
271 \li Page up/Page down -
272 \li Scrolls the rows shown up/down by the number of -
273 visible rows in the view. -
274 \row -
275 \li Ctrl+A -
276 \li Selects all items in the model. -
277 \endtable -
278 -
279 Note that the above table assumes that the -
280 \l{selectionMode}{selection mode} allows the operations. For -
281 instance, you cannot select items if the selection mode is -
282 QAbstractItemView::NoSelection. -
283 -
284 The QAbstractItemView class is one of the \l{Model/View Classes} -
285 and is part of Qt's \l{Model/View Programming}{model/view framework}. -
286 -
287 The view classes that inherit QAbstractItemView only need -
288 to implement their own view-specific functionality, such as -
289 drawing items, returning the geometry of items, finding items, -
290 etc. -
291 -
292 QAbstractItemView provides common slots such as edit() and -
293 setCurrentIndex(). Many protected slots are also provided, including -
294 dataChanged(), rowsInserted(), rowsAboutToBeRemoved(), selectionChanged(), -
295 and currentChanged(). -
296 -
297 The root item is returned by rootIndex(), and the current item by -
298 currentIndex(). To make sure that an item is visible use -
299 scrollTo(). -
300 -
301 Some of QAbstractItemView's functions are concerned with -
302 scrolling, for example setHorizontalScrollMode() and -
303 setVerticalScrollMode(). To set the range of the scroll bars, you -
304 can, for example, reimplement the view's resizeEvent() function: -
305 -
306 \snippet code/src_gui_itemviews_qabstractitemview.cpp 0 -
307 -
308 Note that the range is not updated until the widget is shown. -
309 -
310 Several other functions are concerned with selection control; for -
311 example setSelectionMode(), and setSelectionBehavior(). This class -
312 provides a default selection model to work with -
313 (selectionModel()), but this can be replaced by using -
314 setSelectionModel() with an instance of QItemSelectionModel. -
315 -
316 For complete control over the display and editing of items you can -
317 specify a delegate with setItemDelegate(). -
318 -
319 QAbstractItemView provides a lot of protected functions. Some are -
320 concerned with editing, for example, edit(), and commitData(), -
321 whilst others are keyboard and mouse event handlers. -
322 -
323 \note If you inherit QAbstractItemView and intend to update the contents -
324 of the viewport, you should use viewport->update() instead of -
325 \l{QWidget::update()}{update()} as all painting operations take place on the -
326 viewport. -
327 -
328 \sa {View Classes}, {Model/View Programming}, QAbstractItemModel, {Chart Example} -
329*/ -
330 -
331/*! -
332 \enum QAbstractItemView::SelectionMode -
333 -
334 This enum indicates how the view responds to user selections: -
335 -
336 \value SingleSelection When the user selects an item, any already-selected -
337 item becomes unselected, and the user cannot unselect the selected item by -
338 clicking on it. -
339 -
340 \value ContiguousSelection When the user selects an item in the usual way, -
341 the selection is cleared and the new item selected. However, if the user -
342 presses the Shift key while clicking on an item, all items between the -
343 current item and the clicked item are selected or unselected, depending on -
344 the state of the clicked item. -
345 -
346 \value ExtendedSelection When the user selects an item in the usual way, -
347 the selection is cleared and the new item selected. However, if the user -
348 presses the Ctrl key when clicking on an item, the clicked item gets -
349 toggled and all other items are left untouched. If the user presses the -
350 Shift key while clicking on an item, all items between the current item -
351 and the clicked item are selected or unselected, depending on the state of -
352 the clicked item. Multiple items can be selected by dragging the mouse over -
353 them. -
354 -
355 \value MultiSelection When the user selects an item in the usual way, the -
356 selection status of that item is toggled and the other items are left -
357 alone. Multiple items can be toggled by dragging the mouse over them. -
358 -
359 \value NoSelection Items cannot be selected. -
360 -
361 The most commonly used modes are SingleSelection and ExtendedSelection. -
362*/ -
363 -
364/*! -
365 \enum QAbstractItemView::SelectionBehavior -
366 -
367 \value SelectItems Selecting single items. -
368 \value SelectRows Selecting only rows. -
369 \value SelectColumns Selecting only columns. -
370*/ -
371 -
372/*! -
373 \enum QAbstractItemView::ScrollHint -
374 -
375 \value EnsureVisible Scroll to ensure that the item is visible. -
376 \value PositionAtTop Scroll to position the item at the top of the -
377 viewport. -
378 \value PositionAtBottom Scroll to position the item at the bottom of the -
379 viewport. -
380 \value PositionAtCenter Scroll to position the item at the center of the -
381 viewport. -
382*/ -
383 -
384 -
385/*! -
386 \enum QAbstractItemView::EditTrigger -
387 -
388 This enum describes actions which will initiate item editing. -
389 -
390 \value NoEditTriggers No editing possible. -
391 \value CurrentChanged Editing start whenever current item changes. -
392 \value DoubleClicked Editing starts when an item is double clicked. -
393 \value SelectedClicked Editing starts when clicking on an already selected -
394 item. -
395 \value EditKeyPressed Editing starts when the platform edit key has been -
396 pressed over an item. -
397 \value AnyKeyPressed Editing starts when any key is pressed over an item. -
398 \value AllEditTriggers Editing starts for all above actions. -
399*/ -
400 -
401/*! -
402 \enum QAbstractItemView::CursorAction -
403 -
404 This enum describes the different ways to navigate between items, -
405 \sa moveCursor() -
406 -
407 \value MoveUp Move to the item above the current item. -
408 \value MoveDown Move to the item below the current item. -
409 \value MoveLeft Move to the item left of the current item. -
410 \value MoveRight Move to the item right of the current item. -
411 \value MoveHome Move to the top-left corner item. -
412 \value MoveEnd Move to the bottom-right corner item. -
413 \value MovePageUp Move one page up above the current item. -
414 \value MovePageDown Move one page down below the current item. -
415 \value MoveNext Move to the item after the current item. -
416 \value MovePrevious Move to the item before the current item. -
417*/ -
418 -
419/*! -
420 \enum QAbstractItemView::State -
421 -
422 Describes the different states the view can be in. This is usually -
423 only interesting when reimplementing your own view. -
424 -
425 \value NoState The is the default state. -
426 \value DraggingState The user is dragging items. -
427 \value DragSelectingState The user is selecting items. -
428 \value EditingState The user is editing an item in a widget editor. -
429 \value ExpandingState The user is opening a branch of items. -
430 \value CollapsingState The user is closing a branch of items. -
431 \value AnimatingState The item view is performing an animation. -
432*/ -
433 -
434/*! -
435 \since 4.2 -
436 \enum QAbstractItemView::ScrollMode -
437 -
438 \value ScrollPerItem The view will scroll the contents one item at a time. -
439 \value ScrollPerPixel The view will scroll the contents one pixel at a time. -
440*/ -
441 -
442/*! -
443 \fn QRect QAbstractItemView::visualRect(const QModelIndex &index) const = 0 -
444 Returns the rectangle on the viewport occupied by the item at \a index. -
445 -
446 If your item is displayed in several areas then visualRect should return -
447 the primary area that contains index and not the complete area that index -
448 might encompasses, touch or cause drawing. -
449 -
450 In the base class this is a pure virtual function. -
451 -
452 \sa indexAt(), visualRegionForSelection() -
453*/ -
454 -
455/*! -
456 \fn void QAbstractItemView::scrollTo(const QModelIndex &index, ScrollHint hint) = 0 -
457 -
458 Scrolls the view if necessary to ensure that the item at \a index -
459 is visible. The view will try to position the item according to the given \a hint. -
460 -
461 In the base class this is a pure virtual function. -
462*/ -
463 -
464/*! -
465 \fn QModelIndex QAbstractItemView::indexAt(const QPoint &point) const = 0 -
466 -
467 Returns the model index of the item at the viewport coordinates \a point. -
468 -
469 In the base class this is a pure virtual function. -
470 -
471 \sa visualRect() -
472*/ -
473 -
474/*! -
475 \fn void QAbstractItemView::activated(const QModelIndex &index) -
476 -
477 This signal is emitted when the item specified by \a index is -
478 activated by the user. How to activate items depends on the -
479 platform; e.g., by single- or double-clicking the item, or by -
480 pressing the Return or Enter key when the item is current. -
481 -
482 \sa clicked(), doubleClicked(), entered(), pressed() -
483*/ -
484 -
485/*! -
486 \fn void QAbstractItemView::entered(const QModelIndex &index) -
487 -
488 This signal is emitted when the mouse cursor enters the item -
489 specified by \a index. -
490 Mouse tracking needs to be enabled for this feature to work. -
491 -
492 \sa viewportEntered(), activated(), clicked(), doubleClicked(), pressed() -
493*/ -
494 -
495/*! -
496 \fn void QAbstractItemView::viewportEntered() -
497 -
498 This signal is emitted when the mouse cursor enters the viewport. -
499 Mouse tracking needs to be enabled for this feature to work. -
500 -
501 \sa entered() -
502*/ -
503 -
504/*! -
505 \fn void QAbstractItemView::pressed(const QModelIndex &index) -
506 -
507 This signal is emitted when a mouse button is pressed. The item -
508 the mouse was pressed on is specified by \a index. The signal is -
509 only emitted when the index is valid. -
510 -
511 Use the QApplication::mouseButtons() function to get the state -
512 of the mouse buttons. -
513 -
514 \sa activated(), clicked(), doubleClicked(), entered() -
515*/ -
516 -
517/*! -
518 \fn void QAbstractItemView::clicked(const QModelIndex &index) -
519 -
520 This signal is emitted when a mouse button is left-clicked. The item -
521 the mouse was clicked on is specified by \a index. The signal is -
522 only emitted when the index is valid. -
523 -
524 \sa activated(), doubleClicked(), entered(), pressed() -
525*/ -
526 -
527/*! -
528 \fn void QAbstractItemView::doubleClicked(const QModelIndex &index) -
529 -
530 This signal is emitted when a mouse button is double-clicked. The -
531 item the mouse was double-clicked on is specified by \a index. -
532 The signal is only emitted when the index is valid. -
533 -
534 \sa clicked(), activated() -
535*/ -
536 -
537/*! -
538 \fn QModelIndex QAbstractItemView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers) = 0 -
539 -
540 Returns a QModelIndex object pointing to the next object in the view, -
541 based on the given \a cursorAction and keyboard modifiers specified -
542 by \a modifiers. -
543 -
544 In the base class this is a pure virtual function. -
545*/ -
546 -
547/*! -
548 \fn int QAbstractItemView::horizontalOffset() const = 0 -
549 -
550 Returns the horizontal offset of the view. -
551 -
552 In the base class this is a pure virtual function. -
553 -
554 \sa verticalOffset() -
555*/ -
556 -
557/*! -
558 \fn int QAbstractItemView::verticalOffset() const = 0 -
559 -
560 Returns the vertical offset of the view. -
561 -
562 In the base class this is a pure virtual function. -
563 -
564 \sa horizontalOffset() -
565*/ -
566 -
567/*! -
568 \fn bool QAbstractItemView::isIndexHidden(const QModelIndex &index) const -
569 -
570 Returns true if the item referred to by the given \a index is hidden in the view, -
571 otherwise returns false. -
572 -
573 Hiding is a view specific feature. For example in TableView a column can be marked -
574 as hidden or a row in the TreeView. -
575 -
576 In the base class this is a pure virtual function. -
577*/ -
578 -
579/*! -
580 \fn void QAbstractItemView::setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags flags) -
581 -
582 Applies the selection \a flags to the items in or touched by the -
583 rectangle, \a rect. -
584 -
585 When implementing your own itemview setSelection should call -
586 selectionModel()->select(selection, flags) where selection -
587 is either an empty QModelIndex or a QItemSelection that contains -
588 all items that are contained in \a rect. -
589 -
590 \sa selectionCommand(), selectedIndexes() -
591*/ -
592 -
593/*! -
594 \fn QRegion QAbstractItemView::visualRegionForSelection(const QItemSelection &selection) const = 0 -
595 -
596 Returns the region from the viewport of the items in the given -
597 \a selection. -
598 -
599 In the base class this is a pure virtual function. -
600 -
601 \sa visualRect(), selectedIndexes() -
602*/ -
603 -
604/*! -
605 \fn void QAbstractItemView::update() -
606 \internal -
607*/ -
608 -
609/*! -
610 Constructs an abstract item view with the given \a parent. -
611*/ -
612QAbstractItemView::QAbstractItemView(QWidget *parent) -
613 : QAbstractScrollArea(*(new QAbstractItemViewPrivate), parent) -
614{ -
615 d_func()->init();
never executed (the execution status of this line is deduced): d_func()->init();
-
616}
never executed: }
0
617 -
618/*! -
619 \internal -
620*/ -
621QAbstractItemView::QAbstractItemView(QAbstractItemViewPrivate &dd, QWidget *parent) -
622 : QAbstractScrollArea(dd, parent) -
623{ -
624 d_func()->init();
executed (the execution status of this line is deduced): d_func()->init();
-
625}
executed: }
Execution Count:4015
4015
626 -
627/*! -
628 Destroys the view. -
629*/ -
630QAbstractItemView::~QAbstractItemView() -
631{ -
632 Q_D(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
633 // stop these timers here before ~QObject -
634 d->delayedReset.stop();
executed (the execution status of this line is deduced): d->delayedReset.stop();
-
635 d->updateTimer.stop();
executed (the execution status of this line is deduced): d->updateTimer.stop();
-
636 d->delayedEditing.stop();
executed (the execution status of this line is deduced): d->delayedEditing.stop();
-
637 d->delayedAutoScroll.stop();
executed (the execution status of this line is deduced): d->delayedAutoScroll.stop();
-
638 d->autoScrollTimer.stop();
executed (the execution status of this line is deduced): d->autoScrollTimer.stop();
-
639 d->delayedLayout.stop();
executed (the execution status of this line is deduced): d->delayedLayout.stop();
-
640 d->fetchMoreTimer.stop();
executed (the execution status of this line is deduced): d->fetchMoreTimer.stop();
-
641}
executed: }
Execution Count:3389
3389
642 -
643/*! -
644 Sets the \a model for the view to present. -
645 -
646 This function will create and set a new selection model, replacing any -
647 model that was previously set with setSelectionModel(). However, the old -
648 selection model will not be deleted as it may be shared between several -
649 views. We recommend that you delete the old selection model if it is no -
650 longer required. This is done with the following code: -
651 -
652 \snippet code/src_gui_itemviews_qabstractitemview.cpp 2 -
653 -
654 If both the old model and the old selection model do not have parents, or -
655 if their parents are long-lived objects, it may be preferable to call their -
656 deleteLater() functions to explicitly delete them. -
657 -
658 The view \e{does not} take ownership of the model unless it is the model's -
659 parent object because the model may be shared between many different views. -
660 -
661 \sa selectionModel(), setSelectionModel() -
662*/ -
663void QAbstractItemView::setModel(QAbstractItemModel *model) -
664{ -
665 Q_D(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
666 if (model == d->model)
evaluated: model == d->model
TRUEFALSE
yes
Evaluation Count:1640
yes
Evaluation Count:4131
1640-4131
667 return;
executed: return;
Execution Count:1640
1640
668 if (d->model && d->model != QAbstractItemModelPrivate::staticEmptyModel()) {
partially evaluated: d->model
TRUEFALSE
yes
Evaluation Count:4131
no
Evaluation Count:0
evaluated: d->model != QAbstractItemModelPrivate::staticEmptyModel()
TRUEFALSE
yes
Evaluation Count:32
yes
Evaluation Count:4099
0-4131
669 disconnect(d->model, SIGNAL(destroyed()),
executed (the execution status of this line is deduced): disconnect(d->model, "2""destroyed()",
-
670 this, SLOT(_q_modelDestroyed()));
executed (the execution status of this line is deduced): this, "1""_q_modelDestroyed()");
-
671 disconnect(d->model, SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector<int>)),
executed (the execution status of this line is deduced): disconnect(d->model, "2""dataChanged(QModelIndex,QModelIndex,QVector<int>)",
-
672 this, SLOT(dataChanged(QModelIndex,QModelIndex,QVector<int>)));
executed (the execution status of this line is deduced): this, "1""dataChanged(QModelIndex,QModelIndex,QVector<int>)");
-
673 disconnect(d->model, SIGNAL(headerDataChanged(Qt::Orientation,int,int)),
executed (the execution status of this line is deduced): disconnect(d->model, "2""headerDataChanged(Qt::Orientation,int,int)",
-
674 this, SLOT(_q_headerDataChanged()));
executed (the execution status of this line is deduced): this, "1""_q_headerDataChanged()");
-
675 disconnect(d->model, SIGNAL(rowsInserted(QModelIndex,int,int)),
executed (the execution status of this line is deduced): disconnect(d->model, "2""rowsInserted(QModelIndex,int,int)",
-
676 this, SLOT(rowsInserted(QModelIndex,int,int)));
executed (the execution status of this line is deduced): this, "1""rowsInserted(QModelIndex,int,int)");
-
677 disconnect(d->model, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)),
executed (the execution status of this line is deduced): disconnect(d->model, "2""rowsAboutToBeRemoved(QModelIndex,int,int)",
-
678 this, SLOT(rowsAboutToBeRemoved(QModelIndex,int,int)));
executed (the execution status of this line is deduced): this, "1""rowsAboutToBeRemoved(QModelIndex,int,int)");
-
679 disconnect(d->model, SIGNAL(rowsRemoved(QModelIndex,int,int)),
executed (the execution status of this line is deduced): disconnect(d->model, "2""rowsRemoved(QModelIndex,int,int)",
-
680 this, SLOT(_q_rowsRemoved(QModelIndex,int,int)));
executed (the execution status of this line is deduced): this, "1""_q_rowsRemoved(QModelIndex,int,int)");
-
681 disconnect(d->model, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)),
executed (the execution status of this line is deduced): disconnect(d->model, "2""rowsMoved(QModelIndex,int,int,QModelIndex,int)",
-
682 this, SLOT(_q_rowsMoved(QModelIndex,int,int,QModelIndex,int)));
executed (the execution status of this line is deduced): this, "1""_q_rowsMoved(QModelIndex,int,int,QModelIndex,int)");
-
683 disconnect(d->model, SIGNAL(rowsInserted(QModelIndex,int,int)),
executed (the execution status of this line is deduced): disconnect(d->model, "2""rowsInserted(QModelIndex,int,int)",
-
684 this, SLOT(_q_rowsInserted(QModelIndex,int,int)));
executed (the execution status of this line is deduced): this, "1""_q_rowsInserted(QModelIndex,int,int)");
-
685 disconnect(d->model, SIGNAL(columnsAboutToBeRemoved(QModelIndex,int,int)),
executed (the execution status of this line is deduced): disconnect(d->model, "2""columnsAboutToBeRemoved(QModelIndex,int,int)",
-
686 this, SLOT(_q_columnsAboutToBeRemoved(QModelIndex,int,int)));
executed (the execution status of this line is deduced): this, "1""_q_columnsAboutToBeRemoved(QModelIndex,int,int)");
-
687 disconnect(d->model, SIGNAL(columnsRemoved(QModelIndex,int,int)),
executed (the execution status of this line is deduced): disconnect(d->model, "2""columnsRemoved(QModelIndex,int,int)",
-
688 this, SLOT(_q_columnsRemoved(QModelIndex,int,int)));
executed (the execution status of this line is deduced): this, "1""_q_columnsRemoved(QModelIndex,int,int)");
-
689 disconnect(d->model, SIGNAL(columnsInserted(QModelIndex,int,int)),
executed (the execution status of this line is deduced): disconnect(d->model, "2""columnsInserted(QModelIndex,int,int)",
-
690 this, SLOT(_q_columnsInserted(QModelIndex,int,int)));
executed (the execution status of this line is deduced): this, "1""_q_columnsInserted(QModelIndex,int,int)");
-
691 disconnect(d->model, SIGNAL(columnsMoved(QModelIndex,int,int,QModelIndex,int)),
executed (the execution status of this line is deduced): disconnect(d->model, "2""columnsMoved(QModelIndex,int,int,QModelIndex,int)",
-
692 this, SLOT(_q_columnsMoved(QModelIndex,int,int,QModelIndex,int)));
executed (the execution status of this line is deduced): this, "1""_q_columnsMoved(QModelIndex,int,int,QModelIndex,int)");
-
693 -
694 disconnect(d->model, SIGNAL(modelReset()), this, SLOT(reset()));
executed (the execution status of this line is deduced): disconnect(d->model, "2""modelReset()", this, "1""reset()");
-
695 disconnect(d->model, SIGNAL(layoutChanged()), this, SLOT(_q_layoutChanged()));
executed (the execution status of this line is deduced): disconnect(d->model, "2""layoutChanged()", this, "1""_q_layoutChanged()");
-
696 }
executed: }
Execution Count:32
32
697 d->model = (model ? model : QAbstractItemModelPrivate::staticEmptyModel());
evaluated: model
TRUEFALSE
yes
Evaluation Count:4121
yes
Evaluation Count:10
10-4121
698 -
699 // These asserts do basic sanity checking of the model -
700 Q_ASSERT_X(d->model->index(0,0) == d->model->index(0,0),
executed (the execution status of this line is deduced): qt_noop();
-
701 "QAbstractItemView::setModel", -
702 "A model should return the exact same index " -
703 "(including its internal id/pointer) when asked for it twice in a row."); -
704 Q_ASSERT_X(!d->model->index(0,0).parent().isValid(),
executed (the execution status of this line is deduced): qt_noop();
-
705 "QAbstractItemView::setModel", -
706 "The parent of a top level index should be invalid"); -
707 -
708 if (d->model != QAbstractItemModelPrivate::staticEmptyModel()) {
evaluated: d->model != QAbstractItemModelPrivate::staticEmptyModel()
TRUEFALSE
yes
Evaluation Count:4121
yes
Evaluation Count:10
10-4121
709 connect(d->model, SIGNAL(destroyed()),
executed (the execution status of this line is deduced): connect(d->model, "2""destroyed()",
-
710 this, SLOT(_q_modelDestroyed()));
executed (the execution status of this line is deduced): this, "1""_q_modelDestroyed()");
-
711 connect(d->model, SIGNAL(dataChanged(QModelIndex,QModelIndex,QVector<int>)),
executed (the execution status of this line is deduced): connect(d->model, "2""dataChanged(QModelIndex,QModelIndex,QVector<int>)",
-
712 this, SLOT(dataChanged(QModelIndex,QModelIndex,QVector<int>)));
executed (the execution status of this line is deduced): this, "1""dataChanged(QModelIndex,QModelIndex,QVector<int>)");
-
713 connect(d->model, SIGNAL(headerDataChanged(Qt::Orientation,int,int)),
executed (the execution status of this line is deduced): connect(d->model, "2""headerDataChanged(Qt::Orientation,int,int)",
-
714 this, SLOT(_q_headerDataChanged()));
executed (the execution status of this line is deduced): this, "1""_q_headerDataChanged()");
-
715 connect(d->model, SIGNAL(rowsInserted(QModelIndex,int,int)),
executed (the execution status of this line is deduced): connect(d->model, "2""rowsInserted(QModelIndex,int,int)",
-
716 this, SLOT(rowsInserted(QModelIndex,int,int)));
executed (the execution status of this line is deduced): this, "1""rowsInserted(QModelIndex,int,int)");
-
717 connect(d->model, SIGNAL(rowsInserted(QModelIndex,int,int)),
executed (the execution status of this line is deduced): connect(d->model, "2""rowsInserted(QModelIndex,int,int)",
-
718 this, SLOT(_q_rowsInserted(QModelIndex,int,int)));
executed (the execution status of this line is deduced): this, "1""_q_rowsInserted(QModelIndex,int,int)");
-
719 connect(d->model, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)),
executed (the execution status of this line is deduced): connect(d->model, "2""rowsAboutToBeRemoved(QModelIndex,int,int)",
-
720 this, SLOT(rowsAboutToBeRemoved(QModelIndex,int,int)));
executed (the execution status of this line is deduced): this, "1""rowsAboutToBeRemoved(QModelIndex,int,int)");
-
721 connect(d->model, SIGNAL(rowsRemoved(QModelIndex,int,int)),
executed (the execution status of this line is deduced): connect(d->model, "2""rowsRemoved(QModelIndex,int,int)",
-
722 this, SLOT(_q_rowsRemoved(QModelIndex,int,int)));
executed (the execution status of this line is deduced): this, "1""_q_rowsRemoved(QModelIndex,int,int)");
-
723 connect(d->model, SIGNAL(rowsMoved(QModelIndex,int,int,QModelIndex,int)),
executed (the execution status of this line is deduced): connect(d->model, "2""rowsMoved(QModelIndex,int,int,QModelIndex,int)",
-
724 this, SLOT(_q_rowsMoved(QModelIndex,int,int,QModelIndex,int)));
executed (the execution status of this line is deduced): this, "1""_q_rowsMoved(QModelIndex,int,int,QModelIndex,int)");
-
725 connect(d->model, SIGNAL(columnsAboutToBeRemoved(QModelIndex,int,int)),
executed (the execution status of this line is deduced): connect(d->model, "2""columnsAboutToBeRemoved(QModelIndex,int,int)",
-
726 this, SLOT(_q_columnsAboutToBeRemoved(QModelIndex,int,int)));
executed (the execution status of this line is deduced): this, "1""_q_columnsAboutToBeRemoved(QModelIndex,int,int)");
-
727 connect(d->model, SIGNAL(columnsRemoved(QModelIndex,int,int)),
executed (the execution status of this line is deduced): connect(d->model, "2""columnsRemoved(QModelIndex,int,int)",
-
728 this, SLOT(_q_columnsRemoved(QModelIndex,int,int)));
executed (the execution status of this line is deduced): this, "1""_q_columnsRemoved(QModelIndex,int,int)");
-
729 connect(d->model, SIGNAL(columnsInserted(QModelIndex,int,int)),
executed (the execution status of this line is deduced): connect(d->model, "2""columnsInserted(QModelIndex,int,int)",
-
730 this, SLOT(_q_columnsInserted(QModelIndex,int,int)));
executed (the execution status of this line is deduced): this, "1""_q_columnsInserted(QModelIndex,int,int)");
-
731 connect(d->model, SIGNAL(columnsMoved(QModelIndex,int,int,QModelIndex,int)),
executed (the execution status of this line is deduced): connect(d->model, "2""columnsMoved(QModelIndex,int,int,QModelIndex,int)",
-
732 this, SLOT(_q_columnsMoved(QModelIndex,int,int,QModelIndex,int)));
executed (the execution status of this line is deduced): this, "1""_q_columnsMoved(QModelIndex,int,int,QModelIndex,int)");
-
733 -
734 connect(d->model, SIGNAL(modelReset()), this, SLOT(reset()));
executed (the execution status of this line is deduced): connect(d->model, "2""modelReset()", this, "1""reset()");
-
735 connect(d->model, SIGNAL(layoutChanged()), this, SLOT(_q_layoutChanged()));
executed (the execution status of this line is deduced): connect(d->model, "2""layoutChanged()", this, "1""_q_layoutChanged()");
-
736 }
executed: }
Execution Count:4121
4121
737 -
738 QItemSelectionModel *selection_model = new QItemSelectionModel(d->model, this);
executed (the execution status of this line is deduced): QItemSelectionModel *selection_model = new QItemSelectionModel(d->model, this);
-
739 connect(d->model, SIGNAL(destroyed()), selection_model, SLOT(deleteLater()));
executed (the execution status of this line is deduced): connect(d->model, "2""destroyed()", selection_model, "1""deleteLater()");
-
740 setSelectionModel(selection_model);
executed (the execution status of this line is deduced): setSelectionModel(selection_model);
-
741 -
742 reset(); // kill editors, set new root and do layout
executed (the execution status of this line is deduced): reset();
-
743}
executed: }
Execution Count:4131
4131
744 -
745/*! -
746 Returns the model that this view is presenting. -
747*/ -
748QAbstractItemModel *QAbstractItemView::model() const -
749{ -
750 Q_D(const QAbstractItemView);
executed (the execution status of this line is deduced): const QAbstractItemViewPrivate * const d = d_func();
-
751 return (d->model == QAbstractItemModelPrivate::staticEmptyModel() ? 0 : d->model);
executed: return (d->model == QAbstractItemModelPrivate::staticEmptyModel() ? 0 : d->model);
Execution Count:143236
143236
752} -
753 -
754/*! -
755 Sets the current selection model to the given \a selectionModel. -
756 -
757 Note that, if you call setModel() after this function, the given \a selectionModel -
758 will be replaced by one created by the view. -
759 -
760 \note It is up to the application to delete the old selection model if it is no -
761 longer needed; i.e., if it is not being used by other views. This will happen -
762 automatically when its parent object is deleted. However, if it does not have a -
763 parent, or if the parent is a long-lived object, it may be preferable to call its -
764 deleteLater() function to explicitly delete it. -
765 -
766 \sa selectionModel(), setModel(), clearSelection() -
767*/ -
768void QAbstractItemView::setSelectionModel(QItemSelectionModel *selectionModel) -
769{ -
770 // ### if the given model is null, we should use the original selection model -
771 Q_ASSERT(selectionModel);
executed (the execution status of this line is deduced): qt_noop();
-
772 Q_D(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
773 -
774 if (selectionModel->model() != d->model) {
partially evaluated: selectionModel->model() != d->model
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6194
0-6194
775 qWarning("QAbstractItemView::setSelectionModel() failed: "
never executed (the execution status of this line is deduced): QMessageLogger("itemviews/qabstractitemview.cpp", 775, __PRETTY_FUNCTION__).warning("QAbstractItemView::setSelectionModel() failed: "
-
776 "Trying to set a selection model, which works on "
never executed (the execution status of this line is deduced): "Trying to set a selection model, which works on "
-
777 "a different model than the view.");
never executed (the execution status of this line is deduced): "a different model than the view.");
-
778 return;
never executed: return;
0
779 } -
780 -
781 if (d->selectionModel) {
evaluated: d->selectionModel
TRUEFALSE
yes
Evaluation Count:2349
yes
Evaluation Count:3845
2349-3845
782 disconnect(d->selectionModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
executed (the execution status of this line is deduced): disconnect(d->selectionModel, "2""selectionChanged(QItemSelection,QItemSelection)",
-
783 this, SLOT(selectionChanged(QItemSelection,QItemSelection)));
executed (the execution status of this line is deduced): this, "1""selectionChanged(QItemSelection,QItemSelection)");
-
784 disconnect(d->selectionModel, SIGNAL(currentChanged(QModelIndex,QModelIndex)),
executed (the execution status of this line is deduced): disconnect(d->selectionModel, "2""currentChanged(QModelIndex,QModelIndex)",
-
785 this, SLOT(currentChanged(QModelIndex,QModelIndex)));
executed (the execution status of this line is deduced): this, "1""currentChanged(QModelIndex,QModelIndex)");
-
786 }
executed: }
Execution Count:2349
2349
787 -
788 d->selectionModel = selectionModel;
executed (the execution status of this line is deduced): d->selectionModel = selectionModel;
-
789 -
790 if (d->selectionModel) {
partially evaluated: d->selectionModel
TRUEFALSE
yes
Evaluation Count:6194
no
Evaluation Count:0
0-6194
791 connect(d->selectionModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
executed (the execution status of this line is deduced): connect(d->selectionModel, "2""selectionChanged(QItemSelection,QItemSelection)",
-
792 this, SLOT(selectionChanged(QItemSelection,QItemSelection)));
executed (the execution status of this line is deduced): this, "1""selectionChanged(QItemSelection,QItemSelection)");
-
793 connect(d->selectionModel, SIGNAL(currentChanged(QModelIndex,QModelIndex)),
executed (the execution status of this line is deduced): connect(d->selectionModel, "2""currentChanged(QModelIndex,QModelIndex)",
-
794 this, SLOT(currentChanged(QModelIndex,QModelIndex)));
executed (the execution status of this line is deduced): this, "1""currentChanged(QModelIndex,QModelIndex)");
-
795 }
executed: }
Execution Count:6194
6194
796}
executed: }
Execution Count:6194
6194
797 -
798/*! -
799 Returns the current selection model. -
800 -
801 \sa setSelectionModel(), selectedIndexes() -
802*/ -
803QItemSelectionModel* QAbstractItemView::selectionModel() const -
804{ -
805 Q_D(const QAbstractItemView);
executed (the execution status of this line is deduced): const QAbstractItemViewPrivate * const d = d_func();
-
806 return d->selectionModel;
executed: return d->selectionModel;
Execution Count:7716
7716
807} -
808 -
809/*! -
810 Sets the item delegate for this view and its model to \a delegate. -
811 This is useful if you want complete control over the editing and -
812 display of items. -
813 -
814 Any existing delegate will be removed, but not deleted. QAbstractItemView -
815 does not take ownership of \a delegate. -
816 -
817 \warning You should not share the same instance of a delegate between views. -
818 Doing so can cause incorrect or unintuitive editing behavior since each -
819 view connected to a given delegate may receive the \l{QAbstractItemDelegate::}{closeEditor()} -
820 signal, and attempt to access, modify or close an editor that has already been closed. -
821 -
822 \sa itemDelegate() -
823*/ -
824void QAbstractItemView::setItemDelegate(QAbstractItemDelegate *delegate) -
825{ -
826 Q_D(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
827 if (delegate == d->itemDelegate)
partially evaluated: delegate == d->itemDelegate
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4793
0-4793
828 return;
never executed: return;
0
829 -
830 if (d->itemDelegate) {
evaluated: d->itemDelegate
TRUEFALSE
yes
Evaluation Count:299
yes
Evaluation Count:4494
299-4494
831 if (d->delegateRefCount(d->itemDelegate) == 1) {
partially evaluated: d->delegateRefCount(d->itemDelegate) == 1
TRUEFALSE
yes
Evaluation Count:299
no
Evaluation Count:0
0-299
832 disconnect(d->itemDelegate, SIGNAL(closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)),
executed (the execution status of this line is deduced): disconnect(d->itemDelegate, "2""closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)",
-
833 this, SLOT(closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)));
executed (the execution status of this line is deduced): this, "1""closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)");
-
834 disconnect(d->itemDelegate, SIGNAL(commitData(QWidget*)), this, SLOT(commitData(QWidget*)));
executed (the execution status of this line is deduced): disconnect(d->itemDelegate, "2""commitData(QWidget*)", this, "1""commitData(QWidget*)");
-
835 disconnect(d->itemDelegate, SIGNAL(sizeHintChanged(QModelIndex)), this, SLOT(doItemsLayout()));
executed (the execution status of this line is deduced): disconnect(d->itemDelegate, "2""sizeHintChanged(QModelIndex)", this, "1""doItemsLayout()");
-
836 }
executed: }
Execution Count:299
299
837 }
executed: }
Execution Count:299
299
838 -
839 if (delegate) {
evaluated: delegate
TRUEFALSE
yes
Evaluation Count:4788
yes
Evaluation Count:5
5-4788
840 if (d->delegateRefCount(delegate) == 0) {
partially evaluated: d->delegateRefCount(delegate) == 0
TRUEFALSE
yes
Evaluation Count:4788
no
Evaluation Count:0
0-4788
841 connect(delegate, SIGNAL(closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)),
executed (the execution status of this line is deduced): connect(delegate, "2""closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)",
-
842 this, SLOT(closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)));
executed (the execution status of this line is deduced): this, "1""closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)");
-
843 connect(delegate, SIGNAL(commitData(QWidget*)), this, SLOT(commitData(QWidget*)));
executed (the execution status of this line is deduced): connect(delegate, "2""commitData(QWidget*)", this, "1""commitData(QWidget*)");
-
844 connect(delegate, SIGNAL(sizeHintChanged(QModelIndex)), this, SLOT(doItemsLayout()), Qt::QueuedConnection);
executed (the execution status of this line is deduced): connect(delegate, "2""sizeHintChanged(QModelIndex)", this, "1""doItemsLayout()", Qt::QueuedConnection);
-
845 }
executed: }
Execution Count:4788
4788
846 }
executed: }
Execution Count:4788
4788
847 d->itemDelegate = delegate;
executed (the execution status of this line is deduced): d->itemDelegate = delegate;
-
848 viewport()->update();
executed (the execution status of this line is deduced): viewport()->update();
-
849}
executed: }
Execution Count:4793
4793
850 -
851/*! -
852 Returns the item delegate used by this view and model. This is -
853 either one set with setItemDelegate(), or the default one. -
854 -
855 \sa setItemDelegate() -
856*/ -
857QAbstractItemDelegate *QAbstractItemView::itemDelegate() const -
858{ -
859 return d_func()->itemDelegate;
executed: return d_func()->itemDelegate;
Execution Count:1157
1157
860} -
861 -
862/*! -
863 \reimp -
864*/ -
865QVariant QAbstractItemView::inputMethodQuery(Qt::InputMethodQuery query) const -
866{ -
867 const QModelIndex current = currentIndex();
executed (the execution status of this line is deduced): const QModelIndex current = currentIndex();
-
868 if (!current.isValid() || query != Qt::ImCursorRectangle)
evaluated: !current.isValid()
TRUEFALSE
yes
Evaluation Count:37
yes
Evaluation Count:2
partially evaluated: query != Qt::ImCursorRectangle
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-37
869 return QAbstractScrollArea::inputMethodQuery(query);
executed: return QAbstractScrollArea::inputMethodQuery(query);
Execution Count:39
39
870 return visualRect(current);
never executed: return visualRect(current);
0
871} -
872 -
873/*! -
874 \since 4.2 -
875 -
876 Sets the given item \a delegate used by this view and model for the given -
877 \a row. All items on \a row will be drawn and managed by \a delegate -
878 instead of using the default delegate (i.e., itemDelegate()). -
879 -
880 Any existing row delegate for \a row will be removed, but not -
881 deleted. QAbstractItemView does not take ownership of \a delegate. -
882 -
883 \note If a delegate has been assigned to both a row and a column, the row -
884 delegate (i.e., this delegate) will take precedence and manage the -
885 intersecting cell index. -
886 -
887 \warning You should not share the same instance of a delegate between views. -
888 Doing so can cause incorrect or unintuitive editing behavior since each -
889 view connected to a given delegate may receive the \l{QAbstractItemDelegate::}{closeEditor()} -
890 signal, and attempt to access, modify or close an editor that has already been closed. -
891 -
892 \sa itemDelegateForRow(), setItemDelegateForColumn(), itemDelegate() -
893*/ -
894void QAbstractItemView::setItemDelegateForRow(int row, QAbstractItemDelegate *delegate) -
895{ -
896 Q_D(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
897 if (QAbstractItemDelegate *rowDelegate = d->rowDelegates.value(row, 0)) {
evaluated: QAbstractItemDelegate *rowDelegate = d->rowDelegates.value(row, 0)
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:5
3-5
898 if (d->delegateRefCount(rowDelegate) == 1) {
partially evaluated: d->delegateRefCount(rowDelegate) == 1
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
899 disconnect(rowDelegate, SIGNAL(closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)),
executed (the execution status of this line is deduced): disconnect(rowDelegate, "2""closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)",
-
900 this, SLOT(closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)));
executed (the execution status of this line is deduced): this, "1""closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)");
-
901 disconnect(rowDelegate, SIGNAL(commitData(QWidget*)), this, SLOT(commitData(QWidget*)));
executed (the execution status of this line is deduced): disconnect(rowDelegate, "2""commitData(QWidget*)", this, "1""commitData(QWidget*)");
-
902 }
executed: }
Execution Count:3
3
903 d->rowDelegates.remove(row);
executed (the execution status of this line is deduced): d->rowDelegates.remove(row);
-
904 }
executed: }
Execution Count:3
3
905 if (delegate) {
evaluated: delegate
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:1
1-7
906 if (d->delegateRefCount(delegate) == 0) {
partially evaluated: d->delegateRefCount(delegate) == 0
TRUEFALSE
yes
Evaluation Count:7
no
Evaluation Count:0
0-7
907 connect(delegate, SIGNAL(closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)),
executed (the execution status of this line is deduced): connect(delegate, "2""closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)",
-
908 this, SLOT(closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)));
executed (the execution status of this line is deduced): this, "1""closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)");
-
909 connect(delegate, SIGNAL(commitData(QWidget*)), this, SLOT(commitData(QWidget*)));
executed (the execution status of this line is deduced): connect(delegate, "2""commitData(QWidget*)", this, "1""commitData(QWidget*)");
-
910 }
executed: }
Execution Count:7
7
911 d->rowDelegates.insert(row, delegate);
executed (the execution status of this line is deduced): d->rowDelegates.insert(row, delegate);
-
912 }
executed: }
Execution Count:7
7
913 viewport()->update();
executed (the execution status of this line is deduced): viewport()->update();
-
914}
executed: }
Execution Count:8
8
915 -
916/*! -
917 \since 4.2 -
918 -
919 Returns the item delegate used by this view and model for the given \a row, -
920 or 0 if no delegate has been assigned. You can call itemDelegate() to get a -
921 pointer to the current delegate for a given index. -
922 -
923 \sa setItemDelegateForRow(), itemDelegateForColumn(), setItemDelegate() -
924*/ -
925QAbstractItemDelegate *QAbstractItemView::itemDelegateForRow(int row) const -
926{ -
927 Q_D(const QAbstractItemView);
executed (the execution status of this line is deduced): const QAbstractItemViewPrivate * const d = d_func();
-
928 return d->rowDelegates.value(row, 0);
executed: return d->rowDelegates.value(row, 0);
Execution Count:7
7
929} -
930 -
931/*! -
932 \since 4.2 -
933 -
934 Sets the given item \a delegate used by this view and model for the given -
935 \a column. All items on \a column will be drawn and managed by \a delegate -
936 instead of using the default delegate (i.e., itemDelegate()). -
937 -
938 Any existing column delegate for \a column will be removed, but not -
939 deleted. QAbstractItemView does not take ownership of \a delegate. -
940 -
941 \note If a delegate has been assigned to both a row and a column, the row -
942 delegate will take precedence and manage the intersecting cell index. -
943 -
944 \warning You should not share the same instance of a delegate between views. -
945 Doing so can cause incorrect or unintuitive editing behavior since each -
946 view connected to a given delegate may receive the \l{QAbstractItemDelegate::}{closeEditor()} -
947 signal, and attempt to access, modify or close an editor that has already been closed. -
948 -
949 \sa itemDelegateForColumn(), setItemDelegateForRow(), itemDelegate() -
950*/ -
951void QAbstractItemView::setItemDelegateForColumn(int column, QAbstractItemDelegate *delegate) -
952{ -
953 Q_D(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
954 if (QAbstractItemDelegate *columnDelegate = d->columnDelegates.value(column, 0)) {
evaluated: QAbstractItemDelegate *columnDelegate = d->columnDelegates.value(column, 0)
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:9
3-9
955 if (d->delegateRefCount(columnDelegate) == 1) {
evaluated: d->delegateRefCount(columnDelegate) == 1
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1
1-2
956 disconnect(columnDelegate, SIGNAL(closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)),
executed (the execution status of this line is deduced): disconnect(columnDelegate, "2""closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)",
-
957 this, SLOT(closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)));
executed (the execution status of this line is deduced): this, "1""closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)");
-
958 disconnect(columnDelegate, SIGNAL(commitData(QWidget*)), this, SLOT(commitData(QWidget*)));
executed (the execution status of this line is deduced): disconnect(columnDelegate, "2""commitData(QWidget*)", this, "1""commitData(QWidget*)");
-
959 }
executed: }
Execution Count:2
2
960 d->columnDelegates.remove(column);
executed (the execution status of this line is deduced): d->columnDelegates.remove(column);
-
961 }
executed: }
Execution Count:3
3
962 if (delegate) {
evaluated: delegate
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:1
1-11
963 if (d->delegateRefCount(delegate) == 0) {
evaluated: d->delegateRefCount(delegate) == 0
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:6
5-6
964 connect(delegate, SIGNAL(closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)),
executed (the execution status of this line is deduced): connect(delegate, "2""closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)",
-
965 this, SLOT(closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)));
executed (the execution status of this line is deduced): this, "1""closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)");
-
966 connect(delegate, SIGNAL(commitData(QWidget*)), this, SLOT(commitData(QWidget*)));
executed (the execution status of this line is deduced): connect(delegate, "2""commitData(QWidget*)", this, "1""commitData(QWidget*)");
-
967 }
executed: }
Execution Count:5
5
968 d->columnDelegates.insert(column, delegate);
executed (the execution status of this line is deduced): d->columnDelegates.insert(column, delegate);
-
969 }
executed: }
Execution Count:11
11
970 viewport()->update();
executed (the execution status of this line is deduced): viewport()->update();
-
971}
executed: }
Execution Count:12
12
972 -
973/*! -
974 \since 4.2 -
975 -
976 Returns the item delegate used by this view and model for the given \a -
977 column. You can call itemDelegate() to get a pointer to the current delegate -
978 for a given index. -
979 -
980 \sa setItemDelegateForColumn(), itemDelegateForRow(), itemDelegate() -
981*/ -
982QAbstractItemDelegate *QAbstractItemView::itemDelegateForColumn(int column) const -
983{ -
984 Q_D(const QAbstractItemView);
executed (the execution status of this line is deduced): const QAbstractItemViewPrivate * const d = d_func();
-
985 return d->columnDelegates.value(column, 0);
executed: return d->columnDelegates.value(column, 0);
Execution Count:7
7
986} -
987 -
988/*! -
989 Returns the item delegate used by this view and model for -
990 the given \a index. -
991*/ -
992QAbstractItemDelegate *QAbstractItemView::itemDelegate(const QModelIndex &index) const -
993{ -
994 Q_D(const QAbstractItemView);
executed (the execution status of this line is deduced): const QAbstractItemViewPrivate * const d = d_func();
-
995 return d->delegateForIndex(index);
executed: return d->delegateForIndex(index);
Execution Count:45527
45527
996} -
997 -
998/*! -
999 \property QAbstractItemView::selectionMode -
1000 \brief which selection mode the view operates in -
1001 -
1002 This property controls whether the user can select one or many items -
1003 and, in many-item selections, whether the selection must be a -
1004 continuous range of items. -
1005 -
1006 \sa SelectionMode, SelectionBehavior -
1007*/ -
1008void QAbstractItemView::setSelectionMode(SelectionMode mode) -
1009{ -
1010 Q_D(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
1011 d->selectionMode = mode;
executed (the execution status of this line is deduced): d->selectionMode = mode;
-
1012}
executed: }
Execution Count:2670
2670
1013 -
1014QAbstractItemView::SelectionMode QAbstractItemView::selectionMode() const -
1015{ -
1016 Q_D(const QAbstractItemView);
executed (the execution status of this line is deduced): const QAbstractItemViewPrivate * const d = d_func();
-
1017 return d->selectionMode;
executed: return d->selectionMode;
Execution Count:206
206
1018} -
1019 -
1020/*! -
1021 \property QAbstractItemView::selectionBehavior -
1022 \brief which selection behavior the view uses -
1023 -
1024 This property holds whether selections are done -
1025 in terms of single items, rows or columns. -
1026 -
1027 \sa SelectionMode, SelectionBehavior -
1028*/ -
1029 -
1030void QAbstractItemView::setSelectionBehavior(QAbstractItemView::SelectionBehavior behavior) -
1031{ -
1032 Q_D(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
1033 d->selectionBehavior = behavior;
executed (the execution status of this line is deduced): d->selectionBehavior = behavior;
-
1034}
executed: }
Execution Count:1234
1234
1035 -
1036QAbstractItemView::SelectionBehavior QAbstractItemView::selectionBehavior() const -
1037{ -
1038 Q_D(const QAbstractItemView);
executed (the execution status of this line is deduced): const QAbstractItemViewPrivate * const d = d_func();
-
1039 return d->selectionBehavior;
executed: return d->selectionBehavior;
Execution Count:4100
4100
1040} -
1041 -
1042/*! -
1043 Sets the current item to be the item at \a index. -
1044 -
1045 Unless the current selection mode is -
1046 \l{QAbstractItemView::}{NoSelection}, the item is also be selected. -
1047 Note that this function also updates the starting position for any -
1048 new selections the user performs. -
1049 -
1050 To set an item as the current item without selecting it, call -
1051 -
1052 \c{selectionModel()->setCurrentIndex(index, QItemSelectionModel::NoUpdate);} -
1053 -
1054 \sa currentIndex(), currentChanged(), selectionMode -
1055*/ -
1056void QAbstractItemView::setCurrentIndex(const QModelIndex &index) -
1057{ -
1058 Q_D(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
1059 if (d->selectionModel && (!index.isValid() || d->isIndexEnabled(index))) {
evaluated: d->selectionModel
TRUEFALSE
yes
Evaluation Count:1471
yes
Evaluation Count:22
evaluated: !index.isValid()
TRUEFALSE
yes
Evaluation Count:20
yes
Evaluation Count:1451
evaluated: d->isIndexEnabled(index)
TRUEFALSE
yes
Evaluation Count:1437
yes
Evaluation Count:14
14-1471
1060 QItemSelectionModel::SelectionFlags command = selectionCommand(index, 0);
executed (the execution status of this line is deduced): QItemSelectionModel::SelectionFlags command = selectionCommand(index, 0);
-
1061 d->selectionModel->setCurrentIndex(index, command);
executed (the execution status of this line is deduced): d->selectionModel->setCurrentIndex(index, command);
-
1062 d->currentIndexSet = true;
executed (the execution status of this line is deduced): d->currentIndexSet = true;
-
1063 if ((command & QItemSelectionModel::Current) == 0)
evaluated: (command & QItemSelectionModel::Current) == 0
TRUEFALSE
yes
Evaluation Count:1453
yes
Evaluation Count:4
4-1453
1064 d->pressedPosition = visualRect(currentIndex()).center() + d->offset();
executed: d->pressedPosition = visualRect(currentIndex()).center() + d->offset();
Execution Count:1453
1453
1065 }
executed: }
Execution Count:1457
1457
1066}
executed: }
Execution Count:1493
1493
1067 -
1068/*! -
1069 Returns the model index of the current item. -
1070 -
1071 \sa setCurrentIndex() -
1072*/ -
1073QModelIndex QAbstractItemView::currentIndex() const -
1074{ -
1075 Q_D(const QAbstractItemView);
executed (the execution status of this line is deduced): const QAbstractItemViewPrivate * const d = d_func();
-
1076 return d->selectionModel ? d->selectionModel->currentIndex() : QModelIndex();
executed: return d->selectionModel ? d->selectionModel->currentIndex() : QModelIndex();
Execution Count:28231
28231
1077} -
1078 -
1079 -
1080/*! -
1081 Reset the internal state of the view. -
1082 -
1083 \warning This function will reset open editors, scroll bar positions, -
1084 selections, etc. Existing changes will not be committed. If you would like -
1085 to save your changes when resetting the view, you can reimplement this -
1086 function, commit your changes, and then call the superclass' -
1087 implementation. -
1088*/ -
1089void QAbstractItemView::reset() -
1090{ -
1091 Q_D(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
1092 d->delayedReset.stop(); //make sure we stop the timer
executed (the execution status of this line is deduced): d->delayedReset.stop();
-
1093 foreach (const QEditorInfo &info, d->indexEditorHash) {
executed (the execution status of this line is deduced): for (QForeachContainer<__typeof__(d->indexEditorHash)> _container_(d->indexEditorHash); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (const QEditorInfo &info = *_container_.i;; __extension__ ({--_container_.brk; break;})) {
-
1094 if (info.widget)
partially evaluated: info.widget
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
1095 d->releaseEditor(info.widget.data(), d->indexForEditor(info.widget.data()));
executed: d->releaseEditor(info.widget.data(), d->indexForEditor(info.widget.data()));
Execution Count:1
1
1096 }
executed: }
Execution Count:1
1
1097 d->editorIndexHash.clear();
executed (the execution status of this line is deduced): d->editorIndexHash.clear();
-
1098 d->indexEditorHash.clear();
executed (the execution status of this line is deduced): d->indexEditorHash.clear();
-
1099 d->persistent.clear();
executed (the execution status of this line is deduced): d->persistent.clear();
-
1100 d->currentIndexSet = false;
executed (the execution status of this line is deduced): d->currentIndexSet = false;
-
1101 setState(NoState);
executed (the execution status of this line is deduced): setState(NoState);
-
1102 setRootIndex(QModelIndex());
executed (the execution status of this line is deduced): setRootIndex(QModelIndex());
-
1103 if (d->selectionModel)
evaluated: d->selectionModel
TRUEFALSE
yes
Evaluation Count:6097
yes
Evaluation Count:22
22-6097
1104 d->selectionModel->reset();
executed: d->selectionModel->reset();
Execution Count:6097
6097
1105#ifndef QT_NO_ACCESSIBILITY -
1106 if (QAccessible::isActive()) {
evaluated: QAccessible::isActive()
TRUEFALSE
yes
Evaluation Count:20
yes
Evaluation Count:6099
20-6099
1107 QAccessibleTableModelChangeEvent accessibleEvent(this, QAccessibleTableModelChangeEvent::ModelReset);
executed (the execution status of this line is deduced): QAccessibleTableModelChangeEvent accessibleEvent(this, QAccessibleTableModelChangeEvent::ModelReset);
-
1108 QAccessible::updateAccessibility(&accessibleEvent);
executed (the execution status of this line is deduced): QAccessible::updateAccessibility(&accessibleEvent);
-
1109 }
executed: }
Execution Count:20
20
1110#endif -
1111}
executed: }
Execution Count:6119
6119
1112 -
1113/*! -
1114 Sets the root item to the item at the given \a index. -
1115 -
1116 \sa rootIndex() -
1117*/ -
1118void QAbstractItemView::setRootIndex(const QModelIndex &index) -
1119{ -
1120 Q_D(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
1121 if (index.isValid() && index.model() != d->model) {
evaluated: index.isValid()
TRUEFALSE
yes
Evaluation Count:736
yes
Evaluation Count:6255
partially evaluated: index.model() != d->model
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:736
0-6255
1122 qWarning("QAbstractItemView::setRootIndex failed : index must be from the currently set model");
never executed (the execution status of this line is deduced): QMessageLogger("itemviews/qabstractitemview.cpp", 1122, __PRETTY_FUNCTION__).warning("QAbstractItemView::setRootIndex failed : index must be from the currently set model");
-
1123 return;
never executed: return;
0
1124 } -
1125 d->root = index;
executed (the execution status of this line is deduced): d->root = index;
-
1126 d->doDelayedItemsLayout();
executed (the execution status of this line is deduced): d->doDelayedItemsLayout();
-
1127}
executed: }
Execution Count:6991
6991
1128 -
1129/*! -
1130 Returns the model index of the model's root item. The root item is -
1131 the parent item to the view's toplevel items. The root can be invalid. -
1132 -
1133 \sa setRootIndex() -
1134*/ -
1135QModelIndex QAbstractItemView::rootIndex() const -
1136{ -
1137 return QModelIndex(d_func()->root);
executed: return QModelIndex(d_func()->root);
Execution Count:3964
3964
1138} -
1139 -
1140/*! -
1141 Selects all items in the view. -
1142 This function will use the selection behavior -
1143 set on the view when selecting. -
1144 -
1145 \sa setSelection(), selectedIndexes(), clearSelection() -
1146*/ -
1147void QAbstractItemView::selectAll() -
1148{ -
1149 Q_D(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
1150 SelectionMode mode = d->selectionMode;
executed (the execution status of this line is deduced): SelectionMode mode = d->selectionMode;
-
1151 if (mode == MultiSelection || mode == ExtendedSelection)
partially evaluated: mode == MultiSelection
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:29
evaluated: mode == ExtendedSelection
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:20
0-29
1152 d->selectAll(QItemSelectionModel::ClearAndSelect
executed: d->selectAll(QItemSelectionModel::ClearAndSelect |d->selectionBehaviorFlags());
Execution Count:9
9
1153 |d->selectionBehaviorFlags());
executed: d->selectAll(QItemSelectionModel::ClearAndSelect |d->selectionBehaviorFlags());
Execution Count:9
9
1154 else if (mode != SingleSelection)
partially evaluated: mode != SingleSelection
TRUEFALSE
yes
Evaluation Count:20
no
Evaluation Count:0
0-20
1155 d->selectAll(selectionCommand(d->model->index(0, 0, d->root)));
executed: d->selectAll(selectionCommand(d->model->index(0, 0, d->root)));
Execution Count:20
20
1156} -
1157 -
1158/*! -
1159 Starts editing the item corresponding to the given \a index if it is -
1160 editable. -
1161 -
1162 Note that this function does not change the current index. Since the current -
1163 index defines the next and previous items to edit, users may find that -
1164 keyboard navigation does not work as expected. To provide consistent navigation -
1165 behavior, call setCurrentIndex() before this function with the same model -
1166 index. -
1167 -
1168 \sa QModelIndex::flags() -
1169*/ -
1170void QAbstractItemView::edit(const QModelIndex &index) -
1171{ -
1172 Q_D(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
1173 if (!d->isIndexValid(index))
evaluated: !d->isIndexValid(index)
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:49
8-49
1174 qWarning("edit: index was invalid");
executed: QMessageLogger("itemviews/qabstractitemview.cpp", 1174, __PRETTY_FUNCTION__).warning("edit: index was invalid");
Execution Count:8
8
1175 if (!edit(index, AllEditTriggers, 0))
evaluated: !edit(index, AllEditTriggers, 0)
TRUEFALSE
yes
Evaluation Count:20
yes
Evaluation Count:37
20-37
1176 qWarning("edit: editing failed");
executed: QMessageLogger("itemviews/qabstractitemview.cpp", 1176, __PRETTY_FUNCTION__).warning("edit: editing failed");
Execution Count:20
20
1177}
executed: }
Execution Count:57
57
1178 -
1179/*! -
1180 Deselects all selected items. The current index will not be changed. -
1181 -
1182 \sa setSelection(), selectAll() -
1183*/ -
1184void QAbstractItemView::clearSelection() -
1185{ -
1186 Q_D(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
1187 if (d->selectionModel)
evaluated: d->selectionModel
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:22
10-22
1188 d->selectionModel->clearSelection();
executed: d->selectionModel->clearSelection();
Execution Count:10
10
1189}
executed: }
Execution Count:32
32
1190 -
1191/*! -
1192 \internal -
1193 -
1194 This function is intended to lay out the items in the view. -
1195 The default implementation just calls updateGeometries() and updates the viewport. -
1196*/ -
1197void QAbstractItemView::doItemsLayout() -
1198{ -
1199 Q_D(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
1200 d->interruptDelayedItemsLayout();
executed (the execution status of this line is deduced): d->interruptDelayedItemsLayout();
-
1201 updateGeometries();
executed (the execution status of this line is deduced): updateGeometries();
-
1202 d->viewport->update();
executed (the execution status of this line is deduced): d->viewport->update();
-
1203}
executed: }
Execution Count:8572
8572
1204 -
1205/*! -
1206 \property QAbstractItemView::editTriggers -
1207 \brief which actions will initiate item editing -
1208 -
1209 This property is a selection of flags defined by -
1210 \l{EditTrigger}, combined using the OR -
1211 operator. The view will only initiate the editing of an item if the -
1212 action performed is set in this property. -
1213*/ -
1214void QAbstractItemView::setEditTriggers(EditTriggers actions) -
1215{ -
1216 Q_D(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
1217 d->editTriggers = actions;
executed (the execution status of this line is deduced): d->editTriggers = actions;
-
1218}
executed: }
Execution Count:1446
1446
1219 -
1220QAbstractItemView::EditTriggers QAbstractItemView::editTriggers() const -
1221{ -
1222 Q_D(const QAbstractItemView);
executed (the execution status of this line is deduced): const QAbstractItemViewPrivate * const d = d_func();
-
1223 return d->editTriggers;
executed: return d->editTriggers;
Execution Count:217
217
1224} -
1225 -
1226/*! -
1227 \since 4.2 -
1228 \property QAbstractItemView::verticalScrollMode -
1229 \brief how the view scrolls its contents in the vertical direction -
1230 -
1231 This property controls how the view scroll its contents vertically. -
1232 Scrolling can be done either per pixel or per item. -
1233*/ -
1234 -
1235void QAbstractItemView::setVerticalScrollMode(ScrollMode mode) -
1236{ -
1237 Q_D(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
1238 if (mode == d->verticalScrollMode)
evaluated: mode == d->verticalScrollMode
TRUEFALSE
yes
Evaluation Count:110
yes
Evaluation Count:92
92-110
1239 return;
executed: return;
Execution Count:110
110
1240 QModelIndex topLeft = indexAt(QPoint(0, 0));
executed (the execution status of this line is deduced): QModelIndex topLeft = indexAt(QPoint(0, 0));
-
1241 d->verticalScrollMode = mode;
executed (the execution status of this line is deduced): d->verticalScrollMode = mode;
-
1242 updateGeometries(); // update the scroll bars
executed (the execution status of this line is deduced): updateGeometries();
-
1243 scrollTo(topLeft, QAbstractItemView::PositionAtTop);
executed (the execution status of this line is deduced): scrollTo(topLeft, QAbstractItemView::PositionAtTop);
-
1244}
executed: }
Execution Count:92
92
1245 -
1246QAbstractItemView::ScrollMode QAbstractItemView::verticalScrollMode() const -
1247{ -
1248 Q_D(const QAbstractItemView);
executed (the execution status of this line is deduced): const QAbstractItemViewPrivate * const d = d_func();
-
1249 return d->verticalScrollMode;
executed: return d->verticalScrollMode;
Execution Count:46216
46216
1250} -
1251 -
1252/*! -
1253 \since 4.2 -
1254 \property QAbstractItemView::horizontalScrollMode -
1255 \brief how the view scrolls its contents in the horizontal direction -
1256 -
1257 This property controls how the view scroll its contents horizontally. -
1258 Scrolling can be done either per pixel or per item. -
1259*/ -
1260 -
1261void QAbstractItemView::setHorizontalScrollMode(ScrollMode mode) -
1262{ -
1263 Q_D(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
1264 d->horizontalScrollMode = mode;
executed (the execution status of this line is deduced): d->horizontalScrollMode = mode;
-
1265 updateGeometries(); // update the scroll bars
executed (the execution status of this line is deduced): updateGeometries();
-
1266}
executed: }
Execution Count:864
864
1267 -
1268QAbstractItemView::ScrollMode QAbstractItemView::horizontalScrollMode() const -
1269{ -
1270 Q_D(const QAbstractItemView);
executed (the execution status of this line is deduced): const QAbstractItemViewPrivate * const d = d_func();
-
1271 return d->horizontalScrollMode;
executed: return d->horizontalScrollMode;
Execution Count:44642
44642
1272} -
1273 -
1274#ifndef QT_NO_DRAGANDDROP -
1275/*! -
1276 \since 4.2 -
1277 \property QAbstractItemView::dragDropOverwriteMode -
1278 \brief the view's drag and drop behavior -
1279 -
1280 If its value is \c true, the selected data will overwrite the -
1281 existing item data when dropped, while moving the data will clear -
1282 the item. If its value is \c false, the selected data will be -
1283 inserted as a new item when the data is dropped. When the data is -
1284 moved, the item is removed as well. -
1285 -
1286 The default value is \c false, as in the QListView and QTreeView -
1287 subclasses. In the QTableView subclass, on the other hand, the -
1288 property has been set to \c true. -
1289 -
1290 Note: This is not intended to prevent overwriting of items. -
1291 The model's implementation of flags() should do that by not -
1292 returning Qt::ItemIsDropEnabled. -
1293 -
1294 \sa dragDropMode -
1295*/ -
1296void QAbstractItemView::setDragDropOverwriteMode(bool overwrite) -
1297{ -
1298 Q_D(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
1299 d->overwrite = overwrite;
executed (the execution status of this line is deduced): d->overwrite = overwrite;
-
1300}
executed: }
Execution Count:2
2
1301 -
1302bool QAbstractItemView::dragDropOverwriteMode() const -
1303{ -
1304 Q_D(const QAbstractItemView);
executed (the execution status of this line is deduced): const QAbstractItemViewPrivate * const d = d_func();
-
1305 return d->overwrite;
executed: return d->overwrite;
Execution Count:4
4
1306} -
1307#endif -
1308 -
1309/*! -
1310 \property QAbstractItemView::autoScroll -
1311 \brief whether autoscrolling in drag move events is enabled -
1312 -
1313 If this property is set to true (the default), the -
1314 QAbstractItemView automatically scrolls the contents of the view -
1315 if the user drags within 16 pixels of the viewport edge. If the current -
1316 item changes, then the view will scroll automatically to ensure that the -
1317 current item is fully visible. -
1318 -
1319 This property only works if the viewport accepts drops. Autoscroll is -
1320 switched off by setting this property to false. -
1321*/ -
1322 -
1323void QAbstractItemView::setAutoScroll(bool enable) -
1324{ -
1325 Q_D(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
1326 d->autoScroll = enable;
executed (the execution status of this line is deduced): d->autoScroll = enable;
-
1327}
executed: }
Execution Count:54
54
1328 -
1329bool QAbstractItemView::hasAutoScroll() const -
1330{ -
1331 Q_D(const QAbstractItemView);
executed (the execution status of this line is deduced): const QAbstractItemViewPrivate * const d = d_func();
-
1332 return d->autoScroll;
executed: return d->autoScroll;
Execution Count:56
56
1333} -
1334 -
1335/*! -
1336 \since 4.4 -
1337 \property QAbstractItemView::autoScrollMargin -
1338 \brief the size of the area when auto scrolling is triggered -
1339 -
1340 This property controls the size of the area at the edge of the viewport that -
1341 triggers autoscrolling. The default value is 16 pixels. -
1342*/ -
1343void QAbstractItemView::setAutoScrollMargin(int margin) -
1344{ -
1345 Q_D(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
1346 d->autoScrollMargin = margin;
executed (the execution status of this line is deduced): d->autoScrollMargin = margin;
-
1347}
executed: }
Execution Count:2
2
1348 -
1349int QAbstractItemView::autoScrollMargin() const -
1350{ -
1351 Q_D(const QAbstractItemView);
executed (the execution status of this line is deduced): const QAbstractItemViewPrivate * const d = d_func();
-
1352 return d->autoScrollMargin;
executed: return d->autoScrollMargin;
Execution Count:3
3
1353} -
1354 -
1355/*! -
1356 \property QAbstractItemView::tabKeyNavigation -
1357 \brief whether item navigation with tab and backtab is enabled. -
1358*/ -
1359 -
1360void QAbstractItemView::setTabKeyNavigation(bool enable) -
1361{ -
1362 Q_D(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
1363 d->tabKeyNavigation = enable;
executed (the execution status of this line is deduced): d->tabKeyNavigation = enable;
-
1364}
executed: }
Execution Count:84
84
1365 -
1366bool QAbstractItemView::tabKeyNavigation() const -
1367{ -
1368 Q_D(const QAbstractItemView);
executed (the execution status of this line is deduced): const QAbstractItemViewPrivate * const d = d_func();
-
1369 return d->tabKeyNavigation;
executed: return d->tabKeyNavigation;
Execution Count:55
55
1370} -
1371 -
1372#ifndef QT_NO_DRAGANDDROP -
1373/*! -
1374 \property QAbstractItemView::showDropIndicator -
1375 \brief whether the drop indicator is shown when dragging items and dropping. -
1376 -
1377 \sa dragEnabled, DragDropMode, dragDropOverwriteMode, acceptDrops -
1378*/ -
1379 -
1380void QAbstractItemView::setDropIndicatorShown(bool enable) -
1381{ -
1382 Q_D(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
1383 d->showDropIndicator = enable;
executed (the execution status of this line is deduced): d->showDropIndicator = enable;
-
1384}
executed: }
Execution Count:52
52
1385 -
1386bool QAbstractItemView::showDropIndicator() const -
1387{ -
1388 Q_D(const QAbstractItemView);
executed (the execution status of this line is deduced): const QAbstractItemViewPrivate * const d = d_func();
-
1389 return d->showDropIndicator;
executed: return d->showDropIndicator;
Execution Count:53
53
1390} -
1391 -
1392/*! -
1393 \property QAbstractItemView::dragEnabled -
1394 \brief whether the view supports dragging of its own items -
1395 -
1396 \sa showDropIndicator, DragDropMode, dragDropOverwriteMode, acceptDrops -
1397*/ -
1398 -
1399void QAbstractItemView::setDragEnabled(bool enable) -
1400{ -
1401 Q_D(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
1402 d->dragEnabled = enable;
executed (the execution status of this line is deduced): d->dragEnabled = enable;
-
1403}
executed: }
Execution Count:1700
1700
1404 -
1405bool QAbstractItemView::dragEnabled() const -
1406{ -
1407 Q_D(const QAbstractItemView);
executed (the execution status of this line is deduced): const QAbstractItemViewPrivate * const d = d_func();
-
1408 return d->dragEnabled;
executed: return d->dragEnabled;
Execution Count:174
174
1409} -
1410 -
1411/*! -
1412 \since 4.2 -
1413 \enum QAbstractItemView::DragDropMode -
1414 -
1415 Describes the various drag and drop events the view can act upon. -
1416 By default the view does not support dragging or dropping (\c -
1417 NoDragDrop). -
1418 -
1419 \value NoDragDrop Does not support dragging or dropping. -
1420 \value DragOnly The view supports dragging of its own items -
1421 \value DropOnly The view accepts drops -
1422 \value DragDrop The view supports both dragging and dropping -
1423 \value InternalMove The view accepts move (\b{not copy}) operations only -
1424 from itself. -
1425 -
1426 Note that the model used needs to provide support for drag and drop operations. -
1427 -
1428 \sa setDragDropMode(), {Using drag and drop with item views} -
1429*/ -
1430 -
1431/*! -
1432 \property QAbstractItemView::dragDropMode -
1433 \brief the drag and drop event the view will act upon -
1434 -
1435 \since 4.2 -
1436 \sa showDropIndicator, dragDropOverwriteMode -
1437*/ -
1438void QAbstractItemView::setDragDropMode(DragDropMode behavior) -
1439{ -
1440 Q_D(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
1441 d->dragDropMode = behavior;
executed (the execution status of this line is deduced): d->dragDropMode = behavior;
-
1442 setDragEnabled(behavior == DragOnly || behavior == DragDrop || behavior == InternalMove);
executed (the execution status of this line is deduced): setDragEnabled(behavior == DragOnly || behavior == DragDrop || behavior == InternalMove);
-
1443 setAcceptDrops(behavior == DropOnly || behavior == DragDrop || behavior == InternalMove);
executed (the execution status of this line is deduced): setAcceptDrops(behavior == DropOnly || behavior == DragDrop || behavior == InternalMove);
-
1444}
executed: }
Execution Count:592
592
1445 -
1446QAbstractItemView::DragDropMode QAbstractItemView::dragDropMode() const -
1447{ -
1448 Q_D(const QAbstractItemView);
executed (the execution status of this line is deduced): const QAbstractItemViewPrivate * const d = d_func();
-
1449 DragDropMode setBehavior = d->dragDropMode;
executed (the execution status of this line is deduced): DragDropMode setBehavior = d->dragDropMode;
-
1450 if (!dragEnabled() && !acceptDrops())
evaluated: !dragEnabled()
TRUEFALSE
yes
Evaluation Count:45
yes
Evaluation Count:16
evaluated: !acceptDrops()
TRUEFALSE
yes
Evaluation Count:38
yes
Evaluation Count:7
7-45
1451 return NoDragDrop;
executed: return NoDragDrop;
Execution Count:38
38
1452 -
1453 if (dragEnabled() && !acceptDrops())
evaluated: dragEnabled()
TRUEFALSE
yes
Evaluation Count:16
yes
Evaluation Count:7
evaluated: !acceptDrops()
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:9
7-16
1454 return DragOnly;
executed: return DragOnly;
Execution Count:7
7
1455 -
1456 if (!dragEnabled() && acceptDrops())
evaluated: !dragEnabled()
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:9
partially evaluated: acceptDrops()
TRUEFALSE
yes
Evaluation Count:7
no
Evaluation Count:0
0-9
1457 return DropOnly;
executed: return DropOnly;
Execution Count:7
7
1458 -
1459 if (dragEnabled() && acceptDrops()) {
partially evaluated: dragEnabled()
TRUEFALSE
yes
Evaluation Count:9
no
Evaluation Count:0
partially evaluated: acceptDrops()
TRUEFALSE
yes
Evaluation Count:9
no
Evaluation Count:0
0-9
1460 if (setBehavior == InternalMove)
evaluated: setBehavior == InternalMove
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:7
2-7
1461 return setBehavior;
executed: return setBehavior;
Execution Count:2
2
1462 else -
1463 return DragDrop;
executed: return DragDrop;
Execution Count:7
7
1464 } -
1465 -
1466 return NoDragDrop;
never executed: return NoDragDrop;
0
1467} -
1468 -
1469/*! -
1470 \property QAbstractItemView::defaultDropAction -
1471 \brief the drop action that will be used by default in QAbstractItemView::drag() -
1472 -
1473 If the property is not set, the drop action is CopyAction when the supported -
1474 actions support CopyAction. -
1475 -
1476 \since 4.6 -
1477 \sa showDropIndicator, dragDropOverwriteMode -
1478*/ -
1479void QAbstractItemView::setDefaultDropAction(Qt::DropAction dropAction) -
1480{ -
1481 Q_D(QAbstractItemView);
never executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
1482 d->defaultDropAction = dropAction;
never executed (the execution status of this line is deduced): d->defaultDropAction = dropAction;
-
1483}
never executed: }
0
1484 -
1485Qt::DropAction QAbstractItemView::defaultDropAction() const -
1486{ -
1487 Q_D(const QAbstractItemView);
never executed (the execution status of this line is deduced): const QAbstractItemViewPrivate * const d = d_func();
-
1488 return d->defaultDropAction;
never executed: return d->defaultDropAction;
0
1489} -
1490 -
1491#endif // QT_NO_DRAGANDDROP -
1492 -
1493/*! -
1494 \property QAbstractItemView::alternatingRowColors -
1495 \brief whether to draw the background using alternating colors -
1496 -
1497 If this property is true, the item background will be drawn using -
1498 QPalette::Base and QPalette::AlternateBase; otherwise the background -
1499 will be drawn using the QPalette::Base color. -
1500 -
1501 By default, this property is false. -
1502*/ -
1503void QAbstractItemView::setAlternatingRowColors(bool enable) -
1504{ -
1505 Q_D(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
1506 d->alternatingColors = enable;
executed (the execution status of this line is deduced): d->alternatingColors = enable;
-
1507 if (isVisible())
evaluated: isVisible()
TRUEFALSE
yes
Evaluation Count:16
yes
Evaluation Count:41
16-41
1508 d->viewport->update();
executed: d->viewport->update();
Execution Count:16
16
1509}
executed: }
Execution Count:57
57
1510 -
1511bool QAbstractItemView::alternatingRowColors() const -
1512{ -
1513 Q_D(const QAbstractItemView);
executed (the execution status of this line is deduced): const QAbstractItemViewPrivate * const d = d_func();
-
1514 return d->alternatingColors;
executed: return d->alternatingColors;
Execution Count:58
58
1515} -
1516 -
1517/*! -
1518 \property QAbstractItemView::iconSize -
1519 \brief the size of items' icons -
1520 -
1521 Setting this property when the view is visible will cause the -
1522 items to be laid out again. -
1523*/ -
1524void QAbstractItemView::setIconSize(const QSize &size) -
1525{ -
1526 Q_D(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
1527 if (size == d->iconSize)
evaluated: size == d->iconSize
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:271
1-271
1528 return;
executed: return;
Execution Count:1
1
1529 d->iconSize = size;
executed (the execution status of this line is deduced): d->iconSize = size;
-
1530 d->doDelayedItemsLayout();
executed (the execution status of this line is deduced): d->doDelayedItemsLayout();
-
1531}
executed: }
Execution Count:271
271
1532 -
1533QSize QAbstractItemView::iconSize() const -
1534{ -
1535 Q_D(const QAbstractItemView);
executed (the execution status of this line is deduced): const QAbstractItemViewPrivate * const d = d_func();
-
1536 return d->iconSize;
executed: return d->iconSize;
Execution Count:95
95
1537} -
1538 -
1539/*! -
1540 \property QAbstractItemView::textElideMode -
1541 -
1542 \brief the position of the "..." in elided text. -
1543 -
1544 The default value for all item views is Qt::ElideRight. -
1545*/ -
1546void QAbstractItemView::setTextElideMode(Qt::TextElideMode mode) -
1547{ -
1548 Q_D(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
1549 d->textElideMode = mode;
executed (the execution status of this line is deduced): d->textElideMode = mode;
-
1550}
executed: }
Execution Count:528
528
1551 -
1552Qt::TextElideMode QAbstractItemView::textElideMode() const -
1553{ -
1554 return d_func()->textElideMode;
executed: return d_func()->textElideMode;
Execution Count:1
1
1555} -
1556 -
1557/*! -
1558 \reimp -
1559*/ -
1560bool QAbstractItemView::focusNextPrevChild(bool next) -
1561{ -
1562 Q_D(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
1563 if (d->tabKeyNavigation && isEnabled() && d->viewport->isEnabled()) {
evaluated: d->tabKeyNavigation
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:6
partially evaluated: isEnabled()
TRUEFALSE
yes
Evaluation Count:14
no
Evaluation Count:0
partially evaluated: d->viewport->isEnabled()
TRUEFALSE
yes
Evaluation Count:14
no
Evaluation Count:0
0-14
1564 QKeyEvent event(QEvent::KeyPress, next ? Qt::Key_Tab : Qt::Key_Backtab, Qt::NoModifier);
executed (the execution status of this line is deduced): QKeyEvent event(QEvent::KeyPress, next ? Qt::Key_Tab : Qt::Key_Backtab, Qt::NoModifier);
-
1565 keyPressEvent(&event);
executed (the execution status of this line is deduced): keyPressEvent(&event);
-
1566 if (event.isAccepted())
evaluated: event.isAccepted()
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:4
4-10
1567 return true;
executed: return true;
Execution Count:10
10
1568 }
executed: }
Execution Count:4
4
1569 return QAbstractScrollArea::focusNextPrevChild(next);
executed: return QAbstractScrollArea::focusNextPrevChild(next);
Execution Count:10
10
1570} -
1571 -
1572/*! -
1573 \reimp -
1574*/ -
1575bool QAbstractItemView::event(QEvent *event) -
1576{ -
1577 Q_D(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
1578 switch (event->type()) { -
1579 case QEvent::Paint: -
1580 //we call this here because the scrollbars' visibility might be altered -
1581 //so this can't be done in the paintEvent method -
1582 d->executePostedLayout(); //make sure we set the layout properly
executed (the execution status of this line is deduced): d->executePostedLayout();
-
1583 break;
executed: break;
Execution Count:722
722
1584 case QEvent::Show: -
1585 d->executePostedLayout(); //make sure we set the layout properly
executed (the execution status of this line is deduced): d->executePostedLayout();
-
1586 if (d->shouldScrollToCurrentOnShow) {
evaluated: d->shouldScrollToCurrentOnShow
TRUEFALSE
yes
Evaluation Count:75
yes
Evaluation Count:1257
75-1257
1587 d->shouldScrollToCurrentOnShow = false;
executed (the execution status of this line is deduced): d->shouldScrollToCurrentOnShow = false;
-
1588 const QModelIndex current = currentIndex();
executed (the execution status of this line is deduced): const QModelIndex current = currentIndex();
-
1589 if (current.isValid() && (d->state == QAbstractItemView::EditingState || d->autoScroll))
evaluated: current.isValid()
TRUEFALSE
yes
Evaluation Count:33
yes
Evaluation Count:42
partially evaluated: d->state == QAbstractItemView::EditingState
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:33
partially evaluated: d->autoScroll
TRUEFALSE
yes
Evaluation Count:33
no
Evaluation Count:0
0-42
1590 scrollTo(current);
executed: scrollTo(current);
Execution Count:33
33
1591 }
executed: }
Execution Count:75
75
1592 break;
executed: break;
Execution Count:1332
1332
1593 case QEvent::LocaleChange: -
1594 viewport()->update();
executed (the execution status of this line is deduced): viewport()->update();
-
1595 break;
executed: break;
Execution Count:6
6
1596 case QEvent::LayoutDirectionChange: -
1597 case QEvent::ApplicationLayoutDirectionChange: -
1598 updateGeometries();
executed (the execution status of this line is deduced): updateGeometries();
-
1599 break;
executed: break;
Execution Count:24
24
1600 case QEvent::StyleChange: -
1601 doItemsLayout();
executed (the execution status of this line is deduced): doItemsLayout();
-
1602 break;
executed: break;
Execution Count:10
10
1603 case QEvent::FocusOut: -
1604 d->checkPersistentEditorFocus();
executed (the execution status of this line is deduced): d->checkPersistentEditorFocus();
-
1605 break;
executed: break;
Execution Count:102
102
1606 case QEvent::FontChange: -
1607 d->doDelayedItemsLayout(); // the size of the items will change
executed (the execution status of this line is deduced): d->doDelayedItemsLayout();
-
1608 break;
executed: break;
Execution Count:4
4
1609 default: -
1610 break;
executed: break;
Execution Count:51646
51646
1611 } -
1612 return QAbstractScrollArea::event(event);
executed: return QAbstractScrollArea::event(event);
Execution Count:53846
53846
1613} -
1614 -
1615/*! -
1616 \fn bool QAbstractItemView::viewportEvent(QEvent *event) -
1617 -
1618 This function is used to handle tool tips, and What's -
1619 This? mode, if the given \a event is a QEvent::ToolTip,or a -
1620 QEvent::WhatsThis. It passes all other -
1621 events on to its base class viewportEvent() handler. -
1622*/ -
1623bool QAbstractItemView::viewportEvent(QEvent *event) -
1624{ -
1625 Q_D(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
1626 switch (event->type()) { -
1627 case QEvent::HoverMove: -
1628 case QEvent::HoverEnter: -
1629 d->setHoverIndex(indexAt(static_cast<QHoverEvent*>(event)->pos()));
never executed (the execution status of this line is deduced): d->setHoverIndex(indexAt(static_cast<QHoverEvent*>(event)->pos()));
-
1630 break;
never executed: break;
0
1631 case QEvent::HoverLeave: -
1632 d->setHoverIndex(QModelIndex());
never executed (the execution status of this line is deduced): d->setHoverIndex(QModelIndex());
-
1633 break;
never executed: break;
0
1634 case QEvent::Enter: -
1635 d->viewportEnteredNeeded = true;
executed (the execution status of this line is deduced): d->viewportEnteredNeeded = true;
-
1636 break;
executed: break;
Execution Count:264
264
1637 case QEvent::Leave: -
1638 #ifndef QT_NO_STATUSTIP -
1639 if (d->shouldClearStatusTip && d->parent) {
partially evaluated: d->shouldClearStatusTip
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:22
never evaluated: d->parent
0-22
1640 QString empty;
never executed (the execution status of this line is deduced): QString empty;
-
1641 QStatusTipEvent tip(empty);
never executed (the execution status of this line is deduced): QStatusTipEvent tip(empty);
-
1642 QApplication::sendEvent(d->parent, &tip);
never executed (the execution status of this line is deduced): QApplication::sendEvent(d->parent, &tip);
-
1643 d->shouldClearStatusTip = false;
never executed (the execution status of this line is deduced): d->shouldClearStatusTip = false;
-
1644 }
never executed: }
0
1645 #endif -
1646 d->enteredIndex = QModelIndex();
executed (the execution status of this line is deduced): d->enteredIndex = QModelIndex();
-
1647 break;
executed: break;
Execution Count:22
22
1648 case QEvent::ToolTip: -
1649 case QEvent::QueryWhatsThis: -
1650 case QEvent::WhatsThis: { -
1651 QHelpEvent *he = static_cast<QHelpEvent*>(event);
never executed (the execution status of this line is deduced): QHelpEvent *he = static_cast<QHelpEvent*>(event);
-
1652 const QModelIndex index = indexAt(he->pos());
never executed (the execution status of this line is deduced): const QModelIndex index = indexAt(he->pos());
-
1653 QStyleOptionViewItem option = d->viewOptions();
never executed (the execution status of this line is deduced): QStyleOptionViewItem option = d->viewOptions();
-
1654 option.rect = visualRect(index);
never executed (the execution status of this line is deduced): option.rect = visualRect(index);
-
1655 option.state |= (index == currentIndex() ? QStyle::State_HasFocus : QStyle::State_None);
never evaluated: index == currentIndex()
0
1656 -
1657 QAbstractItemDelegate *delegate = d->delegateForIndex(index);
never executed (the execution status of this line is deduced): QAbstractItemDelegate *delegate = d->delegateForIndex(index);
-
1658 if (!delegate)
never evaluated: !delegate
0
1659 return false;
never executed: return false;
0
1660 return delegate->helpEvent(he, this, option, index);
never executed: return delegate->helpEvent(he, this, option, index);
0
1661 } -
1662 case QEvent::FontChange: -
1663 d->doDelayedItemsLayout(); // the size of the items will change
executed (the execution status of this line is deduced): d->doDelayedItemsLayout();
-
1664 break;
executed: break;
Execution Count:1
1
1665 case QEvent::WindowActivate: -
1666 case QEvent::WindowDeactivate: -
1667 d->viewport->update();
executed (the execution status of this line is deduced): d->viewport->update();
-
1668 break;
executed: break;
Execution Count:824
824
1669 case QEvent::ScrollPrepare: -
1670 executeDelayedItemsLayout();
never executed (the execution status of this line is deduced): executeDelayedItemsLayout();
-
1671#ifndef QT_NO_GESTURES -
1672 connect(QScroller::scroller(d->viewport), SIGNAL(stateChanged(QScroller::State)), this, SLOT(_q_scrollerStateChanged()), Qt::UniqueConnection);
never executed (the execution status of this line is deduced): connect(QScroller::scroller(d->viewport), "2""stateChanged(QScroller::State)", this, "1""_q_scrollerStateChanged()", Qt::UniqueConnection);
-
1673#endif -
1674 break;
never executed: break;
0
1675 -
1676 default: -
1677 break;
executed: break;
Execution Count:35341
35341
1678 } -
1679 return QAbstractScrollArea::viewportEvent(event);
executed: return QAbstractScrollArea::viewportEvent(event);
Execution Count:36452
36452
1680} -
1681 -
1682/*! -
1683 This function is called with the given \a event when a mouse button is pressed -
1684 while the cursor is inside the widget. If a valid item is pressed on it is made -
1685 into the current item. This function emits the pressed() signal. -
1686*/ -
1687void QAbstractItemView::mousePressEvent(QMouseEvent *event) -
1688{ -
1689 Q_D(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
1690 d->delayedAutoScroll.stop(); //any interaction with the view cancel the auto scrolling
executed (the execution status of this line is deduced): d->delayedAutoScroll.stop();
-
1691 QPoint pos = event->pos();
executed (the execution status of this line is deduced): QPoint pos = event->pos();
-
1692 QPersistentModelIndex index = indexAt(pos);
executed (the execution status of this line is deduced): QPersistentModelIndex index = indexAt(pos);
-
1693 -
1694 if (!d->selectionModel
partially evaluated: !d->selectionModel
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:899
0-899
1695 || (d->state == EditingState && d->hasEditor(index)))
evaluated: d->state == EditingState
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:898
partially evaluated: d->hasEditor(index)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-898
1696 return;
never executed: return;
0
1697 -
1698 d->pressedAlreadySelected = d->selectionModel->isSelected(index);
executed (the execution status of this line is deduced): d->pressedAlreadySelected = d->selectionModel->isSelected(index);
-
1699 d->pressedIndex = index;
executed (the execution status of this line is deduced): d->pressedIndex = index;
-
1700 d->pressedModifiers = event->modifiers();
executed (the execution status of this line is deduced): d->pressedModifiers = event->modifiers();
-
1701 QItemSelectionModel::SelectionFlags command = selectionCommand(index, event);
executed (the execution status of this line is deduced): QItemSelectionModel::SelectionFlags command = selectionCommand(index, event);
-
1702 d->noSelectionOnMousePress = command == QItemSelectionModel::NoUpdate || !index.isValid();
evaluated: command == QItemSelectionModel::NoUpdate
TRUEFALSE
yes
Evaluation Count:24
yes
Evaluation Count:875
evaluated: !index.isValid()
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:869
6-875
1703 QPoint offset = d->offset();
executed (the execution status of this line is deduced): QPoint offset = d->offset();
-
1704 if ((command & QItemSelectionModel::Current) == 0)
evaluated: (command & QItemSelectionModel::Current) == 0
TRUEFALSE
yes
Evaluation Count:808
yes
Evaluation Count:91
91-808
1705 d->pressedPosition = pos + offset;
executed: d->pressedPosition = pos + offset;
Execution Count:808
808
1706 else if (!indexAt(d->pressedPosition - offset).isValid())
evaluated: !indexAt(d->pressedPosition - offset).isValid()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:90
1-90
1707 d->pressedPosition = visualRect(currentIndex()).center() + offset;
executed: d->pressedPosition = visualRect(currentIndex()).center() + offset;
Execution Count:1
1
1708 -
1709 if (edit(index, NoEditTriggers, event))
evaluated: edit(index, NoEditTriggers, event)
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:896
3-896
1710 return;
executed: return;
Execution Count:3
3
1711 -
1712 if (index.isValid() && d->isIndexEnabled(index)) {
evaluated: index.isValid()
TRUEFALSE
yes
Evaluation Count:888
yes
Evaluation Count:8
evaluated: d->isIndexEnabled(index)
TRUEFALSE
yes
Evaluation Count:705
yes
Evaluation Count:183
8-888
1713 // we disable scrollTo for mouse press so the item doesn't change position -
1714 // when the user is interacting with it (ie. clicking on it) -
1715 bool autoScroll = d->autoScroll;
executed (the execution status of this line is deduced): bool autoScroll = d->autoScroll;
-
1716 d->autoScroll = false;
executed (the execution status of this line is deduced): d->autoScroll = false;
-
1717 d->selectionModel->setCurrentIndex(index, QItemSelectionModel::NoUpdate);
executed (the execution status of this line is deduced): d->selectionModel->setCurrentIndex(index, QItemSelectionModel::NoUpdate);
-
1718 d->autoScroll = autoScroll;
executed (the execution status of this line is deduced): d->autoScroll = autoScroll;
-
1719 QRect rect(d->pressedPosition - offset, pos);
executed (the execution status of this line is deduced): QRect rect(d->pressedPosition - offset, pos);
-
1720 if (command.testFlag(QItemSelectionModel::Toggle)) {
evaluated: command.testFlag(QItemSelectionModel::Toggle)
TRUEFALSE
yes
Evaluation Count:62
yes
Evaluation Count:643
62-643
1721 command &= ~QItemSelectionModel::Toggle;
executed (the execution status of this line is deduced): command &= ~QItemSelectionModel::Toggle;
-
1722 d->ctrlDragSelectionFlag = d->selectionModel->isSelected(index) ? QItemSelectionModel::Deselect : QItemSelectionModel::Select;
evaluated: d->selectionModel->isSelected(index)
TRUEFALSE
yes
Evaluation Count:40
yes
Evaluation Count:22
22-40
1723 command |= d->ctrlDragSelectionFlag;
executed (the execution status of this line is deduced): command |= d->ctrlDragSelectionFlag;
-
1724 }
executed: }
Execution Count:62
62
1725 setSelection(rect, command);
executed (the execution status of this line is deduced): setSelection(rect, command);
-
1726 -
1727 // signal handlers may change the model -
1728 emit pressed(index);
executed (the execution status of this line is deduced): pressed(index);
-
1729 if (d->autoScroll) {
partially evaluated: d->autoScroll
TRUEFALSE
yes
Evaluation Count:705
no
Evaluation Count:0
0-705
1730 //we delay the autoscrolling to filter out double click event -
1731 //100 is to be sure that there won't be a double-click misinterpreted as a 2 single clicks -
1732 d->delayedAutoScroll.start(QApplication::doubleClickInterval()+100, this);
executed (the execution status of this line is deduced): d->delayedAutoScroll.start(QApplication::doubleClickInterval()+100, this);
-
1733 }
executed: }
Execution Count:705
705
1734 -
1735 } else {
executed: }
Execution Count:705
705
1736 // Forces a finalize() even if mouse is pressed, but not on a item -
1737 d->selectionModel->select(QModelIndex(), QItemSelectionModel::Select);
executed (the execution status of this line is deduced): d->selectionModel->select(QModelIndex(), QItemSelectionModel::Select);
-
1738 }
executed: }
Execution Count:191
191
1739} -
1740 -
1741/*! -
1742 This function is called with the given \a event when a mouse move event is -
1743 sent to the widget. If a selection is in progress and new items are moved -
1744 over the selection is extended; if a drag is in progress it is continued. -
1745*/ -
1746void QAbstractItemView::mouseMoveEvent(QMouseEvent *event) -
1747{ -
1748 Q_D(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
1749 QPoint topLeft;
executed (the execution status of this line is deduced): QPoint topLeft;
-
1750 QPoint bottomRight = event->pos();
executed (the execution status of this line is deduced): QPoint bottomRight = event->pos();
-
1751 -
1752 if (state() == ExpandingState || state() == CollapsingState)
partially evaluated: state() == ExpandingState
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:26
partially evaluated: state() == CollapsingState
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:26
0-26
1753 return;
never executed: return;
0
1754 -
1755#ifndef QT_NO_DRAGANDDROP -
1756 if (state() == DraggingState) {
partially evaluated: state() == DraggingState
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:26
0-26
1757 topLeft = d->pressedPosition - d->offset();
never executed (the execution status of this line is deduced): topLeft = d->pressedPosition - d->offset();
-
1758 if ((topLeft - bottomRight).manhattanLength() > QApplication::startDragDistance()) {
never evaluated: (topLeft - bottomRight).manhattanLength() > QApplication::startDragDistance()
0
1759 d->pressedIndex = QModelIndex();
never executed (the execution status of this line is deduced): d->pressedIndex = QModelIndex();
-
1760 startDrag(d->model->supportedDragActions());
never executed (the execution status of this line is deduced): startDrag(d->model->supportedDragActions());
-
1761 setState(NoState); // the startDrag will return when the dnd operation is done
never executed (the execution status of this line is deduced): setState(NoState);
-
1762 stopAutoScroll();
never executed (the execution status of this line is deduced): stopAutoScroll();
-
1763 }
never executed: }
0
1764 return;
never executed: return;
0
1765 } -
1766#endif // QT_NO_DRAGANDDROP -
1767 -
1768 QPersistentModelIndex index = indexAt(bottomRight);
executed (the execution status of this line is deduced): QPersistentModelIndex index = indexAt(bottomRight);
-
1769 QModelIndex buddy = d->model->buddy(d->pressedIndex);
executed (the execution status of this line is deduced): QModelIndex buddy = d->model->buddy(d->pressedIndex);
-
1770 if ((state() == EditingState && d->hasEditor(buddy))
partially evaluated: state() == EditingState
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:26
never evaluated: d->hasEditor(buddy)
0-26
1771 || edit(index, NoEditTriggers, event))
partially evaluated: edit(index, NoEditTriggers, event)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:26
0-26
1772 return;
never executed: return;
0
1773 -
1774 if (d->selectionMode != SingleSelection)
partially evaluated: d->selectionMode != SingleSelection
TRUEFALSE
yes
Evaluation Count:26
no
Evaluation Count:0
0-26
1775 topLeft = d->pressedPosition - d->offset();
executed: topLeft = d->pressedPosition - d->offset();
Execution Count:26
26
1776 else -
1777 topLeft = bottomRight;
never executed: topLeft = bottomRight;
0
1778 -
1779 d->checkMouseMove(index);
executed (the execution status of this line is deduced): d->checkMouseMove(index);
-
1780 -
1781#ifndef QT_NO_DRAGANDDROP -
1782 if (d->pressedIndex.isValid()
evaluated: d->pressedIndex.isValid()
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:14
12-14
1783 && d->dragEnabled
partially evaluated: d->dragEnabled
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12
0-12
1784 && (state() != DragSelectingState)
never evaluated: (state() != DragSelectingState)
0
1785 && (event->buttons() != Qt::NoButton)
never evaluated: (event->buttons() != Qt::NoButton)
0
1786 && !d->selectedDraggableIndexes().isEmpty()) {
never evaluated: !d->selectedDraggableIndexes().isEmpty()
0
1787 setState(DraggingState);
never executed (the execution status of this line is deduced): setState(DraggingState);
-
1788 return;
never executed: return;
0
1789 } -
1790#endif -
1791 -
1792 if ((event->buttons() & Qt::LeftButton) && d->selectionAllowed(index) && d->selectionModel) {
evaluated: (event->buttons() & Qt::LeftButton)
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:11
partially evaluated: d->selectionAllowed(index)
TRUEFALSE
yes
Evaluation Count:15
no
Evaluation Count:0
partially evaluated: d->selectionModel
TRUEFALSE
yes
Evaluation Count:15
no
Evaluation Count:0
0-15
1793 setState(DragSelectingState);
executed (the execution status of this line is deduced): setState(DragSelectingState);
-
1794 QItemSelectionModel::SelectionFlags command = selectionCommand(index, event);
executed (the execution status of this line is deduced): QItemSelectionModel::SelectionFlags command = selectionCommand(index, event);
-
1795 if (d->ctrlDragSelectionFlag != QItemSelectionModel::NoUpdate && command.testFlag(QItemSelectionModel::Toggle)) {
evaluated: d->ctrlDragSelectionFlag != QItemSelectionModel::NoUpdate
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:3
partially evaluated: command.testFlag(QItemSelectionModel::Toggle)
TRUEFALSE
yes
Evaluation Count:12
no
Evaluation Count:0
0-12
1796 command &= ~QItemSelectionModel::Toggle;
executed (the execution status of this line is deduced): command &= ~QItemSelectionModel::Toggle;
-
1797 command |= d->ctrlDragSelectionFlag;
executed (the execution status of this line is deduced): command |= d->ctrlDragSelectionFlag;
-
1798 }
executed: }
Execution Count:12
12
1799 -
1800 // Do the normalize ourselves, since QRect::normalized() is flawed -
1801 QRect selectionRect = QRect(topLeft, bottomRight);
executed (the execution status of this line is deduced): QRect selectionRect = QRect(topLeft, bottomRight);
-
1802 setSelection(selectionRect, command);
executed (the execution status of this line is deduced): setSelection(selectionRect, command);
-
1803 -
1804 // set at the end because it might scroll the view -
1805 if (index.isValid()
evaluated: index.isValid()
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:1
1-14
1806 && (index != d->selectionModel->currentIndex())
partially evaluated: (index != d->selectionModel->currentIndex())
TRUEFALSE
yes
Evaluation Count:14
no
Evaluation Count:0
0-14
1807 && d->isIndexEnabled(index))
partially evaluated: d->isIndexEnabled(index)
TRUEFALSE
yes
Evaluation Count:14
no
Evaluation Count:0
0-14
1808 d->selectionModel->setCurrentIndex(index, QItemSelectionModel::NoUpdate);
executed: d->selectionModel->setCurrentIndex(index, QItemSelectionModel::NoUpdate);
Execution Count:14
14
1809 }
executed: }
Execution Count:15
15
1810}
executed: }
Execution Count:26
26
1811 -
1812/*! -
1813 This function is called with the given \a event when a mouse button is released, -
1814 after a mouse press event on the widget. If a user presses the mouse inside your -
1815 widget and then drags the mouse to another location before releasing the mouse button, -
1816 your widget receives the release event. The function will emit the clicked() signal if an -
1817 item was being pressed. -
1818*/ -
1819void QAbstractItemView::mouseReleaseEvent(QMouseEvent *event) -
1820{ -
1821 Q_D(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
1822 -
1823 QPoint pos = event->pos();
executed (the execution status of this line is deduced): QPoint pos = event->pos();
-
1824 QPersistentModelIndex index = indexAt(pos);
executed (the execution status of this line is deduced): QPersistentModelIndex index = indexAt(pos);
-
1825 -
1826 if (state() == EditingState) {
evaluated: state() == EditingState
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:4929
3-4929
1827 if (d->isIndexValid(index)
partially evaluated: d->isIndexValid(index)
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
1828 && d->isIndexEnabled(index)
partially evaluated: d->isIndexEnabled(index)
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
1829 && d->sendDelegateEvent(index, event))
partially evaluated: d->sendDelegateEvent(index, event)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
1830 update(index);
never executed: update(index);
0
1831 return;
executed: return;
Execution Count:3
3
1832 } -
1833 -
1834 bool click = (index == d->pressedIndex && index.isValid());
evaluated: index == d->pressedIndex
TRUEFALSE
yes
Evaluation Count:377
yes
Evaluation Count:4552
evaluated: index.isValid()
TRUEFALSE
yes
Evaluation Count:372
yes
Evaluation Count:5
5-4552
1835 bool selectedClicked = click && (event->button() == Qt::LeftButton) && d->pressedAlreadySelected;
evaluated: click
TRUEFALSE
yes
Evaluation Count:372
yes
Evaluation Count:4557
evaluated: (event->button() == Qt::LeftButton)
TRUEFALSE
yes
Evaluation Count:369
yes
Evaluation Count:3
evaluated: d->pressedAlreadySelected
TRUEFALSE
yes
Evaluation Count:82
yes
Evaluation Count:287
3-4557
1836 EditTrigger trigger = (selectedClicked ? SelectedClicked : NoEditTriggers);
evaluated: selectedClicked
TRUEFALSE
yes
Evaluation Count:82
yes
Evaluation Count:4847
82-4847
1837 bool edited = edit(index, trigger, event);
executed (the execution status of this line is deduced): bool edited = edit(index, trigger, event);
-
1838 -
1839 d->ctrlDragSelectionFlag = QItemSelectionModel::NoUpdate;
executed (the execution status of this line is deduced): d->ctrlDragSelectionFlag = QItemSelectionModel::NoUpdate;
-
1840 -
1841 if (d->selectionModel && d->noSelectionOnMousePress) {
partially evaluated: d->selectionModel
TRUEFALSE
yes
Evaluation Count:4929
no
Evaluation Count:0
evaluated: d->noSelectionOnMousePress
TRUEFALSE
yes
Evaluation Count:27
yes
Evaluation Count:4902
0-4929
1842 d->noSelectionOnMousePress = false;
executed (the execution status of this line is deduced): d->noSelectionOnMousePress = false;
-
1843 d->selectionModel->select(index, selectionCommand(index, event));
executed (the execution status of this line is deduced): d->selectionModel->select(index, selectionCommand(index, event));
-
1844 }
executed: }
Execution Count:27
27
1845 -
1846 setState(NoState);
executed (the execution status of this line is deduced): setState(NoState);
-
1847 -
1848 if (click) {
evaluated: click
TRUEFALSE
yes
Evaluation Count:372
yes
Evaluation Count:4557
372-4557
1849 if (event->button() == Qt::LeftButton)
evaluated: event->button() == Qt::LeftButton
TRUEFALSE
yes
Evaluation Count:369
yes
Evaluation Count:3
3-369
1850 emit clicked(index);
executed: clicked(index);
Execution Count:369
369
1851 if (edited)
evaluated: edited
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:368
4-368
1852 return;
executed: return;
Execution Count:4
4
1853 QStyleOptionViewItem option = d->viewOptions();
executed (the execution status of this line is deduced): QStyleOptionViewItem option = d->viewOptions();
-
1854 if (d->pressedAlreadySelected)
evaluated: d->pressedAlreadySelected
TRUEFALSE
yes
Evaluation Count:81
yes
Evaluation Count:287
81-287
1855 option.state |= QStyle::State_Selected;
executed: option.state |= QStyle::State_Selected;
Execution Count:81
81
1856 if (style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, &option, this))
partially evaluated: style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, &option, this)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:368
0-368
1857 emit activated(index);
never executed: activated(index);
0
1858 }
executed: }
Execution Count:368
368
1859}
executed: }
Execution Count:4925
4925
1860 -
1861/*! -
1862 This function is called with the given \a event when a mouse button is -
1863 double clicked inside the widget. If the double-click is on a valid item it -
1864 emits the doubleClicked() signal and calls edit() on the item. -
1865*/ -
1866void QAbstractItemView::mouseDoubleClickEvent(QMouseEvent *event) -
1867{ -
1868 Q_D(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
1869 -
1870 QModelIndex index = indexAt(event->pos());
executed (the execution status of this line is deduced): QModelIndex index = indexAt(event->pos());
-
1871 if (!index.isValid()
partially evaluated: !index.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:200
0-200
1872 || !d->isIndexEnabled(index)
evaluated: !d->isIndexEnabled(index)
TRUEFALSE
yes
Evaluation Count:51
yes
Evaluation Count:149
51-149
1873 || (d->pressedIndex != index)) {
evaluated: (d->pressedIndex != index)
TRUEFALSE
yes
Evaluation Count:133
yes
Evaluation Count:16
16-133
1874 QMouseEvent me(QEvent::MouseButtonPress,
executed (the execution status of this line is deduced): QMouseEvent me(QEvent::MouseButtonPress,
-
1875 event->localPos(), event->windowPos(), event->screenPos(),
executed (the execution status of this line is deduced): event->localPos(), event->windowPos(), event->screenPos(),
-
1876 event->button(), event->buttons(), event->modifiers());
executed (the execution status of this line is deduced): event->button(), event->buttons(), event->modifiers());
-
1877 mousePressEvent(&me);
executed (the execution status of this line is deduced): mousePressEvent(&me);
-
1878 return;
executed: return;
Execution Count:184
184
1879 } -
1880 // signal handlers may change the model -
1881 QPersistentModelIndex persistent = index;
executed (the execution status of this line is deduced): QPersistentModelIndex persistent = index;
-
1882 emit doubleClicked(persistent);
executed (the execution status of this line is deduced): doubleClicked(persistent);
-
1883 if ((event->button() == Qt::LeftButton) && !edit(persistent, DoubleClicked, event)
partially evaluated: (event->button() == Qt::LeftButton)
TRUEFALSE
yes
Evaluation Count:16
no
Evaluation Count:0
partially evaluated: !edit(persistent, DoubleClicked, event)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:16
0-16
1884 && !style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, 0, this))
never evaluated: !style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, 0, this)
0
1885 emit activated(persistent);
never executed: activated(persistent);
0
1886}
executed: }
Execution Count:16
16
1887 -
1888#ifndef QT_NO_DRAGANDDROP -
1889 -
1890/*! -
1891 This function is called with the given \a event when a drag and drop operation enters -
1892 the widget. If the drag is over a valid dropping place (e.g. over an item that -
1893 accepts drops), the event is accepted; otherwise it is ignored. -
1894 -
1895 \sa dropEvent(), startDrag() -
1896*/ -
1897void QAbstractItemView::dragEnterEvent(QDragEnterEvent *event) -
1898{ -
1899 if (dragDropMode() == InternalMove
never evaluated: dragDropMode() == InternalMove
0
1900 && (event->source() != this|| !(event->possibleActions() & Qt::MoveAction)))
never evaluated: event->source() != this
never evaluated: !(event->possibleActions() & Qt::MoveAction)
0
1901 return;
never executed: return;
0
1902 -
1903 if (d_func()->canDecode(event)) {
never evaluated: d_func()->canDecode(event)
0
1904 event->accept();
never executed (the execution status of this line is deduced): event->accept();
-
1905 setState(DraggingState);
never executed (the execution status of this line is deduced): setState(DraggingState);
-
1906 } else {
never executed: }
0
1907 event->ignore();
never executed (the execution status of this line is deduced): event->ignore();
-
1908 }
never executed: }
0
1909} -
1910 -
1911/*! -
1912 This function is called continuously with the given \a event during a drag and -
1913 drop operation over the widget. It can cause the view to scroll if, for example, -
1914 the user drags a selection to view's right or bottom edge. In this case, the -
1915 event will be accepted; otherwise it will be ignored. -
1916 -
1917 \sa dropEvent(), startDrag() -
1918*/ -
1919void QAbstractItemView::dragMoveEvent(QDragMoveEvent *event) -
1920{ -
1921 Q_D(QAbstractItemView);
never executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
1922 if (dragDropMode() == InternalMove
never evaluated: dragDropMode() == InternalMove
0
1923 && (event->source() != this || !(event->possibleActions() & Qt::MoveAction)))
never evaluated: event->source() != this
never evaluated: !(event->possibleActions() & Qt::MoveAction)
0
1924 return;
never executed: return;
0
1925 -
1926 // ignore by default -
1927 event->ignore();
never executed (the execution status of this line is deduced): event->ignore();
-
1928 -
1929 QModelIndex index = indexAt(event->pos());
never executed (the execution status of this line is deduced): QModelIndex index = indexAt(event->pos());
-
1930 d->hover = index;
never executed (the execution status of this line is deduced): d->hover = index;
-
1931 if (!d->droppingOnItself(event, index)
never evaluated: !d->droppingOnItself(event, index)
0
1932 && d->canDecode(event)) {
never evaluated: d->canDecode(event)
0
1933 -
1934 if (index.isValid() && d->showDropIndicator) {
never evaluated: index.isValid()
never evaluated: d->showDropIndicator
0
1935 QRect rect = visualRect(index);
never executed (the execution status of this line is deduced): QRect rect = visualRect(index);
-
1936 d->dropIndicatorPosition = d->position(event->pos(), rect, index);
never executed (the execution status of this line is deduced): d->dropIndicatorPosition = d->position(event->pos(), rect, index);
-
1937 switch (d->dropIndicatorPosition) { -
1938 case AboveItem: -
1939 if (d->isIndexDropEnabled(index.parent())) {
never evaluated: d->isIndexDropEnabled(index.parent())
0
1940 d->dropIndicatorRect = QRect(rect.left(), rect.top(), rect.width(), 0);
never executed (the execution status of this line is deduced): d->dropIndicatorRect = QRect(rect.left(), rect.top(), rect.width(), 0);
-
1941 event->accept();
never executed (the execution status of this line is deduced): event->accept();
-
1942 } else {
never executed: }
0
1943 d->dropIndicatorRect = QRect();
never executed (the execution status of this line is deduced): d->dropIndicatorRect = QRect();
-
1944 }
never executed: }
0
1945 break;
never executed: break;
0
1946 case BelowItem: -
1947 if (d->isIndexDropEnabled(index.parent())) {
never evaluated: d->isIndexDropEnabled(index.parent())
0
1948 d->dropIndicatorRect = QRect(rect.left(), rect.bottom(), rect.width(), 0);
never executed (the execution status of this line is deduced): d->dropIndicatorRect = QRect(rect.left(), rect.bottom(), rect.width(), 0);
-
1949 event->accept();
never executed (the execution status of this line is deduced): event->accept();
-
1950 } else {
never executed: }
0
1951 d->dropIndicatorRect = QRect();
never executed (the execution status of this line is deduced): d->dropIndicatorRect = QRect();
-
1952 }
never executed: }
0
1953 break;
never executed: break;
0
1954 case OnItem: -
1955 if (d->isIndexDropEnabled(index)) {
never evaluated: d->isIndexDropEnabled(index)
0
1956 d->dropIndicatorRect = rect;
never executed (the execution status of this line is deduced): d->dropIndicatorRect = rect;
-
1957 event->accept();
never executed (the execution status of this line is deduced): event->accept();
-
1958 } else {
never executed: }
0
1959 d->dropIndicatorRect = QRect();
never executed (the execution status of this line is deduced): d->dropIndicatorRect = QRect();
-
1960 }
never executed: }
0
1961 break;
never executed: break;
0
1962 case OnViewport: -
1963 d->dropIndicatorRect = QRect();
never executed (the execution status of this line is deduced): d->dropIndicatorRect = QRect();
-
1964 if (d->isIndexDropEnabled(rootIndex())) {
never evaluated: d->isIndexDropEnabled(rootIndex())
0
1965 event->accept(); // allow dropping in empty areas
never executed (the execution status of this line is deduced): event->accept();
-
1966 }
never executed: }
0
1967 break;
never executed: break;
0
1968 } -
1969 } else {
never executed: }
0
1970 d->dropIndicatorRect = QRect();
never executed (the execution status of this line is deduced): d->dropIndicatorRect = QRect();
-
1971 d->dropIndicatorPosition = OnViewport;
never executed (the execution status of this line is deduced): d->dropIndicatorPosition = OnViewport;
-
1972 if (d->isIndexDropEnabled(rootIndex())) {
never evaluated: d->isIndexDropEnabled(rootIndex())
0
1973 event->accept(); // allow dropping in empty areas
never executed (the execution status of this line is deduced): event->accept();
-
1974 }
never executed: }
0
1975 }
never executed: }
0
1976 d->viewport->update();
never executed (the execution status of this line is deduced): d->viewport->update();
-
1977 } // can decode
never executed: }
0
1978 -
1979 if (d->shouldAutoScroll(event->pos()))
never evaluated: d->shouldAutoScroll(event->pos())
0
1980 startAutoScroll();
never executed: startAutoScroll();
0
1981}
never executed: }
0
1982 -
1983/*! -
1984 \internal -
1985 Return true if this is a move from ourself and \a index is a child of the selection that -
1986 is being moved. -
1987 */ -
1988bool QAbstractItemViewPrivate::droppingOnItself(QDropEvent *event, const QModelIndex &index) -
1989{ -
1990 Q_Q(QAbstractItemView);
never executed (the execution status of this line is deduced): QAbstractItemView * const q = q_func();
-
1991 Qt::DropAction dropAction = event->dropAction();
never executed (the execution status of this line is deduced): Qt::DropAction dropAction = event->dropAction();
-
1992 if (q->dragDropMode() == QAbstractItemView::InternalMove)
never evaluated: q->dragDropMode() == QAbstractItemView::InternalMove
0
1993 dropAction = Qt::MoveAction;
never executed: dropAction = Qt::MoveAction;
0
1994 if (event->source() == q
never evaluated: event->source() == q
0
1995 && event->possibleActions() & Qt::MoveAction
never evaluated: event->possibleActions() & Qt::MoveAction
0
1996 && dropAction == Qt::MoveAction) {
never evaluated: dropAction == Qt::MoveAction
0
1997 QModelIndexList selectedIndexes = q->selectedIndexes();
never executed (the execution status of this line is deduced): QModelIndexList selectedIndexes = q->selectedIndexes();
-
1998 QModelIndex child = index;
never executed (the execution status of this line is deduced): QModelIndex child = index;
-
1999 while (child.isValid() && child != root) {
never evaluated: child.isValid()
never evaluated: child != root
0
2000 if (selectedIndexes.contains(child))
never evaluated: selectedIndexes.contains(child)
0
2001 return true;
never executed: return true;
0
2002 child = child.parent();
never executed (the execution status of this line is deduced): child = child.parent();
-
2003 }
never executed: }
0
2004 }
never executed: }
0
2005 return false;
never executed: return false;
0
2006} -
2007 -
2008/*! -
2009 \fn void QAbstractItemView::dragLeaveEvent(QDragLeaveEvent *event) -
2010 -
2011 This function is called when the item being dragged leaves the view. -
2012 The \a event describes the state of the drag and drop operation. -
2013*/ -
2014void QAbstractItemView::dragLeaveEvent(QDragLeaveEvent *) -
2015{ -
2016 Q_D(QAbstractItemView);
never executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
2017 stopAutoScroll();
never executed (the execution status of this line is deduced): stopAutoScroll();
-
2018 setState(NoState);
never executed (the execution status of this line is deduced): setState(NoState);
-
2019 d->hover = QModelIndex();
never executed (the execution status of this line is deduced): d->hover = QModelIndex();
-
2020 d->viewport->update();
never executed (the execution status of this line is deduced): d->viewport->update();
-
2021}
never executed: }
0
2022 -
2023/*! -
2024 This function is called with the given \a event when a drop event occurs over -
2025 the widget. If the model accepts the even position the drop event is accepted; -
2026 otherwise it is ignored. -
2027 -
2028 \sa startDrag() -
2029*/ -
2030void QAbstractItemView::dropEvent(QDropEvent *event) -
2031{ -
2032 Q_D(QAbstractItemView);
never executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
2033 if (dragDropMode() == InternalMove) {
never evaluated: dragDropMode() == InternalMove
0
2034 if (event->source() != this || !(event->possibleActions() & Qt::MoveAction))
never evaluated: event->source() != this
never evaluated: !(event->possibleActions() & Qt::MoveAction)
0
2035 return;
never executed: return;
0
2036 }
never executed: }
0
2037 -
2038 QModelIndex index;
never executed (the execution status of this line is deduced): QModelIndex index;
-
2039 int col = -1;
never executed (the execution status of this line is deduced): int col = -1;
-
2040 int row = -1;
never executed (the execution status of this line is deduced): int row = -1;
-
2041 if (d->dropOn(event, &row, &col, &index)) {
never evaluated: d->dropOn(event, &row, &col, &index)
0
2042 if (d->model->dropMimeData(event->mimeData(),
never evaluated: d->model->dropMimeData(event->mimeData(), dragDropMode() == InternalMove ? Qt::MoveAction : event->dropAction(), row, col, index)
0
2043 dragDropMode() == InternalMove ? Qt::MoveAction : event->dropAction(), row, col, index)) {
never evaluated: d->model->dropMimeData(event->mimeData(), dragDropMode() == InternalMove ? Qt::MoveAction : event->dropAction(), row, col, index)
0
2044 if (dragDropMode() == InternalMove)
never evaluated: dragDropMode() == InternalMove
0
2045 event->setDropAction(Qt::MoveAction);
never executed: event->setDropAction(Qt::MoveAction);
0
2046 event->accept();
never executed (the execution status of this line is deduced): event->accept();
-
2047 }
never executed: }
0
2048 }
never executed: }
0
2049 stopAutoScroll();
never executed (the execution status of this line is deduced): stopAutoScroll();
-
2050 setState(NoState);
never executed (the execution status of this line is deduced): setState(NoState);
-
2051 d->viewport->update();
never executed (the execution status of this line is deduced): d->viewport->update();
-
2052}
never executed: }
0
2053 -
2054/*! -
2055 If the event hasn't already been accepted, determines the index to drop on. -
2056 -
2057 if (row == -1 && col == -1) -
2058 // append to this drop index -
2059 else -
2060 // place at row, col in drop index -
2061 -
2062 If it returns true a drop can be done, and dropRow, dropCol and dropIndex reflects the position of the drop. -
2063 \internal -
2064 */ -
2065bool QAbstractItemViewPrivate::dropOn(QDropEvent *event, int *dropRow, int *dropCol, QModelIndex *dropIndex) -
2066{ -
2067 Q_Q(QAbstractItemView);
never executed (the execution status of this line is deduced): QAbstractItemView * const q = q_func();
-
2068 if (event->isAccepted())
never evaluated: event->isAccepted()
0
2069 return false;
never executed: return false;
0
2070 -
2071 QModelIndex index;
never executed (the execution status of this line is deduced): QModelIndex index;
-
2072 // rootIndex() (i.e. the viewport) might be a valid index -
2073 if (viewport->rect().contains(event->pos())) {
never evaluated: viewport->rect().contains(event->pos())
0
2074 index = q->indexAt(event->pos());
never executed (the execution status of this line is deduced): index = q->indexAt(event->pos());
-
2075 if (!index.isValid() || !q->visualRect(index).contains(event->pos()))
never evaluated: !index.isValid()
never evaluated: !q->visualRect(index).contains(event->pos())
0
2076 index = root;
never executed: index = root;
0
2077 }
never executed: }
0
2078 -
2079 // If we are allowed to do the drop -
2080 if (model->supportedDropActions() & event->dropAction()) {
never evaluated: model->supportedDropActions() & event->dropAction()
0
2081 int row = -1;
never executed (the execution status of this line is deduced): int row = -1;
-
2082 int col = -1;
never executed (the execution status of this line is deduced): int col = -1;
-
2083 if (index != root) {
never evaluated: index != root
0
2084 dropIndicatorPosition = position(event->pos(), q->visualRect(index), index);
never executed (the execution status of this line is deduced): dropIndicatorPosition = position(event->pos(), q->visualRect(index), index);
-
2085 switch (dropIndicatorPosition) { -
2086 case QAbstractItemView::AboveItem: -
2087 row = index.row();
never executed (the execution status of this line is deduced): row = index.row();
-
2088 col = index.column();
never executed (the execution status of this line is deduced): col = index.column();
-
2089 index = index.parent();
never executed (the execution status of this line is deduced): index = index.parent();
-
2090 break;
never executed: break;
0
2091 case QAbstractItemView::BelowItem: -
2092 row = index.row() + 1;
never executed (the execution status of this line is deduced): row = index.row() + 1;
-
2093 col = index.column();
never executed (the execution status of this line is deduced): col = index.column();
-
2094 index = index.parent();
never executed (the execution status of this line is deduced): index = index.parent();
-
2095 break;
never executed: break;
0
2096 case QAbstractItemView::OnItem: -
2097 case QAbstractItemView::OnViewport: -
2098 break;
never executed: break;
0
2099 } -
2100 } else {
never executed: }
0
2101 dropIndicatorPosition = QAbstractItemView::OnViewport;
never executed (the execution status of this line is deduced): dropIndicatorPosition = QAbstractItemView::OnViewport;
-
2102 }
never executed: }
0
2103 *dropIndex = index;
never executed (the execution status of this line is deduced): *dropIndex = index;
-
2104 *dropRow = row;
never executed (the execution status of this line is deduced): *dropRow = row;
-
2105 *dropCol = col;
never executed (the execution status of this line is deduced): *dropCol = col;
-
2106 if (!droppingOnItself(event, index))
never evaluated: !droppingOnItself(event, index)
0
2107 return true;
never executed: return true;
0
2108 }
never executed: }
0
2109 return false;
never executed: return false;
0
2110} -
2111 -
2112QAbstractItemView::DropIndicatorPosition -
2113QAbstractItemViewPrivate::position(const QPoint &pos, const QRect &rect, const QModelIndex &index) const -
2114{ -
2115 QAbstractItemView::DropIndicatorPosition r = QAbstractItemView::OnViewport;
never executed (the execution status of this line is deduced): QAbstractItemView::DropIndicatorPosition r = QAbstractItemView::OnViewport;
-
2116 if (!overwrite) {
never evaluated: !overwrite
0
2117 const int margin = 2;
never executed (the execution status of this line is deduced): const int margin = 2;
-
2118 if (pos.y() - rect.top() < margin) {
never evaluated: pos.y() - rect.top() < margin
0
2119 r = QAbstractItemView::AboveItem;
never executed (the execution status of this line is deduced): r = QAbstractItemView::AboveItem;
-
2120 } else if (rect.bottom() - pos.y() < margin) {
never executed: }
never evaluated: rect.bottom() - pos.y() < margin
0
2121 r = QAbstractItemView::BelowItem;
never executed (the execution status of this line is deduced): r = QAbstractItemView::BelowItem;
-
2122 } else if (rect.contains(pos, true)) {
never executed: }
never evaluated: rect.contains(pos, true)
0
2123 r = QAbstractItemView::OnItem;
never executed (the execution status of this line is deduced): r = QAbstractItemView::OnItem;
-
2124 }
never executed: }
0
2125 } else { -
2126 QRect touchingRect = rect;
never executed (the execution status of this line is deduced): QRect touchingRect = rect;
-
2127 touchingRect.adjust(-1, -1, 1, 1);
never executed (the execution status of this line is deduced): touchingRect.adjust(-1, -1, 1, 1);
-
2128 if (touchingRect.contains(pos, false)) {
never evaluated: touchingRect.contains(pos, false)
0
2129 r = QAbstractItemView::OnItem;
never executed (the execution status of this line is deduced): r = QAbstractItemView::OnItem;
-
2130 }
never executed: }
0
2131 }
never executed: }
0
2132 -
2133 if (r == QAbstractItemView::OnItem && (!(model->flags(index) & Qt::ItemIsDropEnabled)))
never evaluated: r == QAbstractItemView::OnItem
never evaluated: (!(model->flags(index) & Qt::ItemIsDropEnabled))
0
2134 r = pos.y() < rect.center().y() ? QAbstractItemView::AboveItem : QAbstractItemView::BelowItem;
never executed: r = pos.y() < rect.center().y() ? QAbstractItemView::AboveItem : QAbstractItemView::BelowItem;
never evaluated: pos.y() < rect.center().y()
0
2135 -
2136 return r;
never executed: return r;
0
2137} -
2138 -
2139#endif // QT_NO_DRAGANDDROP -
2140 -
2141/*! -
2142 This function is called with the given \a event when the widget obtains the focus. -
2143 By default, the event is ignored. -
2144 -
2145 \sa setFocus(), focusOutEvent() -
2146*/ -
2147void QAbstractItemView::focusInEvent(QFocusEvent *event) -
2148{ -
2149 Q_D(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
2150 QAbstractScrollArea::focusInEvent(event);
executed (the execution status of this line is deduced): QAbstractScrollArea::focusInEvent(event);
-
2151 -
2152 const QItemSelectionModel* model = selectionModel();
executed (the execution status of this line is deduced): const QItemSelectionModel* model = selectionModel();
-
2153 const bool currentIndexValid = currentIndex().isValid();
executed (the execution status of this line is deduced): const bool currentIndexValid = currentIndex().isValid();
-
2154 -
2155 if (model
evaluated: model
TRUEFALSE
yes
Evaluation Count:272
yes
Evaluation Count:24
24-272
2156 && !d->currentIndexSet
evaluated: !d->currentIndexSet
TRUEFALSE
yes
Evaluation Count:248
yes
Evaluation Count:24
24-248
2157 && !currentIndexValid) {
evaluated: !currentIndexValid
TRUEFALSE
yes
Evaluation Count:174
yes
Evaluation Count:74
74-174
2158 bool autoScroll = d->autoScroll;
executed (the execution status of this line is deduced): bool autoScroll = d->autoScroll;
-
2159 d->autoScroll = false;
executed (the execution status of this line is deduced): d->autoScroll = false;
-
2160 QModelIndex index = moveCursor(MoveNext, Qt::NoModifier); // first visible index
executed (the execution status of this line is deduced): QModelIndex index = moveCursor(MoveNext, Qt::NoModifier);
-
2161 if (index.isValid() && d->isIndexEnabled(index) && event->reason() != Qt::MouseFocusReason)
evaluated: index.isValid()
TRUEFALSE
yes
Evaluation Count:159
yes
Evaluation Count:15
partially evaluated: d->isIndexEnabled(index)
TRUEFALSE
yes
Evaluation Count:159
no
Evaluation Count:0
evaluated: event->reason() != Qt::MouseFocusReason
TRUEFALSE
yes
Evaluation Count:157
yes
Evaluation Count:2
0-159
2162 selectionModel()->setCurrentIndex(index, QItemSelectionModel::NoUpdate);
executed: selectionModel()->setCurrentIndex(index, QItemSelectionModel::NoUpdate);
Execution Count:157
157
2163 d->autoScroll = autoScroll;
executed (the execution status of this line is deduced): d->autoScroll = autoScroll;
-
2164 }
executed: }
Execution Count:174
174
2165 -
2166 if (model && currentIndexValid) {
evaluated: model
TRUEFALSE
yes
Evaluation Count:272
yes
Evaluation Count:24
evaluated: currentIndexValid
TRUEFALSE
yes
Evaluation Count:98
yes
Evaluation Count:174
24-272
2167 if (currentIndex().flags() != Qt::ItemIsEditable)
partially evaluated: currentIndex().flags() != Qt::ItemIsEditable
TRUEFALSE
yes
Evaluation Count:98
no
Evaluation Count:0
0-98
2168 setAttribute(Qt::WA_InputMethodEnabled, false);
executed: setAttribute(Qt::WA_InputMethodEnabled, false);
Execution Count:98
98
2169 else -
2170 setAttribute(Qt::WA_InputMethodEnabled);
never executed: setAttribute(Qt::WA_InputMethodEnabled);
0
2171 } -
2172 -
2173 if (!currentIndexValid)
evaluated: !currentIndexValid
TRUEFALSE
yes
Evaluation Count:198
yes
Evaluation Count:98
98-198
2174 setAttribute(Qt::WA_InputMethodEnabled, false);
executed: setAttribute(Qt::WA_InputMethodEnabled, false);
Execution Count:198
198
2175 -
2176 d->viewport->update();
executed (the execution status of this line is deduced): d->viewport->update();
-
2177}
executed: }
Execution Count:296
296
2178 -
2179/*! -
2180 This function is called with the given \a event when the widget -
2181 looses the focus. By default, the event is ignored. -
2182 -
2183 \sa clearFocus(), focusInEvent() -
2184*/ -
2185void QAbstractItemView::focusOutEvent(QFocusEvent *event) -
2186{ -
2187 Q_D(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
2188 QAbstractScrollArea::focusOutEvent(event);
executed (the execution status of this line is deduced): QAbstractScrollArea::focusOutEvent(event);
-
2189 d->viewport->update();
executed (the execution status of this line is deduced): d->viewport->update();
-
2190}
executed: }
Execution Count:102
102
2191 -
2192/*! -
2193 This function is called with the given \a event when a key event is sent to -
2194 the widget. The default implementation handles basic cursor movement, e.g. Up, -
2195 Down, Left, Right, Home, PageUp, and PageDown; the activated() signal is -
2196 emitted if the current index is valid and the activation key is pressed -
2197 (e.g. Enter or Return, depending on the platform). -
2198 This function is where editing is initiated by key press, e.g. if F2 is -
2199 pressed. -
2200 -
2201 \sa edit(), moveCursor(), keyboardSearch(), tabKeyNavigation -
2202*/ -
2203void QAbstractItemView::keyPressEvent(QKeyEvent *event) -
2204{ -
2205 Q_D(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
2206 d->delayedAutoScroll.stop(); //any interaction with the view cancel the auto scrolling
executed (the execution status of this line is deduced): d->delayedAutoScroll.stop();
-
2207 -
2208#ifdef QT_KEYPAD_NAVIGATION -
2209 switch (event->key()) { -
2210 case Qt::Key_Select: -
2211 if (QApplication::keypadNavigationEnabled()) { -
2212 if (!hasEditFocus()) { -
2213 setEditFocus(true); -
2214 return; -
2215 } -
2216 } -
2217 break; -
2218 case Qt::Key_Back: -
2219 if (QApplication::keypadNavigationEnabled() && hasEditFocus()) { -
2220 setEditFocus(false); -
2221 } else { -
2222 event->ignore(); -
2223 } -
2224 return; -
2225 case Qt::Key_Down: -
2226 case Qt::Key_Up: -
2227 // Let's ignore vertical navigation events, only if there is no other widget -
2228 // what can take the focus in vertical direction. This means widget can handle navigation events -
2229 // even the widget don't have edit focus, and there is no other widget in requested direction. -
2230 if(QApplication::keypadNavigationEnabled() && !hasEditFocus() -
2231 && QWidgetPrivate::canKeypadNavigate(Qt::Vertical)) { -
2232 event->ignore(); -
2233 return; -
2234 } -
2235 break; -
2236 case Qt::Key_Left: -
2237 case Qt::Key_Right: -
2238 // Similar logic as in up and down events -
2239 if(QApplication::keypadNavigationEnabled() && !hasEditFocus() -
2240 && (QWidgetPrivate::canKeypadNavigate(Qt::Horizontal) || QWidgetPrivate::inTabWidget(this))) { -
2241 event->ignore(); -
2242 return; -
2243 } -
2244 break; -
2245 default: -
2246 if (QApplication::keypadNavigationEnabled() && !hasEditFocus()) { -
2247 event->ignore(); -
2248 return; -
2249 } -
2250 } -
2251#endif -
2252 -
2253#if !defined(QT_NO_CLIPBOARD) && !defined(QT_NO_SHORTCUT) -
2254 if (event == QKeySequence::Copy) {
partially evaluated: event == QKeySequence::Copy
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1083
0-1083
2255 QVariant variant;
never executed (the execution status of this line is deduced): QVariant variant;
-
2256 if (d->model)
never evaluated: d->model
0
2257 variant = d->model->data(currentIndex(), Qt::DisplayRole);
never executed: variant = d->model->data(currentIndex(), Qt::DisplayRole);
0
2258 if (variant.type() == QVariant::String)
never evaluated: variant.type() == QVariant::String
0
2259 QApplication::clipboard()->setText(variant.toString());
never executed: QApplication::clipboard()->setText(variant.toString());
0
2260 event->accept();
never executed (the execution status of this line is deduced): event->accept();
-
2261 }
never executed: }
0
2262#endif -
2263 -
2264 QPersistentModelIndex newCurrent;
executed (the execution status of this line is deduced): QPersistentModelIndex newCurrent;
-
2265 d->moveCursorUpdatedView = false;
executed (the execution status of this line is deduced): d->moveCursorUpdatedView = false;
-
2266 switch (event->key()) { -
2267 case Qt::Key_Down: -
2268 newCurrent = moveCursor(MoveDown, event->modifiers());
executed (the execution status of this line is deduced): newCurrent = moveCursor(MoveDown, event->modifiers());
-
2269 break;
executed: break;
Execution Count:258
258
2270 case Qt::Key_Up: -
2271 newCurrent = moveCursor(MoveUp, event->modifiers());
executed (the execution status of this line is deduced): newCurrent = moveCursor(MoveUp, event->modifiers());
-
2272 break;
executed: break;
Execution Count:250
250
2273 case Qt::Key_Left: -
2274 newCurrent = moveCursor(MoveLeft, event->modifiers());
executed (the execution status of this line is deduced): newCurrent = moveCursor(MoveLeft, event->modifiers());
-
2275 break;
executed: break;
Execution Count:220
220
2276 case Qt::Key_Right: -
2277 newCurrent = moveCursor(MoveRight, event->modifiers());
executed (the execution status of this line is deduced): newCurrent = moveCursor(MoveRight, event->modifiers());
-
2278 break;
executed: break;
Execution Count:116
116
2279 case Qt::Key_Home: -
2280 newCurrent = moveCursor(MoveHome, event->modifiers());
never executed (the execution status of this line is deduced): newCurrent = moveCursor(MoveHome, event->modifiers());
-
2281 break;
never executed: break;
0
2282 case Qt::Key_End: -
2283 newCurrent = moveCursor(MoveEnd, event->modifiers());
never executed (the execution status of this line is deduced): newCurrent = moveCursor(MoveEnd, event->modifiers());
-
2284 break;
never executed: break;
0
2285 case Qt::Key_PageUp: -
2286 newCurrent = moveCursor(MovePageUp, event->modifiers());
executed (the execution status of this line is deduced): newCurrent = moveCursor(MovePageUp, event->modifiers());
-
2287 break;
executed: break;
Execution Count:2
2
2288 case Qt::Key_PageDown: -
2289 newCurrent = moveCursor(MovePageDown, event->modifiers());
executed (the execution status of this line is deduced): newCurrent = moveCursor(MovePageDown, event->modifiers());
-
2290 break;
executed: break;
Execution Count:3
3
2291 case Qt::Key_Tab: -
2292 if (d->tabKeyNavigation)
evaluated: d->tabKeyNavigation
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:2
2-10
2293 newCurrent = moveCursor(MoveNext, event->modifiers());
executed: newCurrent = moveCursor(MoveNext, event->modifiers());
Execution Count:10
10
2294 break;
executed: break;
Execution Count:12
12
2295 case Qt::Key_Backtab: -
2296 if (d->tabKeyNavigation)
evaluated: d->tabKeyNavigation
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:1
1-4
2297 newCurrent = moveCursor(MovePrevious, event->modifiers());
executed: newCurrent = moveCursor(MovePrevious, event->modifiers());
Execution Count:4
4
2298 break;
executed: break;
Execution Count:5
5
2299 } -
2300 -
2301 QPersistentModelIndex oldCurrent = currentIndex();
executed (the execution status of this line is deduced): QPersistentModelIndex oldCurrent = currentIndex();
-
2302 if (newCurrent != oldCurrent && newCurrent.isValid() && d->isIndexEnabled(newCurrent)) {
evaluated: newCurrent != oldCurrent
TRUEFALSE
yes
Evaluation Count:872
yes
Evaluation Count:211
evaluated: newCurrent.isValid()
TRUEFALSE
yes
Evaluation Count:697
yes
Evaluation Count:175
partially evaluated: d->isIndexEnabled(newCurrent)
TRUEFALSE
yes
Evaluation Count:697
no
Evaluation Count:0
0-872
2303 if (!hasFocus() && QApplication::focusWidget() == indexWidget(oldCurrent))
evaluated: !hasFocus()
TRUEFALSE
yes
Evaluation Count:142
yes
Evaluation Count:555
evaluated: QApplication::focusWidget() == indexWidget(oldCurrent)
TRUEFALSE
yes
Evaluation Count:134
yes
Evaluation Count:8
8-555
2304 setFocus();
executed: setFocus();
Execution Count:134
134
2305 QItemSelectionModel::SelectionFlags command = selectionCommand(newCurrent, event);
executed (the execution status of this line is deduced): QItemSelectionModel::SelectionFlags command = selectionCommand(newCurrent, event);
-
2306 if (command != QItemSelectionModel::NoUpdate
partially evaluated: command != QItemSelectionModel::NoUpdate
TRUEFALSE
yes
Evaluation Count:697
no
Evaluation Count:0
0-697
2307 || style()->styleHint(QStyle::SH_ItemView_MovementWithoutUpdatingSelection, 0, this)) {
never evaluated: style()->styleHint(QStyle::SH_ItemView_MovementWithoutUpdatingSelection, 0, this)
0
2308 // note that we don't check if the new current index is enabled because moveCursor() makes sure it is -
2309 if (command & QItemSelectionModel::Current) {
evaluated: command & QItemSelectionModel::Current
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:693
4-693
2310 d->selectionModel->setCurrentIndex(newCurrent, QItemSelectionModel::NoUpdate);
executed (the execution status of this line is deduced): d->selectionModel->setCurrentIndex(newCurrent, QItemSelectionModel::NoUpdate);
-
2311 if (!indexAt(d->pressedPosition - d->offset()).isValid())
evaluated: !indexAt(d->pressedPosition - d->offset()).isValid()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:1
1-3
2312 d->pressedPosition = visualRect(oldCurrent).center() + d->offset();
executed: d->pressedPosition = visualRect(oldCurrent).center() + d->offset();
Execution Count:3
3
2313 QRect rect(d->pressedPosition - d->offset(), visualRect(newCurrent).center());
executed (the execution status of this line is deduced): QRect rect(d->pressedPosition - d->offset(), visualRect(newCurrent).center());
-
2314 setSelection(rect, command);
executed (the execution status of this line is deduced): setSelection(rect, command);
-
2315 } else {
executed: }
Execution Count:4
4
2316 d->selectionModel->setCurrentIndex(newCurrent, command);
executed (the execution status of this line is deduced): d->selectionModel->setCurrentIndex(newCurrent, command);
-
2317 d->pressedPosition = visualRect(newCurrent).center() + d->offset();
executed (the execution status of this line is deduced): d->pressedPosition = visualRect(newCurrent).center() + d->offset();
-
2318 if (newCurrent.isValid()) {
evaluated: newCurrent.isValid()
TRUEFALSE
yes
Evaluation Count:692
yes
Evaluation Count:1
1-692
2319 // We copy the same behaviour as for mousePressEvent(). -
2320 QRect rect(d->pressedPosition - d->offset(), QSize(1, 1));
executed (the execution status of this line is deduced): QRect rect(d->pressedPosition - d->offset(), QSize(1, 1));
-
2321 setSelection(rect, command);
executed (the execution status of this line is deduced): setSelection(rect, command);
-
2322 }
executed: }
Execution Count:692
692
2323 }
executed: }
Execution Count:693
693
2324 event->accept();
executed (the execution status of this line is deduced): event->accept();
-
2325 return;
executed: return;
Execution Count:697
697
2326 } -
2327 }
never executed: }
0
2328 -
2329 switch (event->key()) { -
2330 // ignored keys -
2331 case Qt::Key_Down: -
2332 case Qt::Key_Up: -
2333#ifdef QT_KEYPAD_NAVIGATION -
2334 if (QApplication::keypadNavigationEnabled() && QWidgetPrivate::canKeypadNavigate(Qt::Vertical)) { -
2335 event->accept(); // don't change focus -
2336 break; -
2337 } -
2338#endif -
2339 case Qt::Key_Left: -
2340 case Qt::Key_Right: -
2341#ifdef QT_KEYPAD_NAVIGATION -
2342 if (QApplication::navigationMode() == Qt::NavigationModeKeypadDirectional -
2343 && (QWidgetPrivate::canKeypadNavigate(Qt::Horizontal) -
2344 || (QWidgetPrivate::inTabWidget(this) && d->model->columnCount(d->root) > 1))) { -
2345 event->accept(); // don't change focus -
2346 break; -
2347 } -
2348#endif // QT_KEYPAD_NAVIGATION -
2349 case Qt::Key_Home: -
2350 case Qt::Key_End: -
2351 case Qt::Key_PageUp: -
2352 case Qt::Key_PageDown: -
2353 case Qt::Key_Escape: -
2354 case Qt::Key_Shift: -
2355 case Qt::Key_Control: -
2356 case Qt::Key_Delete: -
2357 case Qt::Key_Backspace: -
2358 event->ignore();
executed (the execution status of this line is deduced): event->ignore();
-
2359 break;
executed: break;
Execution Count:257
257
2360 case Qt::Key_Space: -
2361 case Qt::Key_Select: -
2362 if (!edit(currentIndex(), AnyKeyPressed, event) && d->selectionModel)
partially evaluated: !edit(currentIndex(), AnyKeyPressed, event)
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
partially evaluated: d->selectionModel
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
2363 d->selectionModel->select(currentIndex(), selectionCommand(currentIndex(), event));
executed: d->selectionModel->select(currentIndex(), selectionCommand(currentIndex(), event));
Execution Count:1
1
2364#ifdef QT_KEYPAD_NAVIGATION -
2365 if ( event->key()==Qt::Key_Select ) { -
2366 // Also do Key_Enter action. -
2367 if (currentIndex().isValid()) { -
2368 if (state() != EditingState) -
2369 emit activated(currentIndex()); -
2370 } else { -
2371 event->ignore(); -
2372 } -
2373 } -
2374#endif -
2375 break;
executed: break;
Execution Count:1
1
2376#ifdef Q_WS_MAC -
2377 case Qt::Key_Enter: -
2378 case Qt::Key_Return: -
2379 // Propagate the enter if you couldn't edit the item and there are no -
2380 // current editors (if there are editors, the event was most likely propagated from it). -
2381 if (!edit(currentIndex(), EditKeyPressed, event) && d->editorIndexHash.isEmpty()) -
2382 event->ignore(); -
2383 break; -
2384#else -
2385 case Qt::Key_F2: -
2386 if (!edit(currentIndex(), EditKeyPressed, event))
evaluated: !edit(currentIndex(), EditKeyPressed, event)
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:1
1-4
2387 event->ignore();
executed: event->ignore();
Execution Count:4
4
2388 break;
executed: break;
Execution Count:5
5
2389 case Qt::Key_Enter: -
2390 case Qt::Key_Return: -
2391 // ### we can't open the editor on enter, becuse -
2392 // some widgets will forward the enter event back -
2393 // to the viewport, starting an endless loop -
2394 if (state() != EditingState || hasFocus()) {
evaluated: state() != EditingState
TRUEFALSE
yes
Evaluation Count:95
yes
Evaluation Count:13
partially evaluated: hasFocus()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13
0-95
2395 if (currentIndex().isValid())
evaluated: currentIndex().isValid()
TRUEFALSE
yes
Evaluation Count:75
yes
Evaluation Count:20
20-75
2396 emit activated(currentIndex());
executed: activated(currentIndex());
Execution Count:75
75
2397 event->ignore();
executed (the execution status of this line is deduced): event->ignore();
-
2398 }
executed: }
Execution Count:95
95
2399 break;
executed: break;
Execution Count:108
108
2400#endif -
2401 case Qt::Key_A: -
2402 if (event->modifiers() & Qt::ControlModifier) {
partially evaluated: event->modifiers() & Qt::ControlModifier
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
2403 selectAll();
executed (the execution status of this line is deduced): selectAll();
-
2404 break;
executed: break;
Execution Count:1
1
2405 } -
2406 default: { -
2407#ifdef Q_WS_MAC -
2408 if (event->key() == Qt::Key_O && event->modifiers() & Qt::ControlModifier && currentIndex().isValid()) { -
2409 emit activated(currentIndex()); -
2410 break; -
2411 } -
2412#endif -
2413 bool modified = (event->modifiers() & (Qt::ControlModifier | Qt::AltModifier | Qt::MetaModifier));
executed (the execution status of this line is deduced): bool modified = (event->modifiers() & (Qt::ControlModifier | Qt::AltModifier | Qt::MetaModifier));
-
2414 if (!event->text().isEmpty() && !modified && !edit(currentIndex(), AnyKeyPressed, event)) {
evaluated: !event->text().isEmpty()
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:4
partially evaluated: !modified
TRUEFALSE
yes
Evaluation Count:10
no
Evaluation Count:0
partially evaluated: !edit(currentIndex(), AnyKeyPressed, event)
TRUEFALSE
yes
Evaluation Count:10
no
Evaluation Count:0
0-10
2415 keyboardSearch(event->text());
executed (the execution status of this line is deduced): keyboardSearch(event->text());
-
2416 event->accept();
executed (the execution status of this line is deduced): event->accept();
-
2417 } else {
executed: }
Execution Count:10
10
2418 event->ignore();
executed (the execution status of this line is deduced): event->ignore();
-
2419 }
executed: }
Execution Count:4
4
2420 break; }
executed: break;
Execution Count:14
14
2421 } -
2422 if (d->moveCursorUpdatedView)
evaluated: d->moveCursorUpdatedView
TRUEFALSE
yes
Evaluation Count:20
yes
Evaluation Count:366
20-366
2423 event->accept();
executed: event->accept();
Execution Count:20
20
2424}
executed: }
Execution Count:386
386
2425 -
2426/*! -
2427 This function is called with the given \a event when a resize event is sent to -
2428 the widget. -
2429 -
2430 \sa QWidget::resizeEvent() -
2431*/ -
2432void QAbstractItemView::resizeEvent(QResizeEvent *event) -
2433{ -
2434 QAbstractScrollArea::resizeEvent(event);
executed (the execution status of this line is deduced): QAbstractScrollArea::resizeEvent(event);
-
2435 updateGeometries();
executed (the execution status of this line is deduced): updateGeometries();
-
2436}
executed: }
Execution Count:2446
2446
2437 -
2438/*! -
2439 This function is called with the given \a event when a timer event is sent -
2440 to the widget. -
2441 -
2442 \sa QObject::timerEvent() -
2443*/ -
2444void QAbstractItemView::timerEvent(QTimerEvent *event) -
2445{ -
2446 Q_D(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
2447 if (event->timerId() == d->fetchMoreTimer.timerId())
evaluated: event->timerId() == d->fetchMoreTimer.timerId()
TRUEFALSE
yes
Evaluation Count:1192
yes
Evaluation Count:683
683-1192
2448 d->fetchMore();
executed: d->fetchMore();
Execution Count:1192
1192
2449 else if (event->timerId() == d->delayedReset.timerId())
partially evaluated: event->timerId() == d->delayedReset.timerId()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:683
0-683
2450 reset();
never executed: reset();
0
2451 else if (event->timerId() == d->autoScrollTimer.timerId())
partially evaluated: event->timerId() == d->autoScrollTimer.timerId()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:683
0-683
2452 doAutoScroll();
never executed: doAutoScroll();
0
2453 else if (event->timerId() == d->updateTimer.timerId())
partially evaluated: event->timerId() == d->updateTimer.timerId()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:683
0-683
2454 d->updateDirtyRegion();
never executed: d->updateDirtyRegion();
0
2455 else if (event->timerId() == d->delayedEditing.timerId()) {
evaluated: event->timerId() == d->delayedEditing.timerId()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:682
1-682
2456 d->delayedEditing.stop();
executed (the execution status of this line is deduced): d->delayedEditing.stop();
-
2457 edit(currentIndex());
executed (the execution status of this line is deduced): edit(currentIndex());
-
2458 } else if (event->timerId() == d->delayedLayout.timerId()) {
executed: }
Execution Count:1
evaluated: event->timerId() == d->delayedLayout.timerId()
TRUEFALSE
yes
Evaluation Count:307
yes
Evaluation Count:375
1-375
2459 d->delayedLayout.stop();
executed (the execution status of this line is deduced): d->delayedLayout.stop();
-
2460 if (isVisible()) {
evaluated: isVisible()
TRUEFALSE
yes
Evaluation Count:256
yes
Evaluation Count:51
51-256
2461 d->interruptDelayedItemsLayout();
executed (the execution status of this line is deduced): d->interruptDelayedItemsLayout();
-
2462 doItemsLayout();
executed (the execution status of this line is deduced): doItemsLayout();
-
2463 const QModelIndex current = currentIndex();
executed (the execution status of this line is deduced): const QModelIndex current = currentIndex();
-
2464 if (current.isValid() && d->state == QAbstractItemView::EditingState)
evaluated: current.isValid()
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:244
partially evaluated: d->state == QAbstractItemView::EditingState
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12
0-244
2465 scrollTo(current);
never executed: scrollTo(current);
0
2466 }
executed: }
Execution Count:256
256
2467 } else if (event->timerId() == d->delayedAutoScroll.timerId()) {
executed: }
Execution Count:307
evaluated: event->timerId() == d->delayedAutoScroll.timerId()
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:367
8-367
2468 d->delayedAutoScroll.stop();
executed (the execution status of this line is deduced): d->delayedAutoScroll.stop();
-
2469 //end of the timer: if the current item is still the same as the one when the mouse press occurred -
2470 //we only get here if there was no double click -
2471 if (d->pressedIndex.isValid() && d->pressedIndex == currentIndex())
partially evaluated: d->pressedIndex.isValid()
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
partially evaluated: d->pressedIndex == currentIndex()
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
0-8
2472 scrollTo(d->pressedIndex);
executed: scrollTo(d->pressedIndex);
Execution Count:8
8
2473 }
executed: }
Execution Count:8
8
2474} -
2475 -
2476/*! -
2477 \reimp -
2478*/ -
2479void QAbstractItemView::inputMethodEvent(QInputMethodEvent *event) -
2480{ -
2481 if (event->commitString().isEmpty() && event->preeditString().isEmpty()) {
never evaluated: event->commitString().isEmpty()
never evaluated: event->preeditString().isEmpty()
0
2482 event->ignore();
never executed (the execution status of this line is deduced): event->ignore();
-
2483 return;
never executed: return;
0
2484 } -
2485 if (!edit(currentIndex(), AnyKeyPressed, event)) {
never evaluated: !edit(currentIndex(), AnyKeyPressed, event)
0
2486 if (!event->commitString().isEmpty())
never evaluated: !event->commitString().isEmpty()
0
2487 keyboardSearch(event->commitString());
never executed: keyboardSearch(event->commitString());
0
2488 event->ignore();
never executed (the execution status of this line is deduced): event->ignore();
-
2489 }
never executed: }
0
2490}
never executed: }
0
2491 -
2492#ifndef QT_NO_DRAGANDDROP -
2493/*! -
2494 \enum QAbstractItemView::DropIndicatorPosition -
2495 -
2496 This enum indicates the position of the drop indicator in -
2497 relation to the index at the current mouse position: -
2498 -
2499 \value OnItem The item will be dropped on the index. -
2500 -
2501 \value AboveItem The item will be dropped above the index. -
2502 -
2503 \value BelowItem The item will be dropped below the index. -
2504 -
2505 \value OnViewport The item will be dropped onto a region of the viewport with -
2506 no items. The way each view handles items dropped onto the viewport depends on -
2507 the behavior of the underlying model in use. -
2508*/ -
2509 -
2510 -
2511/*! -
2512 \since 4.1 -
2513 -
2514 Returns the position of the drop indicator in relation to the closest item. -
2515*/ -
2516QAbstractItemView::DropIndicatorPosition QAbstractItemView::dropIndicatorPosition() const -
2517{ -
2518 Q_D(const QAbstractItemView);
never executed (the execution status of this line is deduced): const QAbstractItemViewPrivate * const d = d_func();
-
2519 return d->dropIndicatorPosition;
never executed: return d->dropIndicatorPosition;
0
2520} -
2521#endif -
2522 -
2523/*! -
2524 This convenience function returns a list of all selected and -
2525 non-hidden item indexes in the view. The list contains no -
2526 duplicates, and is not sorted. -
2527 -
2528 \sa QItemSelectionModel::selectedIndexes() -
2529*/ -
2530QModelIndexList QAbstractItemView::selectedIndexes() const -
2531{ -
2532 Q_D(const QAbstractItemView);
executed (the execution status of this line is deduced): const QAbstractItemViewPrivate * const d = d_func();
-
2533 QModelIndexList indexes;
executed (the execution status of this line is deduced): QModelIndexList indexes;
-
2534 if (d->selectionModel) {
evaluated: d->selectionModel
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:2
1-2
2535 indexes = d->selectionModel->selectedIndexes();
executed (the execution status of this line is deduced): indexes = d->selectionModel->selectedIndexes();
-
2536 QList<QModelIndex>::iterator it = indexes.begin();
executed (the execution status of this line is deduced): QList<QModelIndex>::iterator it = indexes.begin();
-
2537 while (it != indexes.end())
partially evaluated: it != indexes.end()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
2538 if (isIndexHidden(*it))
never evaluated: isIndexHidden(*it)
0
2539 it = indexes.erase(it);
never executed: it = indexes.erase(it);
0
2540 else -
2541 ++it;
never executed: ++it;
0
2542 }
executed: }
Execution Count:1
1
2543 return indexes;
executed: return indexes;
Execution Count:3
3
2544} -
2545 -
2546/*! -
2547 Starts editing the item at \a index, creating an editor if -
2548 necessary, and returns true if the view's \l{State} is now -
2549 EditingState; otherwise returns false. -
2550 -
2551 The action that caused the editing process is described by -
2552 \a trigger, and the associated event is specified by \a event. -
2553 -
2554 Editing can be forced by specifying the \a trigger to be -
2555 QAbstractItemView::AllEditTriggers. -
2556 -
2557 \sa closeEditor() -
2558*/ -
2559bool QAbstractItemView::edit(const QModelIndex &index, EditTrigger trigger, QEvent *event) -
2560{ -
2561 Q_D(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
2562 -
2563 if (!d->isIndexValid(index))
evaluated: !d->isIndexValid(index)
TRUEFALSE
yes
Evaluation Count:32
yes
Evaluation Count:7944
32-7944
2564 return false;
executed: return false;
Execution Count:32
32
2565 -
2566 if (QWidget *w = (d->persistent.isEmpty() ? static_cast<QWidget*>(0) : d->editorForIndex(index).widget.data())) {
evaluated: d->persistent.isEmpty()
TRUEFALSE
yes
Evaluation Count:7928
yes
Evaluation Count:16
16-7928
2567 if (w->focusPolicy() == Qt::NoFocus)
evaluated: w->focusPolicy() == Qt::NoFocus
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:3
1-3
2568 return false;
executed: return false;
Execution Count:1
1
2569 w->setFocus();
executed (the execution status of this line is deduced): w->setFocus();
-
2570 return true;
executed: return true;
Execution Count:3
3
2571 } -
2572 -
2573 if (trigger == DoubleClicked) {
evaluated: trigger == DoubleClicked
TRUEFALSE
yes
Evaluation Count:31
yes
Evaluation Count:7909
31-7909
2574 d->delayedEditing.stop();
executed (the execution status of this line is deduced): d->delayedEditing.stop();
-
2575 d->delayedAutoScroll.stop();
executed (the execution status of this line is deduced): d->delayedAutoScroll.stop();
-
2576 } else if (trigger == CurrentChanged) {
executed: }
Execution Count:31
evaluated: trigger == CurrentChanged
TRUEFALSE
yes
Evaluation Count:2008
yes
Evaluation Count:5901
31-5901
2577 d->delayedEditing.stop();
executed (the execution status of this line is deduced): d->delayedEditing.stop();
-
2578 }
executed: }
Execution Count:2008
2008
2579 -
2580 if (d->sendDelegateEvent(index, event)) {
evaluated: d->sendDelegateEvent(index, event)
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:7936
4-7936
2581 update(index);
executed (the execution status of this line is deduced): update(index);
-
2582 return true;
executed: return true;
Execution Count:4
4
2583 } -
2584 -
2585 // save the previous trigger before updating -
2586 EditTriggers lastTrigger = d->lastTrigger;
executed (the execution status of this line is deduced): EditTriggers lastTrigger = d->lastTrigger;
-
2587 d->lastTrigger = trigger;
executed (the execution status of this line is deduced): d->lastTrigger = trigger;
-
2588 -
2589 if (!d->shouldEdit(trigger, d->model->buddy(index)))
evaluated: !d->shouldEdit(trigger, d->model->buddy(index))
TRUEFALSE
yes
Evaluation Count:7867
yes
Evaluation Count:69
69-7867
2590 return false;
executed: return false;
Execution Count:7867
7867
2591 -
2592 if (d->delayedEditing.isActive())
partially evaluated: d->delayedEditing.isActive()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:69
0-69
2593 return false;
never executed: return false;
0
2594 -
2595 // we will receive a mouseButtonReleaseEvent after a -
2596 // mouseDoubleClickEvent, so we need to check the previous trigger -
2597 if (lastTrigger == DoubleClicked && trigger == SelectedClicked)
partially evaluated: lastTrigger == DoubleClicked
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:69
never evaluated: trigger == SelectedClicked
0-69
2598 return false;
never executed: return false;
0
2599 -
2600 // we may get a double click event later -
2601 if (trigger == SelectedClicked)
evaluated: trigger == SelectedClicked
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:67
2-67
2602 d->delayedEditing.start(QApplication::doubleClickInterval(), this);
executed: d->delayedEditing.start(QApplication::doubleClickInterval(), this);
Execution Count:2
2
2603 else -
2604 d->openEditor(index, d->shouldForwardEvent(trigger, event) ? event : 0);
executed: d->openEditor(index, d->shouldForwardEvent(trigger, event) ? event : 0);
Execution Count:67
67
2605 -
2606 return true;
executed: return true;
Execution Count:69
69
2607} -
2608 -
2609/*! -
2610 \internal -
2611 Updates the data shown in the open editor widgets in the view. -
2612*/ -
2613void QAbstractItemView::updateEditorData() -
2614{ -
2615 Q_D(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
2616 d->updateEditorData(QModelIndex(), QModelIndex());
executed (the execution status of this line is deduced): d->updateEditorData(QModelIndex(), QModelIndex());
-
2617}
executed: }
Execution Count:8
8
2618 -
2619/*! -
2620 \internal -
2621 Updates the geometry of the open editor widgets in the view. -
2622*/ -
2623void QAbstractItemView::updateEditorGeometries() -
2624{ -
2625 Q_D(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
2626 if(d->editorIndexHash.isEmpty())
evaluated: d->editorIndexHash.isEmpty()
TRUEFALSE
yes
Evaluation Count:17925
yes
Evaluation Count:31
31-17925
2627 return;
executed: return;
Execution Count:17925
17925
2628 QStyleOptionViewItem option = d->viewOptions();
executed (the execution status of this line is deduced): QStyleOptionViewItem option = d->viewOptions();
-
2629 QEditorIndexHash::iterator it = d->editorIndexHash.begin();
executed (the execution status of this line is deduced): QEditorIndexHash::iterator it = d->editorIndexHash.begin();
-
2630 QWidgetList editorsToRelease;
executed (the execution status of this line is deduced): QWidgetList editorsToRelease;
-
2631 QWidgetList editorsToHide;
executed (the execution status of this line is deduced): QWidgetList editorsToHide;
-
2632 while (it != d->editorIndexHash.end()) {
evaluated: it != d->editorIndexHash.end()
TRUEFALSE
yes
Evaluation Count:70
yes
Evaluation Count:31
31-70
2633 QModelIndex index = it.value();
executed (the execution status of this line is deduced): QModelIndex index = it.value();
-
2634 QWidget *editor = it.key();
executed (the execution status of this line is deduced): QWidget *editor = it.key();
-
2635 if (index.isValid() && editor) {
partially evaluated: index.isValid()
TRUEFALSE
yes
Evaluation Count:70
no
Evaluation Count:0
partially evaluated: editor
TRUEFALSE
yes
Evaluation Count:70
no
Evaluation Count:0
0-70
2636 option.rect = visualRect(index);
executed (the execution status of this line is deduced): option.rect = visualRect(index);
-
2637 if (option.rect.isValid()) {
evaluated: option.rect.isValid()
TRUEFALSE
yes
Evaluation Count:25
yes
Evaluation Count:45
25-45
2638 editor->show();
executed (the execution status of this line is deduced): editor->show();
-
2639 QAbstractItemDelegate *delegate = d->delegateForIndex(index);
executed (the execution status of this line is deduced): QAbstractItemDelegate *delegate = d->delegateForIndex(index);
-
2640 if (delegate)
partially evaluated: delegate
TRUEFALSE
yes
Evaluation Count:25
no
Evaluation Count:0
0-25
2641 delegate->updateEditorGeometry(editor, option, index);
executed: delegate->updateEditorGeometry(editor, option, index);
Execution Count:25
25
2642 } else {
executed: }
Execution Count:25
25
2643 editorsToHide << editor;
executed (the execution status of this line is deduced): editorsToHide << editor;
-
2644 }
executed: }
Execution Count:45
45
2645 ++it;
executed (the execution status of this line is deduced): ++it;
-
2646 } else {
executed: }
Execution Count:70
70
2647 d->indexEditorHash.remove(it.value());
never executed (the execution status of this line is deduced): d->indexEditorHash.remove(it.value());
-
2648 it = d->editorIndexHash.erase(it);
never executed (the execution status of this line is deduced): it = d->editorIndexHash.erase(it);
-
2649 editorsToRelease << editor;
never executed (the execution status of this line is deduced): editorsToRelease << editor;
-
2650 }
never executed: }
0
2651 } -
2652 -
2653 //we hide and release the editor outside of the loop because it might change the focus and try -
2654 //to change the editors hashes. -
2655 for (int i = 0; i < editorsToHide.count(); ++i) {
evaluated: i < editorsToHide.count()
TRUEFALSE
yes
Evaluation Count:45
yes
Evaluation Count:31
31-45
2656 editorsToHide.at(i)->hide();
executed (the execution status of this line is deduced): editorsToHide.at(i)->hide();
-
2657 }
executed: }
Execution Count:45
45
2658 for (int i = 0; i < editorsToRelease.count(); ++i) {
partially evaluated: i < editorsToRelease.count()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:31
0-31
2659 d->releaseEditor(editorsToRelease.at(i));
never executed (the execution status of this line is deduced): d->releaseEditor(editorsToRelease.at(i));
-
2660 }
never executed: }
0
2661}
executed: }
Execution Count:31
31
2662 -
2663/*! -
2664 \since 4.4 -
2665 -
2666 Updates the geometry of the child widgets of the view. -
2667*/ -
2668void QAbstractItemView::updateGeometries() -
2669{ -
2670 updateEditorGeometries();
executed (the execution status of this line is deduced): updateEditorGeometries();
-
2671 d_func()->fetchMoreTimer.start(0, this); //fetch more later
executed (the execution status of this line is deduced): d_func()->fetchMoreTimer.start(0, this);
-
2672}
executed: }
Execution Count:6306
6306
2673 -
2674/*! -
2675 \internal -
2676*/ -
2677void QAbstractItemView::verticalScrollbarValueChanged(int value) -
2678{ -
2679 Q_D(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
2680 if (verticalScrollBar()->maximum() == value && d->model->canFetchMore(d->root))
evaluated: verticalScrollBar()->maximum() == value
TRUEFALSE
yes
Evaluation Count:53
yes
Evaluation Count:656
evaluated: d->model->canFetchMore(d->root)
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:49
4-656
2681 d->model->fetchMore(d->root);
executed: d->model->fetchMore(d->root);
Execution Count:4
4
2682 QPoint posInVp = viewport()->mapFromGlobal(QCursor::pos());
executed (the execution status of this line is deduced): QPoint posInVp = viewport()->mapFromGlobal(QCursor::pos());
-
2683 if (viewport()->rect().contains(posInVp))
evaluated: viewport()->rect().contains(posInVp)
TRUEFALSE
yes
Evaluation Count:679
yes
Evaluation Count:30
30-679
2684 d->checkMouseMove(posInVp);
executed: d->checkMouseMove(posInVp);
Execution Count:679
679
2685}
executed: }
Execution Count:709
709
2686 -
2687/*! -
2688 \internal -
2689*/ -
2690void QAbstractItemView::horizontalScrollbarValueChanged(int value) -
2691{ -
2692 Q_D(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
2693 if (horizontalScrollBar()->maximum() == value && d->model->canFetchMore(d->root))
evaluated: horizontalScrollBar()->maximum() == value
TRUEFALSE
yes
Evaluation Count:304
yes
Evaluation Count:5432
partially evaluated: d->model->canFetchMore(d->root)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:304
0-5432
2694 d->model->fetchMore(d->root);
never executed: d->model->fetchMore(d->root);
0
2695 QPoint posInVp = viewport()->mapFromGlobal(QCursor::pos());
executed (the execution status of this line is deduced): QPoint posInVp = viewport()->mapFromGlobal(QCursor::pos());
-
2696 if (viewport()->rect().contains(posInVp))
evaluated: viewport()->rect().contains(posInVp)
TRUEFALSE
yes
Evaluation Count:5712
yes
Evaluation Count:24
24-5712
2697 d->checkMouseMove(posInVp);
executed: d->checkMouseMove(posInVp);
Execution Count:5712
5712
2698}
executed: }
Execution Count:5736
5736
2699 -
2700/*! -
2701 \internal -
2702*/ -
2703void QAbstractItemView::verticalScrollbarAction(int) -
2704{ -
2705 //do nothing -
2706} -
2707 -
2708/*! -
2709 \internal -
2710*/ -
2711void QAbstractItemView::horizontalScrollbarAction(int) -
2712{ -
2713 //do nothing -
2714} -
2715 -
2716/*! -
2717 Closes the given \a editor, and releases it. The \a hint is -
2718 used to specify how the view should respond to the end of the editing -
2719 operation. For example, the hint may indicate that the next item in -
2720 the view should be opened for editing. -
2721 -
2722 \sa edit(), commitData() -
2723*/ -
2724 -
2725void QAbstractItemView::closeEditor(QWidget *editor, QAbstractItemDelegate::EndEditHint hint) -
2726{ -
2727 Q_D(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
2728 -
2729 // Close the editor -
2730 if (editor) {
evaluated: editor
TRUEFALSE
yes
Evaluation Count:51
yes
Evaluation Count:8
8-51
2731 bool isPersistent = d->persistent.contains(editor);
executed (the execution status of this line is deduced): bool isPersistent = d->persistent.contains(editor);
-
2732 bool hadFocus = editor->hasFocus();
executed (the execution status of this line is deduced): bool hadFocus = editor->hasFocus();
-
2733 QModelIndex index = d->indexForEditor(editor);
executed (the execution status of this line is deduced): QModelIndex index = d->indexForEditor(editor);
-
2734 if (!index.isValid())
partially evaluated: !index.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:51
0-51
2735 return; // the editor was not registered
never executed: return;
0
2736 -
2737 if (!isPersistent) {
partially evaluated: !isPersistent
TRUEFALSE
yes
Evaluation Count:51
no
Evaluation Count:0
0-51
2738 setState(NoState);
executed (the execution status of this line is deduced): setState(NoState);
-
2739 QModelIndex index = d->indexForEditor(editor);
executed (the execution status of this line is deduced): QModelIndex index = d->indexForEditor(editor);
-
2740 editor->removeEventFilter(d->delegateForIndex(index));
executed (the execution status of this line is deduced): editor->removeEventFilter(d->delegateForIndex(index));
-
2741 d->removeEditor(editor);
executed (the execution status of this line is deduced): d->removeEditor(editor);
-
2742 }
executed: }
Execution Count:51
51
2743 if (hadFocus)
evaluated: hadFocus
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:38
13-38
2744 setFocus(); // this will send a focusLost event to the editor
executed: setFocus();
Execution Count:13
13
2745 else -
2746 d->checkPersistentEditorFocus();
executed: d->checkPersistentEditorFocus();
Execution Count:38
38
2747 -
2748 QPointer<QWidget> ed = editor;
executed (the execution status of this line is deduced): QPointer<QWidget> ed = editor;
-
2749 QApplication::sendPostedEvents(editor, 0);
executed (the execution status of this line is deduced): QApplication::sendPostedEvents(editor, 0);
-
2750 editor = ed;
executed (the execution status of this line is deduced): editor = ed;
-
2751 -
2752 if (!isPersistent && editor)
partially evaluated: !isPersistent
TRUEFALSE
yes
Evaluation Count:51
no
Evaluation Count:0
partially evaluated: editor
TRUEFALSE
yes
Evaluation Count:51
no
Evaluation Count:0
0-51
2753 d->releaseEditor(editor, index);
executed: d->releaseEditor(editor, index);
Execution Count:51
51
2754 }
executed: }
Execution Count:51
51
2755 -
2756 // The EndEditHint part -
2757 QItemSelectionModel::SelectionFlags flags = QItemSelectionModel::ClearAndSelect
executed (the execution status of this line is deduced): QItemSelectionModel::SelectionFlags flags = QItemSelectionModel::ClearAndSelect
-
2758 | d->selectionBehaviorFlags();
executed (the execution status of this line is deduced): | d->selectionBehaviorFlags();
-
2759 switch (hint) { -
2760 case QAbstractItemDelegate::EditNextItem: { -
2761 QModelIndex index = moveCursor(MoveNext, Qt::NoModifier);
executed (the execution status of this line is deduced): QModelIndex index = moveCursor(MoveNext, Qt::NoModifier);
-
2762 if (index.isValid()) {
partially evaluated: index.isValid()
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
2763 QPersistentModelIndex persistent(index);
executed (the execution status of this line is deduced): QPersistentModelIndex persistent(index);
-
2764 d->selectionModel->setCurrentIndex(persistent, flags);
executed (the execution status of this line is deduced): d->selectionModel->setCurrentIndex(persistent, flags);
-
2765 // currentChanged signal would have already started editing -
2766 if (index.flags() & Qt::ItemIsEditable
partially evaluated: index.flags() & Qt::ItemIsEditable
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
2767 && (!(editTriggers() & QAbstractItemView::CurrentChanged)))
partially evaluated: (!(editTriggers() & QAbstractItemView::CurrentChanged))
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
2768 edit(persistent);
executed: edit(persistent);
Execution Count:2
2
2769 } break; }
executed: }
Execution Count:2
executed: break;
Execution Count:2
2
2770 case QAbstractItemDelegate::EditPreviousItem: { -
2771 QModelIndex index = moveCursor(MovePrevious, Qt::NoModifier);
never executed (the execution status of this line is deduced): QModelIndex index = moveCursor(MovePrevious, Qt::NoModifier);
-
2772 if (index.isValid()) {
never evaluated: index.isValid()
0
2773 QPersistentModelIndex persistent(index);
never executed (the execution status of this line is deduced): QPersistentModelIndex persistent(index);
-
2774 d->selectionModel->setCurrentIndex(persistent, flags);
never executed (the execution status of this line is deduced): d->selectionModel->setCurrentIndex(persistent, flags);
-
2775 // currentChanged signal would have already started editing -
2776 if (index.flags() & Qt::ItemIsEditable
never evaluated: index.flags() & Qt::ItemIsEditable
0
2777 && (!(editTriggers() & QAbstractItemView::CurrentChanged)))
never evaluated: (!(editTriggers() & QAbstractItemView::CurrentChanged))
0
2778 edit(persistent);
never executed: edit(persistent);
0
2779 } break; }
never executed: }
never executed: break;
0
2780 case QAbstractItemDelegate::SubmitModelCache: -
2781 d->model->submit();
executed (the execution status of this line is deduced): d->model->submit();
-
2782 break;
executed: break;
Execution Count:15
15
2783 case QAbstractItemDelegate::RevertModelCache: -
2784 d->model->revert();
executed (the execution status of this line is deduced): d->model->revert();
-
2785 break;
executed: break;
Execution Count:1
1
2786 default: -
2787 break;
executed: break;
Execution Count:41
41
2788 } -
2789}
executed: }
Execution Count:59
59
2790 -
2791/*! -
2792 Commit the data in the \a editor to the model. -
2793 -
2794 \sa closeEditor() -
2795*/ -
2796void QAbstractItemView::commitData(QWidget *editor) -
2797{ -
2798 Q_D(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
2799 if (!editor || !d->itemDelegate || d->currentlyCommittingEditor)
evaluated: !editor
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:49
partially evaluated: !d->itemDelegate
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:49
partially evaluated: d->currentlyCommittingEditor
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:49
0-49
2800 return;
executed: return;
Execution Count:8
8
2801 QModelIndex index = d->indexForEditor(editor);
executed (the execution status of this line is deduced): QModelIndex index = d->indexForEditor(editor);
-
2802 if (!index.isValid())
partially evaluated: !index.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:49
0-49
2803 return;
never executed: return;
0
2804 d->currentlyCommittingEditor = editor;
executed (the execution status of this line is deduced): d->currentlyCommittingEditor = editor;
-
2805 QAbstractItemDelegate *delegate = d->delegateForIndex(index);
executed (the execution status of this line is deduced): QAbstractItemDelegate *delegate = d->delegateForIndex(index);
-
2806 editor->removeEventFilter(delegate);
executed (the execution status of this line is deduced): editor->removeEventFilter(delegate);
-
2807 delegate->setModelData(editor, d->model, index);
executed (the execution status of this line is deduced): delegate->setModelData(editor, d->model, index);
-
2808 editor->installEventFilter(delegate);
executed (the execution status of this line is deduced): editor->installEventFilter(delegate);
-
2809 d->currentlyCommittingEditor = 0;
executed (the execution status of this line is deduced): d->currentlyCommittingEditor = 0;
-
2810}
executed: }
Execution Count:49
49
2811 -
2812/*! -
2813 This function is called when the given \a editor has been destroyed. -
2814 -
2815 \sa closeEditor() -
2816*/ -
2817void QAbstractItemView::editorDestroyed(QObject *editor) -
2818{ -
2819 Q_D(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
2820 QWidget *w = qobject_cast<QWidget*>(editor);
executed (the execution status of this line is deduced): QWidget *w = qobject_cast<QWidget*>(editor);
-
2821 d->removeEditor(w);
executed (the execution status of this line is deduced): d->removeEditor(w);
-
2822 d->persistent.remove(w);
executed (the execution status of this line is deduced): d->persistent.remove(w);
-
2823 if (state() == EditingState)
partially evaluated: state() == EditingState
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
2824 setState(NoState);
never executed: setState(NoState);
0
2825}
executed: }
Execution Count:8
8
2826 -
2827/*! -
2828 \obsolete -
2829 Sets the horizontal scroll bar's steps per item to \a steps. -
2830 -
2831 This is the number of steps used by the horizontal scroll bar to -
2832 represent the width of an item. -
2833 -
2834 Note that if the view has a horizontal header, the item steps -
2835 will be ignored and the header section size will be used instead. -
2836 -
2837 \sa horizontalStepsPerItem(), setVerticalStepsPerItem() -
2838*/ -
2839void QAbstractItemView::setHorizontalStepsPerItem(int steps) -
2840{ -
2841 Q_UNUSED(steps)
executed (the execution status of this line is deduced): (void)steps;
-
2842 // do nothing -
2843}
executed: }
Execution Count:8
8
2844 -
2845/*! -
2846 \obsolete -
2847 Returns the horizontal scroll bar's steps per item. -
2848 -
2849 \sa setHorizontalStepsPerItem(), verticalStepsPerItem() -
2850*/ -
2851int QAbstractItemView::horizontalStepsPerItem() const -
2852{ -
2853 return 1;
executed: return 1;
Execution Count:8
8
2854} -
2855 -
2856/*! -
2857 \obsolete -
2858 Sets the vertical scroll bar's steps per item to \a steps. -
2859 -
2860 This is the number of steps used by the vertical scroll bar to -
2861 represent the height of an item. -
2862 -
2863 Note that if the view has a vertical header, the item steps -
2864 will be ignored and the header section size will be used instead. -
2865 -
2866 \sa verticalStepsPerItem(), setHorizontalStepsPerItem() -
2867*/ -
2868void QAbstractItemView::setVerticalStepsPerItem(int steps) -
2869{ -
2870 Q_UNUSED(steps)
executed (the execution status of this line is deduced): (void)steps;
-
2871 // do nothing -
2872}
executed: }
Execution Count:8
8
2873 -
2874/*! -
2875 \obsolete -
2876 Returns the vertical scroll bar's steps per item. -
2877 -
2878 \sa setVerticalStepsPerItem(), horizontalStepsPerItem() -
2879*/ -
2880int QAbstractItemView::verticalStepsPerItem() const -
2881{ -
2882 return 1;
executed: return 1;
Execution Count:8
8
2883} -
2884 -
2885/*! -
2886 Moves to and selects the item best matching the string \a search. -
2887 If no item is found nothing happens. -
2888 -
2889 In the default implementation, the search is reset if \a search is empty, or -
2890 the time interval since the last search has exceeded -
2891 QApplication::keyboardInputInterval(). -
2892*/ -
2893void QAbstractItemView::keyboardSearch(const QString &search) -
2894{ -
2895 Q_D(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
2896 if (!d->model->rowCount(d->root) || !d->model->columnCount(d->root))
evaluated: !d->model->rowCount(d->root)
TRUEFALSE
yes
Evaluation Count:51
yes
Evaluation Count:15
partially evaluated: !d->model->columnCount(d->root)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15
0-51
2897 return;
executed: return;
Execution Count:51
51
2898 -
2899 QModelIndex start = currentIndex().isValid() ? currentIndex()
evaluated: currentIndex().isValid()
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:9
6-9
2900 : d->model->index(0, 0, d->root);
executed (the execution status of this line is deduced): : d->model->index(0, 0, d->root);
-
2901 bool skipRow = false;
executed (the execution status of this line is deduced): bool skipRow = false;
-
2902 bool keyboardTimeWasValid = d->keyboardInputTime.isValid();
executed (the execution status of this line is deduced): bool keyboardTimeWasValid = d->keyboardInputTime.isValid();
-
2903 qint64 keyboardInputTimeElapsed = d->keyboardInputTime.restart();
executed (the execution status of this line is deduced): qint64 keyboardInputTimeElapsed = d->keyboardInputTime.restart();
-
2904 if (search.isEmpty() || !keyboardTimeWasValid
evaluated: search.isEmpty()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:12
evaluated: !keyboardTimeWasValid
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:9
3-12
2905 || keyboardInputTimeElapsed > QApplication::keyboardInputInterval()) {
partially evaluated: keyboardInputTimeElapsed > QApplication::keyboardInputInterval()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:9
0-9
2906 d->keyboardInput = search;
executed (the execution status of this line is deduced): d->keyboardInput = search;
-
2907 skipRow = currentIndex().isValid(); //if it is not valid we should really start at QModelIndex(0,0)
executed (the execution status of this line is deduced): skipRow = currentIndex().isValid();
-
2908 } else {
executed: }
Execution Count:6
6
2909 d->keyboardInput += search;
executed (the execution status of this line is deduced): d->keyboardInput += search;
-
2910 }
executed: }
Execution Count:9
9
2911 -
2912 // special case for searches with same key like 'aaaaa' -
2913 bool sameKey = false;
executed (the execution status of this line is deduced): bool sameKey = false;
-
2914 if (d->keyboardInput.length() > 1) {
evaluated: d->keyboardInput.length() > 1
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:6
6-9
2915 int c = d->keyboardInput.count(d->keyboardInput.at(d->keyboardInput.length() - 1));
executed (the execution status of this line is deduced): int c = d->keyboardInput.count(d->keyboardInput.at(d->keyboardInput.length() - 1));
-
2916 sameKey = (c == d->keyboardInput.length());
executed (the execution status of this line is deduced): sameKey = (c == d->keyboardInput.length());
-
2917 if (sameKey)
partially evaluated: sameKey
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:9
0-9
2918 skipRow = true;
never executed: skipRow = true;
0
2919 }
executed: }
Execution Count:9
9
2920 -
2921 // skip if we are searching for the same key or a new search started -
2922 if (skipRow) {
evaluated: skipRow
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:12
3-12
2923 QModelIndex parent = start.parent();
executed (the execution status of this line is deduced): QModelIndex parent = start.parent();
-
2924 int newRow = (start.row() < d->model->rowCount(parent) - 1) ? start.row() + 1 : 0;
partially evaluated: (start.row() < d->model->rowCount(parent) - 1)
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
2925 start = d->model->index(newRow, start.column(), parent);
executed (the execution status of this line is deduced): start = d->model->index(newRow, start.column(), parent);
-
2926 }
executed: }
Execution Count:3
3
2927 -
2928 // search from start with wraparound -
2929 const QString searchString = sameKey ? QString(d->keyboardInput.at(0)) : d->keyboardInput;
partially evaluated: sameKey
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15
0-15
2930 QModelIndex current = start;
executed (the execution status of this line is deduced): QModelIndex current = start;
-
2931 QModelIndexList match;
executed (the execution status of this line is deduced): QModelIndexList match;
-
2932 QModelIndex firstMatch;
executed (the execution status of this line is deduced): QModelIndex firstMatch;
-
2933 QModelIndex startMatch;
executed (the execution status of this line is deduced): QModelIndex startMatch;
-
2934 QModelIndexList previous;
executed (the execution status of this line is deduced): QModelIndexList previous;
-
2935 do { -
2936 match = d->model->match(current, Qt::DisplayRole, searchString);
executed (the execution status of this line is deduced): match = d->model->match(current, Qt::DisplayRole, searchString);
-
2937 if (match == previous)
evaluated: match == previous
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:8
8-11
2938 break;
executed: break;
Execution Count:11
11
2939 firstMatch = match.value(0);
executed (the execution status of this line is deduced): firstMatch = match.value(0);
-
2940 previous = match;
executed (the execution status of this line is deduced): previous = match;
-
2941 if (firstMatch.isValid()) {
partially evaluated: firstMatch.isValid()
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
0-8
2942 if (d->isIndexEnabled(firstMatch)) {
evaluated: d->isIndexEnabled(firstMatch)
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:4
4
2943 setCurrentIndex(firstMatch);
executed (the execution status of this line is deduced): setCurrentIndex(firstMatch);
-
2944 break;
executed: break;
Execution Count:4
4
2945 } -
2946 int row = firstMatch.row() + 1;
executed (the execution status of this line is deduced): int row = firstMatch.row() + 1;
-
2947 if (row >= d->model->rowCount(firstMatch.parent()))
evaluated: row >= d->model->rowCount(firstMatch.parent())
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:3
1-3
2948 row = 0;
executed: row = 0;
Execution Count:1
1
2949 current = firstMatch.sibling(row, firstMatch.column());
executed (the execution status of this line is deduced): current = firstMatch.sibling(row, firstMatch.column());
-
2950 -
2951 //avoid infinite loop if all the matching items are disabled. -
2952 if (!startMatch.isValid())
evaluated: !startMatch.isValid()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:3
1-3
2953 startMatch = firstMatch;
executed: startMatch = firstMatch;
Execution Count:1
1
2954 else if (startMatch == firstMatch)
partially evaluated: startMatch == firstMatch
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
2955 break;
never executed: break;
0
2956 } -
2957 } while (current != start && firstMatch.isValid());
executed: }
Execution Count:4
partially evaluated: current != start
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
partially evaluated: firstMatch.isValid()
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
0-4
2958}
executed: }
Execution Count:15
15
2959 -
2960/*! -
2961 Returns the size hint for the item with the specified \a index or -
2962 an invalid size for invalid indexes. -
2963 -
2964 \sa sizeHintForRow(), sizeHintForColumn() -
2965*/ -
2966QSize QAbstractItemView::sizeHintForIndex(const QModelIndex &index) const -
2967{ -
2968 Q_D(const QAbstractItemView);
executed (the execution status of this line is deduced): const QAbstractItemViewPrivate * const d = d_func();
-
2969 if (!d->isIndexValid(index) || !d->itemDelegate)
evaluated: !d->isIndexValid(index)
TRUEFALSE
yes
Evaluation Count:27
yes
Evaluation Count:1618
partially evaluated: !d->itemDelegate
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1618
0-1618
2970 return QSize();
executed: return QSize();
Execution Count:27
27
2971 return d->delegateForIndex(index)->sizeHint(d->viewOptions(), index);
executed: return d->delegateForIndex(index)->sizeHint(d->viewOptions(), index);
Execution Count:1618
1618
2972} -
2973 -
2974/*! -
2975 Returns the height size hint for the specified \a row or -1 if -
2976 there is no model. -
2977 -
2978 The returned height is calculated using the size hints of the -
2979 given \a row's items, i.e. the returned value is the maximum -
2980 height among the items. Note that to control the height of a row, -
2981 you must reimplement the QAbstractItemDelegate::sizeHint() -
2982 function. -
2983 -
2984 This function is used in views with a vertical header to find the -
2985 size hint for a header section based on the contents of the given -
2986 \a row. -
2987 -
2988 \sa sizeHintForColumn() -
2989*/ -
2990int QAbstractItemView::sizeHintForRow(int row) const -
2991{ -
2992 Q_D(const QAbstractItemView);
executed (the execution status of this line is deduced): const QAbstractItemViewPrivate * const d = d_func();
-
2993 -
2994 if (row < 0 || row >= d->model->rowCount(d->root))
evaluated: row < 0
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1996
evaluated: row >= d->model->rowCount(d->root)
TRUEFALSE
yes
Evaluation Count:400
yes
Evaluation Count:1596
1-1996
2995 return -1;
executed: return -1;
Execution Count:401
401
2996 -
2997 ensurePolished();
executed (the execution status of this line is deduced): ensurePolished();
-
2998 -
2999 QStyleOptionViewItem option = d->viewOptions();
executed (the execution status of this line is deduced): QStyleOptionViewItem option = d->viewOptions();
-
3000 int height = 0;
executed (the execution status of this line is deduced): int height = 0;
-
3001 int colCount = d->model->columnCount(d->root);
executed (the execution status of this line is deduced): int colCount = d->model->columnCount(d->root);
-
3002 QModelIndex index;
executed (the execution status of this line is deduced): QModelIndex index;
-
3003 for (int c = 0; c < colCount; ++c) {
evaluated: c < colCount
TRUEFALSE
yes
Evaluation Count:39084
yes
Evaluation Count:1596
1596-39084
3004 index = d->model->index(row, c, d->root);
executed (the execution status of this line is deduced): index = d->model->index(row, c, d->root);
-
3005 if (QWidget *editor = d->editorForIndex(index).widget.data())
partially evaluated: QWidget *editor = d->editorForIndex(index).widget.data()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:39084
0-39084
3006 height = qMax(height, editor->height());
never executed: height = qMax(height, editor->height());
0
3007 int hint = d->delegateForIndex(index)->sizeHint(option, index).height();
executed (the execution status of this line is deduced): int hint = d->delegateForIndex(index)->sizeHint(option, index).height();
-
3008 height = qMax(height, hint);
executed (the execution status of this line is deduced): height = qMax(height, hint);
-
3009 }
executed: }
Execution Count:39084
39084
3010 return height;
executed: return height;
Execution Count:1596
1596
3011} -
3012 -
3013/*! -
3014 Returns the width size hint for the specified \a column or -1 if there is no model. -
3015 -
3016 This function is used in views with a horizontal header to find the size hint for -
3017 a header section based on the contents of the given \a column. -
3018 -
3019 \sa sizeHintForRow() -
3020*/ -
3021int QAbstractItemView::sizeHintForColumn(int column) const -
3022{ -
3023 Q_D(const QAbstractItemView);
executed (the execution status of this line is deduced): const QAbstractItemViewPrivate * const d = d_func();
-
3024 -
3025 if (column < 0 || column >= d->model->columnCount(d->root))
evaluated: column < 0
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:14
evaluated: column >= d->model->columnCount(d->root)
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:2
1-14
3026 return -1;
executed: return -1;
Execution Count:13
13
3027 -
3028 ensurePolished();
executed (the execution status of this line is deduced): ensurePolished();
-
3029 -
3030 QStyleOptionViewItem option = d->viewOptions();
executed (the execution status of this line is deduced): QStyleOptionViewItem option = d->viewOptions();
-
3031 int width = 0;
executed (the execution status of this line is deduced): int width = 0;
-
3032 int rows = d->model->rowCount(d->root);
executed (the execution status of this line is deduced): int rows = d->model->rowCount(d->root);
-
3033 QModelIndex index;
executed (the execution status of this line is deduced): QModelIndex index;
-
3034 for (int r = 0; r < rows; ++r) {
evaluated: r < rows
TRUEFALSE
yes
Evaluation Count:50
yes
Evaluation Count:2
2-50
3035 index = d->model->index(r, column, d->root);
executed (the execution status of this line is deduced): index = d->model->index(r, column, d->root);
-
3036 if (QWidget *editor = d->editorForIndex(index).widget.data())
partially evaluated: QWidget *editor = d->editorForIndex(index).widget.data()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:50
0-50
3037 width = qMax(width, editor->sizeHint().width());
never executed: width = qMax(width, editor->sizeHint().width());
0
3038 int hint = d->delegateForIndex(index)->sizeHint(option, index).width();
executed (the execution status of this line is deduced): int hint = d->delegateForIndex(index)->sizeHint(option, index).width();
-
3039 width = qMax(width, hint);
executed (the execution status of this line is deduced): width = qMax(width, hint);
-
3040 }
executed: }
Execution Count:50
50
3041 return width;
executed: return width;
Execution Count:2
2
3042} -
3043 -
3044/*! -
3045 Opens a persistent editor on the item at the given \a index. -
3046 If no editor exists, the delegate will create a new editor. -
3047 -
3048 \sa closePersistentEditor() -
3049*/ -
3050void QAbstractItemView::openPersistentEditor(const QModelIndex &index) -
3051{ -
3052 Q_D(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
3053 QStyleOptionViewItem options = d->viewOptions();
executed (the execution status of this line is deduced): QStyleOptionViewItem options = d->viewOptions();
-
3054 options.rect = visualRect(index);
executed (the execution status of this line is deduced): options.rect = visualRect(index);
-
3055 options.state |= (index == currentIndex() ? QStyle::State_HasFocus : QStyle::State_None);
evaluated: index == currentIndex()
TRUEFALSE
yes
Evaluation Count:26
yes
Evaluation Count:37
26-37
3056 -
3057 QWidget *editor = d->editor(index, options);
executed (the execution status of this line is deduced): QWidget *editor = d->editor(index, options);
-
3058 if (editor) {
evaluated: editor
TRUEFALSE
yes
Evaluation Count:37
yes
Evaluation Count:26
26-37
3059 editor->show();
executed (the execution status of this line is deduced): editor->show();
-
3060 d->persistent.insert(editor);
executed (the execution status of this line is deduced): d->persistent.insert(editor);
-
3061 }
executed: }
Execution Count:37
37
3062}
executed: }
Execution Count:63
63
3063 -
3064/*! -
3065 Closes the persistent editor for the item at the given \a index. -
3066 -
3067 \sa openPersistentEditor() -
3068*/ -
3069void QAbstractItemView::closePersistentEditor(const QModelIndex &index) -
3070{ -
3071 Q_D(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
3072 if (QWidget *editor = d->editorForIndex(index).widget.data()) {
evaluated: QWidget *editor = d->editorForIndex(index).widget.data()
TRUEFALSE
yes
Evaluation Count:22
yes
Evaluation Count:26
22-26
3073 if (index == selectionModel()->currentIndex())
evaluated: index == selectionModel()->currentIndex()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:21
1-21
3074 closeEditor(editor, QAbstractItemDelegate::RevertModelCache);
executed: closeEditor(editor, QAbstractItemDelegate::RevertModelCache);
Execution Count:1
1
3075 d->persistent.remove(editor);
executed (the execution status of this line is deduced): d->persistent.remove(editor);
-
3076 d->removeEditor(editor);
executed (the execution status of this line is deduced): d->removeEditor(editor);
-
3077 d->releaseEditor(editor, index);
executed (the execution status of this line is deduced): d->releaseEditor(editor, index);
-
3078 }
executed: }
Execution Count:22
22
3079}
executed: }
Execution Count:48
48
3080 -
3081/*! -
3082 \since 4.1 -
3083 -
3084 Sets the given \a widget on the item at the given \a index, passing the -
3085 ownership of the widget to the viewport. -
3086 -
3087 If \a index is invalid (e.g., if you pass the root index), this function -
3088 will do nothing. -
3089 -
3090 The given \a widget's \l{QWidget}{autoFillBackground} property must be set -
3091 to true, otherwise the widget's background will be transparent, showing -
3092 both the model data and the item at the given \a index. -
3093 -
3094 If index widget A is replaced with index widget B, index widget A will be -
3095 deleted. For example, in the code snippet below, the QLineEdit object will -
3096 be deleted. -
3097 -
3098 \snippet code/src_gui_itemviews_qabstractitemview.cpp 1 -
3099 -
3100 This function should only be used to display static content within the -
3101 visible area corresponding to an item of data. If you want to display -
3102 custom dynamic content or implement a custom editor widget, subclass -
3103 QItemDelegate instead. -
3104 -
3105 \sa {Delegate Classes} -
3106*/ -
3107void QAbstractItemView::setIndexWidget(const QModelIndex &index, QWidget *widget) -
3108{ -
3109 Q_D(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
3110 if (!d->isIndexValid(index))
evaluated: !d->isIndexValid(index)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:49
1-49
3111 return;
executed: return;
Execution Count:1
1
3112 if (QWidget *oldWidget = indexWidget(index)) {
evaluated: QWidget *oldWidget = indexWidget(index)
TRUEFALSE
yes
Evaluation Count:22
yes
Evaluation Count:27
22-27
3113 d->persistent.remove(oldWidget);
executed (the execution status of this line is deduced): d->persistent.remove(oldWidget);
-
3114 d->removeEditor(oldWidget);
executed (the execution status of this line is deduced): d->removeEditor(oldWidget);
-
3115 oldWidget->deleteLater();
executed (the execution status of this line is deduced): oldWidget->deleteLater();
-
3116 }
executed: }
Execution Count:22
22
3117 if (widget) {
evaluated: widget
TRUEFALSE
yes
Evaluation Count:28
yes
Evaluation Count:21
21-28
3118 widget->setParent(viewport());
executed (the execution status of this line is deduced): widget->setParent(viewport());
-
3119 d->persistent.insert(widget);
executed (the execution status of this line is deduced): d->persistent.insert(widget);
-
3120 d->addEditor(index, widget, true);
executed (the execution status of this line is deduced): d->addEditor(index, widget, true);
-
3121 widget->show();
executed (the execution status of this line is deduced): widget->show();
-
3122 dataChanged(index, index); // update the geometry
executed (the execution status of this line is deduced): dataChanged(index, index);
-
3123 if (!d->delayedPendingLayout)
evaluated: !d->delayedPendingLayout
TRUEFALSE
yes
Evaluation Count:21
yes
Evaluation Count:7
7-21
3124 widget->setGeometry(visualRect(index));
executed: widget->setGeometry(visualRect(index));
Execution Count:21
21
3125 }
executed: }
Execution Count:28
28
3126}
executed: }
Execution Count:49
49
3127 -
3128/*! -
3129 \since 4.1 -
3130 -
3131 Returns the widget for the item at the given \a index. -
3132*/ -
3133QWidget* QAbstractItemView::indexWidget(const QModelIndex &index) const -
3134{ -
3135 Q_D(const QAbstractItemView);
executed (the execution status of this line is deduced): const QAbstractItemViewPrivate * const d = d_func();
-
3136 if (d->isIndexValid(index))
evaluated: d->isIndexValid(index)
TRUEFALSE
yes
Evaluation Count:320
yes
Evaluation Count:10
10-320
3137 if (QWidget *editor = d->editorForIndex(index).widget.data())
evaluated: QWidget *editor = d->editorForIndex(index).widget.data()
TRUEFALSE
yes
Evaluation Count:66
yes
Evaluation Count:254
66-254
3138 return editor;
executed: return editor;
Execution Count:66
66
3139 -
3140 return 0;
executed: return 0;
Execution Count:264
264
3141} -
3142 -
3143/*! -
3144 \since 4.1 -
3145 -
3146 Scrolls the view to the top. -
3147 -
3148 \sa scrollTo(), scrollToBottom() -
3149*/ -
3150void QAbstractItemView::scrollToTop() -
3151{ -
3152 verticalScrollBar()->setValue(verticalScrollBar()->minimum());
executed (the execution status of this line is deduced): verticalScrollBar()->setValue(verticalScrollBar()->minimum());
-
3153}
executed: }
Execution Count:2
2
3154 -
3155/*! -
3156 \since 4.1 -
3157 -
3158 Scrolls the view to the bottom. -
3159 -
3160 \sa scrollTo(), scrollToTop() -
3161*/ -
3162void QAbstractItemView::scrollToBottom() -
3163{ -
3164 Q_D(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
3165 if (d->delayedPendingLayout) {
evaluated: d->delayedPendingLayout
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:22
1-22
3166 d->executePostedLayout();
executed (the execution status of this line is deduced): d->executePostedLayout();
-
3167 updateGeometries();
executed (the execution status of this line is deduced): updateGeometries();
-
3168 }
executed: }
Execution Count:1
1
3169 verticalScrollBar()->setValue(verticalScrollBar()->maximum());
executed (the execution status of this line is deduced): verticalScrollBar()->setValue(verticalScrollBar()->maximum());
-
3170}
executed: }
Execution Count:23
23
3171 -
3172/*! -
3173 \since 4.3 -
3174 -
3175 Updates the area occupied by the given \a index. -
3176 -
3177*/ -
3178void QAbstractItemView::update(const QModelIndex &index) -
3179{ -
3180 Q_D(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
3181 if (index.isValid()) {
evaluated: index.isValid()
TRUEFALSE
yes
Evaluation Count:25427
yes
Evaluation Count:80
80-25427
3182 const QRect rect = visualRect(index);
executed (the execution status of this line is deduced): const QRect rect = visualRect(index);
-
3183 //this test is important for peformance reason -
3184 //For example in dataChanged we simply update all the cells without checking -
3185 //it can be a major bottleneck to update rects that aren't even part of the viewport -
3186 if (d->viewport->rect().intersects(rect))
evaluated: d->viewport->rect().intersects(rect)
TRUEFALSE
yes
Evaluation Count:22531
yes
Evaluation Count:2896
2896-22531
3187 d->viewport->update(rect);
executed: d->viewport->update(rect);
Execution Count:22531
22531
3188 }
executed: }
Execution Count:25427
25427
3189}
executed: }
Execution Count:25507
25507
3190 -
3191/*! -
3192 This slot is called when items with the given \a roles are changed in the -
3193 model. The changed items are those from \a topLeft to \a bottomRight -
3194 inclusive. If just one item is changed \a topLeft == \a bottomRight. -
3195 -
3196 The \a roles which have been changed can either be an empty container (meaning everything -
3197 has changed), or a non-empty container with the subset of roles which have changed. -
3198*/ -
3199void QAbstractItemView::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles) -
3200{ -
3201 Q_UNUSED(roles);
executed (the execution status of this line is deduced): (void)roles;;
-
3202 // Single item changed -
3203 Q_D(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
3204 if (topLeft == bottomRight && topLeft.isValid()) {
evaluated: topLeft == bottomRight
TRUEFALSE
yes
Evaluation Count:57487
yes
Evaluation Count:676
evaluated: topLeft.isValid()
TRUEFALSE
yes
Evaluation Count:57474
yes
Evaluation Count:13
13-57487
3205 const QEditorInfo &editorInfo = d->editorForIndex(topLeft);
executed (the execution status of this line is deduced): const QEditorInfo &editorInfo = d->editorForIndex(topLeft);
-
3206 //we don't update the edit data if it is static -
3207 if (!editorInfo.isStatic && editorInfo.widget) {
evaluated: !editorInfo.isStatic
TRUEFALSE
yes
Evaluation Count:57451
yes
Evaluation Count:23
evaluated: editorInfo.widget
TRUEFALSE
yes
Evaluation Count:32
yes
Evaluation Count:57419
23-57451
3208 QAbstractItemDelegate *delegate = d->delegateForIndex(topLeft);
executed (the execution status of this line is deduced): QAbstractItemDelegate *delegate = d->delegateForIndex(topLeft);
-
3209 if (delegate) {
partially evaluated: delegate
TRUEFALSE
yes
Evaluation Count:32
no
Evaluation Count:0
0-32
3210 delegate->setEditorData(editorInfo.widget.data(), topLeft);
executed (the execution status of this line is deduced): delegate->setEditorData(editorInfo.widget.data(), topLeft);
-
3211 }
executed: }
Execution Count:32
32
3212 }
executed: }
Execution Count:32
32
3213 if (isVisible() && !d->delayedPendingLayout) {
evaluated: isVisible()
TRUEFALSE
yes
Evaluation Count:976
yes
Evaluation Count:56498
evaluated: !d->delayedPendingLayout
TRUEFALSE
yes
Evaluation Count:524
yes
Evaluation Count:452
452-56498
3214 // otherwise the items will be update later anyway -
3215 update(topLeft);
executed (the execution status of this line is deduced): update(topLeft);
-
3216 }
executed: }
Execution Count:524
524
3217 } else {
executed: }
Execution Count:57474
57474
3218 d->updateEditorData(topLeft, bottomRight);
executed (the execution status of this line is deduced): d->updateEditorData(topLeft, bottomRight);
-
3219 if (isVisible() && !d->delayedPendingLayout)
evaluated: isVisible()
TRUEFALSE
yes
Evaluation Count:98
yes
Evaluation Count:591
evaluated: !d->delayedPendingLayout
TRUEFALSE
yes
Evaluation Count:62
yes
Evaluation Count:36
36-591
3220 d->viewport->update();
executed: d->viewport->update();
Execution Count:62
62
3221 }
executed: }
Execution Count:689
689
3222 -
3223#ifndef QT_NO_ACCESSIBILITY -
3224 if (QAccessible::isActive()) {
evaluated: QAccessible::isActive()
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:58154
9-58154
3225 QAccessibleTableModelChangeEvent accessibleEvent(this, QAccessibleTableModelChangeEvent::DataChanged);
executed (the execution status of this line is deduced): QAccessibleTableModelChangeEvent accessibleEvent(this, QAccessibleTableModelChangeEvent::DataChanged);
-
3226 accessibleEvent.setFirstRow(topLeft.row());
executed (the execution status of this line is deduced): accessibleEvent.setFirstRow(topLeft.row());
-
3227 accessibleEvent.setFirstColumn(topLeft.column());
executed (the execution status of this line is deduced): accessibleEvent.setFirstColumn(topLeft.column());
-
3228 accessibleEvent.setLastRow(bottomRight.row());
executed (the execution status of this line is deduced): accessibleEvent.setLastRow(bottomRight.row());
-
3229 accessibleEvent.setLastColumn(bottomRight.column());
executed (the execution status of this line is deduced): accessibleEvent.setLastColumn(bottomRight.column());
-
3230 QAccessible::updateAccessibility(&accessibleEvent);
executed (the execution status of this line is deduced): QAccessible::updateAccessibility(&accessibleEvent);
-
3231 }
executed: }
Execution Count:9
9
3232#endif -
3233}
executed: }
Execution Count:58163
58163
3234 -
3235/*! -
3236 This slot is called when rows are inserted. The new rows are those -
3237 under the given \a parent from \a start to \a end inclusive. The -
3238 base class implementation calls fetchMore() on the model to check -
3239 for more data. -
3240 -
3241 \sa rowsAboutToBeRemoved() -
3242*/ -
3243void QAbstractItemView::rowsInserted(const QModelIndex &, int, int) -
3244{ -
3245 if (!isVisible())
evaluated: !isVisible()
TRUEFALSE
yes
Evaluation Count:90983
yes
Evaluation Count:8558
8558-90983
3246 d_func()->fetchMoreTimer.start(0, this); //fetch more later
executed: d_func()->fetchMoreTimer.start(0, this);
Execution Count:90983
90983
3247 else -
3248 updateEditorGeometries();
executed: updateEditorGeometries();
Execution Count:8558
8558
3249} -
3250 -
3251/*! -
3252 This slot is called when rows are about to be removed. The deleted rows are -
3253 those under the given \a parent from \a start to \a end inclusive. -
3254 -
3255 \sa rowsInserted() -
3256*/ -
3257void QAbstractItemView::rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end) -
3258{ -
3259 Q_D(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
3260 -
3261 setState(CollapsingState);
executed (the execution status of this line is deduced): setState(CollapsingState);
-
3262 -
3263 // Ensure one selected item in single selection mode. -
3264 QModelIndex current = currentIndex();
executed (the execution status of this line is deduced): QModelIndex current = currentIndex();
-
3265 if (d->selectionMode == SingleSelection
evaluated: d->selectionMode == SingleSelection
TRUEFALSE
yes
Evaluation Count:1452
yes
Evaluation Count:1677
1452-1677
3266 && current.isValid()
evaluated: current.isValid()
TRUEFALSE
yes
Evaluation Count:25
yes
Evaluation Count:1427
25-1427
3267 && current.row() >= start
evaluated: current.row() >= start
TRUEFALSE
yes
Evaluation Count:21
yes
Evaluation Count:4
4-21
3268 && current.row() <= end
evaluated: current.row() <= end
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:10
10-11
3269 && current.parent() == parent) {
evaluated: current.parent() == parent
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:3
3-8
3270 int totalToRemove = end - start + 1;
executed (the execution status of this line is deduced): int totalToRemove = end - start + 1;
-
3271 if (d->model->rowCount(parent) <= totalToRemove) { // no more children
evaluated: d->model->rowCount(parent) <= totalToRemove
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:4
4
3272 QModelIndex index = parent;
executed (the execution status of this line is deduced): QModelIndex index = parent;
-
3273 while (index != d->root && !d->isIndexEnabled(index))
evaluated: index != d->root
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2
partially evaluated: !d->isIndexEnabled(index)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
3274 index = index.parent();
never executed: index = index.parent();
0
3275 if (index != d->root)
evaluated: index != d->root
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2
2
3276 setCurrentIndex(index);
executed: setCurrentIndex(index);
Execution Count:2
2
3277 } else {
executed: }
Execution Count:4
4
3278 int row = end + 1;
executed (the execution status of this line is deduced): int row = end + 1;
-
3279 QModelIndex next;
executed (the execution status of this line is deduced): QModelIndex next;
-
3280 do { // find the next visible and enabled item -
3281 next = d->model->index(row++, current.column(), current.parent());
executed (the execution status of this line is deduced): next = d->model->index(row++, current.column(), current.parent());
-
3282 } while (next.isValid() && (isIndexHidden(next) || !d->isIndexEnabled(next)));
executed: }
Execution Count:4
partially evaluated: next.isValid()
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
partially evaluated: isIndexHidden(next)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
partially evaluated: !d->isIndexEnabled(next)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
3283 if (row > d->model->rowCount(parent)) {
partially evaluated: row > d->model->rowCount(parent)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
3284 row = start - 1;
never executed (the execution status of this line is deduced): row = start - 1;
-
3285 do { // find the previous visible and enabled item -
3286 next = d->model->index(row--, current.column(), current.parent());
never executed (the execution status of this line is deduced): next = d->model->index(row--, current.column(), current.parent());
-
3287 } while (next.isValid() && (isIndexHidden(next) || !d->isIndexEnabled(next)));
never executed: }
never evaluated: next.isValid()
never evaluated: isIndexHidden(next)
never evaluated: !d->isIndexEnabled(next)
0
3288 }
never executed: }
0
3289 setCurrentIndex(next);
executed (the execution status of this line is deduced): setCurrentIndex(next);
-
3290 }
executed: }
Execution Count:4
4
3291 } -
3292 -
3293 // Remove all affected editors; this is more efficient than waiting for updateGeometries() to clean out editors for invalid indexes -
3294 QEditorIndexHash::iterator i = d->editorIndexHash.begin();
executed (the execution status of this line is deduced): QEditorIndexHash::iterator i = d->editorIndexHash.begin();
-
3295 while (i != d->editorIndexHash.end()) {
evaluated: i != d->editorIndexHash.end()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:3129
4-3129
3296 const QModelIndex index = i.value();
executed (the execution status of this line is deduced): const QModelIndex index = i.value();
-
3297 if (index.row() >= start && index.row() <= end && d->model->parent(index) == parent) {
evaluated: index.row() >= start
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:1
partially evaluated: index.row() <= end
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
partially evaluated: d->model->parent(index) == parent
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
3298 QWidget *editor = i.key();
executed (the execution status of this line is deduced): QWidget *editor = i.key();
-
3299 QEditorInfo info = d->indexEditorHash.take(index);
executed (the execution status of this line is deduced): QEditorInfo info = d->indexEditorHash.take(index);
-
3300 i = d->editorIndexHash.erase(i);
executed (the execution status of this line is deduced): i = d->editorIndexHash.erase(i);
-
3301 if (info.widget)
evaluated: info.widget
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1
1-2
3302 d->releaseEditor(editor, index);
executed: d->releaseEditor(editor, index);
Execution Count:2
2
3303 } else {
executed: }
Execution Count:3
3
3304 ++i;
executed (the execution status of this line is deduced): ++i;
-
3305 }
executed: }
Execution Count:1
1
3306 } -
3307}
executed: }
Execution Count:3129
3129
3308 -
3309/*! -
3310 \internal -
3311 -
3312 This slot is called when rows have been removed. The deleted -
3313 rows are those under the given \a parent from \a start to \a end -
3314 inclusive. -
3315*/ -
3316void QAbstractItemViewPrivate::_q_rowsRemoved(const QModelIndex &index, int start, int end) -
3317{ -
3318 Q_UNUSED(index)
executed (the execution status of this line is deduced): (void)index;
-
3319 Q_UNUSED(start)
executed (the execution status of this line is deduced): (void)start;
-
3320 Q_UNUSED(end)
executed (the execution status of this line is deduced): (void)end;
-
3321 -
3322 Q_Q(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemView * const q = q_func();
-
3323 if (q->isVisible())
evaluated: q->isVisible()
TRUEFALSE
yes
Evaluation Count:2644
yes
Evaluation Count:477
477-2644
3324 q->updateEditorGeometries();
executed: q->updateEditorGeometries();
Execution Count:2644
2644
3325 q->setState(QAbstractItemView::NoState);
executed (the execution status of this line is deduced): q->setState(QAbstractItemView::NoState);
-
3326#ifndef QT_NO_ACCESSIBILITY -
3327 if (QAccessible::isActive()) {
partially evaluated: QAccessible::isActive()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3121
0-3121
3328 QAccessibleTableModelChangeEvent accessibleEvent(q, QAccessibleTableModelChangeEvent::RowsRemoved);
never executed (the execution status of this line is deduced): QAccessibleTableModelChangeEvent accessibleEvent(q, QAccessibleTableModelChangeEvent::RowsRemoved);
-
3329 accessibleEvent.setFirstRow(start);
never executed (the execution status of this line is deduced): accessibleEvent.setFirstRow(start);
-
3330 accessibleEvent.setLastRow(end);
never executed (the execution status of this line is deduced): accessibleEvent.setLastRow(end);
-
3331 QAccessible::updateAccessibility(&accessibleEvent);
never executed (the execution status of this line is deduced): QAccessible::updateAccessibility(&accessibleEvent);
-
3332 }
never executed: }
0
3333#endif -
3334}
executed: }
Execution Count:3121
3121
3335 -
3336/*! -
3337 \internal -
3338 -
3339 This slot is called when columns are about to be removed. The deleted -
3340 columns are those under the given \a parent from \a start to \a end -
3341 inclusive. -
3342*/ -
3343void QAbstractItemViewPrivate::_q_columnsAboutToBeRemoved(const QModelIndex &parent, int start, int end) -
3344{ -
3345 Q_Q(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemView * const q = q_func();
-
3346 -
3347 q->setState(QAbstractItemView::CollapsingState);
executed (the execution status of this line is deduced): q->setState(QAbstractItemView::CollapsingState);
-
3348 -
3349 // Ensure one selected item in single selection mode. -
3350 QModelIndex current = q->currentIndex();
executed (the execution status of this line is deduced): QModelIndex current = q->currentIndex();
-
3351 if (current.isValid()
evaluated: current.isValid()
TRUEFALSE
yes
Evaluation Count:20
yes
Evaluation Count:259
20-259
3352 && selectionMode == QAbstractItemView::SingleSelection
evaluated: selectionMode == QAbstractItemView::SingleSelection
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:13
7-13
3353 && current.column() >= start
partially evaluated: current.column() >= start
TRUEFALSE
yes
Evaluation Count:7
no
Evaluation Count:0
0-7
3354 && current.column() <= end) {
evaluated: current.column() <= end
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:5
2-5
3355 int totalToRemove = end - start + 1;
executed (the execution status of this line is deduced): int totalToRemove = end - start + 1;
-
3356 if (model->columnCount(parent) < totalToRemove) { // no more columns
partially evaluated: model->columnCount(parent) < totalToRemove
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
3357 QModelIndex index = parent;
never executed (the execution status of this line is deduced): QModelIndex index = parent;
-
3358 while (index.isValid() && !isIndexEnabled(index))
never evaluated: index.isValid()
never evaluated: !isIndexEnabled(index)
0
3359 index = index.parent();
never executed: index = index.parent();
0
3360 if (index.isValid())
never evaluated: index.isValid()
0
3361 q->setCurrentIndex(index);
never executed: q->setCurrentIndex(index);
0
3362 } else {
never executed: }
0
3363 int column = end;
executed (the execution status of this line is deduced): int column = end;
-
3364 QModelIndex next;
executed (the execution status of this line is deduced): QModelIndex next;
-
3365 do { // find the next visible and enabled item -
3366 next = model->index(current.row(), column++, current.parent());
executed (the execution status of this line is deduced): next = model->index(current.row(), column++, current.parent());
-
3367 } while (next.isValid() && (q->isIndexHidden(next) || !isIndexEnabled(next)));
executed: }
Execution Count:2
partially evaluated: next.isValid()
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
partially evaluated: q->isIndexHidden(next)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
partially evaluated: !isIndexEnabled(next)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
3368 q->setCurrentIndex(next);
executed (the execution status of this line is deduced): q->setCurrentIndex(next);
-
3369 }
executed: }
Execution Count:2
2
3370 } -
3371 -
3372 // Remove all affected editors; this is more efficient than waiting for updateGeometries() to clean out editors for invalid indexes -
3373 QEditorIndexHash::iterator it = editorIndexHash.begin();
executed (the execution status of this line is deduced): QEditorIndexHash::iterator it = editorIndexHash.begin();
-
3374 while (it != editorIndexHash.end()) {
evaluated: it != editorIndexHash.end()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:279
1-279
3375 QModelIndex index = it.value();
executed (the execution status of this line is deduced): QModelIndex index = it.value();
-
3376 if (index.column() <= start && index.column() >= end && model->parent(index) == parent) {
partially evaluated: index.column() <= start
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
partially evaluated: index.column() >= end
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
never evaluated: model->parent(index) == parent
0-1
3377 QWidget *editor = it.key();
never executed (the execution status of this line is deduced): QWidget *editor = it.key();
-
3378 QEditorInfo info = indexEditorHash.take(it.value());
never executed (the execution status of this line is deduced): QEditorInfo info = indexEditorHash.take(it.value());
-
3379 it = editorIndexHash.erase(it);
never executed (the execution status of this line is deduced): it = editorIndexHash.erase(it);
-
3380 if (info.widget)
never evaluated: info.widget
0
3381 releaseEditor(editor, index);
never executed: releaseEditor(editor, index);
0
3382 } else {
never executed: }
0
3383 ++it;
executed (the execution status of this line is deduced): ++it;
-
3384 }
executed: }
Execution Count:1
1
3385 } -
3386 -
3387}
executed: }
Execution Count:279
279
3388 -
3389/*! -
3390 \internal -
3391 -
3392 This slot is called when columns have been removed. The deleted -
3393 rows are those under the given \a parent from \a start to \a end -
3394 inclusive. -
3395*/ -
3396void QAbstractItemViewPrivate::_q_columnsRemoved(const QModelIndex &index, int start, int end) -
3397{ -
3398 Q_UNUSED(index)
executed (the execution status of this line is deduced): (void)index;
-
3399 Q_UNUSED(start)
executed (the execution status of this line is deduced): (void)start;
-
3400 Q_UNUSED(end)
executed (the execution status of this line is deduced): (void)end;
-
3401 -
3402 Q_Q(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemView * const q = q_func();
-
3403 if (q->isVisible())
evaluated: q->isVisible()
TRUEFALSE
yes
Evaluation Count:211
yes
Evaluation Count:68
68-211
3404 q->updateEditorGeometries();
executed: q->updateEditorGeometries();
Execution Count:211
211
3405 q->setState(QAbstractItemView::NoState);
executed (the execution status of this line is deduced): q->setState(QAbstractItemView::NoState);
-
3406#ifndef QT_NO_ACCESSIBILITY -
3407 if (QAccessible::isActive()) {
evaluated: QAccessible::isActive()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:275
4-275
3408 QAccessibleTableModelChangeEvent accessibleEvent(q, QAccessibleTableModelChangeEvent::ColumnsRemoved);
executed (the execution status of this line is deduced): QAccessibleTableModelChangeEvent accessibleEvent(q, QAccessibleTableModelChangeEvent::ColumnsRemoved);
-
3409 accessibleEvent.setFirstColumn(start);
executed (the execution status of this line is deduced): accessibleEvent.setFirstColumn(start);
-
3410 accessibleEvent.setLastColumn(end);
executed (the execution status of this line is deduced): accessibleEvent.setLastColumn(end);
-
3411 QAccessible::updateAccessibility(&accessibleEvent);
executed (the execution status of this line is deduced): QAccessible::updateAccessibility(&accessibleEvent);
-
3412 }
executed: }
Execution Count:4
4
3413#endif -
3414}
executed: }
Execution Count:279
279
3415 -
3416 -
3417/*! -
3418 \internal -
3419 -
3420 This slot is called when rows have been inserted. -
3421*/ -
3422void QAbstractItemViewPrivate::_q_rowsInserted(const QModelIndex &index, int start, int end) -
3423{ -
3424 Q_UNUSED(index)
executed (the execution status of this line is deduced): (void)index;
-
3425 Q_UNUSED(start)
executed (the execution status of this line is deduced): (void)start;
-
3426 Q_UNUSED(end)
executed (the execution status of this line is deduced): (void)end;
-
3427 -
3428#ifndef QT_NO_ACCESSIBILITY -
3429 Q_Q(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemView * const q = q_func();
-
3430 if (QAccessible::isActive()) {
evaluated: QAccessible::isActive()
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:195919
15-195919
3431 QAccessibleTableModelChangeEvent accessibleEvent(q, QAccessibleTableModelChangeEvent::RowsInserted);
executed (the execution status of this line is deduced): QAccessibleTableModelChangeEvent accessibleEvent(q, QAccessibleTableModelChangeEvent::RowsInserted);
-
3432 accessibleEvent.setFirstRow(start);
executed (the execution status of this line is deduced): accessibleEvent.setFirstRow(start);
-
3433 accessibleEvent.setLastRow(end);
executed (the execution status of this line is deduced): accessibleEvent.setLastRow(end);
-
3434 QAccessible::updateAccessibility(&accessibleEvent);
executed (the execution status of this line is deduced): QAccessible::updateAccessibility(&accessibleEvent);
-
3435 }
executed: }
Execution Count:15
15
3436#endif -
3437}
executed: }
Execution Count:195934
195934
3438 -
3439/*! -
3440 \internal -
3441 -
3442 This slot is called when columns have been inserted. -
3443*/ -
3444void QAbstractItemViewPrivate::_q_columnsInserted(const QModelIndex &index, int start, int end) -
3445{ -
3446 Q_UNUSED(index)
executed (the execution status of this line is deduced): (void)index;
-
3447 Q_UNUSED(start)
executed (the execution status of this line is deduced): (void)start;
-
3448 Q_UNUSED(end)
executed (the execution status of this line is deduced): (void)end;
-
3449 -
3450 Q_Q(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemView * const q = q_func();
-
3451 if (q->isVisible())
evaluated: q->isVisible()
TRUEFALSE
yes
Evaluation Count:226
yes
Evaluation Count:606
226-606
3452 q->updateEditorGeometries();
executed: q->updateEditorGeometries();
Execution Count:226
226
3453#ifndef QT_NO_ACCESSIBILITY -
3454 if (QAccessible::isActive()) {
evaluated: QAccessible::isActive()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:830
2-830
3455 QAccessibleTableModelChangeEvent accessibleEvent(q, QAccessibleTableModelChangeEvent::ColumnsInserted);
executed (the execution status of this line is deduced): QAccessibleTableModelChangeEvent accessibleEvent(q, QAccessibleTableModelChangeEvent::ColumnsInserted);
-
3456 accessibleEvent.setFirstColumn(start);
executed (the execution status of this line is deduced): accessibleEvent.setFirstColumn(start);
-
3457 accessibleEvent.setLastColumn(end);
executed (the execution status of this line is deduced): accessibleEvent.setLastColumn(end);
-
3458 QAccessible::updateAccessibility(&accessibleEvent);
executed (the execution status of this line is deduced): QAccessible::updateAccessibility(&accessibleEvent);
-
3459 }
executed: }
Execution Count:2
2
3460#endif -
3461}
executed: }
Execution Count:832
832
3462 -
3463/*! -
3464 \internal -
3465*/ -
3466void QAbstractItemViewPrivate::_q_modelDestroyed() -
3467{ -
3468 model = QAbstractItemModelPrivate::staticEmptyModel();
executed (the execution status of this line is deduced): model = QAbstractItemModelPrivate::staticEmptyModel();
-
3469 doDelayedReset();
executed (the execution status of this line is deduced): doDelayedReset();
-
3470}
executed: }
Execution Count:2070
2070
3471 -
3472/*! -
3473 \internal -
3474 -
3475 This slot is called when the layout is changed. -
3476*/ -
3477void QAbstractItemViewPrivate::_q_layoutChanged() -
3478{ -
3479 doDelayedItemsLayout();
executed (the execution status of this line is deduced): doDelayedItemsLayout();
-
3480#ifndef QT_NO_ACCESSIBILITY -
3481 Q_Q(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemView * const q = q_func();
-
3482 if (QAccessible::isActive()) {
partially evaluated: QAccessible::isActive()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1298
0-1298
3483 QAccessibleTableModelChangeEvent accessibleEvent(q, QAccessibleTableModelChangeEvent::ModelReset);
never executed (the execution status of this line is deduced): QAccessibleTableModelChangeEvent accessibleEvent(q, QAccessibleTableModelChangeEvent::ModelReset);
-
3484 QAccessible::updateAccessibility(&accessibleEvent);
never executed (the execution status of this line is deduced): QAccessible::updateAccessibility(&accessibleEvent);
-
3485 }
never executed: }
0
3486#endif -
3487}
executed: }
Execution Count:1298
1298
3488 -
3489void QAbstractItemViewPrivate::_q_rowsMoved(const QModelIndex &, int, int, const QModelIndex &, int) -
3490{ -
3491 _q_layoutChanged();
never executed (the execution status of this line is deduced): _q_layoutChanged();
-
3492}
never executed: }
0
3493 -
3494void QAbstractItemViewPrivate::_q_columnsMoved(const QModelIndex &, int, int, const QModelIndex &, int) -
3495{ -
3496 _q_layoutChanged();
never executed (the execution status of this line is deduced): _q_layoutChanged();
-
3497}
never executed: }
0
3498 -
3499/*! -
3500 This slot is called when the selection is changed. The previous -
3501 selection (which may be empty), is specified by \a deselected, and the -
3502 new selection by \a selected. -
3503 -
3504 \sa setSelection() -
3505*/ -
3506void QAbstractItemView::selectionChanged(const QItemSelection &selected, -
3507 const QItemSelection &deselected) -
3508{ -
3509 Q_D(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
3510 if (isVisible() && updatesEnabled()) {
evaluated: isVisible()
TRUEFALSE
yes
Evaluation Count:4251
yes
Evaluation Count:5219
evaluated: updatesEnabled()
TRUEFALSE
yes
Evaluation Count:4231
yes
Evaluation Count:20
20-5219
3511 d->viewport->update(visualRegionForSelection(deselected) | visualRegionForSelection(selected));
executed (the execution status of this line is deduced): d->viewport->update(visualRegionForSelection(deselected) | visualRegionForSelection(selected));
-
3512 }
executed: }
Execution Count:4231
4231
3513}
executed: }
Execution Count:9470
9470
3514 -
3515/*! -
3516 This slot is called when a new item becomes the current item. -
3517 The previous current item is specified by the \a previous index, and the new -
3518 item by the \a current index. -
3519 -
3520 If you want to know about changes to items see the -
3521 dataChanged() signal. -
3522*/ -
3523void QAbstractItemView::currentChanged(const QModelIndex &current, const QModelIndex &previous) -
3524{ -
3525 Q_D(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
3526 Q_ASSERT(d->model);
executed (the execution status of this line is deduced): qt_noop();
-
3527 -
3528 if (previous.isValid()) {
evaluated: previous.isValid()
TRUEFALSE
yes
Evaluation Count:2849
yes
Evaluation Count:1453
1453-2849
3529 QModelIndex buddy = d->model->buddy(previous);
executed (the execution status of this line is deduced): QModelIndex buddy = d->model->buddy(previous);
-
3530 QWidget *editor = d->editorForIndex(buddy).widget.data();
executed (the execution status of this line is deduced): QWidget *editor = d->editorForIndex(buddy).widget.data();
-
3531 if (editor && !d->persistent.contains(editor)) {
evaluated: editor
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:2845
evaluated: !d->persistent.contains(editor)
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:1
1-2845
3532 commitData(editor);
executed (the execution status of this line is deduced): commitData(editor);
-
3533 if (current.row() != previous.row())
evaluated: current.row() != previous.row()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1
1-2
3534 closeEditor(editor, QAbstractItemDelegate::SubmitModelCache);
executed: closeEditor(editor, QAbstractItemDelegate::SubmitModelCache);
Execution Count:2
2
3535 else -
3536 closeEditor(editor, QAbstractItemDelegate::NoHint);
executed: closeEditor(editor, QAbstractItemDelegate::NoHint);
Execution Count:1
1
3537 } -
3538 if (isVisible()) {
evaluated: isVisible()
TRUEFALSE
yes
Evaluation Count:1768
yes
Evaluation Count:1081
1081-1768
3539 update(previous);
executed (the execution status of this line is deduced): update(previous);
-
3540 }
executed: }
Execution Count:1768
1768
3541 }
executed: }
Execution Count:2849
2849
3542 -
3543 if (current.isValid() && !d->autoScrollTimer.isActive()) {
evaluated: current.isValid()
TRUEFALSE
yes
Evaluation Count:3484
yes
Evaluation Count:818
partially evaluated: !d->autoScrollTimer.isActive()
TRUEFALSE
yes
Evaluation Count:3484
no
Evaluation Count:0
0-3484
3544 if (isVisible()) {
evaluated: isVisible()
TRUEFALSE
yes
Evaluation Count:2010
yes
Evaluation Count:1474
1474-2010
3545 if (d->autoScroll)
evaluated: d->autoScroll
TRUEFALSE
yes
Evaluation Count:1251
yes
Evaluation Count:759
759-1251
3546 scrollTo(current);
executed: scrollTo(current);
Execution Count:1251
1251
3547 update(current);
executed (the execution status of this line is deduced): update(current);
-
3548 edit(current, CurrentChanged, 0);
executed (the execution status of this line is deduced): edit(current, CurrentChanged, 0);
-
3549 if (current.row() == (d->model->rowCount(d->root) - 1))
evaluated: current.row() == (d->model->rowCount(d->root) - 1)
TRUEFALSE
yes
Evaluation Count:107
yes
Evaluation Count:1903
107-1903
3550 d->fetchMore();
executed: d->fetchMore();
Execution Count:107
107
3551 } else {
executed: }
Execution Count:2010
2010
3552 d->shouldScrollToCurrentOnShow = d->autoScroll;
executed (the execution status of this line is deduced): d->shouldScrollToCurrentOnShow = d->autoScroll;
-
3553 }
executed: }
Execution Count:1474
1474
3554 } -
3555}
executed: }
Execution Count:4302
4302
3556 -
3557#ifndef QT_NO_DRAGANDDROP -
3558/*! -
3559 Starts a drag by calling drag->exec() using the given \a supportedActions. -
3560*/ -
3561void QAbstractItemView::startDrag(Qt::DropActions supportedActions) -
3562{ -
3563 Q_D(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
3564 QModelIndexList indexes = d->selectedDraggableIndexes();
executed (the execution status of this line is deduced): QModelIndexList indexes = d->selectedDraggableIndexes();
-
3565 if (indexes.count() > 0) {
partially evaluated: indexes.count() > 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
3566 QMimeData *data = d->model->mimeData(indexes);
never executed (the execution status of this line is deduced): QMimeData *data = d->model->mimeData(indexes);
-
3567 if (!data)
never evaluated: !data
0
3568 return;
never executed: return;
0
3569 QRect rect;
never executed (the execution status of this line is deduced): QRect rect;
-
3570 QPixmap pixmap = d->renderToPixmap(indexes, &rect);
never executed (the execution status of this line is deduced): QPixmap pixmap = d->renderToPixmap(indexes, &rect);
-
3571 rect.adjust(horizontalOffset(), verticalOffset(), 0, 0);
never executed (the execution status of this line is deduced): rect.adjust(horizontalOffset(), verticalOffset(), 0, 0);
-
3572 QDrag *drag = new QDrag(this);
never executed (the execution status of this line is deduced): QDrag *drag = new QDrag(this);
-
3573 drag->setPixmap(pixmap);
never executed (the execution status of this line is deduced): drag->setPixmap(pixmap);
-
3574 drag->setMimeData(data);
never executed (the execution status of this line is deduced): drag->setMimeData(data);
-
3575 drag->setHotSpot(d->pressedPosition - rect.topLeft());
never executed (the execution status of this line is deduced): drag->setHotSpot(d->pressedPosition - rect.topLeft());
-
3576 Qt::DropAction defaultDropAction = Qt::IgnoreAction;
never executed (the execution status of this line is deduced): Qt::DropAction defaultDropAction = Qt::IgnoreAction;
-
3577 if (d->defaultDropAction != Qt::IgnoreAction && (supportedActions & d->defaultDropAction))
never evaluated: d->defaultDropAction != Qt::IgnoreAction
never evaluated: (supportedActions & d->defaultDropAction)
0
3578 defaultDropAction = d->defaultDropAction;
never executed: defaultDropAction = d->defaultDropAction;
0
3579 else if (supportedActions & Qt::CopyAction && dragDropMode() != QAbstractItemView::InternalMove)
never evaluated: supportedActions & Qt::CopyAction
never evaluated: dragDropMode() != QAbstractItemView::InternalMove
0
3580 defaultDropAction = Qt::CopyAction;
never executed: defaultDropAction = Qt::CopyAction;
0
3581 if (drag->exec(supportedActions, defaultDropAction) == Qt::MoveAction)
never evaluated: drag->exec(supportedActions, defaultDropAction) == Qt::MoveAction
0
3582 d->clearOrRemove();
never executed: d->clearOrRemove();
0
3583 }
never executed: }
0
3584}
executed: }
Execution Count:4
4
3585#endif // QT_NO_DRAGANDDROP -
3586 -
3587/*! -
3588 Returns a QStyleOptionViewItem structure populated with the view's -
3589 palette, font, state, alignments etc. -
3590*/ -
3591QStyleOptionViewItem QAbstractItemView::viewOptions() const -
3592{ -
3593 Q_D(const QAbstractItemView);
executed (the execution status of this line is deduced): const QAbstractItemViewPrivate * const d = d_func();
-
3594 return d->viewOptions();
executed: return d->viewOptions();
Execution Count:1980
1980
3595} -
3596 -
3597QStyleOptionViewItem QAbstractItemViewPrivate::viewOptions() const -
3598{ -
3599 Q_Q(const QAbstractItemView);
executed (the execution status of this line is deduced): const QAbstractItemView * const q = q_func();
-
3600 QStyleOptionViewItem option;
executed (the execution status of this line is deduced): QStyleOptionViewItem option;
-
3601 option.init(q);
executed (the execution status of this line is deduced): option.init(q);
-
3602 option.state &= ~QStyle::State_MouseOver;
executed (the execution status of this line is deduced): option.state &= ~QStyle::State_MouseOver;
-
3603 option.font = q->font();
executed (the execution status of this line is deduced): option.font = q->font();
-
3604 -
3605#ifndef Q_WS_MAC -
3606 // On mac the focus appearance follows window activation -
3607 // not widget activation -
3608 if (!q->hasFocus())
evaluated: !q->hasFocus()
TRUEFALSE
yes
Evaluation Count:16431
yes
Evaluation Count:25869
16431-25869
3609 option.state &= ~QStyle::State_Active;
executed: option.state &= ~QStyle::State_Active;
Execution Count:16431
16431
3610#endif -
3611 -
3612 option.state &= ~QStyle::State_HasFocus;
executed (the execution status of this line is deduced): option.state &= ~QStyle::State_HasFocus;
-
3613 if (iconSize.isValid()) {
evaluated: iconSize.isValid()
TRUEFALSE
yes
Evaluation Count:2177
yes
Evaluation Count:40123
2177-40123
3614 option.decorationSize = iconSize;
executed (the execution status of this line is deduced): option.decorationSize = iconSize;
-
3615 } else {
executed: }
Execution Count:2177
2177
3616 int pm = q->style()->pixelMetric(QStyle::PM_SmallIconSize, 0, q);
executed (the execution status of this line is deduced): int pm = q->style()->pixelMetric(QStyle::PM_SmallIconSize, 0, q);
-
3617 option.decorationSize = QSize(pm, pm);
executed (the execution status of this line is deduced): option.decorationSize = QSize(pm, pm);
-
3618 }
executed: }
Execution Count:40123
40123
3619 option.decorationPosition = QStyleOptionViewItem::Left;
executed (the execution status of this line is deduced): option.decorationPosition = QStyleOptionViewItem::Left;
-
3620 option.decorationAlignment = Qt::AlignCenter;
executed (the execution status of this line is deduced): option.decorationAlignment = Qt::AlignCenter;
-
3621 option.displayAlignment = Qt::AlignLeft|Qt::AlignVCenter;
executed (the execution status of this line is deduced): option.displayAlignment = Qt::AlignLeft|Qt::AlignVCenter;
-
3622 option.textElideMode = textElideMode;
executed (the execution status of this line is deduced): option.textElideMode = textElideMode;
-
3623 option.rect = QRect();
executed (the execution status of this line is deduced): option.rect = QRect();
-
3624 option.showDecorationSelected = q->style()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected, 0, q);
executed (the execution status of this line is deduced): option.showDecorationSelected = q->style()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected, 0, q);
-
3625 if (wrapItemText)
evaluated: wrapItemText
TRUEFALSE
yes
Evaluation Count:4098
yes
Evaluation Count:38202
4098-38202
3626 option.features = QStyleOptionViewItem::WrapText;
executed: option.features = QStyleOptionViewItem::WrapText;
Execution Count:4098
4098
3627 option.locale = q->locale();
executed (the execution status of this line is deduced): option.locale = q->locale();
-
3628 option.locale.setNumberOptions(QLocale::OmitGroupSeparator);
executed (the execution status of this line is deduced): option.locale.setNumberOptions(QLocale::OmitGroupSeparator);
-
3629 option.widget = q;
executed (the execution status of this line is deduced): option.widget = q;
-
3630 return option;
executed: return option;
Execution Count:42300
42300
3631} -
3632 -
3633/*! -
3634 Returns the item view's state. -
3635 -
3636 \sa setState() -
3637*/ -
3638QAbstractItemView::State QAbstractItemView::state() const -
3639{ -
3640 Q_D(const QAbstractItemView);
executed (the execution status of this line is deduced): const QAbstractItemViewPrivate * const d = d_func();
-
3641 return d->state;
executed: return d->state;
Execution Count:7962
7962
3642} -
3643 -
3644/*! -
3645 Sets the item view's state to the given \a state. -
3646 -
3647 \sa state() -
3648*/ -
3649void QAbstractItemView::setState(State state) -
3650{ -
3651 Q_D(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
3652 d->state = state;
executed (the execution status of this line is deduced): d->state = state;
-
3653}
executed: }
Execution Count:20550
20550
3654 -
3655/*! -
3656 Schedules a layout of the items in the view to be executed when the -
3657 event processing starts. -
3658 -
3659 Even if scheduleDelayedItemsLayout() is called multiple times before -
3660 events are processed, the view will only do the layout once. -
3661 -
3662 \sa executeDelayedItemsLayout() -
3663*/ -
3664void QAbstractItemView::scheduleDelayedItemsLayout() -
3665{ -
3666 Q_D(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
3667 d->doDelayedItemsLayout();
executed (the execution status of this line is deduced): d->doDelayedItemsLayout();
-
3668}
executed: }
Execution Count:6
6
3669 -
3670/*! -
3671 Executes the scheduled layouts without waiting for the event processing -
3672 to begin. -
3673 -
3674 \sa scheduleDelayedItemsLayout() -
3675*/ -
3676void QAbstractItemView::executeDelayedItemsLayout() -
3677{ -
3678 Q_D(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
3679 d->executePostedLayout();
executed (the execution status of this line is deduced): d->executePostedLayout();
-
3680}
executed: }
Execution Count:4
4
3681 -
3682/*! -
3683 \since 4.1 -
3684 -
3685 Marks the given \a region as dirty and schedules it to be updated. -
3686 You only need to call this function if you are implementing -
3687 your own view subclass. -
3688 -
3689 \sa scrollDirtyRegion(), dirtyRegionOffset() -
3690*/ -
3691 -
3692void QAbstractItemView::setDirtyRegion(const QRegion &region) -
3693{ -
3694 Q_D(QAbstractItemView);
never executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
3695 d->setDirtyRegion(region);
never executed (the execution status of this line is deduced): d->setDirtyRegion(region);
-
3696}
never executed: }
0
3697 -
3698/*! -
3699 Prepares the view for scrolling by (\a{dx},\a{dy}) pixels by moving the dirty regions in the -
3700 opposite direction. You only need to call this function if you are implementing a scrolling -
3701 viewport in your view subclass. -
3702 -
3703 If you implement scrollContentsBy() in a subclass of QAbstractItemView, call this function -
3704 before you call QWidget::scroll() on the viewport. Alternatively, just call update(). -
3705 -
3706 \sa scrollContentsBy(), dirtyRegionOffset(), setDirtyRegion() -
3707*/ -
3708void QAbstractItemView::scrollDirtyRegion(int dx, int dy) -
3709{ -
3710 Q_D(QAbstractItemView);
never executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
3711 d->scrollDirtyRegion(dx, dy);
never executed (the execution status of this line is deduced): d->scrollDirtyRegion(dx, dy);
-
3712}
never executed: }
0
3713 -
3714/*! -
3715 Returns the offset of the dirty regions in the view. -
3716 -
3717 If you use scrollDirtyRegion() and implement a paintEvent() in a subclass of -
3718 QAbstractItemView, you should translate the area given by the paint event with -
3719 the offset returned from this function. -
3720 -
3721 \sa scrollDirtyRegion(), setDirtyRegion() -
3722*/ -
3723QPoint QAbstractItemView::dirtyRegionOffset() const -
3724{ -
3725 Q_D(const QAbstractItemView);
never executed (the execution status of this line is deduced): const QAbstractItemViewPrivate * const d = d_func();
-
3726 return d->scrollDelayOffset;
never executed: return d->scrollDelayOffset;
0
3727} -
3728 -
3729/*! -
3730 \internal -
3731*/ -
3732void QAbstractItemView::startAutoScroll() -
3733{ -
3734 d_func()->startAutoScroll();
executed (the execution status of this line is deduced): d_func()->startAutoScroll();
-
3735}
executed: }
Execution Count:8
8
3736 -
3737/*! -
3738 \internal -
3739*/ -
3740void QAbstractItemView::stopAutoScroll() -
3741{ -
3742 d_func()->stopAutoScroll();
executed (the execution status of this line is deduced): d_func()->stopAutoScroll();
-
3743}
executed: }
Execution Count:16
16
3744 -
3745/*! -
3746 \internal -
3747*/ -
3748void QAbstractItemView::doAutoScroll() -
3749{ -
3750 // find how much we should scroll with -
3751 Q_D(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemViewPrivate * const d = d_func();
-
3752 QScrollBar *verticalScroll = verticalScrollBar();
executed (the execution status of this line is deduced): QScrollBar *verticalScroll = verticalScrollBar();
-
3753 QScrollBar *horizontalScroll = horizontalScrollBar();
executed (the execution status of this line is deduced): QScrollBar *horizontalScroll = horizontalScrollBar();
-
3754 -
3755 // QHeaderView does not (normally) have scrollbars -
3756 // It needs to use its parents scroll instead -
3757 QHeaderView *hv = qobject_cast<QHeaderView*>(this);
executed (the execution status of this line is deduced): QHeaderView *hv = qobject_cast<QHeaderView*>(this);
-
3758 if (hv) {
evaluated: hv
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:6
2-6
3759 QAbstractScrollArea *parent = qobject_cast<QAbstractScrollArea*>(parentWidget());
executed (the execution status of this line is deduced): QAbstractScrollArea *parent = qobject_cast<QAbstractScrollArea*>(parentWidget());
-
3760 if (parent) {
partially evaluated: parent
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
3761 if (hv->orientation() == Qt::Horizontal) {
never evaluated: hv->orientation() == Qt::Horizontal
0
3762 if (!hv->horizontalScrollBar() || !hv->horizontalScrollBar()->isVisible())
never evaluated: !hv->horizontalScrollBar()
never evaluated: !hv->horizontalScrollBar()->isVisible()
0
3763 horizontalScroll = parent->horizontalScrollBar();
never executed: horizontalScroll = parent->horizontalScrollBar();
0
3764 } else {
never executed: }
0
3765 if (!hv->verticalScrollBar() || !hv->verticalScrollBar()->isVisible())
never evaluated: !hv->verticalScrollBar()
never evaluated: !hv->verticalScrollBar()->isVisible()
0
3766 verticalScroll = parent->verticalScrollBar();
never executed: verticalScroll = parent->verticalScrollBar();
0
3767 }
never executed: }
0
3768 } -
3769 }
executed: }
Execution Count:2
2
3770 -
3771 int verticalStep = verticalScroll->pageStep();
executed (the execution status of this line is deduced): int verticalStep = verticalScroll->pageStep();
-
3772 int horizontalStep = horizontalScroll->pageStep();
executed (the execution status of this line is deduced): int horizontalStep = horizontalScroll->pageStep();
-
3773 if (d->autoScrollCount < qMax(verticalStep, horizontalStep))
partially evaluated: d->autoScrollCount < qMax(verticalStep, horizontalStep)
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
0-8
3774 ++d->autoScrollCount;
executed: ++d->autoScrollCount;
Execution Count:8
8
3775 -
3776 int margin = d->autoScrollMargin;
executed (the execution status of this line is deduced): int margin = d->autoScrollMargin;
-
3777 int verticalValue = verticalScroll->value();
executed (the execution status of this line is deduced): int verticalValue = verticalScroll->value();
-
3778 int horizontalValue = horizontalScroll->value();
executed (the execution status of this line is deduced): int horizontalValue = horizontalScroll->value();
-
3779 -
3780 QPoint pos = d->viewport->mapFromGlobal(QCursor::pos());
executed (the execution status of this line is deduced): QPoint pos = d->viewport->mapFromGlobal(QCursor::pos());
-
3781 QRect area = static_cast<QAbstractItemView*>(d->viewport)->d_func()->clipRect(); // access QWidget private by bending C++ rules
executed (the execution status of this line is deduced): QRect area = static_cast<QAbstractItemView*>(d->viewport)->d_func()->clipRect();
-
3782 -
3783 // do the scrolling if we are in the scroll margins -
3784 if (pos.y() - area.top() < margin)
evaluated: pos.y() - area.top() < margin
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:6
2-6
3785 verticalScroll->setValue(verticalValue - d->autoScrollCount);
executed: verticalScroll->setValue(verticalValue - d->autoScrollCount);
Execution Count:2
2
3786 else if (area.bottom() - pos.y() < margin)
partially evaluated: area.bottom() - pos.y() < margin
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6
0-6
3787 verticalScroll->setValue(verticalValue + d->autoScrollCount);
never executed: verticalScroll->setValue(verticalValue + d->autoScrollCount);
0
3788 if (pos.x() - area.left() < margin)
partially evaluated: pos.x() - area.left() < margin
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
3789 horizontalScroll->setValue(horizontalValue - d->autoScrollCount);
never executed: horizontalScroll->setValue(horizontalValue - d->autoScrollCount);
0
3790 else if (area.right() - pos.x() < margin)
partially evaluated: area.right() - pos.x() < margin
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
3791 horizontalScroll->setValue(horizontalValue + d->autoScrollCount);
never executed: horizontalScroll->setValue(horizontalValue + d->autoScrollCount);
0
3792 // if nothing changed, stop scrolling -
3793 bool verticalUnchanged = (verticalValue == verticalScroll->value());
executed (the execution status of this line is deduced): bool verticalUnchanged = (verticalValue == verticalScroll->value());
-
3794 bool horizontalUnchanged = (horizontalValue == horizontalScroll->value());
executed (the execution status of this line is deduced): bool horizontalUnchanged = (horizontalValue == horizontalScroll->value());
-
3795 if (verticalUnchanged && horizontalUnchanged) {
partially evaluated: verticalUnchanged
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
partially evaluated: horizontalUnchanged
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
0-8
3796 stopAutoScroll();
executed (the execution status of this line is deduced): stopAutoScroll();
-
3797 } else {
executed: }
Execution Count:8
8
3798#ifndef QT_NO_DRAGANDDROP -
3799 d->dropIndicatorRect = QRect();
never executed (the execution status of this line is deduced): d->dropIndicatorRect = QRect();
-
3800 d->dropIndicatorPosition = QAbstractItemView::OnViewport;
never executed (the execution status of this line is deduced): d->dropIndicatorPosition = QAbstractItemView::OnViewport;
-
3801#endif -
3802 d->viewport->update();
never executed (the execution status of this line is deduced): d->viewport->update();
-
3803 }
never executed: }
0
3804} -
3805 -
3806/*! -
3807 Returns the SelectionFlags to be used when updating a selection with -
3808 to include the \a index specified. The \a event is a user input event, -
3809 such as a mouse or keyboard event. -
3810 -
3811 Reimplement this function to define your own selection behavior. -
3812 -
3813 \sa setSelection() -
3814*/ -
3815QItemSelectionModel::SelectionFlags QAbstractItemView::selectionCommand(const QModelIndex &index, -
3816 const QEvent *event) const -
3817{ -
3818 Q_D(const QAbstractItemView);
executed (the execution status of this line is deduced): const QAbstractItemViewPrivate * const d = d_func();
-
3819 switch (d->selectionMode) { -
3820 case NoSelection: // Never update selection model -
3821 return QItemSelectionModel::NoUpdate;
executed: return QItemSelectionModel::NoUpdate;
Execution Count:33
33
3822 case SingleSelection: // ClearAndSelect on valid index otherwise NoUpdate -
3823 if (event && event->type() == QEvent::MouseButtonRelease)
evaluated: event
TRUEFALSE
yes
Evaluation Count:1025
yes
Evaluation Count:1105
evaluated: event->type() == QEvent::MouseButtonRelease
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1024
1-1105
3824 return QItemSelectionModel::NoUpdate;
executed: return QItemSelectionModel::NoUpdate;
Execution Count:1
1
3825 return QItemSelectionModel::ClearAndSelect|d->selectionBehaviorFlags();
executed: return QItemSelectionModel::ClearAndSelect|d->selectionBehaviorFlags();
Execution Count:2129
2129
3826 case MultiSelection: -
3827 return d->multiSelectionCommand(index, event);
executed: return d->multiSelectionCommand(index, event);
Execution Count:4
4
3828 case ExtendedSelection: -
3829 return d->extendedSelectionCommand(index, event);
executed: return d->extendedSelectionCommand(index, event);
Execution Count:977
977
3830 case ContiguousSelection: -
3831 return d->contiguousSelectionCommand(index, event);
executed: return d->contiguousSelectionCommand(index, event);
Execution Count:4
4
3832 } -
3833 return QItemSelectionModel::NoUpdate;
never executed: return QItemSelectionModel::NoUpdate;
0
3834} -
3835 -
3836QItemSelectionModel::SelectionFlags QAbstractItemViewPrivate::multiSelectionCommand( -
3837 const QModelIndex &index, const QEvent *event) const -
3838{ -
3839 Q_UNUSED(index)
executed (the execution status of this line is deduced): (void)index;
-
3840 -
3841 if (event) {
partially evaluated: event
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
3842 switch (event->type()) { -
3843 case QEvent::KeyPress: -
3844 if (static_cast<const QKeyEvent*>(event)->key() == Qt::Key_Space
never evaluated: static_cast<const QKeyEvent*>(event)->key() == Qt::Key_Space
0
3845 || static_cast<const QKeyEvent*>(event)->key() == Qt::Key_Select)
never evaluated: static_cast<const QKeyEvent*>(event)->key() == Qt::Key_Select
0
3846 return QItemSelectionModel::Toggle|selectionBehaviorFlags();
never executed: return QItemSelectionModel::Toggle|selectionBehaviorFlags();
0
3847 break;
never executed: break;
0
3848 case QEvent::MouseButtonPress: -
3849 if (static_cast<const QMouseEvent*>(event)->button() == Qt::LeftButton)
never evaluated: static_cast<const QMouseEvent*>(event)->button() == Qt::LeftButton
0
3850 return QItemSelectionModel::Toggle|selectionBehaviorFlags(); // toggle
never executed: return QItemSelectionModel::Toggle|selectionBehaviorFlags();
0
3851 break;
never executed: break;
0
3852 case QEvent::MouseButtonRelease: -
3853 if (static_cast<const QMouseEvent*>(event)->button() == Qt::LeftButton)
never evaluated: static_cast<const QMouseEvent*>(event)->button() == Qt::LeftButton
0
3854 return QItemSelectionModel::NoUpdate|selectionBehaviorFlags(); // finalize
never executed: return QItemSelectionModel::NoUpdate|selectionBehaviorFlags();
0
3855 break;
never executed: break;
0
3856 case QEvent::MouseMove: -
3857 if (static_cast<const QMouseEvent*>(event)->buttons() & Qt::LeftButton)
never evaluated: static_cast<const QMouseEvent*>(event)->buttons() & Qt::LeftButton
0
3858 return QItemSelectionModel::ToggleCurrent|selectionBehaviorFlags(); // toggle drag select
never executed: return QItemSelectionModel::ToggleCurrent|selectionBehaviorFlags();
0
3859 default: -
3860 break;
never executed: break;
0
3861 } -
3862 return QItemSelectionModel::NoUpdate;
never executed: return QItemSelectionModel::NoUpdate;
0
3863 } -
3864 -
3865 return QItemSelectionModel::Toggle|selectionBehaviorFlags();
executed: return QItemSelectionModel::Toggle|selectionBehaviorFlags();
Execution Count:4
4
3866} -
3867 -
3868QItemSelectionModel::SelectionFlags QAbstractItemViewPrivate::extendedSelectionCommand( -
3869 const QModelIndex &index, const QEvent *event) const -
3870{ -
3871 Qt::KeyboardModifiers modifiers = QApplication::keyboardModifiers();
executed (the execution status of this line is deduced): Qt::KeyboardModifiers modifiers = QApplication::keyboardModifiers();
-
3872 if (event) {
evaluated: event
TRUEFALSE
yes
Evaluation Count:614
yes
Evaluation Count:367
367-614
3873 switch (event->type()) { -
3874 case QEvent::MouseMove: { -
3875 // Toggle on MouseMove -
3876 modifiers = static_cast<const QMouseEvent*>(event)->modifiers();
executed (the execution status of this line is deduced): modifiers = static_cast<const QMouseEvent*>(event)->modifiers();
-
3877 if (modifiers & Qt::ControlModifier)
evaluated: modifiers & Qt::ControlModifier
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:2
2-13
3878 return QItemSelectionModel::ToggleCurrent|selectionBehaviorFlags();
executed: return QItemSelectionModel::ToggleCurrent|selectionBehaviorFlags();
Execution Count:13
13
3879 break;
executed: break;
Execution Count:2
2
3880 } -
3881 case QEvent::MouseButtonPress: { -
3882 modifiers = static_cast<const QMouseEvent*>(event)->modifiers();
executed (the execution status of this line is deduced): modifiers = static_cast<const QMouseEvent*>(event)->modifiers();
-
3883 const Qt::MouseButton button = static_cast<const QMouseEvent*>(event)->button();
executed (the execution status of this line is deduced): const Qt::MouseButton button = static_cast<const QMouseEvent*>(event)->button();
-
3884 const bool rightButtonPressed = button & Qt::RightButton;
executed (the execution status of this line is deduced): const bool rightButtonPressed = button & Qt::RightButton;
-
3885 const bool shiftKeyPressed = modifiers & Qt::ShiftModifier;
executed (the execution status of this line is deduced): const bool shiftKeyPressed = modifiers & Qt::ShiftModifier;
-
3886 const bool controlKeyPressed = modifiers & Qt::ControlModifier;
executed (the execution status of this line is deduced): const bool controlKeyPressed = modifiers & Qt::ControlModifier;
-
3887 const bool indexIsSelected = selectionModel->isSelected(index);
executed (the execution status of this line is deduced): const bool indexIsSelected = selectionModel->isSelected(index);
-
3888 if ((shiftKeyPressed || controlKeyPressed) && rightButtonPressed)
evaluated: shiftKeyPressed
TRUEFALSE
yes
Evaluation Count:91
yes
Evaluation Count:289
evaluated: controlKeyPressed
TRUEFALSE
yes
Evaluation Count:96
yes
Evaluation Count:193
evaluated: rightButtonPressed
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:185
2-289
3889 return QItemSelectionModel::NoUpdate;
executed: return QItemSelectionModel::NoUpdate;
Execution Count:2
2
3890 if (!shiftKeyPressed && !controlKeyPressed && indexIsSelected)
evaluated: !shiftKeyPressed
TRUEFALSE
yes
Evaluation Count:287
yes
Evaluation Count:91
evaluated: !controlKeyPressed
TRUEFALSE
yes
Evaluation Count:193
yes
Evaluation Count:94
evaluated: indexIsSelected
TRUEFALSE
yes
Evaluation Count:20
yes
Evaluation Count:173
20-287
3891 return QItemSelectionModel::NoUpdate;
executed: return QItemSelectionModel::NoUpdate;
Execution Count:20
20
3892 if (!index.isValid() && !rightButtonPressed && !shiftKeyPressed && !controlKeyPressed)
evaluated: !index.isValid()
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:351
evaluated: !rightButtonPressed
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:1
partially evaluated: !shiftKeyPressed
TRUEFALSE
yes
Evaluation Count:6
no
Evaluation Count:0
evaluated: !controlKeyPressed
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:1
0-351
3893 return QItemSelectionModel::Clear;
executed: return QItemSelectionModel::Clear;
Execution Count:5
5
3894 if (!index.isValid())
evaluated: !index.isValid()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:351
2-351
3895 return QItemSelectionModel::NoUpdate;
executed: return QItemSelectionModel::NoUpdate;
Execution Count:2
2
3896 break;
executed: break;
Execution Count:351
351
3897 } -
3898 case QEvent::MouseButtonRelease: { -
3899 // ClearAndSelect on MouseButtonRelease if MouseButtonPress on selected item or empty area -
3900 modifiers = static_cast<const QMouseEvent*>(event)->modifiers();
executed (the execution status of this line is deduced): modifiers = static_cast<const QMouseEvent*>(event)->modifiers();
-
3901 const Qt::MouseButton button = static_cast<const QMouseEvent*>(event)->button();
executed (the execution status of this line is deduced): const Qt::MouseButton button = static_cast<const QMouseEvent*>(event)->button();
-
3902 const bool rightButtonPressed = button & Qt::RightButton;
executed (the execution status of this line is deduced): const bool rightButtonPressed = button & Qt::RightButton;
-
3903 const bool shiftKeyPressed = modifiers & Qt::ShiftModifier;
executed (the execution status of this line is deduced): const bool shiftKeyPressed = modifiers & Qt::ShiftModifier;
-
3904 const bool controlKeyPressed = modifiers & Qt::ControlModifier;
executed (the execution status of this line is deduced): const bool controlKeyPressed = modifiers & Qt::ControlModifier;
-
3905 if (((index == pressedIndex && selectionModel->isSelected(index))
evaluated: index == pressedIndex
TRUEFALSE
yes
Evaluation Count:17
yes
Evaluation Count:9
evaluated: selectionModel->isSelected(index)
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:5
5-17
3906 || !index.isValid()) && state != QAbstractItemView::DragSelectingState
evaluated: !index.isValid()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:10
evaluated: state != QAbstractItemView::DragSelectingState
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:1
1-15
3907 && !shiftKeyPressed && !controlKeyPressed && (!rightButtonPressed || !index.isValid()))
partially evaluated: !shiftKeyPressed
TRUEFALSE
yes
Evaluation Count:15
no
Evaluation Count:0
evaluated: !controlKeyPressed
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:1
evaluated: !rightButtonPressed
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:2
evaluated: !index.isValid()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
0-15
3908 return QItemSelectionModel::ClearAndSelect|selectionBehaviorFlags();
executed: return QItemSelectionModel::ClearAndSelect|selectionBehaviorFlags();
Execution Count:13
13
3909 return QItemSelectionModel::NoUpdate;
executed: return QItemSelectionModel::NoUpdate;
Execution Count:13
13
3910 } -
3911 case QEvent::KeyPress: { -
3912 // NoUpdate on Key movement and Ctrl -
3913 modifiers = static_cast<const QKeyEvent*>(event)->modifiers();
executed (the execution status of this line is deduced): modifiers = static_cast<const QKeyEvent*>(event)->modifiers();
-
3914 switch (static_cast<const QKeyEvent*>(event)->key()) { -
3915 case Qt::Key_Backtab: -
3916 modifiers = modifiers & ~Qt::ShiftModifier; // special case for backtab
executed (the execution status of this line is deduced): modifiers = modifiers & ~Qt::ShiftModifier;
-
3917 case Qt::Key_Down:
code before this statement executed: case Qt::Key_Down:
Execution Count:2
2
3918 case Qt::Key_Up: -
3919 case Qt::Key_Left: -
3920 case Qt::Key_Right: -
3921 case Qt::Key_Home: -
3922 case Qt::Key_End: -
3923 case Qt::Key_PageUp: -
3924 case Qt::Key_PageDown: -
3925 case Qt::Key_Tab: -
3926 if (modifiers & Qt::ControlModifier
partially evaluated: modifiers & Qt::ControlModifier
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:193
0-193
3927#ifdef QT_KEYPAD_NAVIGATION -
3928 // Preserve historical tab order navigation behavior -
3929 || QApplication::navigationMode() == Qt::NavigationModeKeypadTabOrder -
3930#endif -
3931 ) -
3932 return QItemSelectionModel::NoUpdate;
never executed: return QItemSelectionModel::NoUpdate;
0
3933 break;
executed: break;
Execution Count:193
193
3934 case Qt::Key_Select: -
3935 return QItemSelectionModel::Toggle|selectionBehaviorFlags();
never executed: return QItemSelectionModel::Toggle|selectionBehaviorFlags();
0
3936 case Qt::Key_Space:// Toggle on Ctrl-Qt::Key_Space, Select on Space -
3937 if (modifiers & Qt::ControlModifier)
never evaluated: modifiers & Qt::ControlModifier
0
3938 return QItemSelectionModel::Toggle|selectionBehaviorFlags();
never executed: return QItemSelectionModel::Toggle|selectionBehaviorFlags();
0
3939 return QItemSelectionModel::Select|selectionBehaviorFlags();
never executed: return QItemSelectionModel::Select|selectionBehaviorFlags();
0
3940 default: -
3941 break;
never executed: break;
0
3942 } -
3943 } -
3944 default: -
3945 break;
executed: break;
Execution Count:193
193
3946 } -
3947 }
executed: }
Execution Count:546
546
3948 -
3949 if (modifiers & Qt::ShiftModifier)
evaluated: modifiers & Qt::ShiftModifier
TRUEFALSE
yes
Evaluation Count:99
yes
Evaluation Count:814
99-814
3950 return QItemSelectionModel::SelectCurrent|selectionBehaviorFlags();
executed: return QItemSelectionModel::SelectCurrent|selectionBehaviorFlags();
Execution Count:99
99
3951 if (modifiers & Qt::ControlModifier)
evaluated: modifiers & Qt::ControlModifier
TRUEFALSE
yes
Evaluation Count:104
yes
Evaluation Count:710
104-710
3952 return QItemSelectionModel::Toggle|selectionBehaviorFlags();
executed: return QItemSelectionModel::Toggle|selectionBehaviorFlags();
Execution Count:104
104
3953 if (state == QAbstractItemView::DragSelectingState) {
evaluated: state == QAbstractItemView::DragSelectingState
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:708
2-708
3954 //when drag-selecting we need to clear any previous selection and select the current one -
3955 return QItemSelectionModel::Clear|QItemSelectionModel::SelectCurrent|selectionBehaviorFlags();
executed: return QItemSelectionModel::Clear|QItemSelectionModel::SelectCurrent|selectionBehaviorFlags();
Execution Count:2
2
3956 } -
3957 -
3958 return QItemSelectionModel::ClearAndSelect|selectionBehaviorFlags();
executed: return QItemSelectionModel::ClearAndSelect|selectionBehaviorFlags();
Execution Count:708
708
3959} -
3960 -
3961QItemSelectionModel::SelectionFlags -
3962QAbstractItemViewPrivate::contiguousSelectionCommand(const QModelIndex &index, -
3963 const QEvent *event) const -
3964{ -
3965 QItemSelectionModel::SelectionFlags flags = extendedSelectionCommand(index, event);
executed (the execution status of this line is deduced): QItemSelectionModel::SelectionFlags flags = extendedSelectionCommand(index, event);
-
3966 const int Mask = QItemSelectionModel::Clear | QItemSelectionModel::Select
executed (the execution status of this line is deduced): const int Mask = QItemSelectionModel::Clear | QItemSelectionModel::Select
-
3967 | QItemSelectionModel::Deselect | QItemSelectionModel::Toggle
executed (the execution status of this line is deduced): | QItemSelectionModel::Deselect | QItemSelectionModel::Toggle
-
3968 | QItemSelectionModel::Current;
executed (the execution status of this line is deduced): | QItemSelectionModel::Current;
-
3969 -
3970 switch (flags & Mask) { -
3971 case QItemSelectionModel::Clear: -
3972 case QItemSelectionModel::ClearAndSelect: -
3973 case QItemSelectionModel::SelectCurrent: -
3974 return flags;
executed: return flags;
Execution Count:4
4
3975 case QItemSelectionModel::NoUpdate: -
3976 if (event &&
never evaluated: event
0
3977 (event->type() == QEvent::MouseButtonPress
never evaluated: event->type() == QEvent::MouseButtonPress
0
3978 || event->type() == QEvent::MouseButtonRelease))
never evaluated: event->type() == QEvent::MouseButtonRelease
0
3979 return flags;
never executed: return flags;
0
3980 return QItemSelectionModel::ClearAndSelect|selectionBehaviorFlags();
never executed: return QItemSelectionModel::ClearAndSelect|selectionBehaviorFlags();
0
3981 default: -
3982 return QItemSelectionModel::SelectCurrent|selectionBehaviorFlags();
never executed: return QItemSelectionModel::SelectCurrent|selectionBehaviorFlags();
0
3983 } -
3984}
never executed: }
0
3985 -
3986void QAbstractItemViewPrivate::fetchMore() -
3987{ -
3988 fetchMoreTimer.stop();
executed (the execution status of this line is deduced): fetchMoreTimer.stop();
-
3989 if (!model->canFetchMore(root))
evaluated: !model->canFetchMore(root)
TRUEFALSE
yes
Evaluation Count:1297
yes
Evaluation Count:2
2-1297
3990 return;
executed: return;
Execution Count:1297
1297
3991 int last = model->rowCount(root) - 1;
executed (the execution status of this line is deduced): int last = model->rowCount(root) - 1;
-
3992 if (last < 0) {
partially evaluated: last < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
3993 model->fetchMore(root);
never executed (the execution status of this line is deduced): model->fetchMore(root);
-
3994 return;
never executed: return;
0
3995 } -
3996 -
3997 QModelIndex index = model->index(last, 0, root);
executed (the execution status of this line is deduced): QModelIndex index = model->index(last, 0, root);
-
3998 QRect rect = q_func()->visualRect(index);
executed (the execution status of this line is deduced): QRect rect = q_func()->visualRect(index);
-
3999 if (viewport->rect().intersects(rect))
evaluated: viewport->rect().intersects(rect)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1
4000 model->fetchMore(root);
executed: model->fetchMore(root);
Execution Count:1
1
4001}
executed: }
Execution Count:2
2
4002 -
4003bool QAbstractItemViewPrivate::shouldEdit(QAbstractItemView::EditTrigger trigger, -
4004 const QModelIndex &index) const -
4005{ -
4006 if (!index.isValid())
partially evaluated: !index.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7936
0-7936
4007 return false;
never executed: return false;
0
4008 Qt::ItemFlags flags = model->flags(index);
executed (the execution status of this line is deduced): Qt::ItemFlags flags = model->flags(index);
-
4009 if (((flags & Qt::ItemIsEditable) == 0) || ((flags & Qt::ItemIsEnabled) == 0))
evaluated: ((flags & Qt::ItemIsEditable) == 0)
TRUEFALSE
yes
Evaluation Count:4737
yes
Evaluation Count:3199
evaluated: ((flags & Qt::ItemIsEnabled) == 0)
TRUEFALSE
yes
Evaluation Count:314
yes
Evaluation Count:2885
314-4737
4010 return false;
executed: return false;
Execution Count:5051
5051
4011 if (state == QAbstractItemView::EditingState)
evaluated: state == QAbstractItemView::EditingState
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:2880
5-2880
4012 return false;
executed: return false;
Execution Count:5
5
4013 if (hasEditor(index))
partially evaluated: hasEditor(index)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2880
0-2880
4014 return false;
never executed: return false;
0
4015 if (trigger == QAbstractItemView::AllEditTriggers) // force editing
evaluated: trigger == QAbstractItemView::AllEditTriggers
TRUEFALSE
yes
Evaluation Count:37
yes
Evaluation Count:2843
37-2843
4016 return true;
executed: return true;
Execution Count:37
37
4017 if ((trigger & editTriggers) == QAbstractItemView::SelectedClicked
evaluated: (trigger & editTriggers) == QAbstractItemView::SelectedClicked
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2841
2-2841
4018 && !selectionModel->isSelected(index))
partially evaluated: !selectionModel->isSelected(index)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
4019 return false;
never executed: return false;
0
4020 return (trigger & editTriggers);
executed: return (trigger & editTriggers);
Execution Count:2843
2843
4021} -
4022 -
4023bool QAbstractItemViewPrivate::shouldForwardEvent(QAbstractItemView::EditTrigger trigger, -
4024 const QEvent *event) const -
4025{ -
4026 if (!event || (trigger & editTriggers) != QAbstractItemView::AnyKeyPressed)
evaluated: !event
TRUEFALSE
yes
Evaluation Count:40
yes
Evaluation Count:27
partially evaluated: (trigger & editTriggers) != QAbstractItemView::AnyKeyPressed
TRUEFALSE
yes
Evaluation Count:27
no
Evaluation Count:0
0-40
4027 return false;
executed: return false;
Execution Count:67
67
4028 -
4029 switch (event->type()) { -
4030 case QEvent::KeyPress: -
4031 case QEvent::MouseButtonDblClick: -
4032 case QEvent::MouseButtonPress: -
4033 case QEvent::MouseButtonRelease: -
4034 case QEvent::MouseMove: -
4035 return true;
never executed: return true;
0
4036 default: -
4037 break;
never executed: break;
0
4038 }; -
4039 -
4040 return false;
never executed: return false;
0
4041} -
4042 -
4043bool QAbstractItemViewPrivate::shouldAutoScroll(const QPoint &pos) const -
4044{ -
4045 if (!autoScroll)
never evaluated: !autoScroll
0
4046 return false;
never executed: return false;
0
4047 QRect area = static_cast<QAbstractItemView*>(viewport)->d_func()->clipRect(); // access QWidget private by bending C++ rules
never executed (the execution status of this line is deduced): QRect area = static_cast<QAbstractItemView*>(viewport)->d_func()->clipRect();
-
4048 return (pos.y() - area.top() < autoScrollMargin)
never executed: return (pos.y() - area.top() < autoScrollMargin) || (area.bottom() - pos.y() < autoScrollMargin) || (pos.x() - area.left() < autoScrollMargin) || (area.right() - pos.x() < autoScrollMargin);
0
4049 || (area.bottom() - pos.y() < autoScrollMargin)
never executed: return (pos.y() - area.top() < autoScrollMargin) || (area.bottom() - pos.y() < autoScrollMargin) || (pos.x() - area.left() < autoScrollMargin) || (area.right() - pos.x() < autoScrollMargin);
0
4050 || (pos.x() - area.left() < autoScrollMargin)
never executed: return (pos.y() - area.top() < autoScrollMargin) || (area.bottom() - pos.y() < autoScrollMargin) || (pos.x() - area.left() < autoScrollMargin) || (area.right() - pos.x() < autoScrollMargin);
0
4051 || (area.right() - pos.x() < autoScrollMargin);
never executed: return (pos.y() - area.top() < autoScrollMargin) || (area.bottom() - pos.y() < autoScrollMargin) || (pos.x() - area.left() < autoScrollMargin) || (area.right() - pos.x() < autoScrollMargin);
0
4052} -
4053 -
4054void QAbstractItemViewPrivate::doDelayedItemsLayout(int delay) -
4055{ -
4056 if (!delayedPendingLayout) {
evaluated: !delayedPendingLayout
TRUEFALSE
yes
Evaluation Count:5656
yes
Evaluation Count:50111
5656-50111
4057 delayedPendingLayout = true;
executed (the execution status of this line is deduced): delayedPendingLayout = true;
-
4058 delayedLayout.start(delay, q_func());
executed (the execution status of this line is deduced): delayedLayout.start(delay, q_func());
-
4059 }
executed: }
Execution Count:5656
5656
4060}
executed: }
Execution Count:55767
55767
4061 -
4062void QAbstractItemViewPrivate::interruptDelayedItemsLayout() const -
4063{ -
4064 delayedLayout.stop();
executed (the execution status of this line is deduced): delayedLayout.stop();
-
4065 delayedPendingLayout = false;
executed (the execution status of this line is deduced): delayedPendingLayout = false;
-
4066}
executed: }
Execution Count:15824
15824
4067 -
4068 -
4069 -
4070QWidget *QAbstractItemViewPrivate::editor(const QModelIndex &index, -
4071 const QStyleOptionViewItem &options) -
4072{ -
4073 Q_Q(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemView * const q = q_func();
-
4074 QWidget *w = editorForIndex(index).widget.data();
executed (the execution status of this line is deduced): QWidget *w = editorForIndex(index).widget.data();
-
4075 if (!w) {
partially evaluated: !w
TRUEFALSE
yes
Evaluation Count:130
no
Evaluation Count:0
0-130
4076 QAbstractItemDelegate *delegate = delegateForIndex(index);
executed (the execution status of this line is deduced): QAbstractItemDelegate *delegate = delegateForIndex(index);
-
4077 if (!delegate)
evaluated: !delegate
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:124
6-124
4078 return 0;
executed: return 0;
Execution Count:6
6
4079 w = delegate->createEditor(viewport, options, index);
executed (the execution status of this line is deduced): w = delegate->createEditor(viewport, options, index);
-
4080 if (w) {
evaluated: w
TRUEFALSE
yes
Evaluation Count:104
yes
Evaluation Count:20
20-104
4081 w->installEventFilter(delegate);
executed (the execution status of this line is deduced): w->installEventFilter(delegate);
-
4082 QObject::connect(w, SIGNAL(destroyed(QObject*)), q, SLOT(editorDestroyed(QObject*)));
executed (the execution status of this line is deduced): QObject::connect(w, "2""destroyed(QObject*)", q, "1""editorDestroyed(QObject*)");
-
4083 delegate->updateEditorGeometry(w, options, index);
executed (the execution status of this line is deduced): delegate->updateEditorGeometry(w, options, index);
-
4084 delegate->setEditorData(w, index);
executed (the execution status of this line is deduced): delegate->setEditorData(w, index);
-
4085 addEditor(index, w, false);
executed (the execution status of this line is deduced): addEditor(index, w, false);
-
4086 if (w->parent() == viewport)
partially evaluated: w->parent() == viewport
TRUEFALSE
yes
Evaluation Count:104
no
Evaluation Count:0
0-104
4087 QWidget::setTabOrder(q, w);
executed: QWidget::setTabOrder(q, w);
Execution Count:104
104
4088 -
4089 // Special cases for some editors containing QLineEdit -
4090 QWidget *focusWidget = w;
executed (the execution status of this line is deduced): QWidget *focusWidget = w;
-
4091 while (QWidget *fp = focusWidget->focusProxy())
partially evaluated: QWidget *fp = focusWidget->focusProxy()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:104
0-104
4092 focusWidget = fp;
never executed: focusWidget = fp;
0
4093#ifndef QT_NO_LINEEDIT -
4094 if (QLineEdit *le = qobject_cast<QLineEdit*>(focusWidget))
evaluated: QLineEdit *le = qobject_cast<QLineEdit*>(focusWidget)
TRUEFALSE
yes
Evaluation Count:87
yes
Evaluation Count:17
17-87
4095 le->selectAll();
executed: le->selectAll();
Execution Count:87
87
4096#endif -
4097#ifndef QT_NO_SPINBOX -
4098 if (QSpinBox *sb = qobject_cast<QSpinBox*>(focusWidget))
evaluated: QSpinBox *sb = qobject_cast<QSpinBox*>(focusWidget)
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:100
4-100
4099 sb->selectAll();
executed: sb->selectAll();
Execution Count:4
4
4100 else if (QDoubleSpinBox *dsb = qobject_cast<QDoubleSpinBox*>(focusWidget))
evaluated: QDoubleSpinBox *dsb = qobject_cast<QDoubleSpinBox*>(focusWidget)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:99
1-99
4101 dsb->selectAll();
executed: dsb->selectAll();
Execution Count:1
1
4102#endif -
4103 } -
4104 }
executed: }
Execution Count:124
124
4105 -
4106 return w;
executed: return w;
Execution Count:124
124
4107} -
4108 -
4109void QAbstractItemViewPrivate::updateEditorData(const QModelIndex &tl, const QModelIndex &br) -
4110{ -
4111 // we are counting on having relatively few editors -
4112 const bool checkIndexes = tl.isValid() && br.isValid();
evaluated: tl.isValid()
TRUEFALSE
yes
Evaluation Count:676
yes
Evaluation Count:21
evaluated: br.isValid()
TRUEFALSE
yes
Evaluation Count:662
yes
Evaluation Count:14
14-676
4113 const QModelIndex parent = tl.parent();
executed (the execution status of this line is deduced): const QModelIndex parent = tl.parent();
-
4114 // QTBUG-25370: We need to copy the indexEditorHash, because while we're -
4115 // iterating over it, we are calling methods which can allow user code to -
4116 // call a method on *this which can modify the member indexEditorHash. -
4117 const QIndexEditorHash indexEditorHashCopy = indexEditorHash;
executed (the execution status of this line is deduced): const QIndexEditorHash indexEditorHashCopy = indexEditorHash;
-
4118 QIndexEditorHash::const_iterator it = indexEditorHashCopy.constBegin();
executed (the execution status of this line is deduced): QIndexEditorHash::const_iterator it = indexEditorHashCopy.constBegin();
-
4119 for (; it != indexEditorHashCopy.constEnd(); ++it) {
evaluated: it != indexEditorHashCopy.constEnd()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:697
2-697
4120 QWidget *editor = it.value().widget.data();
executed (the execution status of this line is deduced): QWidget *editor = it.value().widget.data();
-
4121 const QModelIndex index = it.key();
executed (the execution status of this line is deduced): const QModelIndex index = it.key();
-
4122 if (it.value().isStatic || !editor || !index.isValid() ||
partially evaluated: it.value().isStatic
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
partially evaluated: !editor
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
partially evaluated: !index.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
4123 (checkIndexes
evaluated: checkIndexes
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1
4124 && (index.row() < tl.row() || index.row() > br.row()
partially evaluated: index.row() < tl.row()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
partially evaluated: index.row() > br.row()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
4125 || index.column() < tl.column() || index.column() > br.column()
partially evaluated: index.column() < tl.column()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
partially evaluated: index.column() > br.column()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
4126 || index.parent() != parent)))
partially evaluated: index.parent() != parent
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
4127 continue;
never executed: continue;
0
4128 -
4129 QAbstractItemDelegate *delegate = delegateForIndex(index);
executed (the execution status of this line is deduced): QAbstractItemDelegate *delegate = delegateForIndex(index);
-
4130 if (delegate) {
partially evaluated: delegate
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
4131 delegate->setEditorData(editor, index);
executed (the execution status of this line is deduced): delegate->setEditorData(editor, index);
-
4132 }
executed: }
Execution Count:2
2
4133 }
executed: }
Execution Count:2
2
4134}
executed: }
Execution Count:697
697
4135 -
4136/*! -
4137 \internal -
4138 -
4139 In DND if something has been moved then this is called. -
4140 Typically this means you should "remove" the selected item or row, -
4141 but the behavior is view dependant (table just clears the selected indexes for example). -
4142 -
4143 Either remove the selected rows or clear them -
4144*/ -
4145void QAbstractItemViewPrivate::clearOrRemove() -
4146{ -
4147#ifndef QT_NO_DRAGANDDROP -
4148 const QItemSelection selection = selectionModel->selection();
never executed (the execution status of this line is deduced): const QItemSelection selection = selectionModel->selection();
-
4149 QList<QItemSelectionRange>::const_iterator it = selection.constBegin();
never executed (the execution status of this line is deduced): QList<QItemSelectionRange>::const_iterator it = selection.constBegin();
-
4150 -
4151 if (!overwrite) {
never evaluated: !overwrite
0
4152 for (; it != selection.constEnd(); ++it) {
never evaluated: it != selection.constEnd()
0
4153 QModelIndex parent = (*it).parent();
never executed (the execution status of this line is deduced): QModelIndex parent = (*it).parent();
-
4154 if ((*it).left() != 0)
never evaluated: (*it).left() != 0
0
4155 continue;
never executed: continue;
0
4156 if ((*it).right() != (model->columnCount(parent) - 1))
never evaluated: (*it).right() != (model->columnCount(parent) - 1)
0
4157 continue;
never executed: continue;
0
4158 int count = (*it).bottom() - (*it).top() + 1;
never executed (the execution status of this line is deduced): int count = (*it).bottom() - (*it).top() + 1;
-
4159 model->removeRows((*it).top(), count, parent);
never executed (the execution status of this line is deduced): model->removeRows((*it).top(), count, parent);
-
4160 }
never executed: }
0
4161 } else {
never executed: }
0
4162 // we can't remove the rows so reset the items (i.e. the view is like a table) -
4163 QModelIndexList list = selection.indexes();
never executed (the execution status of this line is deduced): QModelIndexList list = selection.indexes();
-
4164 for (int i=0; i < list.size(); ++i) {
never evaluated: i < list.size()
0
4165 QModelIndex index = list.at(i);
never executed (the execution status of this line is deduced): QModelIndex index = list.at(i);
-
4166 QMap<int, QVariant> roles = model->itemData(index);
never executed (the execution status of this line is deduced): QMap<int, QVariant> roles = model->itemData(index);
-
4167 for (QMap<int, QVariant>::Iterator it = roles.begin(); it != roles.end(); ++it)
never evaluated: it != roles.end()
0
4168 it.value() = QVariant();
never executed: it.value() = QVariant();
0
4169 model->setItemData(index, roles);
never executed (the execution status of this line is deduced): model->setItemData(index, roles);
-
4170 }
never executed: }
0
4171 }
never executed: }
0
4172#endif -
4173} -
4174 -
4175/*! -
4176 \internal -
4177 -
4178 When persistent aeditor gets/loses focus, we need to check -
4179 and setcorrectly the current index. -
4180*/ -
4181void QAbstractItemViewPrivate::checkPersistentEditorFocus() -
4182{ -
4183 Q_Q(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemView * const q = q_func();
-
4184 if (QWidget *widget = QApplication::focusWidget()) {
evaluated: QWidget *widget = QApplication::focusWidget()
TRUEFALSE
yes
Evaluation Count:97
yes
Evaluation Count:43
43-97
4185 if (persistent.contains(widget)) {
evaluated: persistent.contains(widget)
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:95
2-95
4186 //a persistent editor has gained the focus -
4187 QModelIndex index = indexForEditor(widget);
executed (the execution status of this line is deduced): QModelIndex index = indexForEditor(widget);
-
4188 if (selectionModel->currentIndex() != index)
partially evaluated: selectionModel->currentIndex() != index
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
4189 q->setCurrentIndex(index);
executed: q->setCurrentIndex(index);
Execution Count:2
2
4190 }
executed: }
Execution Count:2
2
4191 }
executed: }
Execution Count:97
97
4192}
executed: }
Execution Count:140
140
4193 -
4194 -
4195const QEditorInfo & QAbstractItemViewPrivate::editorForIndex(const QModelIndex &index) const -
4196{ -
4197 static QEditorInfo nullInfo; -
4198 -
4199 // do not try to search to avoid slow implicit cast from QModelIndex to QPersistentModelIndex -
4200 if (indexEditorHash.isEmpty())
evaluated: indexEditorHash.isEmpty()
TRUEFALSE
yes
Evaluation Count:161408
yes
Evaluation Count:432
432-161408
4201 return nullInfo;
executed: return nullInfo;
Execution Count:161408
161408
4202 -
4203 QIndexEditorHash::const_iterator it = indexEditorHash.find(index);
executed (the execution status of this line is deduced): QIndexEditorHash::const_iterator it = indexEditorHash.find(index);
-
4204 if (it == indexEditorHash.end())
evaluated: it == indexEditorHash.end()
TRUEFALSE
yes
Evaluation Count:239
yes
Evaluation Count:193
193-239
4205 return nullInfo;
executed: return nullInfo;
Execution Count:239
239
4206 -
4207 return it.value();
executed: return it.value();
Execution Count:193
193
4208} -
4209 -
4210QModelIndex QAbstractItemViewPrivate::indexForEditor(QWidget *editor) const -
4211{ -
4212 // do not try to search to avoid slow implicit cast from QModelIndex to QPersistentModelIndex -
4213 if (indexEditorHash.isEmpty())
partially evaluated: indexEditorHash.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:154
0-154
4214 return QModelIndex();
never executed: return QModelIndex();
0
4215 -
4216 QEditorIndexHash::const_iterator it = editorIndexHash.find(editor);
executed (the execution status of this line is deduced): QEditorIndexHash::const_iterator it = editorIndexHash.find(editor);
-
4217 if (it == editorIndexHash.end())
partially evaluated: it == editorIndexHash.end()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:154
0-154
4218 return QModelIndex();
never executed: return QModelIndex();
0
4219 -
4220 return it.value();
executed: return it.value();
Execution Count:154
154
4221} -
4222 -
4223void QAbstractItemViewPrivate::removeEditor(QWidget *editor) -
4224{ -
4225 QEditorIndexHash::iterator it = editorIndexHash.find(editor);
executed (the execution status of this line is deduced): QEditorIndexHash::iterator it = editorIndexHash.find(editor);
-
4226 if (it != editorIndexHash.end())
evaluated: it != editorIndexHash.end()
TRUEFALSE
yes
Evaluation Count:94
yes
Evaluation Count:9
9-94
4227 { -
4228 indexEditorHash.remove(it.value());
executed (the execution status of this line is deduced): indexEditorHash.remove(it.value());
-
4229 editorIndexHash.erase(it);
executed (the execution status of this line is deduced): editorIndexHash.erase(it);
-
4230 }
executed: }
Execution Count:94
94
4231}
executed: }
Execution Count:103
103
4232 -
4233void QAbstractItemViewPrivate::addEditor(const QModelIndex &index, QWidget *editor, bool isStatic) -
4234{ -
4235 editorIndexHash.insert(editor, index);
executed (the execution status of this line is deduced): editorIndexHash.insert(editor, index);
-
4236 indexEditorHash.insert(index, QEditorInfo(editor, isStatic));
executed (the execution status of this line is deduced): indexEditorHash.insert(index, QEditorInfo(editor, isStatic));
-
4237}
executed: }
Execution Count:132
132
4238 -
4239bool QAbstractItemViewPrivate::sendDelegateEvent(const QModelIndex &index, QEvent *event) const -
4240{ -
4241 Q_Q(const QAbstractItemView);
executed (the execution status of this line is deduced): const QAbstractItemView * const q = q_func();
-
4242 QModelIndex buddy = model->buddy(index);
executed (the execution status of this line is deduced): QModelIndex buddy = model->buddy(index);
-
4243 QStyleOptionViewItem options = viewOptions();
executed (the execution status of this line is deduced): QStyleOptionViewItem options = viewOptions();
-
4244 options.rect = q->visualRect(buddy);
executed (the execution status of this line is deduced): options.rect = q->visualRect(buddy);
-
4245 options.state |= (buddy == q->currentIndex() ? QStyle::State_HasFocus : QStyle::State_None);
evaluated: buddy == q->currentIndex()
TRUEFALSE
yes
Evaluation Count:2479
yes
Evaluation Count:5464
2479-5464
4246 QAbstractItemDelegate *delegate = delegateForIndex(index);
executed (the execution status of this line is deduced): QAbstractItemDelegate *delegate = delegateForIndex(index);
-
4247 return (event && delegate && delegate->editorEvent(event, model, options, buddy));
executed: return (event && delegate && delegate->editorEvent(event, model, options, buddy));
Execution Count:7943
7943
4248} -
4249 -
4250bool QAbstractItemViewPrivate::openEditor(const QModelIndex &index, QEvent *event) -
4251{ -
4252 Q_Q(QAbstractItemView);
executed (the execution status of this line is deduced): QAbstractItemView * const q = q_func();
-
4253 -
4254 QModelIndex buddy = model->buddy(index);
executed (the execution status of this line is deduced): QModelIndex buddy = model->buddy(index);
-
4255 QStyleOptionViewItem options = viewOptions();
executed (the execution status of this line is deduced): QStyleOptionViewItem options = viewOptions();
-
4256 options.rect = q->visualRect(buddy);
executed (the execution status of this line is deduced): options.rect = q->visualRect(buddy);
-
4257 options.state |= (buddy == q->currentIndex() ? QStyle::State_HasFocus : QStyle::State_None);
evaluated: buddy == q->currentIndex()
TRUEFALSE
yes
Evaluation Count:46
yes
Evaluation Count:21
21-46
4258 -
4259 QWidget *w = editor(buddy, options);
executed (the execution status of this line is deduced): QWidget *w = editor(buddy, options);
-
4260 if (!w)
partially evaluated: !w
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:67
0-67
4261 return false;
never executed: return false;
0
4262 -
4263 q->setState(QAbstractItemView::EditingState);
executed (the execution status of this line is deduced): q->setState(QAbstractItemView::EditingState);
-
4264 w->show();
executed (the execution status of this line is deduced): w->show();
-
4265 w->setFocus();
executed (the execution status of this line is deduced): w->setFocus();
-
4266 -
4267 if (event)
partially evaluated: event
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:67
0-67
4268 QApplication::sendEvent(w->focusProxy() ? w->focusProxy() : w, event);
never executed: QApplication::sendEvent(w->focusProxy() ? w->focusProxy() : w, event);
0
4269 -
4270 return true;
executed: return true;
Execution Count:67
67
4271} -
4272 -
4273/* -
4274 \internal -
4275 -
4276 returns the pair QRect/QModelIndex that should be painted on the viewports's rect -
4277*/ -
4278 -
4279QItemViewPaintPairs QAbstractItemViewPrivate::draggablePaintPairs(const QModelIndexList &indexes, QRect *r) const -
4280{ -
4281 Q_ASSERT(r);
never executed (the execution status of this line is deduced): qt_noop();
-
4282 Q_Q(const QAbstractItemView);
never executed (the execution status of this line is deduced): const QAbstractItemView * const q = q_func();
-
4283 QRect &rect = *r;
never executed (the execution status of this line is deduced): QRect &rect = *r;
-
4284 const QRect viewportRect = viewport->rect();
never executed (the execution status of this line is deduced): const QRect viewportRect = viewport->rect();
-
4285 QItemViewPaintPairs ret;
never executed (the execution status of this line is deduced): QItemViewPaintPairs ret;
-
4286 for (int i = 0; i < indexes.count(); ++i) {
never evaluated: i < indexes.count()
0
4287 const QModelIndex &index = indexes.at(i);
never executed (the execution status of this line is deduced): const QModelIndex &index = indexes.at(i);
-
4288 const QRect current = q->visualRect(index);
never executed (the execution status of this line is deduced): const QRect current = q->visualRect(index);
-
4289 if (current.intersects(viewportRect)) {
never evaluated: current.intersects(viewportRect)
0
4290 ret += qMakePair(current, index);
never executed (the execution status of this line is deduced): ret += qMakePair(current, index);
-
4291 rect |= current;
never executed (the execution status of this line is deduced): rect |= current;
-
4292 }
never executed: }
0
4293 }
never executed: }
0
4294 rect &= viewportRect;
never executed (the execution status of this line is deduced): rect &= viewportRect;
-
4295 return ret;
never executed: return ret;
0
4296} -
4297 -
4298QPixmap QAbstractItemViewPrivate::renderToPixmap(const QModelIndexList &indexes, QRect *r) const -
4299{ -
4300 Q_ASSERT(r);
never executed (the execution status of this line is deduced): qt_noop();
-
4301 QItemViewPaintPairs paintPairs = draggablePaintPairs(indexes, r);
never executed (the execution status of this line is deduced): QItemViewPaintPairs paintPairs = draggablePaintPairs(indexes, r);
-
4302 if (paintPairs.isEmpty())
never evaluated: paintPairs.isEmpty()
0
4303 return QPixmap();
never executed: return QPixmap();
0
4304 QPixmap pixmap(r->size());
never executed (the execution status of this line is deduced): QPixmap pixmap(r->size());
-
4305 pixmap.fill(Qt::transparent);
never executed (the execution status of this line is deduced): pixmap.fill(Qt::transparent);
-
4306 QPainter painter(&pixmap);
never executed (the execution status of this line is deduced): QPainter painter(&pixmap);
-
4307 QStyleOptionViewItem option = viewOptions();
never executed (the execution status of this line is deduced): QStyleOptionViewItem option = viewOptions();
-
4308 option.state |= QStyle::State_Selected;
never executed (the execution status of this line is deduced): option.state |= QStyle::State_Selected;
-
4309 for (int j = 0; j < paintPairs.count(); ++j) {
never evaluated: j < paintPairs.count()
0
4310 option.rect = paintPairs.at(j).first.translated(-r->topLeft());
never executed (the execution status of this line is deduced): option.rect = paintPairs.at(j).first.translated(-r->topLeft());
-
4311 const QModelIndex &current = paintPairs.at(j).second;
never executed (the execution status of this line is deduced): const QModelIndex &current = paintPairs.at(j).second;
-
4312 adjustViewOptionsForIndex(&option, current);
never executed (the execution status of this line is deduced): adjustViewOptionsForIndex(&option, current);
-
4313 delegateForIndex(current)->paint(&painter, option, current);
never executed (the execution status of this line is deduced): delegateForIndex(current)->paint(&painter, option, current);
-
4314 }
never executed: }
0
4315 return pixmap;
never executed: return pixmap;
0
4316} -
4317 -
4318void QAbstractItemViewPrivate::selectAll(QItemSelectionModel::SelectionFlags command) -
4319{ -
4320 if (!selectionModel)
evaluated: !selectionModel
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:6
6-12
4321 return;
executed: return;
Execution Count:12
12
4322 -
4323 QItemSelection selection;
executed (the execution status of this line is deduced): QItemSelection selection;
-
4324 QModelIndex tl = model->index(0, 0, root);
executed (the execution status of this line is deduced): QModelIndex tl = model->index(0, 0, root);
-
4325 QModelIndex br = model->index(model->rowCount(root) - 1,
executed (the execution status of this line is deduced): QModelIndex br = model->index(model->rowCount(root) - 1,
-
4326 model->columnCount(root) - 1,
executed (the execution status of this line is deduced): model->columnCount(root) - 1,
-
4327 root);
executed (the execution status of this line is deduced): root);
-
4328 selection.append(QItemSelectionRange(tl, br));
executed (the execution status of this line is deduced): selection.append(QItemSelectionRange(tl, br));
-
4329 selectionModel->select(selection, command);
executed (the execution status of this line is deduced): selectionModel->select(selection, command);
-
4330}
executed: }
Execution Count:6
6
4331 -
4332QModelIndexList QAbstractItemViewPrivate::selectedDraggableIndexes() const -
4333{ -
4334 Q_Q(const QAbstractItemView);
executed (the execution status of this line is deduced): const QAbstractItemView * const q = q_func();
-
4335 QModelIndexList indexes = q->selectedIndexes();
executed (the execution status of this line is deduced): QModelIndexList indexes = q->selectedIndexes();
-
4336 for(int i = indexes.count() - 1 ; i >= 0; --i) {
partially evaluated: i >= 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
4337 if (!isIndexDragEnabled(indexes.at(i)))
never evaluated: !isIndexDragEnabled(indexes.at(i))
0
4338 indexes.removeAt(i);
never executed: indexes.removeAt(i);
0
4339 }
never executed: }
0
4340 return indexes;
executed: return indexes;
Execution Count:4
4
4341} -
4342 -
4343 -
4344QT_END_NAMESPACE -
4345 -
4346#include "moc_qabstractitemview.cpp" -
4347 -
4348#endif // QT_NO_ITEMVIEWS -
4349 -
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial