Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | | - |
7 | | - |
8 | | - |
9 | | - |
10 | QAbstractItemViewPrivate::QAbstractItemViewPrivate() | - |
11 | : model(QAbstractItemModelPrivate::staticEmptyModel()), | - |
12 | itemDelegate(0), | - |
13 | selectionModel(0), | - |
14 | ctrlDragSelectionFlag(QItemSelectionModel::NoUpdate), | - |
15 | noSelectionOnMousePress(false), | - |
16 | selectionMode(QAbstractItemView::ExtendedSelection), | - |
17 | selectionBehavior(QAbstractItemView::SelectItems), | - |
18 | currentlyCommittingEditor(0), | - |
19 | pressedModifiers(Qt::NoModifier), | - |
20 | pressedPosition(QPoint(-1, -1)), | - |
21 | pressedAlreadySelected(false), | - |
22 | viewportEnteredNeeded(false), | - |
23 | state(QAbstractItemView::NoState), | - |
24 | stateBeforeAnimation(QAbstractItemView::NoState), | - |
25 | editTriggers(QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed), | - |
26 | lastTrigger(QAbstractItemView::NoEditTriggers), | - |
27 | tabKeyNavigation(false), | - |
28 | | - |
29 | showDropIndicator(true), | - |
30 | dragEnabled(false), | - |
31 | dragDropMode(QAbstractItemView::NoDragDrop), | - |
32 | overwrite(false), | - |
33 | dropIndicatorPosition(QAbstractItemView::OnItem), | - |
34 | defaultDropAction(Qt::IgnoreAction), | - |
35 | | - |
36 | autoScroll(true), | - |
37 | autoScrollMargin(16), | - |
38 | autoScrollCount(0), | - |
39 | shouldScrollToCurrentOnShow(false), | - |
40 | shouldClearStatusTip(false), | - |
41 | alternatingColors(false), | - |
42 | textElideMode(Qt::ElideRight), | - |
43 | verticalScrollMode(QAbstractItemView::ScrollPerItem), | - |
44 | horizontalScrollMode(QAbstractItemView::ScrollPerItem), | - |
45 | currentIndexSet(false), | - |
46 | wrapItemText(false), | - |
47 | delayedPendingLayout(true), | - |
48 | moveCursorUpdatedView(false) | - |
49 | { | - |
50 | keyboardInputTime.invalidate(); | - |
51 | } executed: } Execution Count:4015 | 4015 |
52 | | - |
53 | QAbstractItemViewPrivate::~QAbstractItemViewPrivate() | - |
54 | { | - |
55 | } | - |
56 | | - |
57 | void QAbstractItemViewPrivate::init() | - |
58 | { | - |
59 | QAbstractItemView * const q = q_func(); | - |
60 | q->setItemDelegate(new QStyledItemDelegate(q)); | - |
61 | | - |
62 | vbar->setRange(0, 0); | - |
63 | hbar->setRange(0, 0); | - |
64 | | - |
65 | QObject::connect(vbar, "2""actionTriggered(int)", | - |
66 | q, "1""verticalScrollbarAction(int)"); | - |
67 | QObject::connect(hbar, "2""actionTriggered(int)", | - |
68 | q, "1""horizontalScrollbarAction(int)"); | - |
69 | QObject::connect(vbar, "2""valueChanged(int)", | - |
70 | q, "1""verticalScrollbarValueChanged(int)"); | - |
71 | QObject::connect(hbar, "2""valueChanged(int)", | - |
72 | q, "1""horizontalScrollbarValueChanged(int)"); | - |
73 | | - |
74 | viewport->setBackgroundRole(QPalette::Base); | - |
75 | | - |
76 | q->setAttribute(Qt::WA_InputMethodEnabled); | - |
77 | } executed: } Execution Count:4015 | 4015 |
78 | | - |
79 | void QAbstractItemViewPrivate::setHoverIndex(const QPersistentModelIndex &index) | - |
80 | { | - |
81 | QAbstractItemView * const q = q_func(); | - |
82 | if (hover == index) evaluated: hover == index yes Evaluation Count:131 | yes Evaluation Count:6286 |
| 131-6286 |
83 | return; executed: return; Execution Count:131 | 131 |
84 | | - |
85 | if (selectionBehavior != QAbstractItemView::SelectRows) { evaluated: selectionBehavior != QAbstractItemView::SelectRows yes Evaluation Count:6271 | yes Evaluation Count:15 |
| 15-6271 |
86 | q->update(hover); | - |
87 | q->update(index); | - |
88 | } else { executed: } Execution Count:6271 | 6271 |
89 | QRect oldHoverRect = q->visualRect(hover); | - |
90 | QRect newHoverRect = q->visualRect(index); | - |
91 | viewport->update(QRect(0, newHoverRect.y(), viewport->width(), newHoverRect.height())); | - |
92 | viewport->update(QRect(0, oldHoverRect.y(), viewport->width(), oldHoverRect.height())); | - |
93 | } executed: } Execution Count:15 | 15 |
94 | hover = index; | - |
95 | } executed: } Execution Count:6286 | 6286 |
96 | | - |
97 | void QAbstractItemViewPrivate::checkMouseMove(const QPersistentModelIndex &index) | - |
98 | { | - |
99 | | - |
100 | QAbstractItemView * const q = q_func(); | - |
101 | setHoverIndex(index); | - |
102 | if (viewportEnteredNeeded || enteredIndex != index) { evaluated: viewportEnteredNeeded yes Evaluation Count:56 | yes Evaluation Count:6361 |
evaluated: enteredIndex != index yes Evaluation Count:6232 | yes Evaluation Count:129 |
| 56-6361 |
103 | viewportEnteredNeeded = false; | - |
104 | | - |
105 | if (index.isValid()) { evaluated: index.isValid() yes Evaluation Count:6280 | yes Evaluation Count:8 |
| 8-6280 |
106 | q->entered(index); | - |
107 | | - |
108 | QString statustip = model->data(index, Qt::StatusTipRole).toString(); | - |
109 | if (parent && (shouldClearStatusTip || !statustip.isEmpty())) { evaluated: parent yes Evaluation Count:28 | yes Evaluation Count:6252 |
partially evaluated: shouldClearStatusTip no Evaluation Count:0 | yes Evaluation Count:28 |
partially evaluated: !statustip.isEmpty() no Evaluation Count:0 | yes Evaluation Count:28 |
| 0-6252 |
110 | QStatusTipEvent tip(statustip); | - |
111 | QApplication::sendEvent(parent, &tip); | - |
112 | shouldClearStatusTip = !statustip.isEmpty(); | - |
113 | } | 0 |
114 | | - |
115 | } else { executed: } Execution Count:6280 | 6280 |
116 | | - |
117 | if (parent && shouldClearStatusTip) { evaluated: parent yes Evaluation Count:1 | yes Evaluation Count:7 |
partially evaluated: shouldClearStatusTip no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-7 |
118 | QString emptyString; | - |
119 | QStatusTipEvent tip( emptyString ); | - |
120 | QApplication::sendEvent(parent, &tip); | - |
121 | } | 0 |
122 | | - |
123 | q->viewportEntered(); | - |
124 | } executed: } Execution Count:8 | 8 |
125 | enteredIndex = index; | - |
126 | } executed: } Execution Count:6288 | 6288 |
127 | } executed: } Execution Count:6417 | 6417 |
128 | | - |
129 | | - |
130 | | - |
131 | | - |
132 | void QAbstractItemViewPrivate::_q_scrollerStateChanged() | - |
133 | { | - |
134 | QAbstractItemView * const q = q_func(); | - |
135 | | - |
136 | if (QScroller *scroller = QScroller::scroller(viewport)) { never evaluated: QScroller *scroller = QScroller::scroller(viewport) | 0 |
137 | switch (scroller->state()) { | - |
138 | case QScroller::Pressed: | - |
139 | | - |
140 | if (q->selectionModel()) { never evaluated: q->selectionModel() | 0 |
141 | oldSelection = q->selectionModel()->selection(); | - |
142 | oldCurrent = q->selectionModel()->currentIndex(); | - |
143 | } | 0 |
144 | break; | 0 |
145 | | - |
146 | case QScroller::Dragging: | - |
147 | | - |
148 | if (q->selectionModel()) { never evaluated: q->selectionModel() | 0 |
149 | q->selectionModel()->select(oldSelection, QItemSelectionModel::ClearAndSelect); | - |
150 | q->selectionModel()->setCurrentIndex(oldCurrent, QItemSelectionModel::NoUpdate); | - |
151 | } | 0 |
152 | | - |
153 | | - |
154 | default: code before this statement never executed: default: | 0 |
155 | oldSelection = QItemSelection(); | - |
156 | oldCurrent = QModelIndex(); | - |
157 | break; | 0 |
158 | } | - |
159 | } | 0 |
160 | } | 0 |
161 | QAbstractItemView::QAbstractItemView(QWidget *parent) | - |
162 | : QAbstractScrollArea(*(new QAbstractItemViewPrivate), parent) | - |
163 | { | - |
164 | d_func()->init(); | - |
165 | } | 0 |
166 | | - |
167 | | - |
168 | | - |
169 | | - |
170 | QAbstractItemView::QAbstractItemView(QAbstractItemViewPrivate &dd, QWidget *parent) | - |
171 | : QAbstractScrollArea(dd, parent) | - |
172 | { | - |
173 | d_func()->init(); | - |
174 | } executed: } Execution Count:4015 | 4015 |
175 | | - |
176 | | - |
177 | | - |
178 | | - |
179 | QAbstractItemView::~QAbstractItemView() | - |
180 | { | - |
181 | QAbstractItemViewPrivate * const d = d_func(); | - |
182 | | - |
183 | d->delayedReset.stop(); | - |
184 | d->updateTimer.stop(); | - |
185 | d->delayedEditing.stop(); | - |
186 | d->delayedAutoScroll.stop(); | - |
187 | d->autoScrollTimer.stop(); | - |
188 | d->delayedLayout.stop(); | - |
189 | d->fetchMoreTimer.stop(); | - |
190 | } executed: } Execution Count:3389 | 3389 |
191 | void QAbstractItemView::setModel(QAbstractItemModel *model) | - |
192 | { | - |
193 | QAbstractItemViewPrivate * const d = d_func(); | - |
194 | if (model == d->model) evaluated: model == d->model yes Evaluation Count:1640 | yes Evaluation Count:4131 |
| 1640-4131 |
195 | return; executed: return; Execution Count:1640 | 1640 |
196 | if (d->model && d->model != QAbstractItemModelPrivate::staticEmptyModel()) { partially evaluated: d->model yes Evaluation Count:4131 | no Evaluation Count:0 |
evaluated: d->model != QAbstractItemModelPrivate::staticEmptyModel() yes Evaluation Count:32 | yes Evaluation Count:4099 |
| 0-4131 |
197 | disconnect(d->model, "2""destroyed()", | - |
198 | this, "1""_q_modelDestroyed()"); | - |
199 | disconnect(d->model, "2""dataChanged(QModelIndex,QModelIndex,QVector<int>)", | - |
200 | this, "1""dataChanged(QModelIndex,QModelIndex,QVector<int>)"); | - |
201 | disconnect(d->model, "2""headerDataChanged(Qt::Orientation,int,int)", | - |
202 | this, "1""_q_headerDataChanged()"); | - |
203 | disconnect(d->model, "2""rowsInserted(QModelIndex,int,int)", | - |
204 | this, "1""rowsInserted(QModelIndex,int,int)"); | - |
205 | disconnect(d->model, "2""rowsAboutToBeRemoved(QModelIndex,int,int)", | - |
206 | this, "1""rowsAboutToBeRemoved(QModelIndex,int,int)"); | - |
207 | disconnect(d->model, "2""rowsRemoved(QModelIndex,int,int)", | - |
208 | this, "1""_q_rowsRemoved(QModelIndex,int,int)"); | - |
209 | disconnect(d->model, "2""rowsMoved(QModelIndex,int,int,QModelIndex,int)", | - |
210 | this, "1""_q_rowsMoved(QModelIndex,int,int,QModelIndex,int)"); | - |
211 | disconnect(d->model, "2""rowsInserted(QModelIndex,int,int)", | - |
212 | this, "1""_q_rowsInserted(QModelIndex,int,int)"); | - |
213 | disconnect(d->model, "2""columnsAboutToBeRemoved(QModelIndex,int,int)", | - |
214 | this, "1""_q_columnsAboutToBeRemoved(QModelIndex,int,int)"); | - |
215 | disconnect(d->model, "2""columnsRemoved(QModelIndex,int,int)", | - |
216 | this, "1""_q_columnsRemoved(QModelIndex,int,int)"); | - |
217 | disconnect(d->model, "2""columnsInserted(QModelIndex,int,int)", | - |
218 | this, "1""_q_columnsInserted(QModelIndex,int,int)"); | - |
219 | disconnect(d->model, "2""columnsMoved(QModelIndex,int,int,QModelIndex,int)", | - |
220 | this, "1""_q_columnsMoved(QModelIndex,int,int,QModelIndex,int)"); | - |
221 | | - |
222 | disconnect(d->model, "2""modelReset()", this, "1""reset()"); | - |
223 | disconnect(d->model, "2""layoutChanged()", this, "1""_q_layoutChanged()"); | - |
224 | } executed: } Execution Count:32 | 32 |
225 | d->model = (model ? model : QAbstractItemModelPrivate::staticEmptyModel()); evaluated: model yes Evaluation Count:4121 | yes Evaluation Count:10 |
| 10-4121 |
226 | | - |
227 | | - |
228 | qt_noop(); | - |
229 | | - |
230 | | - |
231 | | - |
232 | qt_noop(); | - |
233 | | - |
234 | | - |
235 | | - |
236 | if (d->model != QAbstractItemModelPrivate::staticEmptyModel()) { evaluated: d->model != QAbstractItemModelPrivate::staticEmptyModel() yes Evaluation Count:4121 | yes Evaluation Count:10 |
| 10-4121 |
237 | connect(d->model, "2""destroyed()", | - |
238 | this, "1""_q_modelDestroyed()"); | - |
239 | connect(d->model, "2""dataChanged(QModelIndex,QModelIndex,QVector<int>)", | - |
240 | this, "1""dataChanged(QModelIndex,QModelIndex,QVector<int>)"); | - |
241 | connect(d->model, "2""headerDataChanged(Qt::Orientation,int,int)", | - |
242 | this, "1""_q_headerDataChanged()"); | - |
243 | connect(d->model, "2""rowsInserted(QModelIndex,int,int)", | - |
244 | this, "1""rowsInserted(QModelIndex,int,int)"); | - |
245 | connect(d->model, "2""rowsInserted(QModelIndex,int,int)", | - |
246 | this, "1""_q_rowsInserted(QModelIndex,int,int)"); | - |
247 | connect(d->model, "2""rowsAboutToBeRemoved(QModelIndex,int,int)", | - |
248 | this, "1""rowsAboutToBeRemoved(QModelIndex,int,int)"); | - |
249 | connect(d->model, "2""rowsRemoved(QModelIndex,int,int)", | - |
250 | this, "1""_q_rowsRemoved(QModelIndex,int,int)"); | - |
251 | connect(d->model, "2""rowsMoved(QModelIndex,int,int,QModelIndex,int)", | - |
252 | this, "1""_q_rowsMoved(QModelIndex,int,int,QModelIndex,int)"); | - |
253 | connect(d->model, "2""columnsAboutToBeRemoved(QModelIndex,int,int)", | - |
254 | this, "1""_q_columnsAboutToBeRemoved(QModelIndex,int,int)"); | - |
255 | connect(d->model, "2""columnsRemoved(QModelIndex,int,int)", | - |
256 | this, "1""_q_columnsRemoved(QModelIndex,int,int)"); | - |
257 | connect(d->model, "2""columnsInserted(QModelIndex,int,int)", | - |
258 | this, "1""_q_columnsInserted(QModelIndex,int,int)"); | - |
259 | connect(d->model, "2""columnsMoved(QModelIndex,int,int,QModelIndex,int)", | - |
260 | this, "1""_q_columnsMoved(QModelIndex,int,int,QModelIndex,int)"); | - |
261 | | - |
262 | connect(d->model, "2""modelReset()", this, "1""reset()"); | - |
263 | connect(d->model, "2""layoutChanged()", this, "1""_q_layoutChanged()"); | - |
264 | } executed: } Execution Count:4121 | 4121 |
265 | | - |
266 | QItemSelectionModel *selection_model = new QItemSelectionModel(d->model, this); | - |
267 | connect(d->model, "2""destroyed()", selection_model, "1""deleteLater()"); | - |
268 | setSelectionModel(selection_model); | - |
269 | | - |
270 | reset(); | - |
271 | } executed: } Execution Count:4131 | 4131 |
272 | | - |
273 | | - |
274 | | - |
275 | | - |
276 | QAbstractItemModel *QAbstractItemView::model() const | - |
277 | { | - |
278 | const QAbstractItemViewPrivate * const d = d_func(); | - |
279 | return (d->model == QAbstractItemModelPrivate::staticEmptyModel() ? 0 : d->model); executed: return (d->model == QAbstractItemModelPrivate::staticEmptyModel() ? 0 : d->model); Execution Count:143236 | 143236 |
280 | } | - |
281 | void QAbstractItemView::setSelectionModel(QItemSelectionModel *selectionModel) | - |
282 | { | - |
283 | | - |
284 | qt_noop(); | - |
285 | QAbstractItemViewPrivate * const d = d_func(); | - |
286 | | - |
287 | if (selectionModel->model() != d->model) { partially evaluated: selectionModel->model() != d->model no Evaluation Count:0 | yes Evaluation Count:6194 |
| 0-6194 |
288 | QMessageLogger("itemviews/qabstractitemview.cpp", 775, __PRETTY_FUNCTION__).warning("QAbstractItemView::setSelectionModel() failed: " | - |
289 | "Trying to set a selection model, which works on " | - |
290 | "a different model than the view."); | - |
291 | return; | 0 |
292 | } | - |
293 | | - |
294 | if (d->selectionModel) { evaluated: d->selectionModel yes Evaluation Count:2349 | yes Evaluation Count:3845 |
| 2349-3845 |
295 | disconnect(d->selectionModel, "2""selectionChanged(QItemSelection,QItemSelection)", | - |
296 | this, "1""selectionChanged(QItemSelection,QItemSelection)"); | - |
297 | disconnect(d->selectionModel, "2""currentChanged(QModelIndex,QModelIndex)", | - |
298 | this, "1""currentChanged(QModelIndex,QModelIndex)"); | - |
299 | } executed: } Execution Count:2349 | 2349 |
300 | | - |
301 | d->selectionModel = selectionModel; | - |
302 | | - |
303 | if (d->selectionModel) { partially evaluated: d->selectionModel yes Evaluation Count:6194 | no Evaluation Count:0 |
| 0-6194 |
304 | connect(d->selectionModel, "2""selectionChanged(QItemSelection,QItemSelection)", | - |
305 | this, "1""selectionChanged(QItemSelection,QItemSelection)"); | - |
306 | connect(d->selectionModel, "2""currentChanged(QModelIndex,QModelIndex)", | - |
307 | this, "1""currentChanged(QModelIndex,QModelIndex)"); | - |
308 | } executed: } Execution Count:6194 | 6194 |
309 | } executed: } Execution Count:6194 | 6194 |
310 | | - |
311 | | - |
312 | | - |
313 | | - |
314 | | - |
315 | | - |
316 | QItemSelectionModel* QAbstractItemView::selectionModel() const | - |
317 | { | - |
318 | const QAbstractItemViewPrivate * const d = d_func(); | - |
319 | return d->selectionModel; executed: return d->selectionModel; Execution Count:7716 | 7716 |
320 | } | - |
321 | void QAbstractItemView::setItemDelegate(QAbstractItemDelegate *delegate) | - |
322 | { | - |
323 | QAbstractItemViewPrivate * const d = d_func(); | - |
324 | if (delegate == d->itemDelegate) partially evaluated: delegate == d->itemDelegate no Evaluation Count:0 | yes Evaluation Count:4793 |
| 0-4793 |
325 | return; | 0 |
326 | | - |
327 | if (d->itemDelegate) { evaluated: d->itemDelegate yes Evaluation Count:299 | yes Evaluation Count:4494 |
| 299-4494 |
328 | if (d->delegateRefCount(d->itemDelegate) == 1) { partially evaluated: d->delegateRefCount(d->itemDelegate) == 1 yes Evaluation Count:299 | no Evaluation Count:0 |
| 0-299 |
329 | disconnect(d->itemDelegate, "2""closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)", | - |
330 | this, "1""closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)"); | - |
331 | disconnect(d->itemDelegate, "2""commitData(QWidget*)", this, "1""commitData(QWidget*)"); | - |
332 | disconnect(d->itemDelegate, "2""sizeHintChanged(QModelIndex)", this, "1""doItemsLayout()"); | - |
333 | } executed: } Execution Count:299 | 299 |
334 | } executed: } Execution Count:299 | 299 |
335 | | - |
336 | if (delegate) { evaluated: delegate yes Evaluation Count:4788 | yes Evaluation Count:5 |
| 5-4788 |
337 | if (d->delegateRefCount(delegate) == 0) { partially evaluated: d->delegateRefCount(delegate) == 0 yes Evaluation Count:4788 | no Evaluation Count:0 |
| 0-4788 |
338 | connect(delegate, "2""closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)", | - |
339 | this, "1""closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)"); | - |
340 | connect(delegate, "2""commitData(QWidget*)", this, "1""commitData(QWidget*)"); | - |
341 | connect(delegate, "2""sizeHintChanged(QModelIndex)", this, "1""doItemsLayout()", Qt::QueuedConnection); | - |
342 | } executed: } Execution Count:4788 | 4788 |
343 | } executed: } Execution Count:4788 | 4788 |
344 | d->itemDelegate = delegate; | - |
345 | viewport()->update(); | - |
346 | } executed: } Execution Count:4793 | 4793 |
347 | | - |
348 | | - |
349 | | - |
350 | | - |
351 | | - |
352 | | - |
353 | | - |
354 | QAbstractItemDelegate *QAbstractItemView::itemDelegate() const | - |
355 | { | - |
356 | return d_func()->itemDelegate; executed: return d_func()->itemDelegate; Execution Count:1157 | 1157 |
357 | } | - |
358 | | - |
359 | | - |
360 | | - |
361 | | - |
362 | QVariant QAbstractItemView::inputMethodQuery(Qt::InputMethodQuery query) const | - |
363 | { | - |
364 | const QModelIndex current = currentIndex(); | - |
365 | if (!current.isValid() || query != Qt::ImCursorRectangle) evaluated: !current.isValid() yes Evaluation Count:37 | yes Evaluation Count:2 |
partially evaluated: query != Qt::ImCursorRectangle yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-37 |
366 | return QAbstractScrollArea::inputMethodQuery(query); executed: return QAbstractScrollArea::inputMethodQuery(query); Execution Count:39 | 39 |
367 | return visualRect(current); never executed: return visualRect(current); | 0 |
368 | } | - |
369 | void QAbstractItemView::setItemDelegateForRow(int row, QAbstractItemDelegate *delegate) | - |
370 | { | - |
371 | QAbstractItemViewPrivate * const d = d_func(); | - |
372 | if (QAbstractItemDelegate *rowDelegate = d->rowDelegates.value(row, 0)) { evaluated: QAbstractItemDelegate *rowDelegate = d->rowDelegates.value(row, 0) yes Evaluation Count:3 | yes Evaluation Count:5 |
| 3-5 |
373 | if (d->delegateRefCount(rowDelegate) == 1) { partially evaluated: d->delegateRefCount(rowDelegate) == 1 yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
374 | disconnect(rowDelegate, "2""closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)", | - |
375 | this, "1""closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)"); | - |
376 | disconnect(rowDelegate, "2""commitData(QWidget*)", this, "1""commitData(QWidget*)"); | - |
377 | } executed: } Execution Count:3 | 3 |
378 | d->rowDelegates.remove(row); | - |
379 | } executed: } Execution Count:3 | 3 |
380 | if (delegate) { evaluated: delegate yes Evaluation Count:7 | yes Evaluation Count:1 |
| 1-7 |
381 | if (d->delegateRefCount(delegate) == 0) { partially evaluated: d->delegateRefCount(delegate) == 0 yes Evaluation Count:7 | no Evaluation Count:0 |
| 0-7 |
382 | connect(delegate, "2""closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)", | - |
383 | this, "1""closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)"); | - |
384 | connect(delegate, "2""commitData(QWidget*)", this, "1""commitData(QWidget*)"); | - |
385 | } executed: } Execution Count:7 | 7 |
386 | d->rowDelegates.insert(row, delegate); | - |
387 | } executed: } Execution Count:7 | 7 |
388 | viewport()->update(); | - |
389 | } executed: } Execution Count:8 | 8 |
390 | QAbstractItemDelegate *QAbstractItemView::itemDelegateForRow(int row) const | - |
391 | { | - |
392 | const QAbstractItemViewPrivate * const d = d_func(); | - |
393 | return d->rowDelegates.value(row, 0); executed: return d->rowDelegates.value(row, 0); Execution Count:7 | 7 |
394 | } | - |
395 | void QAbstractItemView::setItemDelegateForColumn(int column, QAbstractItemDelegate *delegate) | - |
396 | { | - |
397 | QAbstractItemViewPrivate * const d = d_func(); | - |
398 | if (QAbstractItemDelegate *columnDelegate = d->columnDelegates.value(column, 0)) { evaluated: QAbstractItemDelegate *columnDelegate = d->columnDelegates.value(column, 0) yes Evaluation Count:3 | yes Evaluation Count:9 |
| 3-9 |
399 | if (d->delegateRefCount(columnDelegate) == 1) { evaluated: d->delegateRefCount(columnDelegate) == 1 yes Evaluation Count:2 | yes Evaluation Count:1 |
| 1-2 |
400 | disconnect(columnDelegate, "2""closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)", | - |
401 | this, "1""closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)"); | - |
402 | disconnect(columnDelegate, "2""commitData(QWidget*)", this, "1""commitData(QWidget*)"); | - |
403 | } executed: } Execution Count:2 | 2 |
404 | d->columnDelegates.remove(column); | - |
405 | } executed: } Execution Count:3 | 3 |
406 | if (delegate) { evaluated: delegate yes Evaluation Count:11 | yes Evaluation Count:1 |
| 1-11 |
407 | if (d->delegateRefCount(delegate) == 0) { evaluated: d->delegateRefCount(delegate) == 0 yes Evaluation Count:5 | yes Evaluation Count:6 |
| 5-6 |
408 | connect(delegate, "2""closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)", | - |
409 | this, "1""closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)"); | - |
410 | connect(delegate, "2""commitData(QWidget*)", this, "1""commitData(QWidget*)"); | - |
411 | } executed: } Execution Count:5 | 5 |
412 | d->columnDelegates.insert(column, delegate); | - |
413 | } executed: } Execution Count:11 | 11 |
414 | viewport()->update(); | - |
415 | } executed: } Execution Count:12 | 12 |
416 | QAbstractItemDelegate *QAbstractItemView::itemDelegateForColumn(int column) const | - |
417 | { | - |
418 | const QAbstractItemViewPrivate * const d = d_func(); | - |
419 | return d->columnDelegates.value(column, 0); executed: return d->columnDelegates.value(column, 0); Execution Count:7 | 7 |
420 | } | - |
421 | | - |
422 | | - |
423 | | - |
424 | | - |
425 | | - |
426 | QAbstractItemDelegate *QAbstractItemView::itemDelegate(const QModelIndex &index) const | - |
427 | { | - |
428 | const QAbstractItemViewPrivate * const d = d_func(); | - |
429 | return d->delegateForIndex(index); executed: return d->delegateForIndex(index); Execution Count:45527 | 45527 |
430 | } | - |
431 | void QAbstractItemView::setSelectionMode(SelectionMode mode) | - |
432 | { | - |
433 | QAbstractItemViewPrivate * const d = d_func(); | - |
434 | d->selectionMode = mode; | - |
435 | } executed: } Execution Count:2670 | 2670 |
436 | | - |
437 | QAbstractItemView::SelectionMode QAbstractItemView::selectionMode() const | - |
438 | { | - |
439 | const QAbstractItemViewPrivate * const d = d_func(); | - |
440 | return d->selectionMode; executed: return d->selectionMode; Execution Count:206 | 206 |
441 | } | - |
442 | void QAbstractItemView::setSelectionBehavior(QAbstractItemView::SelectionBehavior behavior) | - |
443 | { | - |
444 | QAbstractItemViewPrivate * const d = d_func(); | - |
445 | d->selectionBehavior = behavior; | - |
446 | } executed: } Execution Count:1234 | 1234 |
447 | | - |
448 | QAbstractItemView::SelectionBehavior QAbstractItemView::selectionBehavior() const | - |
449 | { | - |
450 | const QAbstractItemViewPrivate * const d = d_func(); | - |
451 | return d->selectionBehavior; executed: return d->selectionBehavior; Execution Count:4100 | 4100 |
452 | } | - |
453 | void QAbstractItemView::setCurrentIndex(const QModelIndex &index) | - |
454 | { | - |
455 | QAbstractItemViewPrivate * const d = d_func(); | - |
456 | if (d->selectionModel && (!index.isValid() || d->isIndexEnabled(index))) { evaluated: d->selectionModel yes Evaluation Count:1471 | yes Evaluation Count:22 |
evaluated: !index.isValid() yes Evaluation Count:20 | yes Evaluation Count:1451 |
evaluated: d->isIndexEnabled(index) yes Evaluation Count:1437 | yes Evaluation Count:14 |
| 14-1471 |
457 | QItemSelectionModel::SelectionFlags command = selectionCommand(index, 0); | - |
458 | d->selectionModel->setCurrentIndex(index, command); | - |
459 | d->currentIndexSet = true; | - |
460 | if ((command & QItemSelectionModel::Current) == 0) evaluated: (command & QItemSelectionModel::Current) == 0 yes Evaluation Count:1453 | yes Evaluation Count:4 |
| 4-1453 |
461 | d->pressedPosition = visualRect(currentIndex()).center() + d->offset(); executed: d->pressedPosition = visualRect(currentIndex()).center() + d->offset(); Execution Count:1453 | 1453 |
462 | } executed: } Execution Count:1457 | 1457 |
463 | } executed: } Execution Count:1493 | 1493 |
464 | | - |
465 | | - |
466 | | - |
467 | | - |
468 | | - |
469 | | - |
470 | QModelIndex QAbstractItemView::currentIndex() const | - |
471 | { | - |
472 | const QAbstractItemViewPrivate * const d = d_func(); | - |
473 | return d->selectionModel ? d->selectionModel->currentIndex() : QModelIndex(); executed: return d->selectionModel ? d->selectionModel->currentIndex() : QModelIndex(); Execution Count:28231 | 28231 |
474 | } | - |
475 | void QAbstractItemView::reset() | - |
476 | { | - |
477 | QAbstractItemViewPrivate * const d = d_func(); | - |
478 | d->delayedReset.stop(); | - |
479 | 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;})) { | - |
480 | if (info.widget) partially evaluated: info.widget yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
481 | 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 |
482 | } executed: } Execution Count:1 | 1 |
483 | d->editorIndexHash.clear(); | - |
484 | d->indexEditorHash.clear(); | - |
485 | d->persistent.clear(); | - |
486 | d->currentIndexSet = false; | - |
487 | setState(NoState); | - |
488 | setRootIndex(QModelIndex()); | - |
489 | if (d->selectionModel) evaluated: d->selectionModel yes Evaluation Count:6097 | yes Evaluation Count:22 |
| 22-6097 |
490 | d->selectionModel->reset(); executed: d->selectionModel->reset(); Execution Count:6097 | 6097 |
491 | | - |
492 | if (QAccessible::isActive()) { evaluated: QAccessible::isActive() yes Evaluation Count:20 | yes Evaluation Count:6099 |
| 20-6099 |
493 | QAccessibleTableModelChangeEvent accessibleEvent(this, QAccessibleTableModelChangeEvent::ModelReset); | - |
494 | QAccessible::updateAccessibility(&accessibleEvent); | - |
495 | } executed: } Execution Count:20 | 20 |
496 | | - |
497 | } executed: } Execution Count:6119 | 6119 |
498 | | - |
499 | | - |
500 | | - |
501 | | - |
502 | | - |
503 | | - |
504 | void QAbstractItemView::setRootIndex(const QModelIndex &index) | - |
505 | { | - |
506 | QAbstractItemViewPrivate * const d = d_func(); | - |
507 | if (index.isValid() && index.model() != d->model) { evaluated: index.isValid() yes Evaluation Count:736 | yes Evaluation Count:6255 |
partially evaluated: index.model() != d->model no Evaluation Count:0 | yes Evaluation Count:736 |
| 0-6255 |
508 | QMessageLogger("itemviews/qabstractitemview.cpp", 1122, __PRETTY_FUNCTION__).warning("QAbstractItemView::setRootIndex failed : index must be from the currently set model"); | - |
509 | return; | 0 |
510 | } | - |
511 | d->root = index; | - |
512 | d->doDelayedItemsLayout(); | - |
513 | } executed: } Execution Count:6991 | 6991 |
514 | | - |
515 | | - |
516 | | - |
517 | | - |
518 | | - |
519 | | - |
520 | | - |
521 | QModelIndex QAbstractItemView::rootIndex() const | - |
522 | { | - |
523 | return QModelIndex(d_func()->root); executed: return QModelIndex(d_func()->root); Execution Count:3964 | 3964 |
524 | } | - |
525 | void QAbstractItemView::selectAll() | - |
526 | { | - |
527 | QAbstractItemViewPrivate * const d = d_func(); | - |
528 | SelectionMode mode = d->selectionMode; | - |
529 | if (mode == MultiSelection || mode == ExtendedSelection) partially evaluated: mode == MultiSelection no Evaluation Count:0 | yes Evaluation Count:29 |
evaluated: mode == ExtendedSelection yes Evaluation Count:9 | yes Evaluation Count:20 |
| 0-29 |
530 | d->selectAll(QItemSelectionModel::ClearAndSelect | 9 |
531 | |d->selectionBehaviorFlags()); executed: d->selectAll(QItemSelectionModel::ClearAndSelect |d->selectionBehaviorFlags()); Execution Count:9 | 9 |
532 | else if (mode != SingleSelection) partially evaluated: mode != SingleSelection yes Evaluation Count:20 | no Evaluation Count:0 |
| 0-20 |
533 | 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 |
534 | } | - |
535 | void QAbstractItemView::edit(const QModelIndex &index) | - |
536 | { | - |
537 | QAbstractItemViewPrivate * const d = d_func(); | - |
538 | if (!d->isIndexValid(index)) evaluated: !d->isIndexValid(index) yes Evaluation Count:8 | yes Evaluation Count:49 |
| 8-49 |
539 | QMessageLogger("itemviews/qabstractitemview.cpp", 1174, __PRETTY_FUNCTION__).warning("edit: index was invalid"); executed: QMessageLogger("itemviews/qabstractitemview.cpp", 1174, __PRETTY_FUNCTION__).warning("edit: index was invalid"); Execution Count:8 | 8 |
540 | if (!edit(index, AllEditTriggers, 0)) evaluated: !edit(index, AllEditTriggers, 0) yes Evaluation Count:20 | yes Evaluation Count:37 |
| 20-37 |
541 | QMessageLogger("itemviews/qabstractitemview.cpp", 1176, __PRETTY_FUNCTION__).warning("edit: editing failed"); executed: QMessageLogger("itemviews/qabstractitemview.cpp", 1176, __PRETTY_FUNCTION__).warning("edit: editing failed"); Execution Count:20 | 20 |
542 | } executed: } Execution Count:57 | 57 |
543 | | - |
544 | | - |
545 | | - |
546 | | - |
547 | | - |
548 | | - |
549 | void QAbstractItemView::clearSelection() | - |
550 | { | - |
551 | QAbstractItemViewPrivate * const d = d_func(); | - |
552 | if (d->selectionModel) evaluated: d->selectionModel yes Evaluation Count:10 | yes Evaluation Count:22 |
| 10-22 |
553 | d->selectionModel->clearSelection(); executed: d->selectionModel->clearSelection(); Execution Count:10 | 10 |
554 | } executed: } Execution Count:32 | 32 |
555 | | - |
556 | | - |
557 | | - |
558 | | - |
559 | | - |
560 | | - |
561 | | - |
562 | void QAbstractItemView::doItemsLayout() | - |
563 | { | - |
564 | QAbstractItemViewPrivate * const d = d_func(); | - |
565 | d->interruptDelayedItemsLayout(); | - |
566 | updateGeometries(); | - |
567 | d->viewport->update(); | - |
568 | } executed: } Execution Count:8572 | 8572 |
569 | void QAbstractItemView::setEditTriggers(EditTriggers actions) | - |
570 | { | - |
571 | QAbstractItemViewPrivate * const d = d_func(); | - |
572 | d->editTriggers = actions; | - |
573 | } executed: } Execution Count:1446 | 1446 |
574 | | - |
575 | QAbstractItemView::EditTriggers QAbstractItemView::editTriggers() const | - |
576 | { | - |
577 | const QAbstractItemViewPrivate * const d = d_func(); | - |
578 | return d->editTriggers; executed: return d->editTriggers; Execution Count:217 | 217 |
579 | } | - |
580 | void QAbstractItemView::setVerticalScrollMode(ScrollMode mode) | - |
581 | { | - |
582 | QAbstractItemViewPrivate * const d = d_func(); | - |
583 | if (mode == d->verticalScrollMode) evaluated: mode == d->verticalScrollMode yes Evaluation Count:110 | yes Evaluation Count:92 |
| 92-110 |
584 | return; executed: return; Execution Count:110 | 110 |
585 | QModelIndex topLeft = indexAt(QPoint(0, 0)); | - |
586 | d->verticalScrollMode = mode; | - |
587 | updateGeometries(); | - |
588 | scrollTo(topLeft, QAbstractItemView::PositionAtTop); | - |
589 | } executed: } Execution Count:92 | 92 |
590 | | - |
591 | QAbstractItemView::ScrollMode QAbstractItemView::verticalScrollMode() const | - |
592 | { | - |
593 | const QAbstractItemViewPrivate * const d = d_func(); | - |
594 | return d->verticalScrollMode; executed: return d->verticalScrollMode; Execution Count:46216 | 46216 |
595 | } | - |
596 | void QAbstractItemView::setHorizontalScrollMode(ScrollMode mode) | - |
597 | { | - |
598 | QAbstractItemViewPrivate * const d = d_func(); | - |
599 | d->horizontalScrollMode = mode; | - |
600 | updateGeometries(); | - |
601 | } executed: } Execution Count:864 | 864 |
602 | | - |
603 | QAbstractItemView::ScrollMode QAbstractItemView::horizontalScrollMode() const | - |
604 | { | - |
605 | const QAbstractItemViewPrivate * const d = d_func(); | - |
606 | return d->horizontalScrollMode; executed: return d->horizontalScrollMode; Execution Count:44642 | 44642 |
607 | } | - |
608 | void QAbstractItemView::setDragDropOverwriteMode(bool overwrite) | - |
609 | { | - |
610 | QAbstractItemViewPrivate * const d = d_func(); | - |
611 | d->overwrite = overwrite; | - |
612 | } executed: } Execution Count:2 | 2 |
613 | | - |
614 | bool QAbstractItemView::dragDropOverwriteMode() const | - |
615 | { | - |
616 | const QAbstractItemViewPrivate * const d = d_func(); | - |
617 | return d->overwrite; executed: return d->overwrite; Execution Count:4 | 4 |
618 | } | - |
619 | void QAbstractItemView::setAutoScroll(bool enable) | - |
620 | { | - |
621 | QAbstractItemViewPrivate * const d = d_func(); | - |
622 | d->autoScroll = enable; | - |
623 | } executed: } Execution Count:54 | 54 |
624 | | - |
625 | bool QAbstractItemView::hasAutoScroll() const | - |
626 | { | - |
627 | const QAbstractItemViewPrivate * const d = d_func(); | - |
628 | return d->autoScroll; executed: return d->autoScroll; Execution Count:56 | 56 |
629 | } | - |
630 | void QAbstractItemView::setAutoScrollMargin(int margin) | - |
631 | { | - |
632 | QAbstractItemViewPrivate * const d = d_func(); | - |
633 | d->autoScrollMargin = margin; | - |
634 | } executed: } Execution Count:2 | 2 |
635 | | - |
636 | int QAbstractItemView::autoScrollMargin() const | - |
637 | { | - |
638 | const QAbstractItemViewPrivate * const d = d_func(); | - |
639 | return d->autoScrollMargin; executed: return d->autoScrollMargin; Execution Count:3 | 3 |
640 | } | - |
641 | | - |
642 | | - |
643 | | - |
644 | | - |
645 | | - |
646 | | - |
647 | void QAbstractItemView::setTabKeyNavigation(bool enable) | - |
648 | { | - |
649 | QAbstractItemViewPrivate * const d = d_func(); | - |
650 | d->tabKeyNavigation = enable; | - |
651 | } executed: } Execution Count:84 | 84 |
652 | | - |
653 | bool QAbstractItemView::tabKeyNavigation() const | - |
654 | { | - |
655 | const QAbstractItemViewPrivate * const d = d_func(); | - |
656 | return d->tabKeyNavigation; executed: return d->tabKeyNavigation; Execution Count:55 | 55 |
657 | } | - |
658 | void QAbstractItemView::setDropIndicatorShown(bool enable) | - |
659 | { | - |
660 | QAbstractItemViewPrivate * const d = d_func(); | - |
661 | d->showDropIndicator = enable; | - |
662 | } executed: } Execution Count:52 | 52 |
663 | | - |
664 | bool QAbstractItemView::showDropIndicator() const | - |
665 | { | - |
666 | const QAbstractItemViewPrivate * const d = d_func(); | - |
667 | return d->showDropIndicator; executed: return d->showDropIndicator; Execution Count:53 | 53 |
668 | } | - |
669 | void QAbstractItemView::setDragEnabled(bool enable) | - |
670 | { | - |
671 | QAbstractItemViewPrivate * const d = d_func(); | - |
672 | d->dragEnabled = enable; | - |
673 | } executed: } Execution Count:1700 | 1700 |
674 | | - |
675 | bool QAbstractItemView::dragEnabled() const | - |
676 | { | - |
677 | const QAbstractItemViewPrivate * const d = d_func(); | - |
678 | return d->dragEnabled; executed: return d->dragEnabled; Execution Count:174 | 174 |
679 | } | - |
680 | void QAbstractItemView::setDragDropMode(DragDropMode behavior) | - |
681 | { | - |
682 | QAbstractItemViewPrivate * const d = d_func(); | - |
683 | d->dragDropMode = behavior; | - |
684 | setDragEnabled(behavior == DragOnly || behavior == DragDrop || behavior == InternalMove); | - |
685 | setAcceptDrops(behavior == DropOnly || behavior == DragDrop || behavior == InternalMove); | - |
686 | } executed: } Execution Count:592 | 592 |
687 | | - |
688 | QAbstractItemView::DragDropMode QAbstractItemView::dragDropMode() const | - |
689 | { | - |
690 | const QAbstractItemViewPrivate * const d = d_func(); | - |
691 | DragDropMode setBehavior = d->dragDropMode; | - |
692 | if (!dragEnabled() && !acceptDrops()) evaluated: !dragEnabled() yes Evaluation Count:45 | yes Evaluation Count:16 |
evaluated: !acceptDrops() yes Evaluation Count:38 | yes Evaluation Count:7 |
| 7-45 |
693 | return NoDragDrop; executed: return NoDragDrop; Execution Count:38 | 38 |
694 | | - |
695 | if (dragEnabled() && !acceptDrops()) evaluated: dragEnabled() yes Evaluation Count:16 | yes Evaluation Count:7 |
evaluated: !acceptDrops() yes Evaluation Count:7 | yes Evaluation Count:9 |
| 7-16 |
696 | return DragOnly; executed: return DragOnly; Execution Count:7 | 7 |
697 | | - |
698 | if (!dragEnabled() && acceptDrops()) evaluated: !dragEnabled() yes Evaluation Count:7 | yes Evaluation Count:9 |
partially evaluated: acceptDrops() yes Evaluation Count:7 | no Evaluation Count:0 |
| 0-9 |
699 | return DropOnly; executed: return DropOnly; Execution Count:7 | 7 |
700 | | - |
701 | if (dragEnabled() && acceptDrops()) { partially evaluated: dragEnabled() yes Evaluation Count:9 | no Evaluation Count:0 |
partially evaluated: acceptDrops() yes Evaluation Count:9 | no Evaluation Count:0 |
| 0-9 |
702 | if (setBehavior == InternalMove) evaluated: setBehavior == InternalMove yes Evaluation Count:2 | yes Evaluation Count:7 |
| 2-7 |
703 | return setBehavior; executed: return setBehavior; Execution Count:2 | 2 |
704 | else | - |
705 | return DragDrop; executed: return DragDrop; Execution Count:7 | 7 |
706 | } | - |
707 | | - |
708 | return NoDragDrop; never executed: return NoDragDrop; | 0 |
709 | } | - |
710 | void QAbstractItemView::setDefaultDropAction(Qt::DropAction dropAction) | - |
711 | { | - |
712 | QAbstractItemViewPrivate * const d = d_func(); | - |
713 | d->defaultDropAction = dropAction; | - |
714 | } | 0 |
715 | | - |
716 | Qt::DropAction QAbstractItemView::defaultDropAction() const | - |
717 | { | - |
718 | const QAbstractItemViewPrivate * const d = d_func(); | - |
719 | return d->defaultDropAction; never executed: return d->defaultDropAction; | 0 |
720 | } | - |
721 | void QAbstractItemView::setAlternatingRowColors(bool enable) | - |
722 | { | - |
723 | QAbstractItemViewPrivate * const d = d_func(); | - |
724 | d->alternatingColors = enable; | - |
725 | if (isVisible()) evaluated: isVisible() yes Evaluation Count:16 | yes Evaluation Count:41 |
| 16-41 |
726 | d->viewport->update(); executed: d->viewport->update(); Execution Count:16 | 16 |
727 | } executed: } Execution Count:57 | 57 |
728 | | - |
729 | bool QAbstractItemView::alternatingRowColors() const | - |
730 | { | - |
731 | const QAbstractItemViewPrivate * const d = d_func(); | - |
732 | return d->alternatingColors; executed: return d->alternatingColors; Execution Count:58 | 58 |
733 | } | - |
734 | void QAbstractItemView::setIconSize(const QSize &size) | - |
735 | { | - |
736 | QAbstractItemViewPrivate * const d = d_func(); | - |
737 | if (size == d->iconSize) evaluated: size == d->iconSize yes Evaluation Count:1 | yes Evaluation Count:271 |
| 1-271 |
738 | return; executed: return; Execution Count:1 | 1 |
739 | d->iconSize = size; | - |
740 | d->doDelayedItemsLayout(); | - |
741 | } executed: } Execution Count:271 | 271 |
742 | | - |
743 | QSize QAbstractItemView::iconSize() const | - |
744 | { | - |
745 | const QAbstractItemViewPrivate * const d = d_func(); | - |
746 | return d->iconSize; executed: return d->iconSize; Execution Count:95 | 95 |
747 | } | - |
748 | void QAbstractItemView::setTextElideMode(Qt::TextElideMode mode) | - |
749 | { | - |
750 | QAbstractItemViewPrivate * const d = d_func(); | - |
751 | d->textElideMode = mode; | - |
752 | } executed: } Execution Count:528 | 528 |
753 | | - |
754 | Qt::TextElideMode QAbstractItemView::textElideMode() const | - |
755 | { | - |
756 | return d_func()->textElideMode; executed: return d_func()->textElideMode; Execution Count:1 | 1 |
757 | } | - |
758 | | - |
759 | | - |
760 | | - |
761 | | - |
762 | bool QAbstractItemView::focusNextPrevChild(bool next) | - |
763 | { | - |
764 | QAbstractItemViewPrivate * const d = d_func(); | - |
765 | if (d->tabKeyNavigation && isEnabled() && d->viewport->isEnabled()) { evaluated: d->tabKeyNavigation yes Evaluation Count:14 | yes Evaluation Count:6 |
partially evaluated: isEnabled() yes Evaluation Count:14 | no Evaluation Count:0 |
partially evaluated: d->viewport->isEnabled() yes Evaluation Count:14 | no Evaluation Count:0 |
| 0-14 |
766 | QKeyEvent event(QEvent::KeyPress, next ? Qt::Key_Tab : Qt::Key_Backtab, Qt::NoModifier); | - |
767 | keyPressEvent(&event); | - |
768 | if (event.isAccepted()) evaluated: event.isAccepted() yes Evaluation Count:10 | yes Evaluation Count:4 |
| 4-10 |
769 | return true; executed: return true; Execution Count:10 | 10 |
770 | } executed: } Execution Count:4 | 4 |
771 | return QAbstractScrollArea::focusNextPrevChild(next); executed: return QAbstractScrollArea::focusNextPrevChild(next); Execution Count:10 | 10 |
772 | } | - |
773 | | - |
774 | | - |
775 | | - |
776 | | - |
777 | bool QAbstractItemView::event(QEvent *event) | - |
778 | { | - |
779 | QAbstractItemViewPrivate * const d = d_func(); | - |
780 | switch (event->type()) { | - |
781 | case QEvent::Paint: | - |
782 | | - |
783 | | - |
784 | d->executePostedLayout(); | - |
785 | break; executed: break; Execution Count:722 | 722 |
786 | case QEvent::Show: | - |
787 | d->executePostedLayout(); | - |
788 | if (d->shouldScrollToCurrentOnShow) { evaluated: d->shouldScrollToCurrentOnShow yes Evaluation Count:75 | yes Evaluation Count:1257 |
| 75-1257 |
789 | d->shouldScrollToCurrentOnShow = false; | - |
790 | const QModelIndex current = currentIndex(); | - |
791 | if (current.isValid() && (d->state == QAbstractItemView::EditingState || d->autoScroll)) evaluated: current.isValid() yes Evaluation Count:33 | yes Evaluation Count:42 |
partially evaluated: d->state == QAbstractItemView::EditingState no Evaluation Count:0 | yes Evaluation Count:33 |
partially evaluated: d->autoScroll yes Evaluation Count:33 | no Evaluation Count:0 |
| 0-42 |
792 | scrollTo(current); executed: scrollTo(current); Execution Count:33 | 33 |
793 | } executed: } Execution Count:75 | 75 |
794 | break; executed: break; Execution Count:1332 | 1332 |
795 | case QEvent::LocaleChange: | - |
796 | viewport()->update(); | - |
797 | break; executed: break; Execution Count:6 | 6 |
798 | case QEvent::LayoutDirectionChange: | - |
799 | case QEvent::ApplicationLayoutDirectionChange: | - |
800 | updateGeometries(); | - |
801 | break; executed: break; Execution Count:24 | 24 |
802 | case QEvent::StyleChange: | - |
803 | doItemsLayout(); | - |
804 | break; executed: break; Execution Count:10 | 10 |
805 | case QEvent::FocusOut: | - |
806 | d->checkPersistentEditorFocus(); | - |
807 | break; executed: break; Execution Count:102 | 102 |
808 | case QEvent::FontChange: | - |
809 | d->doDelayedItemsLayout(); | - |
810 | break; executed: break; Execution Count:4 | 4 |
811 | default: | - |
812 | break; executed: break; Execution Count:51646 | 51646 |
813 | } | - |
814 | return QAbstractScrollArea::event(event); executed: return QAbstractScrollArea::event(event); Execution Count:53846 | 53846 |
815 | } | - |
816 | bool QAbstractItemView::viewportEvent(QEvent *event) | - |
817 | { | - |
818 | QAbstractItemViewPrivate * const d = d_func(); | - |
819 | switch (event->type()) { | - |
820 | case QEvent::HoverMove: | - |
821 | case QEvent::HoverEnter: | - |
822 | d->setHoverIndex(indexAt(static_cast<QHoverEvent*>(event)->pos())); | - |
823 | break; | 0 |
824 | case QEvent::HoverLeave: | - |
825 | d->setHoverIndex(QModelIndex()); | - |
826 | break; | 0 |
827 | case QEvent::Enter: | - |
828 | d->viewportEnteredNeeded = true; | - |
829 | break; executed: break; Execution Count:264 | 264 |
830 | case QEvent::Leave: | - |
831 | | - |
832 | if (d->shouldClearStatusTip && d->parent) { partially evaluated: d->shouldClearStatusTip no Evaluation Count:0 | yes Evaluation Count:22 |
never evaluated: d->parent | 0-22 |
833 | QString empty; | - |
834 | QStatusTipEvent tip(empty); | - |
835 | QApplication::sendEvent(d->parent, &tip); | - |
836 | d->shouldClearStatusTip = false; | - |
837 | } | 0 |
838 | | - |
839 | d->enteredIndex = QModelIndex(); | - |
840 | break; executed: break; Execution Count:22 | 22 |
841 | case QEvent::ToolTip: | - |
842 | case QEvent::QueryWhatsThis: | - |
843 | case QEvent::WhatsThis: { | - |
844 | QHelpEvent *he = static_cast<QHelpEvent*>(event); | - |
845 | const QModelIndex index = indexAt(he->pos()); | - |
846 | QStyleOptionViewItem option = d->viewOptions(); | - |
847 | option.rect = visualRect(index); | - |
848 | option.state |= (index == currentIndex() ? QStyle::State_HasFocus : QStyle::State_None); never evaluated: index == currentIndex() | 0 |
849 | | - |
850 | QAbstractItemDelegate *delegate = d->delegateForIndex(index); | - |
851 | if (!delegate) never evaluated: !delegate | 0 |
852 | return false; never executed: return false; | 0 |
853 | return delegate->helpEvent(he, this, option, index); never executed: return delegate->helpEvent(he, this, option, index); | 0 |
854 | } | - |
855 | case QEvent::FontChange: | - |
856 | d->doDelayedItemsLayout(); | - |
857 | break; executed: break; Execution Count:1 | 1 |
858 | case QEvent::WindowActivate: | - |
859 | case QEvent::WindowDeactivate: | - |
860 | d->viewport->update(); | - |
861 | break; executed: break; Execution Count:824 | 824 |
862 | case QEvent::ScrollPrepare: | - |
863 | executeDelayedItemsLayout(); | - |
864 | | - |
865 | connect(QScroller::scroller(d->viewport), "2""stateChanged(QScroller::State)", this, "1""_q_scrollerStateChanged()", Qt::UniqueConnection); | - |
866 | | - |
867 | break; | 0 |
868 | | - |
869 | default: | - |
870 | break; executed: break; Execution Count:35341 | 35341 |
871 | } | - |
872 | return QAbstractScrollArea::viewportEvent(event); executed: return QAbstractScrollArea::viewportEvent(event); Execution Count:36452 | 36452 |
873 | } | - |
874 | | - |
875 | | - |
876 | | - |
877 | | - |
878 | | - |
879 | | - |
880 | void QAbstractItemView::mousePressEvent(QMouseEvent *event) | - |
881 | { | - |
882 | QAbstractItemViewPrivate * const d = d_func(); | - |
883 | d->delayedAutoScroll.stop(); | - |
884 | QPoint pos = event->pos(); | - |
885 | QPersistentModelIndex index = indexAt(pos); | - |
886 | | - |
887 | if (!d->selectionModel partially evaluated: !d->selectionModel no Evaluation Count:0 | yes Evaluation Count:899 |
| 0-899 |
888 | || (d->state == EditingState && d->hasEditor(index))) evaluated: d->state == EditingState yes Evaluation Count:1 | yes Evaluation Count:898 |
partially evaluated: d->hasEditor(index) no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-898 |
889 | return; | 0 |
890 | | - |
891 | d->pressedAlreadySelected = d->selectionModel->isSelected(index); | - |
892 | d->pressedIndex = index; | - |
893 | d->pressedModifiers = event->modifiers(); | - |
894 | QItemSelectionModel::SelectionFlags command = selectionCommand(index, event); | - |
895 | d->noSelectionOnMousePress = command == QItemSelectionModel::NoUpdate || !index.isValid(); evaluated: command == QItemSelectionModel::NoUpdate yes Evaluation Count:24 | yes Evaluation Count:875 |
evaluated: !index.isValid() yes Evaluation Count:6 | yes Evaluation Count:869 |
| 6-875 |
896 | QPoint offset = d->offset(); | - |
897 | if ((command & QItemSelectionModel::Current) == 0) evaluated: (command & QItemSelectionModel::Current) == 0 yes Evaluation Count:808 | yes Evaluation Count:91 |
| 91-808 |
898 | d->pressedPosition = pos + offset; executed: d->pressedPosition = pos + offset; Execution Count:808 | 808 |
899 | else if (!indexAt(d->pressedPosition - offset).isValid()) evaluated: !indexAt(d->pressedPosition - offset).isValid() yes Evaluation Count:1 | yes Evaluation Count:90 |
| 1-90 |
900 | d->pressedPosition = visualRect(currentIndex()).center() + offset; executed: d->pressedPosition = visualRect(currentIndex()).center() + offset; Execution Count:1 | 1 |
901 | | - |
902 | if (edit(index, NoEditTriggers, event)) evaluated: edit(index, NoEditTriggers, event) yes Evaluation Count:3 | yes Evaluation Count:896 |
| 3-896 |
903 | return; executed: return; Execution Count:3 | 3 |
904 | | - |
905 | if (index.isValid() && d->isIndexEnabled(index)) { evaluated: index.isValid() yes Evaluation Count:888 | yes Evaluation Count:8 |
evaluated: d->isIndexEnabled(index) yes Evaluation Count:705 | yes Evaluation Count:183 |
| 8-888 |
906 | | - |
907 | | - |
908 | bool autoScroll = d->autoScroll; | - |
909 | d->autoScroll = false; | - |
910 | d->selectionModel->setCurrentIndex(index, QItemSelectionModel::NoUpdate); | - |
911 | d->autoScroll = autoScroll; | - |
912 | QRect rect(d->pressedPosition - offset, pos); | - |
913 | if (command.testFlag(QItemSelectionModel::Toggle)) { evaluated: command.testFlag(QItemSelectionModel::Toggle) yes Evaluation Count:62 | yes Evaluation Count:643 |
| 62-643 |
914 | command &= ~QItemSelectionModel::Toggle; | - |
915 | d->ctrlDragSelectionFlag = d->selectionModel->isSelected(index) ? QItemSelectionModel::Deselect : QItemSelectionModel::Select; evaluated: d->selectionModel->isSelected(index) yes Evaluation Count:40 | yes Evaluation Count:22 |
| 22-40 |
916 | command |= d->ctrlDragSelectionFlag; | - |
917 | } executed: } Execution Count:62 | 62 |
918 | setSelection(rect, command); | - |
919 | | - |
920 | | - |
921 | pressed(index); | - |
922 | if (d->autoScroll) { partially evaluated: d->autoScroll yes Evaluation Count:705 | no Evaluation Count:0 |
| 0-705 |
923 | | - |
924 | | - |
925 | d->delayedAutoScroll.start(QApplication::doubleClickInterval()+100, this); | - |
926 | } executed: } Execution Count:705 | 705 |
927 | | - |
928 | } else { executed: } Execution Count:705 | 705 |
929 | | - |
930 | d->selectionModel->select(QModelIndex(), QItemSelectionModel::Select); | - |
931 | } executed: } Execution Count:191 | 191 |
932 | } | - |
933 | | - |
934 | | - |
935 | | - |
936 | | - |
937 | | - |
938 | | - |
939 | void QAbstractItemView::mouseMoveEvent(QMouseEvent *event) | - |
940 | { | - |
941 | QAbstractItemViewPrivate * const d = d_func(); | - |
942 | QPoint topLeft; | - |
943 | QPoint bottomRight = event->pos(); | - |
944 | | - |
945 | if (state() == ExpandingState || state() == CollapsingState) partially evaluated: state() == ExpandingState no Evaluation Count:0 | yes Evaluation Count:26 |
partially evaluated: state() == CollapsingState no Evaluation Count:0 | yes Evaluation Count:26 |
| 0-26 |
946 | return; | 0 |
947 | | - |
948 | | - |
949 | if (state() == DraggingState) { partially evaluated: state() == DraggingState no Evaluation Count:0 | yes Evaluation Count:26 |
| 0-26 |
950 | topLeft = d->pressedPosition - d->offset(); | - |
951 | if ((topLeft - bottomRight).manhattanLength() > QApplication::startDragDistance()) { never evaluated: (topLeft - bottomRight).manhattanLength() > QApplication::startDragDistance() | 0 |
952 | d->pressedIndex = QModelIndex(); | - |
953 | startDrag(d->model->supportedDragActions()); | - |
954 | setState(NoState); | - |
955 | stopAutoScroll(); | - |
956 | } | 0 |
957 | return; | 0 |
958 | } | - |
959 | | - |
960 | | - |
961 | QPersistentModelIndex index = indexAt(bottomRight); | - |
962 | QModelIndex buddy = d->model->buddy(d->pressedIndex); | - |
963 | if ((state() == EditingState && d->hasEditor(buddy)) partially evaluated: state() == EditingState no Evaluation Count:0 | yes Evaluation Count:26 |
never evaluated: d->hasEditor(buddy) | 0-26 |
964 | || edit(index, NoEditTriggers, event)) partially evaluated: edit(index, NoEditTriggers, event) no Evaluation Count:0 | yes Evaluation Count:26 |
| 0-26 |
965 | return; | 0 |
966 | | - |
967 | if (d->selectionMode != SingleSelection) partially evaluated: d->selectionMode != SingleSelection yes Evaluation Count:26 | no Evaluation Count:0 |
| 0-26 |
968 | topLeft = d->pressedPosition - d->offset(); executed: topLeft = d->pressedPosition - d->offset(); Execution Count:26 | 26 |
969 | else | - |
970 | topLeft = bottomRight; never executed: topLeft = bottomRight; | 0 |
971 | | - |
972 | d->checkMouseMove(index); | - |
973 | | - |
974 | | - |
975 | if (d->pressedIndex.isValid() evaluated: d->pressedIndex.isValid() yes Evaluation Count:12 | yes Evaluation Count:14 |
| 12-14 |
976 | && d->dragEnabled partially evaluated: d->dragEnabled no Evaluation Count:0 | yes Evaluation Count:12 |
| 0-12 |
977 | && (state() != DragSelectingState) never evaluated: (state() != DragSelectingState) | 0 |
978 | && (event->buttons() != Qt::NoButton) never evaluated: (event->buttons() != Qt::NoButton) | 0 |
979 | && !d->selectedDraggableIndexes().isEmpty()) { never evaluated: !d->selectedDraggableIndexes().isEmpty() | 0 |
980 | setState(DraggingState); | - |
981 | return; | 0 |
982 | } | - |
983 | | - |
984 | | - |
985 | if ((event->buttons() & Qt::LeftButton) && d->selectionAllowed(index) && d->selectionModel) { evaluated: (event->buttons() & Qt::LeftButton) yes Evaluation Count:15 | yes Evaluation Count:11 |
partially evaluated: d->selectionAllowed(index) yes Evaluation Count:15 | no Evaluation Count:0 |
partially evaluated: d->selectionModel yes Evaluation Count:15 | no Evaluation Count:0 |
| 0-15 |
986 | setState(DragSelectingState); | - |
987 | QItemSelectionModel::SelectionFlags command = selectionCommand(index, event); | - |
988 | if (d->ctrlDragSelectionFlag != QItemSelectionModel::NoUpdate && command.testFlag(QItemSelectionModel::Toggle)) { evaluated: d->ctrlDragSelectionFlag != QItemSelectionModel::NoUpdate yes Evaluation Count:12 | yes Evaluation Count:3 |
partially evaluated: command.testFlag(QItemSelectionModel::Toggle) yes Evaluation Count:12 | no Evaluation Count:0 |
| 0-12 |
989 | command &= ~QItemSelectionModel::Toggle; | - |
990 | command |= d->ctrlDragSelectionFlag; | - |
991 | } executed: } Execution Count:12 | 12 |
992 | | - |
993 | | - |
994 | QRect selectionRect = QRect(topLeft, bottomRight); | - |
995 | setSelection(selectionRect, command); | - |
996 | | - |
997 | | - |
998 | if (index.isValid() evaluated: index.isValid() yes Evaluation Count:14 | yes Evaluation Count:1 |
| 1-14 |
999 | && (index != d->selectionModel->currentIndex()) partially evaluated: (index != d->selectionModel->currentIndex()) yes Evaluation Count:14 | no Evaluation Count:0 |
| 0-14 |
1000 | && d->isIndexEnabled(index)) partially evaluated: d->isIndexEnabled(index) yes Evaluation Count:14 | no Evaluation Count:0 |
| 0-14 |
1001 | d->selectionModel->setCurrentIndex(index, QItemSelectionModel::NoUpdate); executed: d->selectionModel->setCurrentIndex(index, QItemSelectionModel::NoUpdate); Execution Count:14 | 14 |
1002 | } executed: } Execution Count:15 | 15 |
1003 | } executed: } Execution Count:26 | 26 |
1004 | void QAbstractItemView::mouseReleaseEvent(QMouseEvent *event) | - |
1005 | { | - |
1006 | QAbstractItemViewPrivate * const d = d_func(); | - |
1007 | | - |
1008 | QPoint pos = event->pos(); | - |
1009 | QPersistentModelIndex index = indexAt(pos); | - |
1010 | | - |
1011 | if (state() == EditingState) { evaluated: state() == EditingState yes Evaluation Count:3 | yes Evaluation Count:4929 |
| 3-4929 |
1012 | if (d->isIndexValid(index) partially evaluated: d->isIndexValid(index) yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
1013 | && d->isIndexEnabled(index) partially evaluated: d->isIndexEnabled(index) yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
1014 | && d->sendDelegateEvent(index, event)) partially evaluated: d->sendDelegateEvent(index, event) no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
1015 | update(index); never executed: update(index); | 0 |
1016 | return; executed: return; Execution Count:3 | 3 |
1017 | } | - |
1018 | | - |
1019 | bool click = (index == d->pressedIndex && index.isValid()); evaluated: index == d->pressedIndex yes Evaluation Count:377 | yes Evaluation Count:4552 |
evaluated: index.isValid() yes Evaluation Count:372 | yes Evaluation Count:5 |
| 5-4552 |
1020 | bool selectedClicked = click && (event->button() == Qt::LeftButton) && d->pressedAlreadySelected; evaluated: click yes Evaluation Count:372 | yes Evaluation Count:4557 |
evaluated: (event->button() == Qt::LeftButton) yes Evaluation Count:369 | yes Evaluation Count:3 |
evaluated: d->pressedAlreadySelected yes Evaluation Count:82 | yes Evaluation Count:287 |
| 3-4557 |
1021 | EditTrigger trigger = (selectedClicked ? SelectedClicked : NoEditTriggers); evaluated: selectedClicked yes Evaluation Count:82 | yes Evaluation Count:4847 |
| 82-4847 |
1022 | bool edited = edit(index, trigger, event); | - |
1023 | | - |
1024 | d->ctrlDragSelectionFlag = QItemSelectionModel::NoUpdate; | - |
1025 | | - |
1026 | if (d->selectionModel && d->noSelectionOnMousePress) { partially evaluated: d->selectionModel yes Evaluation Count:4929 | no Evaluation Count:0 |
evaluated: d->noSelectionOnMousePress yes Evaluation Count:27 | yes Evaluation Count:4902 |
| 0-4929 |
1027 | d->noSelectionOnMousePress = false; | - |
1028 | d->selectionModel->select(index, selectionCommand(index, event)); | - |
1029 | } executed: } Execution Count:27 | 27 |
1030 | | - |
1031 | setState(NoState); | - |
1032 | | - |
1033 | if (click) { evaluated: click yes Evaluation Count:372 | yes Evaluation Count:4557 |
| 372-4557 |
1034 | if (event->button() == Qt::LeftButton) evaluated: event->button() == Qt::LeftButton yes Evaluation Count:369 | yes Evaluation Count:3 |
| 3-369 |
1035 | clicked(index); executed: clicked(index); Execution Count:369 | 369 |
1036 | if (edited) evaluated: edited yes Evaluation Count:4 | yes Evaluation Count:368 |
| 4-368 |
1037 | return; executed: return; Execution Count:4 | 4 |
1038 | QStyleOptionViewItem option = d->viewOptions(); | - |
1039 | if (d->pressedAlreadySelected) evaluated: d->pressedAlreadySelected yes Evaluation Count:81 | yes Evaluation Count:287 |
| 81-287 |
1040 | option.state |= QStyle::State_Selected; executed: option.state |= QStyle::State_Selected; Execution Count:81 | 81 |
1041 | if (style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, &option, this)) partially evaluated: style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, &option, this) no Evaluation Count:0 | yes Evaluation Count:368 |
| 0-368 |
1042 | activated(index); never executed: activated(index); | 0 |
1043 | } executed: } Execution Count:368 | 368 |
1044 | } executed: } Execution Count:4925 | 4925 |
1045 | | - |
1046 | | - |
1047 | | - |
1048 | | - |
1049 | | - |
1050 | | - |
1051 | void QAbstractItemView::mouseDoubleClickEvent(QMouseEvent *event) | - |
1052 | { | - |
1053 | QAbstractItemViewPrivate * const d = d_func(); | - |
1054 | | - |
1055 | QModelIndex index = indexAt(event->pos()); | - |
1056 | if (!index.isValid() partially evaluated: !index.isValid() no Evaluation Count:0 | yes Evaluation Count:200 |
| 0-200 |
1057 | || !d->isIndexEnabled(index) evaluated: !d->isIndexEnabled(index) yes Evaluation Count:51 | yes Evaluation Count:149 |
| 51-149 |
1058 | || (d->pressedIndex != index)) { evaluated: (d->pressedIndex != index) yes Evaluation Count:133 | yes Evaluation Count:16 |
| 16-133 |
1059 | QMouseEvent me(QEvent::MouseButtonPress, | - |
1060 | event->localPos(), event->windowPos(), event->screenPos(), | - |
1061 | event->button(), event->buttons(), event->modifiers()); | - |
1062 | mousePressEvent(&me); | - |
1063 | return; executed: return; Execution Count:184 | 184 |
1064 | } | - |
1065 | | - |
1066 | QPersistentModelIndex persistent = index; | - |
1067 | doubleClicked(persistent); | - |
1068 | if ((event->button() == Qt::LeftButton) && !edit(persistent, DoubleClicked, event) partially evaluated: (event->button() == Qt::LeftButton) yes Evaluation Count:16 | no Evaluation Count:0 |
partially evaluated: !edit(persistent, DoubleClicked, event) no Evaluation Count:0 | yes Evaluation Count:16 |
| 0-16 |
1069 | && !style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, 0, this)) never evaluated: !style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, 0, this) | 0 |
1070 | activated(persistent); never executed: activated(persistent); | 0 |
1071 | } executed: } Execution Count:16 | 16 |
1072 | void QAbstractItemView::dragEnterEvent(QDragEnterEvent *event) | - |
1073 | { | - |
1074 | if (dragDropMode() == InternalMove never evaluated: dragDropMode() == InternalMove | 0 |
1075 | && (event->source() != this|| !(event->possibleActions() & Qt::MoveAction))) never evaluated: event->source() != this never evaluated: !(event->possibleActions() & Qt::MoveAction) | 0 |
1076 | return; | 0 |
1077 | | - |
1078 | if (d_func()->canDecode(event)) { never evaluated: d_func()->canDecode(event) | 0 |
1079 | event->accept(); | - |
1080 | setState(DraggingState); | - |
1081 | } else { | 0 |
1082 | event->ignore(); | - |
1083 | } | 0 |
1084 | } | - |
1085 | void QAbstractItemView::dragMoveEvent(QDragMoveEvent *event) | - |
1086 | { | - |
1087 | QAbstractItemViewPrivate * const d = d_func(); | - |
1088 | if (dragDropMode() == InternalMove never evaluated: dragDropMode() == InternalMove | 0 |
1089 | && (event->source() != this || !(event->possibleActions() & Qt::MoveAction))) never evaluated: event->source() != this never evaluated: !(event->possibleActions() & Qt::MoveAction) | 0 |
1090 | return; | 0 |
1091 | | - |
1092 | | - |
1093 | event->ignore(); | - |
1094 | | - |
1095 | QModelIndex index = indexAt(event->pos()); | - |
1096 | d->hover = index; | - |
1097 | if (!d->droppingOnItself(event, index) never evaluated: !d->droppingOnItself(event, index) | 0 |
1098 | && d->canDecode(event)) { never evaluated: d->canDecode(event) | 0 |
1099 | | - |
1100 | if (index.isValid() && d->showDropIndicator) { never evaluated: index.isValid() never evaluated: d->showDropIndicator | 0 |
1101 | QRect rect = visualRect(index); | - |
1102 | d->dropIndicatorPosition = d->position(event->pos(), rect, index); | - |
1103 | switch (d->dropIndicatorPosition) { | - |
1104 | case AboveItem: | - |
1105 | if (d->isIndexDropEnabled(index.parent())) { never evaluated: d->isIndexDropEnabled(index.parent()) | 0 |
1106 | d->dropIndicatorRect = QRect(rect.left(), rect.top(), rect.width(), 0); | - |
1107 | event->accept(); | - |
1108 | } else { | 0 |
1109 | d->dropIndicatorRect = QRect(); | - |
1110 | } | 0 |
1111 | break; | 0 |
1112 | case BelowItem: | - |
1113 | if (d->isIndexDropEnabled(index.parent())) { never evaluated: d->isIndexDropEnabled(index.parent()) | 0 |
1114 | d->dropIndicatorRect = QRect(rect.left(), rect.bottom(), rect.width(), 0); | - |
1115 | event->accept(); | - |
1116 | } else { | 0 |
1117 | d->dropIndicatorRect = QRect(); | - |
1118 | } | 0 |
1119 | break; | 0 |
1120 | case OnItem: | - |
1121 | if (d->isIndexDropEnabled(index)) { never evaluated: d->isIndexDropEnabled(index) | 0 |
1122 | d->dropIndicatorRect = rect; | - |
1123 | event->accept(); | - |
1124 | } else { | 0 |
1125 | d->dropIndicatorRect = QRect(); | - |
1126 | } | 0 |
1127 | break; | 0 |
1128 | case OnViewport: | - |
1129 | d->dropIndicatorRect = QRect(); | - |
1130 | if (d->isIndexDropEnabled(rootIndex())) { never evaluated: d->isIndexDropEnabled(rootIndex()) | 0 |
1131 | event->accept(); | - |
1132 | } | 0 |
1133 | break; | 0 |
1134 | } | - |
1135 | } else { | 0 |
1136 | d->dropIndicatorRect = QRect(); | - |
1137 | d->dropIndicatorPosition = OnViewport; | - |
1138 | if (d->isIndexDropEnabled(rootIndex())) { never evaluated: d->isIndexDropEnabled(rootIndex()) | 0 |
1139 | event->accept(); | - |
1140 | } | 0 |
1141 | } | 0 |
1142 | d->viewport->update(); | - |
1143 | } | 0 |
1144 | | - |
1145 | if (d->shouldAutoScroll(event->pos())) never evaluated: d->shouldAutoScroll(event->pos()) | 0 |
1146 | startAutoScroll(); never executed: startAutoScroll(); | 0 |
1147 | } | 0 |
1148 | | - |
1149 | | - |
1150 | | - |
1151 | | - |
1152 | | - |
1153 | | - |
1154 | bool QAbstractItemViewPrivate::droppingOnItself(QDropEvent *event, const QModelIndex &index) | - |
1155 | { | - |
1156 | QAbstractItemView * const q = q_func(); | - |
1157 | Qt::DropAction dropAction = event->dropAction(); | - |
1158 | if (q->dragDropMode() == QAbstractItemView::InternalMove) never evaluated: q->dragDropMode() == QAbstractItemView::InternalMove | 0 |
1159 | dropAction = Qt::MoveAction; never executed: dropAction = Qt::MoveAction; | 0 |
1160 | if (event->source() == q never evaluated: event->source() == q | 0 |
1161 | && event->possibleActions() & Qt::MoveAction never evaluated: event->possibleActions() & Qt::MoveAction | 0 |
1162 | && dropAction == Qt::MoveAction) { never evaluated: dropAction == Qt::MoveAction | 0 |
1163 | QModelIndexList selectedIndexes = q->selectedIndexes(); | - |
1164 | QModelIndex child = index; | - |
1165 | while (child.isValid() && child != root) { never evaluated: child.isValid() never evaluated: child != root | 0 |
1166 | if (selectedIndexes.contains(child)) never evaluated: selectedIndexes.contains(child) | 0 |
1167 | return true; never executed: return true; | 0 |
1168 | child = child.parent(); | - |
1169 | } | 0 |
1170 | } | 0 |
1171 | return false; never executed: return false; | 0 |
1172 | } | - |
1173 | | - |
1174 | | - |
1175 | | - |
1176 | | - |
1177 | | - |
1178 | | - |
1179 | | - |
1180 | void QAbstractItemView::dragLeaveEvent(QDragLeaveEvent *) | - |
1181 | { | - |
1182 | QAbstractItemViewPrivate * const d = d_func(); | - |
1183 | stopAutoScroll(); | - |
1184 | setState(NoState); | - |
1185 | d->hover = QModelIndex(); | - |
1186 | d->viewport->update(); | - |
1187 | } | 0 |
1188 | void QAbstractItemView::dropEvent(QDropEvent *event) | - |
1189 | { | - |
1190 | QAbstractItemViewPrivate * const d = d_func(); | - |
1191 | if (dragDropMode() == InternalMove) { never evaluated: dragDropMode() == InternalMove | 0 |
1192 | if (event->source() != this || !(event->possibleActions() & Qt::MoveAction)) never evaluated: event->source() != this never evaluated: !(event->possibleActions() & Qt::MoveAction) | 0 |
1193 | return; | 0 |
1194 | } | 0 |
1195 | | - |
1196 | QModelIndex index; | - |
1197 | int col = -1; | - |
1198 | int row = -1; | - |
1199 | if (d->dropOn(event, &row, &col, &index)) { never evaluated: d->dropOn(event, &row, &col, &index) | 0 |
1200 | if (d->model->dropMimeData(event->mimeData(), | 0 |
1201 | 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 |
1202 | if (dragDropMode() == InternalMove) never evaluated: dragDropMode() == InternalMove | 0 |
1203 | event->setDropAction(Qt::MoveAction); never executed: event->setDropAction(Qt::MoveAction); | 0 |
1204 | event->accept(); | - |
1205 | } | 0 |
1206 | } | 0 |
1207 | stopAutoScroll(); | - |
1208 | setState(NoState); | - |
1209 | d->viewport->update(); | - |
1210 | } | 0 |
1211 | bool QAbstractItemViewPrivate::dropOn(QDropEvent *event, int *dropRow, int *dropCol, QModelIndex *dropIndex) | - |
1212 | { | - |
1213 | QAbstractItemView * const q = q_func(); | - |
1214 | if (event->isAccepted()) never evaluated: event->isAccepted() | 0 |
1215 | return false; never executed: return false; | 0 |
1216 | | - |
1217 | QModelIndex index; | - |
1218 | | - |
1219 | if (viewport->rect().contains(event->pos())) { never evaluated: viewport->rect().contains(event->pos()) | 0 |
1220 | index = q->indexAt(event->pos()); | - |
1221 | if (!index.isValid() || !q->visualRect(index).contains(event->pos())) never evaluated: !index.isValid() never evaluated: !q->visualRect(index).contains(event->pos()) | 0 |
1222 | index = root; never executed: index = root; | 0 |
1223 | } | 0 |
1224 | | - |
1225 | | - |
1226 | if (model->supportedDropActions() & event->dropAction()) { never evaluated: model->supportedDropActions() & event->dropAction() | 0 |
1227 | int row = -1; | - |
1228 | int col = -1; | - |
1229 | if (index != root) { never evaluated: index != root | 0 |
1230 | dropIndicatorPosition = position(event->pos(), q->visualRect(index), index); | - |
1231 | switch (dropIndicatorPosition) { | - |
1232 | case QAbstractItemView::AboveItem: | - |
1233 | row = index.row(); | - |
1234 | col = index.column(); | - |
1235 | index = index.parent(); | - |
1236 | break; | 0 |
1237 | case QAbstractItemView::BelowItem: | - |
1238 | row = index.row() + 1; | - |
1239 | col = index.column(); | - |
1240 | index = index.parent(); | - |
1241 | break; | 0 |
1242 | case QAbstractItemView::OnItem: | - |
1243 | case QAbstractItemView::OnViewport: | - |
1244 | break; | 0 |
1245 | } | - |
1246 | } else { | 0 |
1247 | dropIndicatorPosition = QAbstractItemView::OnViewport; | - |
1248 | } | 0 |
1249 | *dropIndex = index; | - |
1250 | *dropRow = row; | - |
1251 | *dropCol = col; | - |
1252 | if (!droppingOnItself(event, index)) never evaluated: !droppingOnItself(event, index) | 0 |
1253 | return true; never executed: return true; | 0 |
1254 | } | 0 |
1255 | return false; never executed: return false; | 0 |
1256 | } | - |
1257 | | - |
1258 | QAbstractItemView::DropIndicatorPosition | - |
1259 | QAbstractItemViewPrivate::position(const QPoint &pos, const QRect &rect, const QModelIndex &index) const | - |
1260 | { | - |
1261 | QAbstractItemView::DropIndicatorPosition r = QAbstractItemView::OnViewport; | - |
1262 | if (!overwrite) { never evaluated: !overwrite | 0 |
1263 | const int margin = 2; | - |
1264 | if (pos.y() - rect.top() < margin) { never evaluated: pos.y() - rect.top() < margin | 0 |
1265 | r = QAbstractItemView::AboveItem; | - |
1266 | } else if (rect.bottom() - pos.y() < margin) { never evaluated: rect.bottom() - pos.y() < margin | 0 |
1267 | r = QAbstractItemView::BelowItem; | - |
1268 | } else if (rect.contains(pos, true)) { never evaluated: rect.contains(pos, true) | 0 |
1269 | r = QAbstractItemView::OnItem; | - |
1270 | } | 0 |
1271 | } else { | - |
1272 | QRect touchingRect = rect; | - |
1273 | touchingRect.adjust(-1, -1, 1, 1); | - |
1274 | if (touchingRect.contains(pos, false)) { never evaluated: touchingRect.contains(pos, false) | 0 |
1275 | r = QAbstractItemView::OnItem; | - |
1276 | } | 0 |
1277 | } | 0 |
1278 | | - |
1279 | if (r == QAbstractItemView::OnItem && (!(model->flags(index) & Qt::ItemIsDropEnabled))) never evaluated: r == QAbstractItemView::OnItem never evaluated: (!(model->flags(index) & Qt::ItemIsDropEnabled)) | 0 |
1280 | 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 |
1281 | | - |
1282 | return r; never executed: return r; | 0 |
1283 | } | - |
1284 | void QAbstractItemView::focusInEvent(QFocusEvent *event) | - |
1285 | { | - |
1286 | QAbstractItemViewPrivate * const d = d_func(); | - |
1287 | QAbstractScrollArea::focusInEvent(event); | - |
1288 | | - |
1289 | const QItemSelectionModel* model = selectionModel(); | - |
1290 | const bool currentIndexValid = currentIndex().isValid(); | - |
1291 | | - |
1292 | if (model evaluated: model yes Evaluation Count:272 | yes Evaluation Count:24 |
| 24-272 |
1293 | && !d->currentIndexSet evaluated: !d->currentIndexSet yes Evaluation Count:248 | yes Evaluation Count:24 |
| 24-248 |
1294 | && !currentIndexValid) { evaluated: !currentIndexValid yes Evaluation Count:174 | yes Evaluation Count:74 |
| 74-174 |
1295 | bool autoScroll = d->autoScroll; | - |
1296 | d->autoScroll = false; | - |
1297 | QModelIndex index = moveCursor(MoveNext, Qt::NoModifier); | - |
1298 | if (index.isValid() && d->isIndexEnabled(index) && event->reason() != Qt::MouseFocusReason) evaluated: index.isValid() yes Evaluation Count:159 | yes Evaluation Count:15 |
partially evaluated: d->isIndexEnabled(index) yes Evaluation Count:159 | no Evaluation Count:0 |
evaluated: event->reason() != Qt::MouseFocusReason yes Evaluation Count:157 | yes Evaluation Count:2 |
| 0-159 |
1299 | selectionModel()->setCurrentIndex(index, QItemSelectionModel::NoUpdate); executed: selectionModel()->setCurrentIndex(index, QItemSelectionModel::NoUpdate); Execution Count:157 | 157 |
1300 | d->autoScroll = autoScroll; | - |
1301 | } executed: } Execution Count:174 | 174 |
1302 | | - |
1303 | if (model && currentIndexValid) { evaluated: model yes Evaluation Count:272 | yes Evaluation Count:24 |
evaluated: currentIndexValid yes Evaluation Count:98 | yes Evaluation Count:174 |
| 24-272 |
1304 | if (currentIndex().flags() != Qt::ItemIsEditable) partially evaluated: currentIndex().flags() != Qt::ItemIsEditable yes Evaluation Count:98 | no Evaluation Count:0 |
| 0-98 |
1305 | setAttribute(Qt::WA_InputMethodEnabled, false); executed: setAttribute(Qt::WA_InputMethodEnabled, false); Execution Count:98 | 98 |
1306 | else | - |
1307 | setAttribute(Qt::WA_InputMethodEnabled); never executed: setAttribute(Qt::WA_InputMethodEnabled); | 0 |
1308 | } | - |
1309 | | - |
1310 | if (!currentIndexValid) evaluated: !currentIndexValid yes Evaluation Count:198 | yes Evaluation Count:98 |
| 98-198 |
1311 | setAttribute(Qt::WA_InputMethodEnabled, false); executed: setAttribute(Qt::WA_InputMethodEnabled, false); Execution Count:198 | 198 |
1312 | | - |
1313 | d->viewport->update(); | - |
1314 | } executed: } Execution Count:296 | 296 |
1315 | | - |
1316 | | - |
1317 | | - |
1318 | | - |
1319 | | - |
1320 | | - |
1321 | | - |
1322 | void QAbstractItemView::focusOutEvent(QFocusEvent *event) | - |
1323 | { | - |
1324 | QAbstractItemViewPrivate * const d = d_func(); | - |
1325 | QAbstractScrollArea::focusOutEvent(event); | - |
1326 | d->viewport->update(); | - |
1327 | } executed: } Execution Count:102 | 102 |
1328 | void QAbstractItemView::keyPressEvent(QKeyEvent *event) | - |
1329 | { | - |
1330 | QAbstractItemViewPrivate * const d = d_func(); | - |
1331 | d->delayedAutoScroll.stop(); | - |
1332 | if (event == QKeySequence::Copy) { partially evaluated: event == QKeySequence::Copy no Evaluation Count:0 | yes Evaluation Count:1083 |
| 0-1083 |
1333 | QVariant variant; | - |
1334 | if (d->model) never evaluated: d->model | 0 |
1335 | variant = d->model->data(currentIndex(), Qt::DisplayRole); never executed: variant = d->model->data(currentIndex(), Qt::DisplayRole); | 0 |
1336 | if (variant.type() == QVariant::String) never evaluated: variant.type() == QVariant::String | 0 |
1337 | QApplication::clipboard()->setText(variant.toString()); never executed: QApplication::clipboard()->setText(variant.toString()); | 0 |
1338 | event->accept(); | - |
1339 | } | 0 |
1340 | | - |
1341 | | - |
1342 | QPersistentModelIndex newCurrent; | - |
1343 | d->moveCursorUpdatedView = false; | - |
1344 | switch (event->key()) { | - |
1345 | case Qt::Key_Down: | - |
1346 | newCurrent = moveCursor(MoveDown, event->modifiers()); | - |
1347 | break; executed: break; Execution Count:258 | 258 |
1348 | case Qt::Key_Up: | - |
1349 | newCurrent = moveCursor(MoveUp, event->modifiers()); | - |
1350 | break; executed: break; Execution Count:250 | 250 |
1351 | case Qt::Key_Left: | - |
1352 | newCurrent = moveCursor(MoveLeft, event->modifiers()); | - |
1353 | break; executed: break; Execution Count:220 | 220 |
1354 | case Qt::Key_Right: | - |
1355 | newCurrent = moveCursor(MoveRight, event->modifiers()); | - |
1356 | break; executed: break; Execution Count:116 | 116 |
1357 | case Qt::Key_Home: | - |
1358 | newCurrent = moveCursor(MoveHome, event->modifiers()); | - |
1359 | break; | 0 |
1360 | case Qt::Key_End: | - |
1361 | newCurrent = moveCursor(MoveEnd, event->modifiers()); | - |
1362 | break; | 0 |
1363 | case Qt::Key_PageUp: | - |
1364 | newCurrent = moveCursor(MovePageUp, event->modifiers()); | - |
1365 | break; executed: break; Execution Count:2 | 2 |
1366 | case Qt::Key_PageDown: | - |
1367 | newCurrent = moveCursor(MovePageDown, event->modifiers()); | - |
1368 | break; executed: break; Execution Count:3 | 3 |
1369 | case Qt::Key_Tab: | - |
1370 | if (d->tabKeyNavigation) evaluated: d->tabKeyNavigation yes Evaluation Count:10 | yes Evaluation Count:2 |
| 2-10 |
1371 | newCurrent = moveCursor(MoveNext, event->modifiers()); executed: newCurrent = moveCursor(MoveNext, event->modifiers()); Execution Count:10 | 10 |
1372 | break; executed: break; Execution Count:12 | 12 |
1373 | case Qt::Key_Backtab: | - |
1374 | if (d->tabKeyNavigation) evaluated: d->tabKeyNavigation yes Evaluation Count:4 | yes Evaluation Count:1 |
| 1-4 |
1375 | newCurrent = moveCursor(MovePrevious, event->modifiers()); executed: newCurrent = moveCursor(MovePrevious, event->modifiers()); Execution Count:4 | 4 |
1376 | break; executed: break; Execution Count:5 | 5 |
1377 | } | - |
1378 | | - |
1379 | QPersistentModelIndex oldCurrent = currentIndex(); | - |
1380 | if (newCurrent != oldCurrent && newCurrent.isValid() && d->isIndexEnabled(newCurrent)) { evaluated: newCurrent != oldCurrent yes Evaluation Count:872 | yes Evaluation Count:211 |
evaluated: newCurrent.isValid() yes Evaluation Count:697 | yes Evaluation Count:175 |
partially evaluated: d->isIndexEnabled(newCurrent) yes Evaluation Count:697 | no Evaluation Count:0 |
| 0-872 |
1381 | if (!hasFocus() && QApplication::focusWidget() == indexWidget(oldCurrent)) evaluated: !hasFocus() yes Evaluation Count:142 | yes Evaluation Count:555 |
evaluated: QApplication::focusWidget() == indexWidget(oldCurrent) yes Evaluation Count:134 | yes Evaluation Count:8 |
| 8-555 |
1382 | setFocus(); executed: setFocus(); Execution Count:134 | 134 |
1383 | QItemSelectionModel::SelectionFlags command = selectionCommand(newCurrent, event); | - |
1384 | if (command != QItemSelectionModel::NoUpdate partially evaluated: command != QItemSelectionModel::NoUpdate yes Evaluation Count:697 | no Evaluation Count:0 |
| 0-697 |
1385 | || style()->styleHint(QStyle::SH_ItemView_MovementWithoutUpdatingSelection, 0, this)) { never evaluated: style()->styleHint(QStyle::SH_ItemView_MovementWithoutUpdatingSelection, 0, this) | 0 |
1386 | | - |
1387 | if (command & QItemSelectionModel::Current) { evaluated: command & QItemSelectionModel::Current yes Evaluation Count:4 | yes Evaluation Count:693 |
| 4-693 |
1388 | d->selectionModel->setCurrentIndex(newCurrent, QItemSelectionModel::NoUpdate); | - |
1389 | if (!indexAt(d->pressedPosition - d->offset()).isValid()) evaluated: !indexAt(d->pressedPosition - d->offset()).isValid() yes Evaluation Count:3 | yes Evaluation Count:1 |
| 1-3 |
1390 | d->pressedPosition = visualRect(oldCurrent).center() + d->offset(); executed: d->pressedPosition = visualRect(oldCurrent).center() + d->offset(); Execution Count:3 | 3 |
1391 | QRect rect(d->pressedPosition - d->offset(), visualRect(newCurrent).center()); | - |
1392 | setSelection(rect, command); | - |
1393 | } else { executed: } Execution Count:4 | 4 |
1394 | d->selectionModel->setCurrentIndex(newCurrent, command); | - |
1395 | d->pressedPosition = visualRect(newCurrent).center() + d->offset(); | - |
1396 | if (newCurrent.isValid()) { evaluated: newCurrent.isValid() yes Evaluation Count:692 | yes Evaluation Count:1 |
| 1-692 |
1397 | | - |
1398 | QRect rect(d->pressedPosition - d->offset(), QSize(1, 1)); | - |
1399 | setSelection(rect, command); | - |
1400 | } executed: } Execution Count:692 | 692 |
1401 | } executed: } Execution Count:693 | 693 |
1402 | event->accept(); | - |
1403 | return; executed: return; Execution Count:697 | 697 |
1404 | } | - |
1405 | } | 0 |
1406 | | - |
1407 | switch (event->key()) { | - |
1408 | | - |
1409 | case Qt::Key_Down: | - |
1410 | case Qt::Key_Up: | - |
1411 | | - |
1412 | | - |
1413 | | - |
1414 | | - |
1415 | | - |
1416 | | - |
1417 | case Qt::Key_Left: | - |
1418 | case Qt::Key_Right: | - |
1419 | case Qt::Key_Home: | - |
1420 | case Qt::Key_End: | - |
1421 | case Qt::Key_PageUp: | - |
1422 | case Qt::Key_PageDown: | - |
1423 | case Qt::Key_Escape: | - |
1424 | case Qt::Key_Shift: | - |
1425 | case Qt::Key_Control: | - |
1426 | case Qt::Key_Delete: | - |
1427 | case Qt::Key_Backspace: | - |
1428 | event->ignore(); | - |
1429 | break; executed: break; Execution Count:257 | 257 |
1430 | case Qt::Key_Space: | - |
1431 | case Qt::Key_Select: | - |
1432 | if (!edit(currentIndex(), AnyKeyPressed, event) && d->selectionModel) partially evaluated: !edit(currentIndex(), AnyKeyPressed, event) yes Evaluation Count:1 | no Evaluation Count:0 |
partially evaluated: d->selectionModel yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
1433 | d->selectionModel->select(currentIndex(), selectionCommand(currentIndex(), event)); executed: d->selectionModel->select(currentIndex(), selectionCommand(currentIndex(), event)); Execution Count:1 | 1 |
1434 | break; executed: break; Execution Count:1 | 1 |
1435 | case Qt::Key_F2: | - |
1436 | if (!edit(currentIndex(), EditKeyPressed, event)) evaluated: !edit(currentIndex(), EditKeyPressed, event) yes Evaluation Count:4 | yes Evaluation Count:1 |
| 1-4 |
1437 | event->ignore(); executed: event->ignore(); Execution Count:4 | 4 |
1438 | break; executed: break; Execution Count:5 | 5 |
1439 | case Qt::Key_Enter: | - |
1440 | case Qt::Key_Return: | - |
1441 | | - |
1442 | | - |
1443 | | - |
1444 | if (state() != EditingState || hasFocus()) { evaluated: state() != EditingState yes Evaluation Count:95 | yes Evaluation Count:13 |
partially evaluated: hasFocus() no Evaluation Count:0 | yes Evaluation Count:13 |
| 0-95 |
1445 | if (currentIndex().isValid()) evaluated: currentIndex().isValid() yes Evaluation Count:75 | yes Evaluation Count:20 |
| 20-75 |
1446 | activated(currentIndex()); executed: activated(currentIndex()); Execution Count:75 | 75 |
1447 | event->ignore(); | - |
1448 | } executed: } Execution Count:95 | 95 |
1449 | break; executed: break; Execution Count:108 | 108 |
1450 | | - |
1451 | case Qt::Key_A: | - |
1452 | if (event->modifiers() & Qt::ControlModifier) { partially evaluated: event->modifiers() & Qt::ControlModifier yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
1453 | selectAll(); | - |
1454 | break; executed: break; Execution Count:1 | 1 |
1455 | } | - |
1456 | default: { | - |
1457 | | - |
1458 | | - |
1459 | | - |
1460 | | - |
1461 | | - |
1462 | | - |
1463 | bool modified = (event->modifiers() & (Qt::ControlModifier | Qt::AltModifier | Qt::MetaModifier)); | - |
1464 | if (!event->text().isEmpty() && !modified && !edit(currentIndex(), AnyKeyPressed, event)) { evaluated: !event->text().isEmpty() yes Evaluation Count:10 | yes Evaluation Count:4 |
partially evaluated: !modified yes Evaluation Count:10 | no Evaluation Count:0 |
partially evaluated: !edit(currentIndex(), AnyKeyPressed, event) yes Evaluation Count:10 | no Evaluation Count:0 |
| 0-10 |
1465 | keyboardSearch(event->text()); | - |
1466 | event->accept(); | - |
1467 | } else { executed: } Execution Count:10 | 10 |
1468 | event->ignore(); | - |
1469 | } executed: } Execution Count:4 | 4 |
1470 | break; } executed: break; Execution Count:14 | 14 |
1471 | } | - |
1472 | if (d->moveCursorUpdatedView) evaluated: d->moveCursorUpdatedView yes Evaluation Count:20 | yes Evaluation Count:366 |
| 20-366 |
1473 | event->accept(); executed: event->accept(); Execution Count:20 | 20 |
1474 | } executed: } Execution Count:386 | 386 |
1475 | | - |
1476 | | - |
1477 | | - |
1478 | | - |
1479 | | - |
1480 | | - |
1481 | | - |
1482 | void QAbstractItemView::resizeEvent(QResizeEvent *event) | - |
1483 | { | - |
1484 | QAbstractScrollArea::resizeEvent(event); | - |
1485 | updateGeometries(); | - |
1486 | } executed: } Execution Count:2446 | 2446 |
1487 | | - |
1488 | | - |
1489 | | - |
1490 | | - |
1491 | | - |
1492 | | - |
1493 | | - |
1494 | void QAbstractItemView::timerEvent(QTimerEvent *event) | - |
1495 | { | - |
1496 | QAbstractItemViewPrivate * const d = d_func(); | - |
1497 | if (event->timerId() == d->fetchMoreTimer.timerId()) evaluated: event->timerId() == d->fetchMoreTimer.timerId() yes Evaluation Count:1192 | yes Evaluation Count:683 |
| 683-1192 |
1498 | d->fetchMore(); executed: d->fetchMore(); Execution Count:1192 | 1192 |
1499 | else if (event->timerId() == d->delayedReset.timerId()) partially evaluated: event->timerId() == d->delayedReset.timerId() no Evaluation Count:0 | yes Evaluation Count:683 |
| 0-683 |
1500 | reset(); | 0 |
1501 | else if (event->timerId() == d->autoScrollTimer.timerId()) partially evaluated: event->timerId() == d->autoScrollTimer.timerId() no Evaluation Count:0 | yes Evaluation Count:683 |
| 0-683 |
1502 | doAutoScroll(); never executed: doAutoScroll(); | 0 |
1503 | else if (event->timerId() == d->updateTimer.timerId()) partially evaluated: event->timerId() == d->updateTimer.timerId() no Evaluation Count:0 | yes Evaluation Count:683 |
| 0-683 |
1504 | d->updateDirtyRegion(); never executed: d->updateDirtyRegion(); | 0 |
1505 | else if (event->timerId() == d->delayedEditing.timerId()) { evaluated: event->timerId() == d->delayedEditing.timerId() yes Evaluation Count:1 | yes Evaluation Count:682 |
| 1-682 |
1506 | d->delayedEditing.stop(); | - |
1507 | edit(currentIndex()); | - |
1508 | } else if (event->timerId() == d->delayedLayout.timerId()) { executed: } Execution Count:1 evaluated: event->timerId() == d->delayedLayout.timerId() yes Evaluation Count:307 | yes Evaluation Count:375 |
| 1-375 |
1509 | d->delayedLayout.stop(); | - |
1510 | if (isVisible()) { evaluated: isVisible() yes Evaluation Count:256 | yes Evaluation Count:51 |
| 51-256 |
1511 | d->interruptDelayedItemsLayout(); | - |
1512 | doItemsLayout(); | - |
1513 | const QModelIndex current = currentIndex(); | - |
1514 | if (current.isValid() && d->state == QAbstractItemView::EditingState) evaluated: current.isValid() yes Evaluation Count:12 | yes Evaluation Count:244 |
partially evaluated: d->state == QAbstractItemView::EditingState no Evaluation Count:0 | yes Evaluation Count:12 |
| 0-244 |
1515 | scrollTo(current); never executed: scrollTo(current); | 0 |
1516 | } executed: } Execution Count:256 | 256 |
1517 | } else if (event->timerId() == d->delayedAutoScroll.timerId()) { executed: } Execution Count:307 evaluated: event->timerId() == d->delayedAutoScroll.timerId() yes Evaluation Count:8 | yes Evaluation Count:367 |
| 8-367 |
1518 | d->delayedAutoScroll.stop(); | - |
1519 | | - |
1520 | | - |
1521 | if (d->pressedIndex.isValid() && d->pressedIndex == currentIndex()) partially evaluated: d->pressedIndex.isValid() yes Evaluation Count:8 | no Evaluation Count:0 |
partially evaluated: d->pressedIndex == currentIndex() yes Evaluation Count:8 | no Evaluation Count:0 |
| 0-8 |
1522 | scrollTo(d->pressedIndex); executed: scrollTo(d->pressedIndex); Execution Count:8 | 8 |
1523 | } executed: } Execution Count:8 | 8 |
1524 | } | - |
1525 | | - |
1526 | | - |
1527 | | - |
1528 | | - |
1529 | void QAbstractItemView::inputMethodEvent(QInputMethodEvent *event) | - |
1530 | { | - |
1531 | if (event->commitString().isEmpty() && event->preeditString().isEmpty()) { never evaluated: event->commitString().isEmpty() never evaluated: event->preeditString().isEmpty() | 0 |
1532 | event->ignore(); | - |
1533 | return; | 0 |
1534 | } | - |
1535 | if (!edit(currentIndex(), AnyKeyPressed, event)) { never evaluated: !edit(currentIndex(), AnyKeyPressed, event) | 0 |
1536 | if (!event->commitString().isEmpty()) never evaluated: !event->commitString().isEmpty() | 0 |
1537 | keyboardSearch(event->commitString()); never executed: keyboardSearch(event->commitString()); | 0 |
1538 | event->ignore(); | - |
1539 | } | 0 |
1540 | } | 0 |
1541 | QAbstractItemView::DropIndicatorPosition QAbstractItemView::dropIndicatorPosition() const | - |
1542 | { | - |
1543 | const QAbstractItemViewPrivate * const d = d_func(); | - |
1544 | return d->dropIndicatorPosition; never executed: return d->dropIndicatorPosition; | 0 |
1545 | } | - |
1546 | QModelIndexList QAbstractItemView::selectedIndexes() const | - |
1547 | { | - |
1548 | const QAbstractItemViewPrivate * const d = d_func(); | - |
1549 | QModelIndexList indexes; | - |
1550 | if (d->selectionModel) { evaluated: d->selectionModel yes Evaluation Count:1 | yes Evaluation Count:2 |
| 1-2 |
1551 | indexes = d->selectionModel->selectedIndexes(); | - |
1552 | QList<QModelIndex>::iterator it = indexes.begin(); | - |
1553 | while (it != indexes.end()) partially evaluated: it != indexes.end() no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
1554 | if (isIndexHidden(*it)) never evaluated: isIndexHidden(*it) | 0 |
1555 | it = indexes.erase(it); never executed: it = indexes.erase(it); | 0 |
1556 | else | - |
1557 | ++it; | 0 |
1558 | } executed: } Execution Count:1 | 1 |
1559 | return indexes; executed: return indexes; Execution Count:3 | 3 |
1560 | } | - |
1561 | bool QAbstractItemView::edit(const QModelIndex &index, EditTrigger trigger, QEvent *event) | - |
1562 | { | - |
1563 | QAbstractItemViewPrivate * const d = d_func(); | - |
1564 | | - |
1565 | if (!d->isIndexValid(index)) evaluated: !d->isIndexValid(index) yes Evaluation Count:32 | yes Evaluation Count:7944 |
| 32-7944 |
1566 | return false; executed: return false; Execution Count:32 | 32 |
1567 | | - |
1568 | if (QWidget *w = (d->persistent.isEmpty() ? static_cast<QWidget*>(0) : d->editorForIndex(index).widget.data())) { evaluated: d->persistent.isEmpty() yes Evaluation Count:7928 | yes Evaluation Count:16 |
| 16-7928 |
1569 | if (w->focusPolicy() == Qt::NoFocus) evaluated: w->focusPolicy() == Qt::NoFocus yes Evaluation Count:1 | yes Evaluation Count:3 |
| 1-3 |
1570 | return false; executed: return false; Execution Count:1 | 1 |
1571 | w->setFocus(); | - |
1572 | return true; executed: return true; Execution Count:3 | 3 |
1573 | } | - |
1574 | | - |
1575 | if (trigger == DoubleClicked) { evaluated: trigger == DoubleClicked yes Evaluation Count:31 | yes Evaluation Count:7909 |
| 31-7909 |
1576 | d->delayedEditing.stop(); | - |
1577 | d->delayedAutoScroll.stop(); | - |
1578 | } else if (trigger == CurrentChanged) { executed: } Execution Count:31 evaluated: trigger == CurrentChanged yes Evaluation Count:2008 | yes Evaluation Count:5901 |
| 31-5901 |
1579 | d->delayedEditing.stop(); | - |
1580 | } executed: } Execution Count:2008 | 2008 |
1581 | | - |
1582 | if (d->sendDelegateEvent(index, event)) { evaluated: d->sendDelegateEvent(index, event) yes Evaluation Count:4 | yes Evaluation Count:7936 |
| 4-7936 |
1583 | update(index); | - |
1584 | return true; executed: return true; Execution Count:4 | 4 |
1585 | } | - |
1586 | | - |
1587 | | - |
1588 | EditTriggers lastTrigger = d->lastTrigger; | - |
1589 | d->lastTrigger = trigger; | - |
1590 | | - |
1591 | if (!d->shouldEdit(trigger, d->model->buddy(index))) evaluated: !d->shouldEdit(trigger, d->model->buddy(index)) yes Evaluation Count:7867 | yes Evaluation Count:69 |
| 69-7867 |
1592 | return false; executed: return false; Execution Count:7867 | 7867 |
1593 | | - |
1594 | if (d->delayedEditing.isActive()) partially evaluated: d->delayedEditing.isActive() no Evaluation Count:0 | yes Evaluation Count:69 |
| 0-69 |
1595 | return false; never executed: return false; | 0 |
1596 | | - |
1597 | | - |
1598 | | - |
1599 | if (lastTrigger == DoubleClicked && trigger == SelectedClicked) partially evaluated: lastTrigger == DoubleClicked no Evaluation Count:0 | yes Evaluation Count:69 |
never evaluated: trigger == SelectedClicked | 0-69 |
1600 | return false; never executed: return false; | 0 |
1601 | | - |
1602 | | - |
1603 | if (trigger == SelectedClicked) evaluated: trigger == SelectedClicked yes Evaluation Count:2 | yes Evaluation Count:67 |
| 2-67 |
1604 | d->delayedEditing.start(QApplication::doubleClickInterval(), this); executed: d->delayedEditing.start(QApplication::doubleClickInterval(), this); Execution Count:2 | 2 |
1605 | else | - |
1606 | d->openEditor(index, d->shouldForwardEvent(trigger, event) ? event : 0); executed: d->openEditor(index, d->shouldForwardEvent(trigger, event) ? event : 0); Execution Count:67 | 67 |
1607 | | - |
1608 | return true; executed: return true; Execution Count:69 | 69 |
1609 | } | - |
1610 | | - |
1611 | | - |
1612 | | - |
1613 | | - |
1614 | | - |
1615 | void QAbstractItemView::updateEditorData() | - |
1616 | { | - |
1617 | QAbstractItemViewPrivate * const d = d_func(); | - |
1618 | d->updateEditorData(QModelIndex(), QModelIndex()); | - |
1619 | } executed: } Execution Count:8 | 8 |
1620 | | - |
1621 | | - |
1622 | | - |
1623 | | - |
1624 | | - |
1625 | void QAbstractItemView::updateEditorGeometries() | - |
1626 | { | - |
1627 | QAbstractItemViewPrivate * const d = d_func(); | - |
1628 | if(d->editorIndexHash.isEmpty()) evaluated: d->editorIndexHash.isEmpty() yes Evaluation Count:17925 | yes Evaluation Count:31 |
| 31-17925 |
1629 | return; executed: return; Execution Count:17925 | 17925 |
1630 | QStyleOptionViewItem option = d->viewOptions(); | - |
1631 | QEditorIndexHash::iterator it = d->editorIndexHash.begin(); | - |
1632 | QWidgetList editorsToRelease; | - |
1633 | QWidgetList editorsToHide; | - |
1634 | while (it != d->editorIndexHash.end()) { evaluated: it != d->editorIndexHash.end() yes Evaluation Count:70 | yes Evaluation Count:31 |
| 31-70 |
1635 | QModelIndex index = it.value(); | - |
1636 | QWidget *editor = it.key(); | - |
1637 | if (index.isValid() && editor) { partially evaluated: index.isValid() yes Evaluation Count:70 | no Evaluation Count:0 |
partially evaluated: editor yes Evaluation Count:70 | no Evaluation Count:0 |
| 0-70 |
1638 | option.rect = visualRect(index); | - |
1639 | if (option.rect.isValid()) { evaluated: option.rect.isValid() yes Evaluation Count:25 | yes Evaluation Count:45 |
| 25-45 |
1640 | editor->show(); | - |
1641 | QAbstractItemDelegate *delegate = d->delegateForIndex(index); | - |
1642 | if (delegate) partially evaluated: delegate yes Evaluation Count:25 | no Evaluation Count:0 |
| 0-25 |
1643 | delegate->updateEditorGeometry(editor, option, index); executed: delegate->updateEditorGeometry(editor, option, index); Execution Count:25 | 25 |
1644 | } else { executed: } Execution Count:25 | 25 |
1645 | editorsToHide << editor; | - |
1646 | } executed: } Execution Count:45 | 45 |
1647 | ++it; | - |
1648 | } else { executed: } Execution Count:70 | 70 |
1649 | d->indexEditorHash.remove(it.value()); | - |
1650 | it = d->editorIndexHash.erase(it); | - |
1651 | editorsToRelease << editor; | - |
1652 | } | 0 |
1653 | } | - |
1654 | | - |
1655 | | - |
1656 | | - |
1657 | for (int i = 0; i < editorsToHide.count(); ++i) { evaluated: i < editorsToHide.count() yes Evaluation Count:45 | yes Evaluation Count:31 |
| 31-45 |
1658 | editorsToHide.at(i)->hide(); | - |
1659 | } executed: } Execution Count:45 | 45 |
1660 | for (int i = 0; i < editorsToRelease.count(); ++i) { partially evaluated: i < editorsToRelease.count() no Evaluation Count:0 | yes Evaluation Count:31 |
| 0-31 |
1661 | d->releaseEditor(editorsToRelease.at(i)); | - |
1662 | } | 0 |
1663 | } executed: } Execution Count:31 | 31 |
1664 | | - |
1665 | | - |
1666 | | - |
1667 | | - |
1668 | | - |
1669 | | - |
1670 | void QAbstractItemView::updateGeometries() | - |
1671 | { | - |
1672 | updateEditorGeometries(); | - |
1673 | d_func()->fetchMoreTimer.start(0, this); | - |
1674 | } executed: } Execution Count:6306 | 6306 |
1675 | | - |
1676 | | - |
1677 | | - |
1678 | | - |
1679 | void QAbstractItemView::verticalScrollbarValueChanged(int value) | - |
1680 | { | - |
1681 | QAbstractItemViewPrivate * const d = d_func(); | - |
1682 | if (verticalScrollBar()->maximum() == value && d->model->canFetchMore(d->root)) evaluated: verticalScrollBar()->maximum() == value yes Evaluation Count:53 | yes Evaluation Count:656 |
evaluated: d->model->canFetchMore(d->root) yes Evaluation Count:4 | yes Evaluation Count:49 |
| 4-656 |
1683 | d->model->fetchMore(d->root); executed: d->model->fetchMore(d->root); Execution Count:4 | 4 |
1684 | QPoint posInVp = viewport()->mapFromGlobal(QCursor::pos()); | - |
1685 | if (viewport()->rect().contains(posInVp)) evaluated: viewport()->rect().contains(posInVp) yes Evaluation Count:679 | yes Evaluation Count:30 |
| 30-679 |
1686 | d->checkMouseMove(posInVp); executed: d->checkMouseMove(posInVp); Execution Count:679 | 679 |
1687 | } executed: } Execution Count:709 | 709 |
1688 | | - |
1689 | | - |
1690 | | - |
1691 | | - |
1692 | void QAbstractItemView::horizontalScrollbarValueChanged(int value) | - |
1693 | { | - |
1694 | QAbstractItemViewPrivate * const d = d_func(); | - |
1695 | if (horizontalScrollBar()->maximum() == value && d->model->canFetchMore(d->root)) evaluated: horizontalScrollBar()->maximum() == value yes Evaluation Count:304 | yes Evaluation Count:5432 |
partially evaluated: d->model->canFetchMore(d->root) no Evaluation Count:0 | yes Evaluation Count:304 |
| 0-5432 |
1696 | d->model->fetchMore(d->root); never executed: d->model->fetchMore(d->root); | 0 |
1697 | QPoint posInVp = viewport()->mapFromGlobal(QCursor::pos()); | - |
1698 | if (viewport()->rect().contains(posInVp)) evaluated: viewport()->rect().contains(posInVp) yes Evaluation Count:5712 | yes Evaluation Count:24 |
| 24-5712 |
1699 | d->checkMouseMove(posInVp); executed: d->checkMouseMove(posInVp); Execution Count:5712 | 5712 |
1700 | } executed: } Execution Count:5736 | 5736 |
1701 | | - |
1702 | | - |
1703 | | - |
1704 | | - |
1705 | void QAbstractItemView::verticalScrollbarAction(int) | - |
1706 | { | - |
1707 | | - |
1708 | } | - |
1709 | | - |
1710 | | - |
1711 | | - |
1712 | | - |
1713 | void QAbstractItemView::horizontalScrollbarAction(int) | - |
1714 | { | - |
1715 | | - |
1716 | } | - |
1717 | void QAbstractItemView::closeEditor(QWidget *editor, QAbstractItemDelegate::EndEditHint hint) | - |
1718 | { | - |
1719 | QAbstractItemViewPrivate * const d = d_func(); | - |
1720 | | - |
1721 | | - |
1722 | if (editor) { evaluated: editor yes Evaluation Count:51 | yes Evaluation Count:8 |
| 8-51 |
1723 | bool isPersistent = d->persistent.contains(editor); | - |
1724 | bool hadFocus = editor->hasFocus(); | - |
1725 | QModelIndex index = d->indexForEditor(editor); | - |
1726 | if (!index.isValid()) partially evaluated: !index.isValid() no Evaluation Count:0 | yes Evaluation Count:51 |
| 0-51 |
1727 | return; | 0 |
1728 | | - |
1729 | if (!isPersistent) { partially evaluated: !isPersistent yes Evaluation Count:51 | no Evaluation Count:0 |
| 0-51 |
1730 | setState(NoState); | - |
1731 | QModelIndex index = d->indexForEditor(editor); | - |
1732 | editor->removeEventFilter(d->delegateForIndex(index)); | - |
1733 | d->removeEditor(editor); | - |
1734 | } executed: } Execution Count:51 | 51 |
1735 | if (hadFocus) evaluated: hadFocus yes Evaluation Count:13 | yes Evaluation Count:38 |
| 13-38 |
1736 | setFocus(); executed: setFocus(); Execution Count:13 | 13 |
1737 | else | - |
1738 | d->checkPersistentEditorFocus(); executed: d->checkPersistentEditorFocus(); Execution Count:38 | 38 |
1739 | | - |
1740 | QPointer<QWidget> ed = editor; | - |
1741 | QApplication::sendPostedEvents(editor, 0); | - |
1742 | editor = ed; | - |
1743 | | - |
1744 | if (!isPersistent && editor) partially evaluated: !isPersistent yes Evaluation Count:51 | no Evaluation Count:0 |
partially evaluated: editor yes Evaluation Count:51 | no Evaluation Count:0 |
| 0-51 |
1745 | d->releaseEditor(editor, index); executed: d->releaseEditor(editor, index); Execution Count:51 | 51 |
1746 | } executed: } Execution Count:51 | 51 |
1747 | | - |
1748 | | - |
1749 | QItemSelectionModel::SelectionFlags flags = QItemSelectionModel::ClearAndSelect | - |
1750 | | d->selectionBehaviorFlags(); | - |
1751 | switch (hint) { | - |
1752 | case QAbstractItemDelegate::EditNextItem: { | - |
1753 | QModelIndex index = moveCursor(MoveNext, Qt::NoModifier); | - |
1754 | if (index.isValid()) { partially evaluated: index.isValid() yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
1755 | QPersistentModelIndex persistent(index); | - |
1756 | d->selectionModel->setCurrentIndex(persistent, flags); | - |
1757 | | - |
1758 | if (index.flags() & Qt::ItemIsEditable partially evaluated: index.flags() & Qt::ItemIsEditable yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
1759 | && (!(editTriggers() & QAbstractItemView::CurrentChanged))) partially evaluated: (!(editTriggers() & QAbstractItemView::CurrentChanged)) yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
1760 | edit(persistent); executed: edit(persistent); Execution Count:2 | 2 |
1761 | } break; } executed: } Execution Count:2 executed: break; Execution Count:2 | 2 |
1762 | case QAbstractItemDelegate::EditPreviousItem: { | - |
1763 | QModelIndex index = moveCursor(MovePrevious, Qt::NoModifier); | - |
1764 | if (index.isValid()) { never evaluated: index.isValid() | 0 |
1765 | QPersistentModelIndex persistent(index); | - |
1766 | d->selectionModel->setCurrentIndex(persistent, flags); | - |
1767 | | - |
1768 | if (index.flags() & Qt::ItemIsEditable never evaluated: index.flags() & Qt::ItemIsEditable | 0 |
1769 | && (!(editTriggers() & QAbstractItemView::CurrentChanged))) never evaluated: (!(editTriggers() & QAbstractItemView::CurrentChanged)) | 0 |
1770 | edit(persistent); never executed: edit(persistent); | 0 |
1771 | } break; } | 0 |
1772 | case QAbstractItemDelegate::SubmitModelCache: | - |
1773 | d->model->submit(); | - |
1774 | break; executed: break; Execution Count:15 | 15 |
1775 | case QAbstractItemDelegate::RevertModelCache: | - |
1776 | d->model->revert(); | - |
1777 | break; executed: break; Execution Count:1 | 1 |
1778 | default: | - |
1779 | break; executed: break; Execution Count:41 | 41 |
1780 | } | - |
1781 | } executed: } Execution Count:59 | 59 |
1782 | | - |
1783 | | - |
1784 | | - |
1785 | | - |
1786 | | - |
1787 | | - |
1788 | void QAbstractItemView::commitData(QWidget *editor) | - |
1789 | { | - |
1790 | QAbstractItemViewPrivate * const d = d_func(); | - |
1791 | if (!editor || !d->itemDelegate || d->currentlyCommittingEditor) evaluated: !editor yes Evaluation Count:8 | yes Evaluation Count:49 |
partially evaluated: !d->itemDelegate no Evaluation Count:0 | yes Evaluation Count:49 |
partially evaluated: d->currentlyCommittingEditor no Evaluation Count:0 | yes Evaluation Count:49 |
| 0-49 |
1792 | return; executed: return; Execution Count:8 | 8 |
1793 | QModelIndex index = d->indexForEditor(editor); | - |
1794 | if (!index.isValid()) partially evaluated: !index.isValid() no Evaluation Count:0 | yes Evaluation Count:49 |
| 0-49 |
1795 | return; | 0 |
1796 | d->currentlyCommittingEditor = editor; | - |
1797 | QAbstractItemDelegate *delegate = d->delegateForIndex(index); | - |
1798 | editor->removeEventFilter(delegate); | - |
1799 | delegate->setModelData(editor, d->model, index); | - |
1800 | editor->installEventFilter(delegate); | - |
1801 | d->currentlyCommittingEditor = 0; | - |
1802 | } executed: } Execution Count:49 | 49 |
1803 | | - |
1804 | | - |
1805 | | - |
1806 | | - |
1807 | | - |
1808 | | - |
1809 | void QAbstractItemView::editorDestroyed(QObject *editor) | - |
1810 | { | - |
1811 | QAbstractItemViewPrivate * const d = d_func(); | - |
1812 | QWidget *w = qobject_cast<QWidget*>(editor); | - |
1813 | d->removeEditor(w); | - |
1814 | d->persistent.remove(w); | - |
1815 | if (state() == EditingState) partially evaluated: state() == EditingState no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
1816 | setState(NoState); never executed: setState(NoState); | 0 |
1817 | } executed: } Execution Count:8 | 8 |
1818 | void QAbstractItemView::setHorizontalStepsPerItem(int steps) | - |
1819 | { | - |
1820 | (void)steps; | - |
1821 | | - |
1822 | } executed: } Execution Count:8 | 8 |
1823 | | - |
1824 | | - |
1825 | | - |
1826 | | - |
1827 | | - |
1828 | | - |
1829 | | - |
1830 | int QAbstractItemView::horizontalStepsPerItem() const | - |
1831 | { | - |
1832 | return 1; executed: return 1; Execution Count:8 | 8 |
1833 | } | - |
1834 | void QAbstractItemView::setVerticalStepsPerItem(int steps) | - |
1835 | { | - |
1836 | (void)steps; | - |
1837 | | - |
1838 | } executed: } Execution Count:8 | 8 |
1839 | | - |
1840 | | - |
1841 | | - |
1842 | | - |
1843 | | - |
1844 | | - |
1845 | | - |
1846 | int QAbstractItemView::verticalStepsPerItem() const | - |
1847 | { | - |
1848 | return 1; executed: return 1; Execution Count:8 | 8 |
1849 | } | - |
1850 | void QAbstractItemView::keyboardSearch(const QString &search) | - |
1851 | { | - |
1852 | QAbstractItemViewPrivate * const d = d_func(); | - |
1853 | if (!d->model->rowCount(d->root) || !d->model->columnCount(d->root)) evaluated: !d->model->rowCount(d->root) yes Evaluation Count:51 | yes Evaluation Count:15 |
partially evaluated: !d->model->columnCount(d->root) no Evaluation Count:0 | yes Evaluation Count:15 |
| 0-51 |
1854 | return; executed: return; Execution Count:51 | 51 |
1855 | | - |
1856 | QModelIndex start = currentIndex().isValid() ? currentIndex() evaluated: currentIndex().isValid() yes Evaluation Count:6 | yes Evaluation Count:9 |
| 6-9 |
1857 | : d->model->index(0, 0, d->root); | - |
1858 | bool skipRow = false; | - |
1859 | bool keyboardTimeWasValid = d->keyboardInputTime.isValid(); | - |
1860 | qint64 keyboardInputTimeElapsed = d->keyboardInputTime.restart(); | - |
1861 | if (search.isEmpty() || !keyboardTimeWasValid evaluated: search.isEmpty() yes Evaluation Count:3 | yes Evaluation Count:12 |
evaluated: !keyboardTimeWasValid yes Evaluation Count:3 | yes Evaluation Count:9 |
| 3-12 |
1862 | || keyboardInputTimeElapsed > QApplication::keyboardInputInterval()) { partially evaluated: keyboardInputTimeElapsed > QApplication::keyboardInputInterval() no Evaluation Count:0 | yes Evaluation Count:9 |
| 0-9 |
1863 | d->keyboardInput = search; | - |
1864 | skipRow = currentIndex().isValid(); | - |
1865 | } else { executed: } Execution Count:6 | 6 |
1866 | d->keyboardInput += search; | - |
1867 | } executed: } Execution Count:9 | 9 |
1868 | | - |
1869 | | - |
1870 | bool sameKey = false; | - |
1871 | if (d->keyboardInput.length() > 1) { evaluated: d->keyboardInput.length() > 1 yes Evaluation Count:9 | yes Evaluation Count:6 |
| 6-9 |
1872 | int c = d->keyboardInput.count(d->keyboardInput.at(d->keyboardInput.length() - 1)); | - |
1873 | sameKey = (c == d->keyboardInput.length()); | - |
1874 | if (sameKey) partially evaluated: sameKey no Evaluation Count:0 | yes Evaluation Count:9 |
| 0-9 |
1875 | skipRow = true; never executed: skipRow = true; | 0 |
1876 | } executed: } Execution Count:9 | 9 |
1877 | | - |
1878 | | - |
1879 | if (skipRow) { evaluated: skipRow yes Evaluation Count:3 | yes Evaluation Count:12 |
| 3-12 |
1880 | QModelIndex parent = start.parent(); | - |
1881 | int newRow = (start.row() < d->model->rowCount(parent) - 1) ? start.row() + 1 : 0; partially evaluated: (start.row() < d->model->rowCount(parent) - 1) yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
1882 | start = d->model->index(newRow, start.column(), parent); | - |
1883 | } executed: } Execution Count:3 | 3 |
1884 | | - |
1885 | | - |
1886 | const QString searchString = sameKey ? QString(d->keyboardInput.at(0)) : d->keyboardInput; partially evaluated: sameKey no Evaluation Count:0 | yes Evaluation Count:15 |
| 0-15 |
1887 | QModelIndex current = start; | - |
1888 | QModelIndexList match; | - |
1889 | QModelIndex firstMatch; | - |
1890 | QModelIndex startMatch; | - |
1891 | QModelIndexList previous; | - |
1892 | do { | - |
1893 | match = d->model->match(current, Qt::DisplayRole, searchString); | - |
1894 | if (match == previous) evaluated: match == previous yes Evaluation Count:11 | yes Evaluation Count:8 |
| 8-11 |
1895 | break; executed: break; Execution Count:11 | 11 |
1896 | firstMatch = match.value(0); | - |
1897 | previous = match; | - |
1898 | if (firstMatch.isValid()) { partially evaluated: firstMatch.isValid() yes Evaluation Count:8 | no Evaluation Count:0 |
| 0-8 |
1899 | if (d->isIndexEnabled(firstMatch)) { evaluated: d->isIndexEnabled(firstMatch) yes Evaluation Count:4 | yes Evaluation Count:4 |
| 4 |
1900 | setCurrentIndex(firstMatch); | - |
1901 | break; executed: break; Execution Count:4 | 4 |
1902 | } | - |
1903 | int row = firstMatch.row() + 1; | - |
1904 | if (row >= d->model->rowCount(firstMatch.parent())) evaluated: row >= d->model->rowCount(firstMatch.parent()) yes Evaluation Count:1 | yes Evaluation Count:3 |
| 1-3 |
1905 | row = 0; executed: row = 0; Execution Count:1 | 1 |
1906 | current = firstMatch.sibling(row, firstMatch.column()); | - |
1907 | | - |
1908 | | - |
1909 | if (!startMatch.isValid()) evaluated: !startMatch.isValid() yes Evaluation Count:1 | yes Evaluation Count:3 |
| 1-3 |
1910 | startMatch = firstMatch; executed: startMatch = firstMatch; Execution Count:1 | 1 |
1911 | else if (startMatch == firstMatch) partially evaluated: startMatch == firstMatch no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
1912 | break; | 0 |
1913 | } | - |
1914 | } while (current != start && firstMatch.isValid()); partially evaluated: firstMatch.isValid() yes Evaluation Count:4 | no Evaluation Count:0 |
executed: } Execution Count:4 partially evaluated: current != start yes Evaluation Count:4 | no Evaluation Count:0 |
| 0-4 |
1915 | } executed: } Execution Count:15 | 15 |
1916 | | - |
1917 | | - |
1918 | | - |
1919 | | - |
1920 | | - |
1921 | | - |
1922 | | - |
1923 | QSize QAbstractItemView::sizeHintForIndex(const QModelIndex &index) const | - |
1924 | { | - |
1925 | const QAbstractItemViewPrivate * const d = d_func(); | - |
1926 | if (!d->isIndexValid(index) || !d->itemDelegate) evaluated: !d->isIndexValid(index) yes Evaluation Count:27 | yes Evaluation Count:1618 |
partially evaluated: !d->itemDelegate no Evaluation Count:0 | yes Evaluation Count:1618 |
| 0-1618 |
1927 | return QSize(); executed: return QSize(); Execution Count:27 | 27 |
1928 | return d->delegateForIndex(index)->sizeHint(d->viewOptions(), index); executed: return d->delegateForIndex(index)->sizeHint(d->viewOptions(), index); Execution Count:1618 | 1618 |
1929 | } | - |
1930 | int QAbstractItemView::sizeHintForRow(int row) const | - |
1931 | { | - |
1932 | const QAbstractItemViewPrivate * const d = d_func(); | - |
1933 | | - |
1934 | if (row < 0 || row >= d->model->rowCount(d->root)) evaluated: row < 0 yes Evaluation Count:1 | yes Evaluation Count:1996 |
evaluated: row >= d->model->rowCount(d->root) yes Evaluation Count:400 | yes Evaluation Count:1596 |
| 1-1996 |
1935 | return -1; executed: return -1; Execution Count:401 | 401 |
1936 | | - |
1937 | ensurePolished(); | - |
1938 | | - |
1939 | QStyleOptionViewItem option = d->viewOptions(); | - |
1940 | int height = 0; | - |
1941 | int colCount = d->model->columnCount(d->root); | - |
1942 | QModelIndex index; | - |
1943 | for (int c = 0; c < colCount; ++c) { evaluated: c < colCount yes Evaluation Count:39084 | yes Evaluation Count:1596 |
| 1596-39084 |
1944 | index = d->model->index(row, c, d->root); | - |
1945 | if (QWidget *editor = d->editorForIndex(index).widget.data()) partially evaluated: QWidget *editor = d->editorForIndex(index).widget.data() no Evaluation Count:0 | yes Evaluation Count:39084 |
| 0-39084 |
1946 | height = qMax(height, editor->height()); never executed: height = qMax(height, editor->height()); | 0 |
1947 | int hint = d->delegateForIndex(index)->sizeHint(option, index).height(); | - |
1948 | height = qMax(height, hint); | - |
1949 | } executed: } Execution Count:39084 | 39084 |
1950 | return height; executed: return height; Execution Count:1596 | 1596 |
1951 | } | - |
1952 | int QAbstractItemView::sizeHintForColumn(int column) const | - |
1953 | { | - |
1954 | const QAbstractItemViewPrivate * const d = d_func(); | - |
1955 | | - |
1956 | if (column < 0 || column >= d->model->columnCount(d->root)) evaluated: column < 0 yes Evaluation Count:1 | yes Evaluation Count:14 |
evaluated: column >= d->model->columnCount(d->root) yes Evaluation Count:12 | yes Evaluation Count:2 |
| 1-14 |
1957 | return -1; executed: return -1; Execution Count:13 | 13 |
1958 | | - |
1959 | ensurePolished(); | - |
1960 | | - |
1961 | QStyleOptionViewItem option = d->viewOptions(); | - |
1962 | int width = 0; | - |
1963 | int rows = d->model->rowCount(d->root); | - |
1964 | QModelIndex index; | - |
1965 | for (int r = 0; r < rows; ++r) { evaluated: r < rows yes Evaluation Count:50 | yes Evaluation Count:2 |
| 2-50 |
1966 | index = d->model->index(r, column, d->root); | - |
1967 | if (QWidget *editor = d->editorForIndex(index).widget.data()) partially evaluated: QWidget *editor = d->editorForIndex(index).widget.data() no Evaluation Count:0 | yes Evaluation Count:50 |
| 0-50 |
1968 | width = qMax(width, editor->sizeHint().width()); never executed: width = qMax(width, editor->sizeHint().width()); | 0 |
1969 | int hint = d->delegateForIndex(index)->sizeHint(option, index).width(); | - |
1970 | width = qMax(width, hint); | - |
1971 | } executed: } Execution Count:50 | 50 |
1972 | return width; executed: return width; Execution Count:2 | 2 |
1973 | } | - |
1974 | | - |
1975 | | - |
1976 | | - |
1977 | | - |
1978 | | - |
1979 | | - |
1980 | | - |
1981 | void QAbstractItemView::openPersistentEditor(const QModelIndex &index) | - |
1982 | { | - |
1983 | QAbstractItemViewPrivate * const d = d_func(); | - |
1984 | QStyleOptionViewItem options = d->viewOptions(); | - |
1985 | options.rect = visualRect(index); | - |
1986 | options.state |= (index == currentIndex() ? QStyle::State_HasFocus : QStyle::State_None); evaluated: index == currentIndex() yes Evaluation Count:26 | yes Evaluation Count:37 |
| 26-37 |
1987 | | - |
1988 | QWidget *editor = d->editor(index, options); | - |
1989 | if (editor) { evaluated: editor yes Evaluation Count:37 | yes Evaluation Count:26 |
| 26-37 |
1990 | editor->show(); | - |
1991 | d->persistent.insert(editor); | - |
1992 | } executed: } Execution Count:37 | 37 |
1993 | } executed: } Execution Count:63 | 63 |
1994 | | - |
1995 | | - |
1996 | | - |
1997 | | - |
1998 | | - |
1999 | | - |
2000 | void QAbstractItemView::closePersistentEditor(const QModelIndex &index) | - |
2001 | { | - |
2002 | QAbstractItemViewPrivate * const d = d_func(); | - |
2003 | if (QWidget *editor = d->editorForIndex(index).widget.data()) { evaluated: QWidget *editor = d->editorForIndex(index).widget.data() yes Evaluation Count:22 | yes Evaluation Count:26 |
| 22-26 |
2004 | if (index == selectionModel()->currentIndex()) evaluated: index == selectionModel()->currentIndex() yes Evaluation Count:1 | yes Evaluation Count:21 |
| 1-21 |
2005 | closeEditor(editor, QAbstractItemDelegate::RevertModelCache); executed: closeEditor(editor, QAbstractItemDelegate::RevertModelCache); Execution Count:1 | 1 |
2006 | d->persistent.remove(editor); | - |
2007 | d->removeEditor(editor); | - |
2008 | d->releaseEditor(editor, index); | - |
2009 | } executed: } Execution Count:22 | 22 |
2010 | } executed: } Execution Count:48 | 48 |
2011 | void QAbstractItemView::setIndexWidget(const QModelIndex &index, QWidget *widget) | - |
2012 | { | - |
2013 | QAbstractItemViewPrivate * const d = d_func(); | - |
2014 | if (!d->isIndexValid(index)) evaluated: !d->isIndexValid(index) yes Evaluation Count:1 | yes Evaluation Count:49 |
| 1-49 |
2015 | return; executed: return; Execution Count:1 | 1 |
2016 | if (QWidget *oldWidget = indexWidget(index)) { evaluated: QWidget *oldWidget = indexWidget(index) yes Evaluation Count:22 | yes Evaluation Count:27 |
| 22-27 |
2017 | d->persistent.remove(oldWidget); | - |
2018 | d->removeEditor(oldWidget); | - |
2019 | oldWidget->deleteLater(); | - |
2020 | } executed: } Execution Count:22 | 22 |
2021 | if (widget) { evaluated: widget yes Evaluation Count:28 | yes Evaluation Count:21 |
| 21-28 |
2022 | widget->setParent(viewport()); | - |
2023 | d->persistent.insert(widget); | - |
2024 | d->addEditor(index, widget, true); | - |
2025 | widget->show(); | - |
2026 | dataChanged(index, index); | - |
2027 | if (!d->delayedPendingLayout) evaluated: !d->delayedPendingLayout yes Evaluation Count:21 | yes Evaluation Count:7 |
| 7-21 |
2028 | widget->setGeometry(visualRect(index)); executed: widget->setGeometry(visualRect(index)); Execution Count:21 | 21 |
2029 | } executed: } Execution Count:28 | 28 |
2030 | } executed: } Execution Count:49 | 49 |
2031 | | - |
2032 | | - |
2033 | | - |
2034 | | - |
2035 | | - |
2036 | | - |
2037 | QWidget* QAbstractItemView::indexWidget(const QModelIndex &index) const | - |
2038 | { | - |
2039 | const QAbstractItemViewPrivate * const d = d_func(); | - |
2040 | if (d->isIndexValid(index)) evaluated: d->isIndexValid(index) yes Evaluation Count:320 | yes Evaluation Count:10 |
| 10-320 |
2041 | if (QWidget *editor = d->editorForIndex(index).widget.data()) evaluated: QWidget *editor = d->editorForIndex(index).widget.data() yes Evaluation Count:66 | yes Evaluation Count:254 |
| 66-254 |
2042 | return editor; executed: return editor; Execution Count:66 | 66 |
2043 | | - |
2044 | return 0; executed: return 0; Execution Count:264 | 264 |
2045 | } | - |
2046 | void QAbstractItemView::scrollToTop() | - |
2047 | { | - |
2048 | verticalScrollBar()->setValue(verticalScrollBar()->minimum()); | - |
2049 | } executed: } Execution Count:2 | 2 |
2050 | void QAbstractItemView::scrollToBottom() | - |
2051 | { | - |
2052 | QAbstractItemViewPrivate * const d = d_func(); | - |
2053 | if (d->delayedPendingLayout) { evaluated: d->delayedPendingLayout yes Evaluation Count:1 | yes Evaluation Count:22 |
| 1-22 |
2054 | d->executePostedLayout(); | - |
2055 | updateGeometries(); | - |
2056 | } executed: } Execution Count:1 | 1 |
2057 | verticalScrollBar()->setValue(verticalScrollBar()->maximum()); | - |
2058 | } executed: } Execution Count:23 | 23 |
2059 | | - |
2060 | | - |
2061 | | - |
2062 | | - |
2063 | | - |
2064 | | - |
2065 | | - |
2066 | void QAbstractItemView::update(const QModelIndex &index) | - |
2067 | { | - |
2068 | QAbstractItemViewPrivate * const d = d_func(); | - |
2069 | if (index.isValid()) { evaluated: index.isValid() yes Evaluation Count:25427 | yes Evaluation Count:80 |
| 80-25427 |
2070 | const QRect rect = visualRect(index); | - |
2071 | | - |
2072 | | - |
2073 | | - |
2074 | if (d->viewport->rect().intersects(rect)) evaluated: d->viewport->rect().intersects(rect) yes Evaluation Count:22531 | yes Evaluation Count:2896 |
| 2896-22531 |
2075 | d->viewport->update(rect); executed: d->viewport->update(rect); Execution Count:22531 | 22531 |
2076 | } executed: } Execution Count:25427 | 25427 |
2077 | } executed: } Execution Count:25507 | 25507 |
2078 | void QAbstractItemView::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles) | - |
2079 | { | - |
2080 | (void)roles;; | - |
2081 | | - |
2082 | QAbstractItemViewPrivate * const d = d_func(); | - |
2083 | if (topLeft == bottomRight && topLeft.isValid()) { evaluated: topLeft == bottomRight yes Evaluation Count:57487 | yes Evaluation Count:676 |
evaluated: topLeft.isValid() yes Evaluation Count:57474 | yes Evaluation Count:13 |
| 13-57487 |
2084 | const QEditorInfo &editorInfo = d->editorForIndex(topLeft); | - |
2085 | | - |
2086 | if (!editorInfo.isStatic && editorInfo.widget) { evaluated: !editorInfo.isStatic yes Evaluation Count:57451 | yes Evaluation Count:23 |
evaluated: editorInfo.widget yes Evaluation Count:32 | yes Evaluation Count:57419 |
| 23-57451 |
2087 | QAbstractItemDelegate *delegate = d->delegateForIndex(topLeft); | - |
2088 | if (delegate) { partially evaluated: delegate yes Evaluation Count:32 | no Evaluation Count:0 |
| 0-32 |
2089 | delegate->setEditorData(editorInfo.widget.data(), topLeft); | - |
2090 | } executed: } Execution Count:32 | 32 |
2091 | } executed: } Execution Count:32 | 32 |
2092 | if (isVisible() && !d->delayedPendingLayout) { evaluated: isVisible() yes Evaluation Count:976 | yes Evaluation Count:56498 |
evaluated: !d->delayedPendingLayout yes Evaluation Count:524 | yes Evaluation Count:452 |
| 452-56498 |
2093 | | - |
2094 | update(topLeft); | - |
2095 | } executed: } Execution Count:524 | 524 |
2096 | } else { executed: } Execution Count:57474 | 57474 |
2097 | d->updateEditorData(topLeft, bottomRight); | - |
2098 | if (isVisible() && !d->delayedPendingLayout) evaluated: isVisible() yes Evaluation Count:98 | yes Evaluation Count:591 |
evaluated: !d->delayedPendingLayout yes Evaluation Count:62 | yes Evaluation Count:36 |
| 36-591 |
2099 | d->viewport->update(); executed: d->viewport->update(); Execution Count:62 | 62 |
2100 | } executed: } Execution Count:689 | 689 |
2101 | | - |
2102 | | - |
2103 | if (QAccessible::isActive()) { evaluated: QAccessible::isActive() yes Evaluation Count:9 | yes Evaluation Count:58154 |
| 9-58154 |
2104 | QAccessibleTableModelChangeEvent accessibleEvent(this, QAccessibleTableModelChangeEvent::DataChanged); | - |
2105 | accessibleEvent.setFirstRow(topLeft.row()); | - |
2106 | accessibleEvent.setFirstColumn(topLeft.column()); | - |
2107 | accessibleEvent.setLastRow(bottomRight.row()); | - |
2108 | accessibleEvent.setLastColumn(bottomRight.column()); | - |
2109 | QAccessible::updateAccessibility(&accessibleEvent); | - |
2110 | } executed: } Execution Count:9 | 9 |
2111 | | - |
2112 | } executed: } Execution Count:58163 | 58163 |
2113 | void QAbstractItemView::rowsInserted(const QModelIndex &, int, int) | - |
2114 | { | - |
2115 | if (!isVisible()) evaluated: !isVisible() yes Evaluation Count:90983 | yes Evaluation Count:8558 |
| 8558-90983 |
2116 | d_func()->fetchMoreTimer.start(0, this); executed: d_func()->fetchMoreTimer.start(0, this); Execution Count:90983 | 90983 |
2117 | else | - |
2118 | updateEditorGeometries(); executed: updateEditorGeometries(); Execution Count:8558 | 8558 |
2119 | } | - |
2120 | | - |
2121 | | - |
2122 | | - |
2123 | | - |
2124 | | - |
2125 | | - |
2126 | | - |
2127 | void QAbstractItemView::rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end) | - |
2128 | { | - |
2129 | QAbstractItemViewPrivate * const d = d_func(); | - |
2130 | | - |
2131 | setState(CollapsingState); | - |
2132 | | - |
2133 | | - |
2134 | QModelIndex current = currentIndex(); | - |
2135 | if (d->selectionMode == SingleSelection evaluated: d->selectionMode == SingleSelection yes Evaluation Count:1452 | yes Evaluation Count:1677 |
| 1452-1677 |
2136 | && current.isValid() evaluated: current.isValid() yes Evaluation Count:25 | yes Evaluation Count:1427 |
| 25-1427 |
2137 | && current.row() >= start evaluated: current.row() >= start yes Evaluation Count:21 | yes Evaluation Count:4 |
| 4-21 |
2138 | && current.row() <= end evaluated: current.row() <= end yes Evaluation Count:11 | yes Evaluation Count:10 |
| 10-11 |
2139 | && current.parent() == parent) { evaluated: current.parent() == parent yes Evaluation Count:8 | yes Evaluation Count:3 |
| 3-8 |
2140 | int totalToRemove = end - start + 1; | - |
2141 | if (d->model->rowCount(parent) <= totalToRemove) { evaluated: d->model->rowCount(parent) <= totalToRemove yes Evaluation Count:4 | yes Evaluation Count:4 |
| 4 |
2142 | QModelIndex index = parent; | - |
2143 | while (index != d->root && !d->isIndexEnabled(index)) evaluated: index != d->root yes Evaluation Count:2 | yes Evaluation Count:2 |
partially evaluated: !d->isIndexEnabled(index) no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
2144 | index = index.parent(); never executed: index = index.parent(); | 0 |
2145 | if (index != d->root) evaluated: index != d->root yes Evaluation Count:2 | yes Evaluation Count:2 |
| 2 |
2146 | setCurrentIndex(index); executed: setCurrentIndex(index); Execution Count:2 | 2 |
2147 | } else { executed: } Execution Count:4 | 4 |
2148 | int row = end + 1; | - |
2149 | QModelIndex next; | - |
2150 | do { | - |
2151 | next = d->model->index(row++, current.column(), current.parent()); | - |
2152 | } while (next.isValid() && (isIndexHidden(next) || !d->isIndexEnabled(next))); partially evaluated: next.isValid() yes Evaluation Count:4 | no Evaluation Count:0 |
partially evaluated: isIndexHidden(next) no Evaluation Count:0 | yes Evaluation Count:4 |
partially evaluated: !d->isIndexEnabled(next) no Evaluation Count:0 | yes Evaluation Count:4 |
executed: } Execution Count:4 | 0-4 |
2153 | if (row > d->model->rowCount(parent)) { partially evaluated: row > d->model->rowCount(parent) no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
2154 | row = start - 1; | - |
2155 | do { | - |
2156 | next = d->model->index(row--, current.column(), current.parent()); | - |
2157 | } while (next.isValid() && (isIndexHidden(next) || !d->isIndexEnabled(next))); never evaluated: next.isValid() never evaluated: isIndexHidden(next) never evaluated: !d->isIndexEnabled(next) | 0 |
2158 | } | 0 |
2159 | setCurrentIndex(next); | - |
2160 | } executed: } Execution Count:4 | 4 |
2161 | } | - |
2162 | | - |
2163 | | - |
2164 | QEditorIndexHash::iterator i = d->editorIndexHash.begin(); | - |
2165 | while (i != d->editorIndexHash.end()) { evaluated: i != d->editorIndexHash.end() yes Evaluation Count:4 | yes Evaluation Count:3129 |
| 4-3129 |
2166 | const QModelIndex index = i.value(); | - |
2167 | if (index.row() >= start && index.row() <= end && d->model->parent(index) == parent) { evaluated: index.row() >= start yes Evaluation Count:3 | yes Evaluation Count:1 |
partially evaluated: index.row() <= end yes Evaluation Count:3 | no Evaluation Count:0 |
partially evaluated: d->model->parent(index) == parent yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
2168 | QWidget *editor = i.key(); | - |
2169 | QEditorInfo info = d->indexEditorHash.take(index); | - |
2170 | i = d->editorIndexHash.erase(i); | - |
2171 | if (info.widget) evaluated: info.widget yes Evaluation Count:2 | yes Evaluation Count:1 |
| 1-2 |
2172 | d->releaseEditor(editor, index); executed: d->releaseEditor(editor, index); Execution Count:2 | 2 |
2173 | } else { executed: } Execution Count:3 | 3 |
2174 | ++i; | - |
2175 | } executed: } Execution Count:1 | 1 |
2176 | } | - |
2177 | } executed: } Execution Count:3129 | 3129 |
2178 | void QAbstractItemViewPrivate::_q_rowsRemoved(const QModelIndex &index, int start, int end) | - |
2179 | { | - |
2180 | (void)index; | - |
2181 | (void)start; | - |
2182 | (void)end; | - |
2183 | | - |
2184 | QAbstractItemView * const q = q_func(); | - |
2185 | if (q->isVisible()) evaluated: q->isVisible() yes Evaluation Count:2644 | yes Evaluation Count:477 |
| 477-2644 |
2186 | q->updateEditorGeometries(); executed: q->updateEditorGeometries(); Execution Count:2644 | 2644 |
2187 | q->setState(QAbstractItemView::NoState); | - |
2188 | | - |
2189 | if (QAccessible::isActive()) { partially evaluated: QAccessible::isActive() no Evaluation Count:0 | yes Evaluation Count:3121 |
| 0-3121 |
2190 | QAccessibleTableModelChangeEvent accessibleEvent(q, QAccessibleTableModelChangeEvent::RowsRemoved); | - |
2191 | accessibleEvent.setFirstRow(start); | - |
2192 | accessibleEvent.setLastRow(end); | - |
2193 | QAccessible::updateAccessibility(&accessibleEvent); | - |
2194 | } | 0 |
2195 | | - |
2196 | } executed: } Execution Count:3121 | 3121 |
2197 | void QAbstractItemViewPrivate::_q_columnsAboutToBeRemoved(const QModelIndex &parent, int start, int end) | - |
2198 | { | - |
2199 | QAbstractItemView * const q = q_func(); | - |
2200 | | - |
2201 | q->setState(QAbstractItemView::CollapsingState); | - |
2202 | | - |
2203 | | - |
2204 | QModelIndex current = q->currentIndex(); | - |
2205 | if (current.isValid() evaluated: current.isValid() yes Evaluation Count:20 | yes Evaluation Count:259 |
| 20-259 |
2206 | && selectionMode == QAbstractItemView::SingleSelection evaluated: selectionMode == QAbstractItemView::SingleSelection yes Evaluation Count:7 | yes Evaluation Count:13 |
| 7-13 |
2207 | && current.column() >= start partially evaluated: current.column() >= start yes Evaluation Count:7 | no Evaluation Count:0 |
| 0-7 |
2208 | && current.column() <= end) { evaluated: current.column() <= end yes Evaluation Count:2 | yes Evaluation Count:5 |
| 2-5 |
2209 | int totalToRemove = end - start + 1; | - |
2210 | if (model->columnCount(parent) < totalToRemove) { partially evaluated: model->columnCount(parent) < totalToRemove no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
2211 | QModelIndex index = parent; | - |
2212 | while (index.isValid() && !isIndexEnabled(index)) never evaluated: index.isValid() never evaluated: !isIndexEnabled(index) | 0 |
2213 | index = index.parent(); never executed: index = index.parent(); | 0 |
2214 | if (index.isValid()) never evaluated: index.isValid() | 0 |
2215 | q->setCurrentIndex(index); never executed: q->setCurrentIndex(index); | 0 |
2216 | } else { | 0 |
2217 | int column = end; | - |
2218 | QModelIndex next; | - |
2219 | do { | - |
2220 | next = model->index(current.row(), column++, current.parent()); | - |
2221 | } while (next.isValid() && (q->isIndexHidden(next) || !isIndexEnabled(next))); partially evaluated: next.isValid() yes Evaluation Count:2 | no Evaluation Count:0 |
partially evaluated: q->isIndexHidden(next) no Evaluation Count:0 | yes Evaluation Count:2 |
partially evaluated: !isIndexEnabled(next) no Evaluation Count:0 | yes Evaluation Count:2 |
executed: } Execution Count:2 | 0-2 |
2222 | q->setCurrentIndex(next); | - |
2223 | } executed: } Execution Count:2 | 2 |
2224 | } | - |
2225 | | - |
2226 | | - |
2227 | QEditorIndexHash::iterator it = editorIndexHash.begin(); | - |
2228 | while (it != editorIndexHash.end()) { evaluated: it != editorIndexHash.end() yes Evaluation Count:1 | yes Evaluation Count:279 |
| 1-279 |
2229 | QModelIndex index = it.value(); | - |
2230 | if (index.column() <= start && index.column() >= end && model->parent(index) == parent) { partially evaluated: index.column() <= start yes Evaluation Count:1 | no Evaluation Count:0 |
partially evaluated: index.column() >= end no Evaluation Count:0 | yes Evaluation Count:1 |
never evaluated: model->parent(index) == parent | 0-1 |
2231 | QWidget *editor = it.key(); | - |
2232 | QEditorInfo info = indexEditorHash.take(it.value()); | - |
2233 | it = editorIndexHash.erase(it); | - |
2234 | if (info.widget) never evaluated: info.widget | 0 |
2235 | releaseEditor(editor, index); never executed: releaseEditor(editor, index); | 0 |
2236 | } else { | 0 |
2237 | ++it; | - |
2238 | } executed: } Execution Count:1 | 1 |
2239 | } | - |
2240 | | - |
2241 | } executed: } Execution Count:279 | 279 |
2242 | void QAbstractItemViewPrivate::_q_columnsRemoved(const QModelIndex &index, int start, int end) | - |
2243 | { | - |
2244 | (void)index; | - |
2245 | (void)start; | - |
2246 | (void)end; | - |
2247 | | - |
2248 | QAbstractItemView * const q = q_func(); | - |
2249 | if (q->isVisible()) evaluated: q->isVisible() yes Evaluation Count:211 | yes Evaluation Count:68 |
| 68-211 |
2250 | q->updateEditorGeometries(); executed: q->updateEditorGeometries(); Execution Count:211 | 211 |
2251 | q->setState(QAbstractItemView::NoState); | - |
2252 | | - |
2253 | if (QAccessible::isActive()) { evaluated: QAccessible::isActive() yes Evaluation Count:4 | yes Evaluation Count:275 |
| 4-275 |
2254 | QAccessibleTableModelChangeEvent accessibleEvent(q, QAccessibleTableModelChangeEvent::ColumnsRemoved); | - |
2255 | accessibleEvent.setFirstColumn(start); | - |
2256 | accessibleEvent.setLastColumn(end); | - |
2257 | QAccessible::updateAccessibility(&accessibleEvent); | - |
2258 | } executed: } Execution Count:4 | 4 |
2259 | | - |
2260 | } executed: } Execution Count:279 | 279 |
2261 | | - |
2262 | | - |
2263 | | - |
2264 | | - |
2265 | | - |
2266 | | - |
2267 | | - |
2268 | void QAbstractItemViewPrivate::_q_rowsInserted(const QModelIndex &index, int start, int end) | - |
2269 | { | - |
2270 | (void)index; | - |
2271 | (void)start; | - |
2272 | (void)end; | - |
2273 | | - |
2274 | | - |
2275 | QAbstractItemView * const q = q_func(); | - |
2276 | if (QAccessible::isActive()) { evaluated: QAccessible::isActive() yes Evaluation Count:15 | yes Evaluation Count:195919 |
| 15-195919 |
2277 | QAccessibleTableModelChangeEvent accessibleEvent(q, QAccessibleTableModelChangeEvent::RowsInserted); | - |
2278 | accessibleEvent.setFirstRow(start); | - |
2279 | accessibleEvent.setLastRow(end); | - |
2280 | QAccessible::updateAccessibility(&accessibleEvent); | - |
2281 | } executed: } Execution Count:15 | 15 |
2282 | | - |
2283 | } executed: } Execution Count:195934 | 195934 |
2284 | | - |
2285 | | - |
2286 | | - |
2287 | | - |
2288 | | - |
2289 | | - |
2290 | void QAbstractItemViewPrivate::_q_columnsInserted(const QModelIndex &index, int start, int end) | - |
2291 | { | - |
2292 | (void)index; | - |
2293 | (void)start; | - |
2294 | (void)end; | - |
2295 | | - |
2296 | QAbstractItemView * const q = q_func(); | - |
2297 | if (q->isVisible()) evaluated: q->isVisible() yes Evaluation Count:226 | yes Evaluation Count:606 |
| 226-606 |
2298 | q->updateEditorGeometries(); executed: q->updateEditorGeometries(); Execution Count:226 | 226 |
2299 | | - |
2300 | if (QAccessible::isActive()) { evaluated: QAccessible::isActive() yes Evaluation Count:2 | yes Evaluation Count:830 |
| 2-830 |
2301 | QAccessibleTableModelChangeEvent accessibleEvent(q, QAccessibleTableModelChangeEvent::ColumnsInserted); | - |
2302 | accessibleEvent.setFirstColumn(start); | - |
2303 | accessibleEvent.setLastColumn(end); | - |
2304 | QAccessible::updateAccessibility(&accessibleEvent); | - |
2305 | } executed: } Execution Count:2 | 2 |
2306 | | - |
2307 | } executed: } Execution Count:832 | 832 |
2308 | | - |
2309 | | - |
2310 | | - |
2311 | | - |
2312 | void QAbstractItemViewPrivate::_q_modelDestroyed() | - |
2313 | { | - |
2314 | model = QAbstractItemModelPrivate::staticEmptyModel(); | - |
2315 | doDelayedReset(); | - |
2316 | } executed: } Execution Count:2070 | 2070 |
2317 | | - |
2318 | | - |
2319 | | - |
2320 | | - |
2321 | | - |
2322 | | - |
2323 | void QAbstractItemViewPrivate::_q_layoutChanged() | - |
2324 | { | - |
2325 | doDelayedItemsLayout(); | - |
2326 | | - |
2327 | QAbstractItemView * const q = q_func(); | - |
2328 | if (QAccessible::isActive()) { partially evaluated: QAccessible::isActive() no Evaluation Count:0 | yes Evaluation Count:1298 |
| 0-1298 |
2329 | QAccessibleTableModelChangeEvent accessibleEvent(q, QAccessibleTableModelChangeEvent::ModelReset); | - |
2330 | QAccessible::updateAccessibility(&accessibleEvent); | - |
2331 | } | 0 |
2332 | | - |
2333 | } executed: } Execution Count:1298 | 1298 |
2334 | | - |
2335 | void QAbstractItemViewPrivate::_q_rowsMoved(const QModelIndex &, int, int, const QModelIndex &, int) | - |
2336 | { | - |
2337 | _q_layoutChanged(); | - |
2338 | } | 0 |
2339 | | - |
2340 | void QAbstractItemViewPrivate::_q_columnsMoved(const QModelIndex &, int, int, const QModelIndex &, int) | - |
2341 | { | - |
2342 | _q_layoutChanged(); | - |
2343 | } | 0 |
2344 | void QAbstractItemView::selectionChanged(const QItemSelection &selected, | - |
2345 | const QItemSelection &deselected) | - |
2346 | { | - |
2347 | QAbstractItemViewPrivate * const d = d_func(); | - |
2348 | if (isVisible() && updatesEnabled()) { evaluated: isVisible() yes Evaluation Count:4251 | yes Evaluation Count:5219 |
evaluated: updatesEnabled() yes Evaluation Count:4231 | yes Evaluation Count:20 |
| 20-5219 |
2349 | d->viewport->update(visualRegionForSelection(deselected) | visualRegionForSelection(selected)); | - |
2350 | } executed: } Execution Count:4231 | 4231 |
2351 | } executed: } Execution Count:9470 | 9470 |
2352 | void QAbstractItemView::currentChanged(const QModelIndex ¤t, const QModelIndex &previous) | - |
2353 | { | - |
2354 | QAbstractItemViewPrivate * const d = d_func(); | - |
2355 | qt_noop(); | - |
2356 | | - |
2357 | if (previous.isValid()) { evaluated: previous.isValid() yes Evaluation Count:2849 | yes Evaluation Count:1453 |
| 1453-2849 |
2358 | QModelIndex buddy = d->model->buddy(previous); | - |
2359 | QWidget *editor = d->editorForIndex(buddy).widget.data(); | - |
2360 | if (editor && !d->persistent.contains(editor)) { evaluated: editor yes Evaluation Count:4 | yes Evaluation Count:2845 |
evaluated: !d->persistent.contains(editor) yes Evaluation Count:3 | yes Evaluation Count:1 |
| 1-2845 |
2361 | commitData(editor); | - |
2362 | if (current.row() != previous.row()) evaluated: current.row() != previous.row() yes Evaluation Count:2 | yes Evaluation Count:1 |
| 1-2 |
2363 | closeEditor(editor, QAbstractItemDelegate::SubmitModelCache); executed: closeEditor(editor, QAbstractItemDelegate::SubmitModelCache); Execution Count:2 | 2 |
2364 | else | - |
2365 | closeEditor(editor, QAbstractItemDelegate::NoHint); executed: closeEditor(editor, QAbstractItemDelegate::NoHint); Execution Count:1 | 1 |
2366 | } | - |
2367 | if (isVisible()) { evaluated: isVisible() yes Evaluation Count:1768 | yes Evaluation Count:1081 |
| 1081-1768 |
2368 | update(previous); | - |
2369 | } executed: } Execution Count:1768 | 1768 |
2370 | } executed: } Execution Count:2849 | 2849 |
2371 | | - |
2372 | if (current.isValid() && !d->autoScrollTimer.isActive()) { evaluated: current.isValid() yes Evaluation Count:3484 | yes Evaluation Count:818 |
partially evaluated: !d->autoScrollTimer.isActive() yes Evaluation Count:3484 | no Evaluation Count:0 |
| 0-3484 |
2373 | if (isVisible()) { evaluated: isVisible() yes Evaluation Count:2010 | yes Evaluation Count:1474 |
| 1474-2010 |
2374 | if (d->autoScroll) evaluated: d->autoScroll yes Evaluation Count:1251 | yes Evaluation Count:759 |
| 759-1251 |
2375 | scrollTo(current); executed: scrollTo(current); Execution Count:1251 | 1251 |
2376 | update(current); | - |
2377 | edit(current, CurrentChanged, 0); | - |
2378 | if (current.row() == (d->model->rowCount(d->root) - 1)) evaluated: current.row() == (d->model->rowCount(d->root) - 1) yes Evaluation Count:107 | yes Evaluation Count:1903 |
| 107-1903 |
2379 | d->fetchMore(); executed: d->fetchMore(); Execution Count:107 | 107 |
2380 | } else { executed: } Execution Count:2010 | 2010 |
2381 | d->shouldScrollToCurrentOnShow = d->autoScroll; | - |
2382 | } executed: } Execution Count:1474 | 1474 |
2383 | } | - |
2384 | } executed: } Execution Count:4302 | 4302 |
2385 | | - |
2386 | | - |
2387 | | - |
2388 | | - |
2389 | | - |
2390 | void QAbstractItemView::startDrag(Qt::DropActions supportedActions) | - |
2391 | { | - |
2392 | QAbstractItemViewPrivate * const d = d_func(); | - |
2393 | QModelIndexList indexes = d->selectedDraggableIndexes(); | - |
2394 | if (indexes.count() > 0) { partially evaluated: indexes.count() > 0 no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
2395 | QMimeData *data = d->model->mimeData(indexes); | - |
2396 | if (!data) | 0 |
2397 | return; | 0 |
2398 | QRect rect; | - |
2399 | QPixmap pixmap = d->renderToPixmap(indexes, &rect); | - |
2400 | rect.adjust(horizontalOffset(), verticalOffset(), 0, 0); | - |
2401 | QDrag *drag = new QDrag(this); | - |
2402 | drag->setPixmap(pixmap); | - |
2403 | drag->setMimeData(data); | - |
2404 | drag->setHotSpot(d->pressedPosition - rect.topLeft()); | - |
2405 | Qt::DropAction defaultDropAction = Qt::IgnoreAction; | - |
2406 | if (d->defaultDropAction != Qt::IgnoreAction && (supportedActions & d->defaultDropAction)) never evaluated: d->defaultDropAction != Qt::IgnoreAction never evaluated: (supportedActions & d->defaultDropAction) | 0 |
2407 | defaultDropAction = d->defaultDropAction; never executed: defaultDropAction = d->defaultDropAction; | 0 |
2408 | else if (supportedActions & Qt::CopyAction && dragDropMode() != QAbstractItemView::InternalMove) never evaluated: supportedActions & Qt::CopyAction never evaluated: dragDropMode() != QAbstractItemView::InternalMove | 0 |
2409 | defaultDropAction = Qt::CopyAction; never executed: defaultDropAction = Qt::CopyAction; | 0 |
2410 | if (drag->exec(supportedActions, defaultDropAction) == Qt::MoveAction) never evaluated: drag->exec(supportedActions, defaultDropAction) == Qt::MoveAction | 0 |
2411 | d->clearOrRemove(); never executed: d->clearOrRemove(); | 0 |
2412 | } | 0 |
2413 | } executed: } Execution Count:4 | 4 |
2414 | | - |
2415 | | - |
2416 | | - |
2417 | | - |
2418 | | - |
2419 | | - |
2420 | QStyleOptionViewItem QAbstractItemView::viewOptions() const | - |
2421 | { | - |
2422 | const QAbstractItemViewPrivate * const d = d_func(); | - |
2423 | return d->viewOptions(); executed: return d->viewOptions(); Execution Count:1980 | 1980 |
2424 | } | - |
2425 | | - |
2426 | QStyleOptionViewItem QAbstractItemViewPrivate::viewOptions() const | - |
2427 | { | - |
2428 | const QAbstractItemView * const q = q_func(); | - |
2429 | QStyleOptionViewItem option; | - |
2430 | option.init(q); | - |
2431 | option.state &= ~QStyle::State_MouseOver; | - |
2432 | option.font = q->font(); | - |
2433 | | - |
2434 | | - |
2435 | | - |
2436 | | - |
2437 | if (!q->hasFocus()) evaluated: !q->hasFocus() yes Evaluation Count:16431 | yes Evaluation Count:25869 |
| 16431-25869 |
2438 | option.state &= ~QStyle::State_Active; executed: option.state &= ~QStyle::State_Active; Execution Count:16431 | 16431 |
2439 | | - |
2440 | | - |
2441 | option.state &= ~QStyle::State_HasFocus; | - |
2442 | if (iconSize.isValid()) { evaluated: iconSize.isValid() yes Evaluation Count:2177 | yes Evaluation Count:40123 |
| 2177-40123 |
2443 | option.decorationSize = iconSize; | - |
2444 | } else { executed: } Execution Count:2177 | 2177 |
2445 | int pm = q->style()->pixelMetric(QStyle::PM_SmallIconSize, 0, q); | - |
2446 | option.decorationSize = QSize(pm, pm); | - |
2447 | } executed: } Execution Count:40123 | 40123 |
2448 | option.decorationPosition = QStyleOptionViewItem::Left; | - |
2449 | option.decorationAlignment = Qt::AlignCenter; | - |
2450 | option.displayAlignment = Qt::AlignLeft|Qt::AlignVCenter; | - |
2451 | option.textElideMode = textElideMode; | - |
2452 | option.rect = QRect(); | - |
2453 | option.showDecorationSelected = q->style()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected, 0, q); | - |
2454 | if (wrapItemText) evaluated: wrapItemText yes Evaluation Count:4098 | yes Evaluation Count:38202 |
| 4098-38202 |
2455 | option.features = QStyleOptionViewItem::WrapText; executed: option.features = QStyleOptionViewItem::WrapText; Execution Count:4098 | 4098 |
2456 | option.locale = q->locale(); | - |
2457 | option.locale.setNumberOptions(QLocale::OmitGroupSeparator); | - |
2458 | option.widget = q; | - |
2459 | return option; executed: return option; Execution Count:42300 | 42300 |
2460 | } | - |
2461 | | - |
2462 | | - |
2463 | | - |
2464 | | - |
2465 | | - |
2466 | | - |
2467 | QAbstractItemView::State QAbstractItemView::state() const | - |
2468 | { | - |
2469 | const QAbstractItemViewPrivate * const d = d_func(); | - |
2470 | return d->state; executed: return d->state; Execution Count:7962 | 7962 |
2471 | } | - |
2472 | | - |
2473 | | - |
2474 | | - |
2475 | | - |
2476 | | - |
2477 | | - |
2478 | void QAbstractItemView::setState(State state) | - |
2479 | { | - |
2480 | QAbstractItemViewPrivate * const d = d_func(); | - |
2481 | d->state = state; | - |
2482 | } executed: } Execution Count:20550 | 20550 |
2483 | void QAbstractItemView::scheduleDelayedItemsLayout() | - |
2484 | { | - |
2485 | QAbstractItemViewPrivate * const d = d_func(); | - |
2486 | d->doDelayedItemsLayout(); | - |
2487 | } executed: } Execution Count:6 | 6 |
2488 | | - |
2489 | | - |
2490 | | - |
2491 | | - |
2492 | | - |
2493 | | - |
2494 | | - |
2495 | void QAbstractItemView::executeDelayedItemsLayout() | - |
2496 | { | - |
2497 | QAbstractItemViewPrivate * const d = d_func(); | - |
2498 | d->executePostedLayout(); | - |
2499 | } executed: } Execution Count:4 | 4 |
2500 | void QAbstractItemView::setDirtyRegion(const QRegion ®ion) | - |
2501 | { | - |
2502 | QAbstractItemViewPrivate * const d = d_func(); | - |
2503 | d->setDirtyRegion(region); | - |
2504 | } | 0 |
2505 | void QAbstractItemView::scrollDirtyRegion(int dx, int dy) | - |
2506 | { | - |
2507 | QAbstractItemViewPrivate * const d = d_func(); | - |
2508 | d->scrollDirtyRegion(dx, dy); | - |
2509 | } | 0 |
2510 | QPoint QAbstractItemView::dirtyRegionOffset() const | - |
2511 | { | - |
2512 | const QAbstractItemViewPrivate * const d = d_func(); | - |
2513 | return d->scrollDelayOffset; never executed: return d->scrollDelayOffset; | 0 |
2514 | } | - |
2515 | | - |
2516 | | - |
2517 | | - |
2518 | | - |
2519 | void QAbstractItemView::startAutoScroll() | - |
2520 | { | - |
2521 | d_func()->startAutoScroll(); | - |
2522 | } executed: } Execution Count:8 | 8 |
2523 | | - |
2524 | | - |
2525 | | - |
2526 | | - |
2527 | void QAbstractItemView::stopAutoScroll() | - |
2528 | { | - |
2529 | d_func()->stopAutoScroll(); | - |
2530 | } executed: } Execution Count:16 | 16 |
2531 | | - |
2532 | | - |
2533 | | - |
2534 | | - |
2535 | void QAbstractItemView::doAutoScroll() | - |
2536 | { | - |
2537 | | - |
2538 | QAbstractItemViewPrivate * const d = d_func(); | - |
2539 | QScrollBar *verticalScroll = verticalScrollBar(); | - |
2540 | QScrollBar *horizontalScroll = horizontalScrollBar(); | - |
2541 | | - |
2542 | | - |
2543 | | - |
2544 | QHeaderView *hv = qobject_cast<QHeaderView*>(this); | - |
2545 | if (hv) { evaluated: hv yes Evaluation Count:2 | yes Evaluation Count:6 |
| 2-6 |
2546 | QAbstractScrollArea *parent = qobject_cast<QAbstractScrollArea*>(parentWidget()); | - |
2547 | if (parent) { partially evaluated: parent no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
2548 | if (hv->orientation() == Qt::Horizontal) { never evaluated: hv->orientation() == Qt::Horizontal | 0 |
2549 | if (!hv->horizontalScrollBar() || !hv->horizontalScrollBar()->isVisible()) never evaluated: !hv->horizontalScrollBar() never evaluated: !hv->horizontalScrollBar()->isVisible() | 0 |
2550 | horizontalScroll = parent->horizontalScrollBar(); never executed: horizontalScroll = parent->horizontalScrollBar(); | 0 |
2551 | } else { | 0 |
2552 | if (!hv->verticalScrollBar() || !hv->verticalScrollBar()->isVisible()) never evaluated: !hv->verticalScrollBar() never evaluated: !hv->verticalScrollBar()->isVisible() | 0 |
2553 | verticalScroll = parent->verticalScrollBar(); never executed: verticalScroll = parent->verticalScrollBar(); | 0 |
2554 | } | 0 |
2555 | } | - |
2556 | } executed: } Execution Count:2 | 2 |
2557 | | - |
2558 | int verticalStep = verticalScroll->pageStep(); | - |
2559 | int horizontalStep = horizontalScroll->pageStep(); | - |
2560 | if (d->autoScrollCount < qMax(verticalStep, horizontalStep)) partially evaluated: d->autoScrollCount < qMax(verticalStep, horizontalStep) yes Evaluation Count:8 | no Evaluation Count:0 |
| 0-8 |
2561 | ++d->autoScrollCount; executed: ++d->autoScrollCount; Execution Count:8 | 8 |
2562 | | - |
2563 | int margin = d->autoScrollMargin; | - |
2564 | int verticalValue = verticalScroll->value(); | - |
2565 | int horizontalValue = horizontalScroll->value(); | - |
2566 | | - |
2567 | QPoint pos = d->viewport->mapFromGlobal(QCursor::pos()); | - |
2568 | QRect area = static_cast<QAbstractItemView*>(d->viewport)->d_func()->clipRect(); | - |
2569 | | - |
2570 | | - |
2571 | if (pos.y() - area.top() < margin) evaluated: pos.y() - area.top() < margin yes Evaluation Count:2 | yes Evaluation Count:6 |
| 2-6 |
2572 | verticalScroll->setValue(verticalValue - d->autoScrollCount); executed: verticalScroll->setValue(verticalValue - d->autoScrollCount); Execution Count:2 | 2 |
2573 | else if (area.bottom() - pos.y() < margin) partially evaluated: area.bottom() - pos.y() < margin no Evaluation Count:0 | yes Evaluation Count:6 |
| 0-6 |
2574 | verticalScroll->setValue(verticalValue + d->autoScrollCount); never executed: verticalScroll->setValue(verticalValue + d->autoScrollCount); | 0 |
2575 | if (pos.x() - area.left() < margin) partially evaluated: pos.x() - area.left() < margin no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
2576 | horizontalScroll->setValue(horizontalValue - d->autoScrollCount); never executed: horizontalScroll->setValue(horizontalValue - d->autoScrollCount); | 0 |
2577 | else if (area.right() - pos.x() < margin) partially evaluated: area.right() - pos.x() < margin no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
2578 | horizontalScroll->setValue(horizontalValue + d->autoScrollCount); never executed: horizontalScroll->setValue(horizontalValue + d->autoScrollCount); | 0 |
2579 | | - |
2580 | bool verticalUnchanged = (verticalValue == verticalScroll->value()); | - |
2581 | bool horizontalUnchanged = (horizontalValue == horizontalScroll->value()); | - |
2582 | if (verticalUnchanged && horizontalUnchanged) { partially evaluated: verticalUnchanged yes Evaluation Count:8 | no Evaluation Count:0 |
partially evaluated: horizontalUnchanged yes Evaluation Count:8 | no Evaluation Count:0 |
| 0-8 |
2583 | stopAutoScroll(); | - |
2584 | } else { executed: } Execution Count:8 | 8 |
2585 | | - |
2586 | d->dropIndicatorRect = QRect(); | - |
2587 | d->dropIndicatorPosition = QAbstractItemView::OnViewport; | - |
2588 | | - |
2589 | d->viewport->update(); | - |
2590 | } | 0 |
2591 | } | - |
2592 | QItemSelectionModel::SelectionFlags QAbstractItemView::selectionCommand(const QModelIndex &index, | - |
2593 | const QEvent *event) const | - |
2594 | { | - |
2595 | const QAbstractItemViewPrivate * const d = d_func(); | - |
2596 | switch (d->selectionMode) { | - |
2597 | case NoSelection: | - |
2598 | return QItemSelectionModel::NoUpdate; executed: return QItemSelectionModel::NoUpdate; Execution Count:33 | 33 |
2599 | case SingleSelection: | - |
2600 | if (event && event->type() == QEvent::MouseButtonRelease) evaluated: event yes Evaluation Count:1025 | yes Evaluation Count:1105 |
evaluated: event->type() == QEvent::MouseButtonRelease yes Evaluation Count:1 | yes Evaluation Count:1024 |
| 1-1105 |
2601 | return QItemSelectionModel::NoUpdate; executed: return QItemSelectionModel::NoUpdate; Execution Count:1 | 1 |
2602 | return QItemSelectionModel::ClearAndSelect|d->selectionBehaviorFlags(); executed: return QItemSelectionModel::ClearAndSelect|d->selectionBehaviorFlags(); Execution Count:2129 | 2129 |
2603 | case MultiSelection: | - |
2604 | return d->multiSelectionCommand(index, event); executed: return d->multiSelectionCommand(index, event); Execution Count:4 | 4 |
2605 | case ExtendedSelection: | - |
2606 | return d->extendedSelectionCommand(index, event); executed: return d->extendedSelectionCommand(index, event); Execution Count:977 | 977 |
2607 | case ContiguousSelection: | - |
2608 | return d->contiguousSelectionCommand(index, event); executed: return d->contiguousSelectionCommand(index, event); Execution Count:4 | 4 |
2609 | } | - |
2610 | return QItemSelectionModel::NoUpdate; never executed: return QItemSelectionModel::NoUpdate; | 0 |
2611 | } | - |
2612 | | - |
2613 | QItemSelectionModel::SelectionFlags QAbstractItemViewPrivate::multiSelectionCommand( | - |
2614 | const QModelIndex &index, const QEvent *event) const | - |
2615 | { | - |
2616 | (void)index; | - |
2617 | | - |
2618 | if (event) { partially evaluated: event no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
2619 | switch (event->type()) { | - |
2620 | case QEvent::KeyPress: | - |
2621 | if (static_cast<const QKeyEvent*>(event)->key() == Qt::Key_Space never evaluated: static_cast<const QKeyEvent*>(event)->key() == Qt::Key_Space | 0 |
2622 | || static_cast<const QKeyEvent*>(event)->key() == Qt::Key_Select) never evaluated: static_cast<const QKeyEvent*>(event)->key() == Qt::Key_Select | 0 |
2623 | return QItemSelectionModel::Toggle|selectionBehaviorFlags(); never executed: return QItemSelectionModel::Toggle|selectionBehaviorFlags(); | 0 |
2624 | break; | 0 |
2625 | case QEvent::MouseButtonPress: | - |
2626 | if (static_cast<const QMouseEvent*>(event)->button() == Qt::LeftButton) never evaluated: static_cast<const QMouseEvent*>(event)->button() == Qt::LeftButton | 0 |
2627 | return QItemSelectionModel::Toggle|selectionBehaviorFlags(); never executed: return QItemSelectionModel::Toggle|selectionBehaviorFlags(); | 0 |
2628 | break; | 0 |
2629 | case QEvent::MouseButtonRelease: | - |
2630 | if (static_cast<const QMouseEvent*>(event)->button() == Qt::LeftButton) never evaluated: static_cast<const QMouseEvent*>(event)->button() == Qt::LeftButton | 0 |
2631 | return QItemSelectionModel::NoUpdate|selectionBehaviorFlags(); never executed: return QItemSelectionModel::NoUpdate|selectionBehaviorFlags(); | 0 |
2632 | break; | 0 |
2633 | case QEvent::MouseMove: | - |
2634 | if (static_cast<const QMouseEvent*>(event)->buttons() & Qt::LeftButton) never evaluated: static_cast<const QMouseEvent*>(event)->buttons() & Qt::LeftButton | 0 |
2635 | return QItemSelectionModel::ToggleCurrent|selectionBehaviorFlags(); never executed: return QItemSelectionModel::ToggleCurrent|selectionBehaviorFlags(); | 0 |
2636 | default: | - |
2637 | break; | 0 |
2638 | } | - |
2639 | return QItemSelectionModel::NoUpdate; never executed: return QItemSelectionModel::NoUpdate; | 0 |
2640 | } | - |
2641 | | - |
2642 | return QItemSelectionModel::Toggle|selectionBehaviorFlags(); executed: return QItemSelectionModel::Toggle|selectionBehaviorFlags(); Execution Count:4 | 4 |
2643 | } | - |
2644 | | - |
2645 | QItemSelectionModel::SelectionFlags QAbstractItemViewPrivate::extendedSelectionCommand( | - |
2646 | const QModelIndex &index, const QEvent *event) const | - |
2647 | { | - |
2648 | Qt::KeyboardModifiers modifiers = QApplication::keyboardModifiers(); | - |
2649 | if (event) { evaluated: event yes Evaluation Count:614 | yes Evaluation Count:367 |
| 367-614 |
2650 | switch (event->type()) { | - |
2651 | case QEvent::MouseMove: { | - |
2652 | | - |
2653 | modifiers = static_cast<const QMouseEvent*>(event)->modifiers(); | - |
2654 | if (modifiers & Qt::ControlModifier) evaluated: modifiers & Qt::ControlModifier yes Evaluation Count:13 | yes Evaluation Count:2 |
| 2-13 |
2655 | return QItemSelectionModel::ToggleCurrent|selectionBehaviorFlags(); executed: return QItemSelectionModel::ToggleCurrent|selectionBehaviorFlags(); Execution Count:13 | 13 |
2656 | break; executed: break; Execution Count:2 | 2 |
2657 | } | - |
2658 | case QEvent::MouseButtonPress: { | - |
2659 | modifiers = static_cast<const QMouseEvent*>(event)->modifiers(); | - |
2660 | const Qt::MouseButton button = static_cast<const QMouseEvent*>(event)->button(); | - |
2661 | const bool rightButtonPressed = button & Qt::RightButton; | - |
2662 | const bool shiftKeyPressed = modifiers & Qt::ShiftModifier; | - |
2663 | const bool controlKeyPressed = modifiers & Qt::ControlModifier; | - |
2664 | const bool indexIsSelected = selectionModel->isSelected(index); | - |
2665 | if ((shiftKeyPressed || controlKeyPressed) && rightButtonPressed) evaluated: shiftKeyPressed yes Evaluation Count:91 | yes Evaluation Count:289 |
evaluated: controlKeyPressed yes Evaluation Count:96 | yes Evaluation Count:193 |
evaluated: rightButtonPressed yes Evaluation Count:2 | yes Evaluation Count:185 |
| 2-289 |
2666 | return QItemSelectionModel::NoUpdate; executed: return QItemSelectionModel::NoUpdate; Execution Count:2 | 2 |
2667 | if (!shiftKeyPressed && !controlKeyPressed && indexIsSelected) evaluated: !shiftKeyPressed yes Evaluation Count:287 | yes Evaluation Count:91 |
evaluated: !controlKeyPressed yes Evaluation Count:193 | yes Evaluation Count:94 |
evaluated: indexIsSelected yes Evaluation Count:20 | yes Evaluation Count:173 |
| 20-287 |
2668 | return QItemSelectionModel::NoUpdate; executed: return QItemSelectionModel::NoUpdate; Execution Count:20 | 20 |
2669 | if (!index.isValid() && !rightButtonPressed && !shiftKeyPressed && !controlKeyPressed) evaluated: !index.isValid() yes Evaluation Count:7 | yes Evaluation Count:351 |
evaluated: !rightButtonPressed yes Evaluation Count:6 | yes Evaluation Count:1 |
partially evaluated: !shiftKeyPressed yes Evaluation Count:6 | no Evaluation Count:0 |
evaluated: !controlKeyPressed yes Evaluation Count:5 | yes Evaluation Count:1 |
| 0-351 |
2670 | return QItemSelectionModel::Clear; executed: return QItemSelectionModel::Clear; Execution Count:5 | 5 |
2671 | if (!index.isValid()) evaluated: !index.isValid() yes Evaluation Count:2 | yes Evaluation Count:351 |
| 2-351 |
2672 | return QItemSelectionModel::NoUpdate; executed: return QItemSelectionModel::NoUpdate; Execution Count:2 | 2 |
2673 | break; executed: break; Execution Count:351 | 351 |
2674 | } | - |
2675 | case QEvent::MouseButtonRelease: { | - |
2676 | | - |
2677 | modifiers = static_cast<const QMouseEvent*>(event)->modifiers(); | - |
2678 | const Qt::MouseButton button = static_cast<const QMouseEvent*>(event)->button(); | - |
2679 | const bool rightButtonPressed = button & Qt::RightButton; | - |
2680 | const bool shiftKeyPressed = modifiers & Qt::ShiftModifier; | - |
2681 | const bool controlKeyPressed = modifiers & Qt::ControlModifier; | - |
2682 | if (((index == pressedIndex && selectionModel->isSelected(index)) evaluated: index == pressedIndex yes Evaluation Count:17 | yes Evaluation Count:9 |
evaluated: selectionModel->isSelected(index) yes Evaluation Count:12 | yes Evaluation Count:5 |
| 5-17 |
2683 | || !index.isValid()) && state != QAbstractItemView::DragSelectingState evaluated: !index.isValid() yes Evaluation Count:4 | yes Evaluation Count:10 |
evaluated: state != QAbstractItemView::DragSelectingState yes Evaluation Count:15 | yes Evaluation Count:1 |
| 1-15 |
2684 | && !shiftKeyPressed && !controlKeyPressed && (!rightButtonPressed || !index.isValid())) partially evaluated: !shiftKeyPressed yes Evaluation Count:15 | no Evaluation Count:0 |
evaluated: !controlKeyPressed yes Evaluation Count:14 | yes Evaluation Count:1 |
evaluated: !rightButtonPressed yes Evaluation Count:12 | yes Evaluation Count:2 |
evaluated: !index.isValid() yes Evaluation Count:1 | yes Evaluation Count:1 |
| 0-15 |
2685 | return QItemSelectionModel::ClearAndSelect|selectionBehaviorFlags(); executed: return QItemSelectionModel::ClearAndSelect|selectionBehaviorFlags(); Execution Count:13 | 13 |
2686 | return QItemSelectionModel::NoUpdate; executed: return QItemSelectionModel::NoUpdate; Execution Count:13 | 13 |
2687 | } | - |
2688 | case QEvent::KeyPress: { | - |
2689 | | - |
2690 | modifiers = static_cast<const QKeyEvent*>(event)->modifiers(); | - |
2691 | switch (static_cast<const QKeyEvent*>(event)->key()) { | - |
2692 | case Qt::Key_Backtab: | - |
2693 | modifiers = modifiers & ~Qt::ShiftModifier; | - |
2694 | case Qt::Key_Down: code before this statement executed: case Qt::Key_Down: Execution Count:2 | 2 |
2695 | case Qt::Key_Up: | - |
2696 | case Qt::Key_Left: | - |
2697 | case Qt::Key_Right: | - |
2698 | case Qt::Key_Home: | - |
2699 | case Qt::Key_End: | - |
2700 | case Qt::Key_PageUp: | - |
2701 | case Qt::Key_PageDown: | - |
2702 | case Qt::Key_Tab: | - |
2703 | if (modifiers & Qt::ControlModifier partially evaluated: modifiers & Qt::ControlModifier no Evaluation Count:0 | yes Evaluation Count:193 |
| 0-193 |
2704 | | - |
2705 | | - |
2706 | | - |
2707 | | - |
2708 | ) | - |
2709 | return QItemSelectionModel::NoUpdate; never executed: return QItemSelectionModel::NoUpdate; | 0 |
2710 | break; executed: break; Execution Count:193 | 193 |
2711 | case Qt::Key_Select: | - |
2712 | return QItemSelectionModel::Toggle|selectionBehaviorFlags(); never executed: return QItemSelectionModel::Toggle|selectionBehaviorFlags(); | 0 |
2713 | case Qt::Key_Space: | - |
2714 | if (modifiers & Qt::ControlModifier) never evaluated: modifiers & Qt::ControlModifier | 0 |
2715 | return QItemSelectionModel::Toggle|selectionBehaviorFlags(); never executed: return QItemSelectionModel::Toggle|selectionBehaviorFlags(); | 0 |
2716 | return QItemSelectionModel::Select|selectionBehaviorFlags(); never executed: return QItemSelectionModel::Select|selectionBehaviorFlags(); | 0 |
2717 | default: | - |
2718 | break; | 0 |
2719 | } | - |
2720 | } | - |
2721 | default: | - |
2722 | break; executed: break; Execution Count:193 | 193 |
2723 | } | - |
2724 | } executed: } Execution Count:546 | 546 |
2725 | | - |
2726 | if (modifiers & Qt::ShiftModifier) evaluated: modifiers & Qt::ShiftModifier yes Evaluation Count:99 | yes Evaluation Count:814 |
| 99-814 |
2727 | return QItemSelectionModel::SelectCurrent|selectionBehaviorFlags(); executed: return QItemSelectionModel::SelectCurrent|selectionBehaviorFlags(); Execution Count:99 | 99 |
2728 | if (modifiers & Qt::ControlModifier) evaluated: modifiers & Qt::ControlModifier yes Evaluation Count:104 | yes Evaluation Count:710 |
| 104-710 |
2729 | return QItemSelectionModel::Toggle|selectionBehaviorFlags(); executed: return QItemSelectionModel::Toggle|selectionBehaviorFlags(); Execution Count:104 | 104 |
2730 | if (state == QAbstractItemView::DragSelectingState) { evaluated: state == QAbstractItemView::DragSelectingState yes Evaluation Count:2 | yes Evaluation Count:708 |
| 2-708 |
2731 | | - |
2732 | return QItemSelectionModel::Clear|QItemSelectionModel::SelectCurrent|selectionBehaviorFlags(); executed: return QItemSelectionModel::Clear|QItemSelectionModel::SelectCurrent|selectionBehaviorFlags(); Execution Count:2 | 2 |
2733 | } | - |
2734 | | - |
2735 | return QItemSelectionModel::ClearAndSelect|selectionBehaviorFlags(); executed: return QItemSelectionModel::ClearAndSelect|selectionBehaviorFlags(); Execution Count:708 | 708 |
2736 | } | - |
2737 | | - |
2738 | QItemSelectionModel::SelectionFlags | - |
2739 | QAbstractItemViewPrivate::contiguousSelectionCommand(const QModelIndex &index, | - |
2740 | const QEvent *event) const | - |
2741 | { | - |
2742 | QItemSelectionModel::SelectionFlags flags = extendedSelectionCommand(index, event); | - |
2743 | const int Mask = QItemSelectionModel::Clear | QItemSelectionModel::Select | - |
2744 | | QItemSelectionModel::Deselect | QItemSelectionModel::Toggle | - |
2745 | | QItemSelectionModel::Current; | - |
2746 | | - |
2747 | switch (flags & Mask) { | - |
2748 | case QItemSelectionModel::Clear: | - |
2749 | case QItemSelectionModel::ClearAndSelect: | - |
2750 | case QItemSelectionModel::SelectCurrent: | - |
2751 | return flags; executed: return flags; Execution Count:4 | 4 |
2752 | case QItemSelectionModel::NoUpdate: | - |
2753 | if (event && | 0 |
2754 | (event->type() == QEvent::MouseButtonPress never evaluated: event->type() == QEvent::MouseButtonPress | 0 |
2755 | || event->type() == QEvent::MouseButtonRelease)) never evaluated: event->type() == QEvent::MouseButtonRelease | 0 |
2756 | return flags; never executed: return flags; | 0 |
2757 | return QItemSelectionModel::ClearAndSelect|selectionBehaviorFlags(); never executed: return QItemSelectionModel::ClearAndSelect|selectionBehaviorFlags(); | 0 |
2758 | default: | - |
2759 | return QItemSelectionModel::SelectCurrent|selectionBehaviorFlags(); never executed: return QItemSelectionModel::SelectCurrent|selectionBehaviorFlags(); | 0 |
2760 | } | - |
2761 | } | 0 |
2762 | | - |
2763 | void QAbstractItemViewPrivate::fetchMore() | - |
2764 | { | - |
2765 | fetchMoreTimer.stop(); | - |
2766 | if (!model->canFetchMore(root)) evaluated: !model->canFetchMore(root) yes Evaluation Count:1297 | yes Evaluation Count:2 |
| 2-1297 |
2767 | return; executed: return; Execution Count:1297 | 1297 |
2768 | int last = model->rowCount(root) - 1; | - |
2769 | if (last < 0) { partially evaluated: last < 0 no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
2770 | model->fetchMore(root); | - |
2771 | return; | 0 |
2772 | } | - |
2773 | | - |
2774 | QModelIndex index = model->index(last, 0, root); | - |
2775 | QRect rect = q_func()->visualRect(index); | - |
2776 | if (viewport->rect().intersects(rect)) evaluated: viewport->rect().intersects(rect) yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
2777 | model->fetchMore(root); executed: model->fetchMore(root); Execution Count:1 | 1 |
2778 | } executed: } Execution Count:2 | 2 |
2779 | | - |
2780 | bool QAbstractItemViewPrivate::shouldEdit(QAbstractItemView::EditTrigger trigger, | - |
2781 | const QModelIndex &index) const | - |
2782 | { | - |
2783 | if (!index.isValid()) partially evaluated: !index.isValid() no Evaluation Count:0 | yes Evaluation Count:7936 |
| 0-7936 |
2784 | return false; never executed: return false; | 0 |
2785 | Qt::ItemFlags flags = model->flags(index); | - |
2786 | if (((flags & Qt::ItemIsEditable) == 0) || ((flags & Qt::ItemIsEnabled) == 0)) evaluated: ((flags & Qt::ItemIsEditable) == 0) yes Evaluation Count:4737 | yes Evaluation Count:3199 |
evaluated: ((flags & Qt::ItemIsEnabled) == 0) yes Evaluation Count:314 | yes Evaluation Count:2885 |
| 314-4737 |
2787 | return false; executed: return false; Execution Count:5051 | 5051 |
2788 | if (state == QAbstractItemView::EditingState) evaluated: state == QAbstractItemView::EditingState yes Evaluation Count:5 | yes Evaluation Count:2880 |
| 5-2880 |
2789 | return false; executed: return false; Execution Count:5 | 5 |
2790 | if (hasEditor(index)) partially evaluated: hasEditor(index) no Evaluation Count:0 | yes Evaluation Count:2880 |
| 0-2880 |
2791 | return false; never executed: return false; | 0 |
2792 | if (trigger == QAbstractItemView::AllEditTriggers) evaluated: trigger == QAbstractItemView::AllEditTriggers yes Evaluation Count:37 | yes Evaluation Count:2843 |
| 37-2843 |
2793 | return true; executed: return true; Execution Count:37 | 37 |
2794 | if ((trigger & editTriggers) == QAbstractItemView::SelectedClicked evaluated: (trigger & editTriggers) == QAbstractItemView::SelectedClicked yes Evaluation Count:2 | yes Evaluation Count:2841 |
| 2-2841 |
2795 | && !selectionModel->isSelected(index)) partially evaluated: !selectionModel->isSelected(index) no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
2796 | return false; never executed: return false; | 0 |
2797 | return (trigger & editTriggers); executed: return (trigger & editTriggers); Execution Count:2843 | 2843 |
2798 | } | - |
2799 | | - |
2800 | bool QAbstractItemViewPrivate::shouldForwardEvent(QAbstractItemView::EditTrigger trigger, | - |
2801 | const QEvent *event) const | - |
2802 | { | - |
2803 | if (!event || (trigger & editTriggers) != QAbstractItemView::AnyKeyPressed) evaluated: !event yes Evaluation Count:40 | yes Evaluation Count:27 |
partially evaluated: (trigger & editTriggers) != QAbstractItemView::AnyKeyPressed yes Evaluation Count:27 | no Evaluation Count:0 |
| 0-40 |
2804 | return false; executed: return false; Execution Count:67 | 67 |
2805 | | - |
2806 | switch (event->type()) { | - |
2807 | case QEvent::KeyPress: | - |
2808 | case QEvent::MouseButtonDblClick: | - |
2809 | case QEvent::MouseButtonPress: | - |
2810 | case QEvent::MouseButtonRelease: | - |
2811 | case QEvent::MouseMove: | - |
2812 | return true; never executed: return true; | 0 |
2813 | default: | - |
2814 | break; | 0 |
2815 | }; | - |
2816 | | - |
2817 | return false; never executed: return false; | 0 |
2818 | } | - |
2819 | | - |
2820 | bool QAbstractItemViewPrivate::shouldAutoScroll(const QPoint &pos) const | - |
2821 | { | - |
2822 | if (!autoScroll) never evaluated: !autoScroll | 0 |
2823 | return false; never executed: return false; | 0 |
2824 | QRect area = static_cast<QAbstractItemView*>(viewport)->d_func()->clipRect(); | - |
2825 | return (pos.y() - area.top() < autoScrollMargin) | 0 |
2826 | || (area.bottom() - pos.y() < autoScrollMargin) | 0 |
2827 | || (pos.x() - area.left() < autoScrollMargin) | 0 |
2828 | || (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 |
2829 | } | - |
2830 | | - |
2831 | void QAbstractItemViewPrivate::doDelayedItemsLayout(int delay) | - |
2832 | { | - |
2833 | if (!delayedPendingLayout) { evaluated: !delayedPendingLayout yes Evaluation Count:5656 | yes Evaluation Count:50111 |
| 5656-50111 |
2834 | delayedPendingLayout = true; | - |
2835 | delayedLayout.start(delay, q_func()); | - |
2836 | } executed: } Execution Count:5656 | 5656 |
2837 | } executed: } Execution Count:55767 | 55767 |
2838 | | - |
2839 | void QAbstractItemViewPrivate::interruptDelayedItemsLayout() const | - |
2840 | { | - |
2841 | delayedLayout.stop(); | - |
2842 | delayedPendingLayout = false; | - |
2843 | } executed: } Execution Count:15824 | 15824 |
2844 | | - |
2845 | | - |
2846 | | - |
2847 | QWidget *QAbstractItemViewPrivate::editor(const QModelIndex &index, | - |
2848 | const QStyleOptionViewItem &options) | - |
2849 | { | - |
2850 | QAbstractItemView * const q = q_func(); | - |
2851 | QWidget *w = editorForIndex(index).widget.data(); | - |
2852 | if (!w) { partially evaluated: !w yes Evaluation Count:130 | no Evaluation Count:0 |
| 0-130 |
2853 | QAbstractItemDelegate *delegate = delegateForIndex(index); | - |
2854 | if (!delegate) evaluated: !delegate yes Evaluation Count:6 | yes Evaluation Count:124 |
| 6-124 |
2855 | return 0; executed: return 0; Execution Count:6 | 6 |
2856 | w = delegate->createEditor(viewport, options, index); | - |
2857 | if (w) { evaluated: w yes Evaluation Count:104 | yes Evaluation Count:20 |
| 20-104 |
2858 | w->installEventFilter(delegate); | - |
2859 | QObject::connect(w, "2""destroyed(QObject*)", q, "1""editorDestroyed(QObject*)"); | - |
2860 | delegate->updateEditorGeometry(w, options, index); | - |
2861 | delegate->setEditorData(w, index); | - |
2862 | addEditor(index, w, false); | - |
2863 | if (w->parent() == viewport) partially evaluated: w->parent() == viewport yes Evaluation Count:104 | no Evaluation Count:0 |
| 0-104 |
2864 | QWidget::setTabOrder(q, w); executed: QWidget::setTabOrder(q, w); Execution Count:104 | 104 |
2865 | | - |
2866 | | - |
2867 | QWidget *focusWidget = w; | - |
2868 | while (QWidget *fp = focusWidget->focusProxy()) partially evaluated: QWidget *fp = focusWidget->focusProxy() no Evaluation Count:0 | yes Evaluation Count:104 |
| 0-104 |
2869 | focusWidget = fp; never executed: focusWidget = fp; | 0 |
2870 | | - |
2871 | if (QLineEdit *le = qobject_cast<QLineEdit*>(focusWidget)) evaluated: QLineEdit *le = qobject_cast<QLineEdit*>(focusWidget) yes Evaluation Count:87 | yes Evaluation Count:17 |
| 17-87 |
2872 | le->selectAll(); executed: le->selectAll(); Execution Count:87 | 87 |
2873 | | - |
2874 | | - |
2875 | if (QSpinBox *sb = qobject_cast<QSpinBox*>(focusWidget)) evaluated: QSpinBox *sb = qobject_cast<QSpinBox*>(focusWidget) yes Evaluation Count:4 | yes Evaluation Count:100 |
| 4-100 |
2876 | sb->selectAll(); executed: sb->selectAll(); Execution Count:4 | 4 |
2877 | else if (QDoubleSpinBox *dsb = qobject_cast<QDoubleSpinBox*>(focusWidget)) evaluated: QDoubleSpinBox *dsb = qobject_cast<QDoubleSpinBox*>(focusWidget) yes Evaluation Count:1 | yes Evaluation Count:99 |
| 1-99 |
2878 | dsb->selectAll(); executed: dsb->selectAll(); Execution Count:1 | 1 |
2879 | | - |
2880 | } | - |
2881 | } executed: } Execution Count:124 | 124 |
2882 | | - |
2883 | return w; executed: return w; Execution Count:124 | 124 |
2884 | } | - |
2885 | | - |
2886 | void QAbstractItemViewPrivate::updateEditorData(const QModelIndex &tl, const QModelIndex &br) | - |
2887 | { | - |
2888 | | - |
2889 | const bool checkIndexes = tl.isValid() && br.isValid(); evaluated: tl.isValid() yes Evaluation Count:676 | yes Evaluation Count:21 |
evaluated: br.isValid() yes Evaluation Count:662 | yes Evaluation Count:14 |
| 14-676 |
2890 | const QModelIndex parent = tl.parent(); | - |
2891 | | - |
2892 | | - |
2893 | | - |
2894 | const QIndexEditorHash indexEditorHashCopy = indexEditorHash; | - |
2895 | QIndexEditorHash::const_iterator it = indexEditorHashCopy.constBegin(); | - |
2896 | for (; it != indexEditorHashCopy.constEnd(); ++it) { evaluated: it != indexEditorHashCopy.constEnd() yes Evaluation Count:2 | yes Evaluation Count:697 |
| 2-697 |
2897 | QWidget *editor = it.value().widget.data(); | - |
2898 | const QModelIndex index = it.key(); | - |
2899 | if (it.value().isStatic || !editor || !index.isValid() || partially evaluated: it.value().isStatic no Evaluation Count:0 | yes Evaluation Count:2 |
partially evaluated: !editor no Evaluation Count:0 | yes Evaluation Count:2 |
partially evaluated: !index.isValid() no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
2900 | (checkIndexes evaluated: checkIndexes yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
2901 | && (index.row() < tl.row() || index.row() > br.row() partially evaluated: index.row() < tl.row() no Evaluation Count:0 | yes Evaluation Count:1 |
partially evaluated: index.row() > br.row() no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
2902 | || index.column() < tl.column() || index.column() > br.column() partially evaluated: index.column() < tl.column() no Evaluation Count:0 | yes Evaluation Count:1 |
partially evaluated: index.column() > br.column() no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
2903 | || index.parent() != parent))) partially evaluated: index.parent() != parent no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
2904 | continue; never executed: continue; | 0 |
2905 | | - |
2906 | QAbstractItemDelegate *delegate = delegateForIndex(index); | - |
2907 | if (delegate) { partially evaluated: delegate yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
2908 | delegate->setEditorData(editor, index); | - |
2909 | } executed: } Execution Count:2 | 2 |
2910 | } executed: } Execution Count:2 | 2 |
2911 | } executed: } Execution Count:697 | 697 |
2912 | void QAbstractItemViewPrivate::clearOrRemove() | - |
2913 | { | - |
2914 | | - |
2915 | const QItemSelection selection = selectionModel->selection(); | - |
2916 | QList<QItemSelectionRange>::const_iterator it = selection.constBegin(); | - |
2917 | | - |
2918 | if (!overwrite) { never evaluated: !overwrite | 0 |
2919 | for (; it != selection.constEnd(); ++it) { never evaluated: it != selection.constEnd() | 0 |
2920 | QModelIndex parent = (*it).parent(); | - |
2921 | if ((*it).left() != 0) never evaluated: (*it).left() != 0 | 0 |
2922 | continue; never executed: continue; | 0 |
2923 | if ((*it).right() != (model->columnCount(parent) - 1)) never evaluated: (*it).right() != (model->columnCount(parent) - 1) | 0 |
2924 | continue; never executed: continue; | 0 |
2925 | int count = (*it).bottom() - (*it).top() + 1; | - |
2926 | model->removeRows((*it).top(), count, parent); | - |
2927 | } | 0 |
2928 | } else { | 0 |
2929 | | - |
2930 | QModelIndexList list = selection.indexes(); | - |
2931 | for (int i=0; i < list.size(); ++i) { never evaluated: i < list.size() | 0 |
2932 | QModelIndex index = list.at(i); | - |
2933 | QMap<int, QVariant> roles = model->itemData(index); | - |
2934 | for (QMap<int, QVariant>::Iterator it = roles.begin(); it != roles.end(); ++it) never evaluated: it != roles.end() | 0 |
2935 | it.value() = QVariant(); never executed: it.value() = QVariant(); | 0 |
2936 | model->setItemData(index, roles); | - |
2937 | } | 0 |
2938 | } | 0 |
2939 | | - |
2940 | } | - |
2941 | | - |
2942 | | - |
2943 | | - |
2944 | | - |
2945 | | - |
2946 | | - |
2947 | | - |
2948 | void QAbstractItemViewPrivate::checkPersistentEditorFocus() | - |
2949 | { | - |
2950 | QAbstractItemView * const q = q_func(); | - |
2951 | if (QWidget *widget = QApplication::focusWidget()) { evaluated: QWidget *widget = QApplication::focusWidget() yes Evaluation Count:97 | yes Evaluation Count:43 |
| 43-97 |
2952 | if (persistent.contains(widget)) { evaluated: persistent.contains(widget) yes Evaluation Count:2 | yes Evaluation Count:95 |
| 2-95 |
2953 | | - |
2954 | QModelIndex index = indexForEditor(widget); | - |
2955 | if (selectionModel->currentIndex() != index) partially evaluated: selectionModel->currentIndex() != index yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
2956 | q->setCurrentIndex(index); executed: q->setCurrentIndex(index); Execution Count:2 | 2 |
2957 | } executed: } Execution Count:2 | 2 |
2958 | } executed: } Execution Count:97 | 97 |
2959 | } executed: } Execution Count:140 | 140 |
2960 | | - |
2961 | | - |
2962 | const QEditorInfo & QAbstractItemViewPrivate::editorForIndex(const QModelIndex &index) const | - |
2963 | { | - |
2964 | static QEditorInfo nullInfo; | - |
2965 | | - |
2966 | | - |
2967 | if (indexEditorHash.isEmpty()) evaluated: indexEditorHash.isEmpty() yes Evaluation Count:161408 | yes Evaluation Count:432 |
| 432-161408 |
2968 | return nullInfo; executed: return nullInfo; Execution Count:161408 | 161408 |
2969 | | - |
2970 | QIndexEditorHash::const_iterator it = indexEditorHash.find(index); | - |
2971 | if (it == indexEditorHash.end()) evaluated: it == indexEditorHash.end() yes Evaluation Count:239 | yes Evaluation Count:193 |
| 193-239 |
2972 | return nullInfo; executed: return nullInfo; Execution Count:239 | 239 |
2973 | | - |
2974 | return it.value(); executed: return it.value(); Execution Count:193 | 193 |
2975 | } | - |
2976 | | - |
2977 | QModelIndex QAbstractItemViewPrivate::indexForEditor(QWidget *editor) const | - |
2978 | { | - |
2979 | | - |
2980 | if (indexEditorHash.isEmpty()) partially evaluated: indexEditorHash.isEmpty() no Evaluation Count:0 | yes Evaluation Count:154 |
| 0-154 |
2981 | return QModelIndex(); never executed: return QModelIndex(); | 0 |
2982 | | - |
2983 | QEditorIndexHash::const_iterator it = editorIndexHash.find(editor); | - |
2984 | if (it == editorIndexHash.end()) partially evaluated: it == editorIndexHash.end() no Evaluation Count:0 | yes Evaluation Count:154 |
| 0-154 |
2985 | return QModelIndex(); never executed: return QModelIndex(); | 0 |
2986 | | - |
2987 | return it.value(); executed: return it.value(); Execution Count:154 | 154 |
2988 | } | - |
2989 | | - |
2990 | void QAbstractItemViewPrivate::removeEditor(QWidget *editor) | - |
2991 | { | - |
2992 | QEditorIndexHash::iterator it = editorIndexHash.find(editor); | - |
2993 | if (it != editorIndexHash.end()) evaluated: it != editorIndexHash.end() yes Evaluation Count:94 | yes Evaluation Count:9 |
| 9-94 |
2994 | { | - |
2995 | indexEditorHash.remove(it.value()); | - |
2996 | editorIndexHash.erase(it); | - |
2997 | } executed: } Execution Count:94 | 94 |
2998 | } executed: } Execution Count:103 | 103 |
2999 | | - |
3000 | void QAbstractItemViewPrivate::addEditor(const QModelIndex &index, QWidget *editor, bool isStatic) | - |
3001 | { | - |
3002 | editorIndexHash.insert(editor, index); | - |
3003 | indexEditorHash.insert(index, QEditorInfo(editor, isStatic)); | - |
3004 | } executed: } Execution Count:132 | 132 |
3005 | | - |
3006 | bool QAbstractItemViewPrivate::sendDelegateEvent(const QModelIndex &index, QEvent *event) const | - |
3007 | { | - |
3008 | const QAbstractItemView * const q = q_func(); | - |
3009 | QModelIndex buddy = model->buddy(index); | - |
3010 | QStyleOptionViewItem options = viewOptions(); | - |
3011 | options.rect = q->visualRect(buddy); | - |
3012 | options.state |= (buddy == q->currentIndex() ? QStyle::State_HasFocus : QStyle::State_None); evaluated: buddy == q->currentIndex() yes Evaluation Count:2479 | yes Evaluation Count:5464 |
| 2479-5464 |
3013 | QAbstractItemDelegate *delegate = delegateForIndex(index); | - |
3014 | return (event && delegate && delegate->editorEvent(event, model, options, buddy)); executed: return (event && delegate && delegate->editorEvent(event, model, options, buddy)); Execution Count:7943 | 7943 |
3015 | } | - |
3016 | | - |
3017 | bool QAbstractItemViewPrivate::openEditor(const QModelIndex &index, QEvent *event) | - |
3018 | { | - |
3019 | QAbstractItemView * const q = q_func(); | - |
3020 | | - |
3021 | QModelIndex buddy = model->buddy(index); | - |
3022 | QStyleOptionViewItem options = viewOptions(); | - |
3023 | options.rect = q->visualRect(buddy); | - |
3024 | options.state |= (buddy == q->currentIndex() ? QStyle::State_HasFocus : QStyle::State_None); evaluated: buddy == q->currentIndex() yes Evaluation Count:46 | yes Evaluation Count:21 |
| 21-46 |
3025 | | - |
3026 | QWidget *w = editor(buddy, options); | - |
3027 | if (!w) partially evaluated: !w no Evaluation Count:0 | yes Evaluation Count:67 |
| 0-67 |
3028 | return false; never executed: return false; | 0 |
3029 | | - |
3030 | q->setState(QAbstractItemView::EditingState); | - |
3031 | w->show(); | - |
3032 | w->setFocus(); | - |
3033 | | - |
3034 | if (event) partially evaluated: event no Evaluation Count:0 | yes Evaluation Count:67 |
| 0-67 |
3035 | QApplication::sendEvent(w->focusProxy() ? w->focusProxy() : w, event); never executed: QApplication::sendEvent(w->focusProxy() ? w->focusProxy() : w, event); | 0 |
3036 | | - |
3037 | return true; executed: return true; Execution Count:67 | 67 |
3038 | } | - |
3039 | | - |
3040 | | - |
3041 | | - |
3042 | | - |
3043 | | - |
3044 | | - |
3045 | | - |
3046 | QItemViewPaintPairs QAbstractItemViewPrivate::draggablePaintPairs(const QModelIndexList &indexes, QRect *r) const | - |
3047 | { | - |
3048 | qt_noop(); | - |
3049 | const QAbstractItemView * const q = q_func(); | - |
3050 | QRect &rect = *r; | - |
3051 | const QRect viewportRect = viewport->rect(); | - |
3052 | QItemViewPaintPairs ret; | - |
3053 | for (int i = 0; i < indexes.count(); ++i) { never evaluated: i < indexes.count() | 0 |
3054 | const QModelIndex &index = indexes.at(i); | - |
3055 | const QRect current = q->visualRect(index); | - |
3056 | if (current.intersects(viewportRect)) { never evaluated: current.intersects(viewportRect) | 0 |
3057 | ret += qMakePair(current, index); | - |
3058 | rect |= current; | - |
3059 | } | 0 |
3060 | } | 0 |
3061 | rect &= viewportRect; | - |
3062 | return ret; never executed: return ret; | 0 |
3063 | } | - |
3064 | | - |
3065 | QPixmap QAbstractItemViewPrivate::renderToPixmap(const QModelIndexList &indexes, QRect *r) const | - |
3066 | { | - |
3067 | qt_noop(); | - |
3068 | QItemViewPaintPairs paintPairs = draggablePaintPairs(indexes, r); | - |
3069 | if (paintPairs.isEmpty()) never evaluated: paintPairs.isEmpty() | 0 |
3070 | return QPixmap(); never executed: return QPixmap(); | 0 |
3071 | QPixmap pixmap(r->size()); | - |
3072 | pixmap.fill(Qt::transparent); | - |
3073 | QPainter painter(&pixmap); | - |
3074 | QStyleOptionViewItem option = viewOptions(); | - |
3075 | option.state |= QStyle::State_Selected; | - |
3076 | for (int j = 0; j < paintPairs.count(); ++j) { never evaluated: j < paintPairs.count() | 0 |
3077 | option.rect = paintPairs.at(j).first.translated(-r->topLeft()); | - |
3078 | const QModelIndex ¤t = paintPairs.at(j).second; | - |
3079 | adjustViewOptionsForIndex(&option, current); | - |
3080 | delegateForIndex(current)->paint(&painter, option, current); | - |
3081 | } | 0 |
3082 | return pixmap; never executed: return pixmap; | 0 |
3083 | } | - |
3084 | | - |
3085 | void QAbstractItemViewPrivate::selectAll(QItemSelectionModel::SelectionFlags command) | - |
3086 | { | - |
3087 | if (!selectionModel) evaluated: !selectionModel yes Evaluation Count:12 | yes Evaluation Count:6 |
| 6-12 |
3088 | return; executed: return; Execution Count:12 | 12 |
3089 | | - |
3090 | QItemSelection selection; | - |
3091 | QModelIndex tl = model->index(0, 0, root); | - |
3092 | QModelIndex br = model->index(model->rowCount(root) - 1, | - |
3093 | model->columnCount(root) - 1, | - |
3094 | root); | - |
3095 | selection.append(QItemSelectionRange(tl, br)); | - |
3096 | selectionModel->select(selection, command); | - |
3097 | } executed: } Execution Count:6 | 6 |
3098 | | - |
3099 | QModelIndexList QAbstractItemViewPrivate::selectedDraggableIndexes() const | - |
3100 | { | - |
3101 | const QAbstractItemView * const q = q_func(); | - |
3102 | QModelIndexList indexes = q->selectedIndexes(); | - |
3103 | for(int i = indexes.count() - 1 ; i >= 0; --i) { partially evaluated: i >= 0 no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
3104 | if (!isIndexDragEnabled(indexes.at(i))) never evaluated: !isIndexDragEnabled(indexes.at(i)) | 0 |
3105 | indexes.removeAt(i); never executed: indexes.removeAt(i); | 0 |
3106 | } | 0 |
3107 | return indexes; executed: return indexes; Execution Count:4 | 4 |
3108 | } | - |
3109 | | - |
3110 | | - |
3111 | | - |
3112 | | - |
3113 | | - |
| | |