itemviews/qtreewidget.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4 -
5 -
6 -
7 -
8 -
9typedef bool(*LessThan)(const QPair<QTreeWidgetItem*,int>&,const QPair<QTreeWidgetItem*,int>&); -
10 -
11class QTreeModelLessThan -
12{ -
13public: -
14 inline bool operator()(QTreeWidgetItem *i1, QTreeWidgetItem *i2) const -
15 { return *i1 < *i2; }
executed: return *i1 < *i2;
Execution Count:39
39
16}; -
17 -
18class QTreeModelGreaterThan -
19{ -
20public: -
21 inline bool operator()(QTreeWidgetItem *i1, QTreeWidgetItem *i2) const -
22 { return *i2 < *i1; }
executed: return *i2 < *i1;
Execution Count:8
8
23}; -
24QTreeModel::QTreeModel(int columns, QTreeWidget *parent) -
25 : QAbstractItemModel(parent), rootItem(new QTreeWidgetItem), -
26 headerItem(new QTreeWidgetItem), skipPendingSort(false) -
27{ -
28 rootItem->view = parent; -
29 rootItem->itemFlags = Qt::ItemIsDropEnabled; -
30 headerItem->view = parent; -
31 setColumnCount(columns); -
32}
executed: }
Execution Count:264
264
33 -
34 -
35 -
36 -
37 -
38 -
39QTreeModel::QTreeModel(QTreeModelPrivate &dd, QTreeWidget *parent) -
40 : QAbstractItemModel(dd, parent), rootItem(new QTreeWidgetItem), -
41 headerItem(new QTreeWidgetItem), skipPendingSort(false) -
42{ -
43 rootItem->view = parent; -
44 rootItem->itemFlags = Qt::ItemIsDropEnabled; -
45 headerItem->view = parent; -
46}
never executed: }
0
47 -
48 -
49 -
50 -
51 -
52 -
53 -
54QTreeModel::~QTreeModel() -
55{ -
56 clear(); -
57 delete headerItem; -
58 rootItem->view = 0; -
59 delete rootItem; -
60}
executed: }
Execution Count:263
263
61 -
62 -
63 -
64 -
65 -
66 -
67 -
68void QTreeModel::clear() -
69{ -
70 SkipSorting skipSorting(this); -
71 beginResetModel(); -
72 for (int i = 0; i < rootItem->childCount(); ++i) {
evaluated: i < rootItem->childCount()
TRUEFALSE
yes
Evaluation Count:4182
yes
Evaluation Count:429
429-4182
73 QTreeWidgetItem *item = rootItem->children.at(i); -
74 item->par = 0; -
75 item->view = 0; -
76 delete item; -
77 }
executed: }
Execution Count:4182
4182
78 rootItem->children.clear(); -
79 sortPendingTimer.stop(); -
80 endResetModel(); -
81}
executed: }
Execution Count:429
429
82 -
83 -
84 -
85 -
86 -
87 -
88 -
89void QTreeModel::setColumnCount(int columns) -
90{ -
91 SkipSorting skipSorting(this); -
92 if (columns < 0)
partially evaluated: columns < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:575
0-575
93 return;
never executed: return;
0
94 if (!headerItem) {
evaluated: !headerItem
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:574
1-574
95 headerItem = new QTreeWidgetItem(); -
96 headerItem->view = view(); -
97 }
executed: }
Execution Count:1
1
98 int count = columnCount(); -
99 if (count == columns)
evaluated: count == columns
TRUEFALSE
yes
Evaluation Count:260
yes
Evaluation Count:315
260-315
100 return;
executed: return;
Execution Count:260
260
101 -
102 if (columns < count) {
evaluated: columns < count
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:308
7-308
103 beginRemoveColumns(QModelIndex(), columns, count - 1); -
104 headerItem->values.resize(columns); -
105 endRemoveColumns(); -
106 } else {
executed: }
Execution Count:7
7
107 beginInsertColumns(QModelIndex(), count, columns - 1); -
108 headerItem->values.resize(columns); -
109 for (int i = count; i < columns; ++i) {
evaluated: i < columns
TRUEFALSE
yes
Evaluation Count:441
yes
Evaluation Count:308
308-441
110 headerItem->values[i].append(QWidgetItemData(Qt::DisplayRole, QString::number(i + 1))); -
111 headerItem->d->display.append(QString::number(i + 1)); -
112 }
executed: }
Execution Count:441
441
113 endInsertColumns(); -
114 }
executed: }
Execution Count:308
308
115} -
116QTreeWidgetItem *QTreeModel::item(const QModelIndex &index) const -
117{ -
118 if (!index.isValid())
evaluated: !index.isValid()
TRUEFALSE
yes
Evaluation Count:130
yes
Evaluation Count:115373
130-115373
119 return 0;
executed: return 0;
Execution Count:130
130
120 return static_cast<QTreeWidgetItem*>(index.internalPointer());
executed: return static_cast<QTreeWidgetItem*>(index.internalPointer());
Execution Count:115373
115373
121} -
122QModelIndex QTreeModel::index(const QTreeWidgetItem *item, int column) const -
123{ -
124 executePendingSort(); -
125 -
126 if (!item || (item == rootItem))
evaluated: !item
TRUEFALSE
yes
Evaluation Count:23713
yes
Evaluation Count:98752
evaluated: (item == rootItem)
TRUEFALSE
yes
Evaluation Count:5235
yes
Evaluation Count:93517
5235-98752
127 return QModelIndex();
executed: return QModelIndex();
Execution Count:28948
28948
128 const QTreeWidgetItem *par = item->parent(); -
129 QTreeWidgetItem *itm = const_cast<QTreeWidgetItem*>(item); -
130 if (!par)
evaluated: !par
TRUEFALSE
yes
Evaluation Count:83007
yes
Evaluation Count:10510
10510-83007
131 par = rootItem;
executed: par = rootItem;
Execution Count:83007
83007
132 int row; -
133 int guess = item->d->rowGuess; -
134 if (guess >= 0
evaluated: guess >= 0
TRUEFALSE
yes
Evaluation Count:91323
yes
Evaluation Count:2194
2194-91323
135 && par->children.count() > guess
partially evaluated: par->children.count() > guess
TRUEFALSE
yes
Evaluation Count:91323
no
Evaluation Count:0
0-91323
136 && par->children.at(guess) == itm) {
evaluated: par->children.at(guess) == itm
TRUEFALSE
yes
Evaluation Count:91258
yes
Evaluation Count:65
65-91258
137 row = guess; -
138 } else {
executed: }
Execution Count:91258
91258
139 row = par->children.lastIndexOf(itm); -
140 itm->d->rowGuess = row; -
141 }
executed: }
Execution Count:2259
2259
142 return createIndex(row, column, itm);
executed: return createIndex(row, column, itm);
Execution Count:93517
93517
143} -
144QModelIndex QTreeModel::index(int row, int column, const QModelIndex &parent) const -
145{ -
146 executePendingSort(); -
147 -
148 int c = columnCount(parent); -
149 if (row < 0 || column < 0 || column >= c)
evaluated: row < 0
TRUEFALSE
yes
Evaluation Count:196
yes
Evaluation Count:26186
evaluated: column < 0
TRUEFALSE
yes
Evaluation Count:129
yes
Evaluation Count:26057
evaluated: column >= c
TRUEFALSE
yes
Evaluation Count:105
yes
Evaluation Count:25952
105-26186
150 return QModelIndex();
executed: return QModelIndex();
Execution Count:430
430
151 -
152 QTreeWidgetItem *parentItem = parent.isValid() ? item(parent) : rootItem;
evaluated: parent.isValid()
TRUEFALSE
yes
Evaluation Count:7233
yes
Evaluation Count:18719
7233-18719
153 if (parentItem && row < parentItem->childCount()) {
partially evaluated: parentItem
TRUEFALSE
yes
Evaluation Count:25952
no
Evaluation Count:0
evaluated: row < parentItem->childCount()
TRUEFALSE
yes
Evaluation Count:25815
yes
Evaluation Count:137
0-25952
154 QTreeWidgetItem *itm = parentItem->child(row); -
155 if (itm)
partially evaluated: itm
TRUEFALSE
yes
Evaluation Count:25815
no
Evaluation Count:0
0-25815
156 return createIndex(row, column, itm);
executed: return createIndex(row, column, itm);
Execution Count:25815
25815
157 return QModelIndex();
never executed: return QModelIndex();
0
158 } -
159 -
160 return QModelIndex();
executed: return QModelIndex();
Execution Count:137
137
161} -
162QModelIndex QTreeModel::parent(const QModelIndex &child) const -
163{ -
164 SkipSorting skipSorting(this); -
165 -
166 -
167 if (!child.isValid())
evaluated: !child.isValid()
TRUEFALSE
yes
Evaluation Count:213
yes
Evaluation Count:44625
213-44625
168 return QModelIndex();
executed: return QModelIndex();
Execution Count:213
213
169 QTreeWidgetItem *itm = static_cast<QTreeWidgetItem *>(child.internalPointer()); -
170 if (!itm || itm == rootItem)
partially evaluated: !itm
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:44625
partially evaluated: itm == rootItem
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:44625
0-44625
171 return QModelIndex();
never executed: return QModelIndex();
0
172 QTreeWidgetItem *parent = itm->parent(); -
173 return index(parent, 0);
executed: return index(parent, 0);
Execution Count:44625
44625
174} -
175int QTreeModel::rowCount(const QModelIndex &parent) const -
176{ -
177 if (!parent.isValid())
evaluated: !parent.isValid()
TRUEFALSE
yes
Evaluation Count:8887
yes
Evaluation Count:65022
8887-65022
178 return rootItem->childCount();
executed: return rootItem->childCount();
Execution Count:8887
8887
179 -
180 QTreeWidgetItem *parentItem = item(parent); -
181 if (parentItem)
partially evaluated: parentItem
TRUEFALSE
yes
Evaluation Count:65022
no
Evaluation Count:0
0-65022
182 return parentItem->childCount();
executed: return parentItem->childCount();
Execution Count:65022
65022
183 return 0;
never executed: return 0;
0
184} -
185int QTreeModel::columnCount(const QModelIndex &index) const -
186{ -
187 (void)index;; -
188 if (!headerItem)
partially evaluated: !headerItem
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:104566
0-104566
189 return 0;
never executed: return 0;
0
190 return headerItem->columnCount();
executed: return headerItem->columnCount();
Execution Count:104566
104566
191} -
192 -
193bool QTreeModel::hasChildren(const QModelIndex &parent) const -
194{ -
195 if (!parent.isValid())
evaluated: !parent.isValid()
TRUEFALSE
yes
Evaluation Count:753
yes
Evaluation Count:6636
753-6636
196 return (rootItem->childCount() > 0);
executed: return (rootItem->childCount() > 0);
Execution Count:753
753
197 -
198 QTreeWidgetItem *itm = item(parent); -
199 if (!itm)
partially evaluated: !itm
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6636
0-6636
200 return false;
never executed: return false;
0
201 switch (itm->d->policy) { -
202 case QTreeWidgetItem::ShowIndicator: -
203 return true;
executed: return true;
Execution Count:1
1
204 case QTreeWidgetItem::DontShowIndicator: -
205 return false;
executed: return false;
Execution Count:1
1
206 case QTreeWidgetItem::DontShowIndicatorWhenChildless: -
207 return (itm->childCount() > 0);
executed: return (itm->childCount() > 0);
Execution Count:6634
6634
208 } -
209 return false;
never executed: return false;
0
210} -
211QVariant QTreeModel::data(const QModelIndex &index, int role) const -
212{ -
213 if (!index.isValid())
evaluated: !index.isValid()
TRUEFALSE
yes
Evaluation Count:181
yes
Evaluation Count:18369
181-18369
214 return QVariant();
executed: return QVariant();
Execution Count:181
181
215 QTreeWidgetItem *itm = item(index); -
216 if (itm)
partially evaluated: itm
TRUEFALSE
yes
Evaluation Count:18369
no
Evaluation Count:0
0-18369
217 return itm->data(index.column(), role);
executed: return itm->data(index.column(), role);
Execution Count:18369
18369
218 return QVariant();
never executed: return QVariant();
0
219} -
220bool QTreeModel::setData(const QModelIndex &index, const QVariant &value, int role) -
221{ -
222 if (!index.isValid())
evaluated: !index.isValid()
TRUEFALSE
yes
Evaluation Count:105
yes
Evaluation Count:132
105-132
223 return false;
executed: return false;
Execution Count:105
105
224 QTreeWidgetItem *itm = item(index); -
225 if (itm) {
partially evaluated: itm
TRUEFALSE
yes
Evaluation Count:132
no
Evaluation Count:0
0-132
226 itm->setData(index.column(), role, value); -
227 return true;
executed: return true;
Execution Count:132
132
228 } -
229 return false;
never executed: return false;
0
230} -
231 -
232QMap<int, QVariant> QTreeModel::itemData(const QModelIndex &index) const -
233{ -
234 QMap<int, QVariant> roles; -
235 QTreeWidgetItem *itm = item(index); -
236 if (itm) {
evaluated: itm
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:53
2-53
237 int column = index.column(); -
238 if (column < itm->values.count()) {
evaluated: column < itm->values.count()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1
239 for (int i = 0; i < itm->values.at(column).count(); ++i) {
evaluated: i < itm->values.at(column).count()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:1
1-5
240 roles.insert(itm->values.at(column).at(i).role, -
241 itm->values.at(column).at(i).value); -
242 }
executed: }
Execution Count:5
5
243 }
executed: }
Execution Count:1
1
244 -
245 -
246 QVariant displayValue = itm->data(column, Qt::DisplayRole); -
247 if (displayValue.isValid())
evaluated: displayValue.isValid()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1
248 roles.insert(Qt::DisplayRole, displayValue);
executed: roles.insert(Qt::DisplayRole, displayValue);
Execution Count:1
1
249 -
250 QVariant checkValue = itm->data(column, Qt::CheckStateRole); -
251 if (checkValue.isValid())
evaluated: checkValue.isValid()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1
252 roles.insert(Qt::CheckStateRole, checkValue);
executed: roles.insert(Qt::CheckStateRole, checkValue);
Execution Count:1
1
253 }
executed: }
Execution Count:2
2
254 return roles;
executed: return roles;
Execution Count:55
55
255} -
256 -
257 -
258 -
259 -
260 -
261bool QTreeModel::insertRows(int row, int count, const QModelIndex &parent) -
262{ -
263 SkipSorting skipSorting(this); -
264 if (count < 1 || row < 0 || row > rowCount(parent) || parent.column() > 0)
evaluated: count < 1
TRUEFALSE
yes
Evaluation Count:16
yes
Evaluation Count:22
evaluated: row < 0
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:18
evaluated: row > rowCount(parent)
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:14
partially evaluated: parent.column() > 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:14
0-22
265 return false;
executed: return false;
Execution Count:24
24
266 -
267 beginInsertRows(parent, row, row + count - 1); -
268 QTreeWidgetItem *par = item(parent); -
269 while (count > 0) {
evaluated: count > 0
TRUEFALSE
yes
Evaluation Count:120
yes
Evaluation Count:14
14-120
270 QTreeWidgetItem *item = new QTreeWidgetItem(); -
271 item->view = view(); -
272 item->par = par; -
273 if (par)
partially evaluated: par
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:120
0-120
274 par->children.insert(row++, item);
never executed: par->children.insert(row++, item);
0
275 else -
276 rootItem->children.insert(row++, item);
executed: rootItem->children.insert(row++, item);
Execution Count:120
120
277 --count; -
278 }
executed: }
Execution Count:120
120
279 endInsertRows(); -
280 return true;
executed: return true;
Execution Count:14
14
281} -
282 -
283 -
284 -
285 -
286 -
287bool QTreeModel::insertColumns(int column, int count, const QModelIndex &parent) -
288{ -
289 SkipSorting skipSorting(this); -
290 if (count < 1 || column < 0 || column > columnCount(parent) || parent.column() > 0 || !headerItem)
evaluated: count < 1
TRUEFALSE
yes
Evaluation Count:16
yes
Evaluation Count:23
evaluated: column < 0
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:19
evaluated: column > columnCount(parent)
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:7
partially evaluated: parent.column() > 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7
partially evaluated: !headerItem
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7
0-23
291 return false;
executed: return false;
Execution Count:32
32
292 -
293 beginInsertColumns(parent, column, column + count - 1); -
294 -
295 int oldCount = columnCount(parent); -
296 column = qBound(0, column, oldCount); -
297 headerItem->values.resize(oldCount + count); -
298 for (int i = oldCount; i < oldCount + count; ++i) {
evaluated: i < oldCount + count
TRUEFALSE
yes
Evaluation Count:85
yes
Evaluation Count:7
7-85
299 headerItem->values[i].append(QWidgetItemData(Qt::DisplayRole, QString::number(i + 1))); -
300 headerItem->d->display.append(QString::number(i + 1)); -
301 }
executed: }
Execution Count:85
85
302 -
303 QStack<QTreeWidgetItem*> itemstack; -
304 itemstack.push(0); -
305 while (!itemstack.isEmpty()) {
evaluated: !itemstack.isEmpty()
TRUEFALSE
yes
Evaluation Count:187
yes
Evaluation Count:7
7-187
306 QTreeWidgetItem *par = itemstack.pop(); -
307 QList<QTreeWidgetItem*> children = par ? par->children : rootItem->children;
evaluated: par
TRUEFALSE
yes
Evaluation Count:180
yes
Evaluation Count:7
7-180
308 for (int row = 0; row < children.count(); ++row) {
evaluated: row < children.count()
TRUEFALSE
yes
Evaluation Count:3860
yes
Evaluation Count:187
187-3860
309 QTreeWidgetItem *child = children.at(row); -
310 if (child->children.count())
evaluated: child->children.count()
TRUEFALSE
yes
Evaluation Count:180
yes
Evaluation Count:3680
180-3680
311 itemstack.push(child);
executed: itemstack.push(child);
Execution Count:180
180
312 child->values.insert(column, count, QVector<QWidgetItemData>()); -
313 }
executed: }
Execution Count:3860
3860
314 }
executed: }
Execution Count:187
187
315 -
316 endInsertColumns(); -
317 return true;
executed: return true;
Execution Count:7
7
318} -
319 -
320 -
321 -
322 -
323 -
324bool QTreeModel::removeRows(int row, int count, const QModelIndex &parent) { -
325 if (count < 1 || row < 0 || (row + count) > rowCount(parent))
evaluated: count < 1
TRUEFALSE
yes
Evaluation Count:16
yes
Evaluation Count:28
evaluated: row < 0
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:22
evaluated: (row + count) > rowCount(parent)
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:14
6-28
326 return false;
executed: return false;
Execution Count:30
30
327 -
328 beginRemoveRows(parent, row, row + count - 1); -
329 -
330 bool blockSignal = signalsBlocked(); -
331 blockSignals(true); -
332 -
333 QTreeWidgetItem *itm = item(parent); -
334 for (int i = row + count - 1; i >= row; --i) {
evaluated: i >= row
TRUEFALSE
yes
Evaluation Count:120
yes
Evaluation Count:14
14-120
335 QTreeWidgetItem *child = itm ? itm->takeChild(i) : rootItem->children.takeAt(i);
partially evaluated: itm
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:120
0-120
336 qt_noop(); -
337 child->view = 0; -
338 delete child; -
339 child = 0; -
340 }
executed: }
Execution Count:120
120
341 blockSignals(blockSignal); -
342 -
343 endRemoveRows(); -
344 return true;
executed: return true;
Execution Count:14
14
345} -
346QVariant QTreeModel::headerData(int section, Qt::Orientation orientation, int role) const -
347{ -
348 if (orientation != Qt::Horizontal)
partially evaluated: orientation != Qt::Horizontal
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2895
0-2895
349 return QVariant();
never executed: return QVariant();
0
350 -
351 if (headerItem)
partially evaluated: headerItem
TRUEFALSE
yes
Evaluation Count:2895
no
Evaluation Count:0
0-2895
352 return headerItem->data(section, role);
executed: return headerItem->data(section, role);
Execution Count:2895
2895
353 if (role == Qt::DisplayRole)
never evaluated: role == Qt::DisplayRole
0
354 return QString::number(section + 1);
never executed: return QString::number(section + 1);
0
355 return QVariant();
never executed: return QVariant();
0
356} -
357bool QTreeModel::setHeaderData(int section, Qt::Orientation orientation, -
358 const QVariant &value, int role) -
359{ -
360 if (section < 0 || orientation != Qt::Horizontal || !headerItem || section >= columnCount())
evaluated: section < 0
TRUEFALSE
yes
Evaluation Count:57
yes
Evaluation Count:64
evaluated: orientation != Qt::Horizontal
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:60
partially evaluated: !headerItem
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:60
evaluated: section >= columnCount()
TRUEFALSE
yes
Evaluation Count:57
yes
Evaluation Count:3
0-64
361 return false;
executed: return false;
Execution Count:118
118
362 -
363 headerItem->setData(section, role, value); -
364 return true;
executed: return true;
Execution Count:3
3
365} -
366Qt::ItemFlags QTreeModel::flags(const QModelIndex &index) const -
367{ -
368 if (!index.isValid())
evaluated: !index.isValid()
TRUEFALSE
yes
Evaluation Count:53
yes
Evaluation Count:10738
53-10738
369 return rootItem->flags();
executed: return rootItem->flags();
Execution Count:53
53
370 QTreeWidgetItem *itm = item(index); -
371 qt_noop(); -
372 return itm->flags();
executed: return itm->flags();
Execution Count:10738
10738
373} -
374void QTreeModel::sort(int column, Qt::SortOrder order) -
375{ -
376 SkipSorting skipSorting(this); -
377 sortPendingTimer.stop(); -
378 -
379 if (column < 0 || column >= columnCount())
evaluated: column < 0
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:465
evaluated: column >= columnCount()
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:455
1-465
380 return;
executed: return;
Execution Count:11
11
381 -
382 -
383 rootItem->sortChildren(column, order, true); -
384}
executed: }
Execution Count:455
455
385 -
386 -
387 -
388 -
389void QTreeModel::ensureSorted(int column, Qt::SortOrder order, -
390 int start, int end, const QModelIndex &parent) -
391{ -
392 if (isChanging())
partially evaluated: isChanging()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:21
0-21
393 return;
never executed: return;
0
394 -
395 sortPendingTimer.stop(); -
396 -
397 if (column < 0 || column >= columnCount())
partially evaluated: column < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:21
partially evaluated: column >= columnCount()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:21
0-21
398 return;
never executed: return;
0
399 -
400 SkipSorting skipSorting(this); -
401 -
402 QTreeWidgetItem *itm = item(parent); -
403 if (!itm)
partially evaluated: !itm
TRUEFALSE
yes
Evaluation Count:21
no
Evaluation Count:0
0-21
404 itm = rootItem;
executed: itm = rootItem;
Execution Count:21
21
405 QList<QTreeWidgetItem*> lst = itm->children; -
406 -
407 int count = end - start + 1; -
408 QVector < QPair<QTreeWidgetItem*,int> > sorting(count); -
409 for (int i = 0; i < count; ++i) {
evaluated: i < count
TRUEFALSE
yes
Evaluation Count:21
yes
Evaluation Count:21
21
410 sorting[i].first = lst.at(start + i); -
411 sorting[i].second = start + i; -
412 }
executed: }
Execution Count:21
21
413 -
414 LessThan compare = (order == Qt::AscendingOrder ? &itemLessThan : &itemGreaterThan);
evaluated: order == Qt::AscendingOrder
TRUEFALSE
yes
Evaluation Count:17
yes
Evaluation Count:4
4-17
415 qStableSort(sorting.begin(), sorting.end(), compare); -
416 -
417 QModelIndexList oldPersistentIndexes; -
418 QModelIndexList newPersistentIndexes; -
419 QList<QTreeWidgetItem*>::iterator lit = lst.begin(); -
420 bool changed = false; -
421 -
422 for (int i = 0; i < count; ++i) {
evaluated: i < count
TRUEFALSE
yes
Evaluation Count:21
yes
Evaluation Count:21
21
423 int oldRow = sorting.at(i).second; -
424 QTreeWidgetItem *item = lst.takeAt(oldRow); -
425 lit = sortedInsertionIterator(lit, lst.end(), order, item); -
426 int newRow = qMax(lit - lst.begin(), 0); -
427 -
428 if ((newRow < oldRow) && !(*item < *lst.at(oldRow - 1)) && !(*lst.at(oldRow - 1) < *item ))
evaluated: (newRow < oldRow)
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:13
evaluated: !(*item < *lst.at(oldRow - 1))
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:3
partially evaluated: !(*lst.at(oldRow - 1) < *item )
TRUEFALSE
yes
Evaluation Count:5
no
Evaluation Count:0
0-13
429 newRow = oldRow;
executed: newRow = oldRow;
Execution Count:5
5
430 -
431 lit = lst.insert(lit, item); -
432 if (newRow != oldRow) {
evaluated: newRow != oldRow
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:13
8-13
433 -
434 if (!changed) {
partially evaluated: !changed
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
0-8
435 changed = true; -
436 layoutAboutToBeChanged(); -
437 oldPersistentIndexes = persistentIndexList(); -
438 newPersistentIndexes = oldPersistentIndexes; -
439 }
executed: }
Execution Count:8
8
440 for (int j = i + 1; j < count; ++j) {
partially evaluated: j < count
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
441 int otherRow = sorting.at(j).second; -
442 if (oldRow < otherRow && newRow >= otherRow)
never evaluated: oldRow < otherRow
never evaluated: newRow >= otherRow
0
443 --sorting[j].second;
never executed: --sorting[j].second;
0
444 else if (oldRow > otherRow && newRow <= otherRow)
never evaluated: oldRow > otherRow
never evaluated: newRow <= otherRow
0
445 ++sorting[j].second;
never executed: ++sorting[j].second;
0
446 } -
447 for (int k = 0; k < newPersistentIndexes.count(); ++k) {
evaluated: k < newPersistentIndexes.count()
TRUEFALSE
yes
Evaluation Count:32
yes
Evaluation Count:8
8-32
448 QModelIndex pi = newPersistentIndexes.at(k); -
449 if (pi.parent() != parent)
partially evaluated: pi.parent() != parent
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:32
0-32
450 continue;
never executed: continue;
0
451 int oldPersistentRow = pi.row(); -
452 int newPersistentRow = oldPersistentRow; -
453 if (oldPersistentRow == oldRow)
evaluated: oldPersistentRow == oldRow
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:24
8-24
454 newPersistentRow = newRow;
executed: newPersistentRow = newRow;
Execution Count:8
8
455 else if (oldRow < oldPersistentRow && newRow >= oldPersistentRow)
evaluated: oldRow < oldPersistentRow
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:11
evaluated: newRow >= oldPersistentRow
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:7
6-13
456 newPersistentRow = oldPersistentRow - 1;
executed: newPersistentRow = oldPersistentRow - 1;
Execution Count:6
6
457 else if (oldRow > oldPersistentRow && newRow <= oldPersistentRow)
evaluated: oldRow > oldPersistentRow
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:7
evaluated: newRow <= oldPersistentRow
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:7
4-11
458 newPersistentRow = oldPersistentRow + 1;
executed: newPersistentRow = oldPersistentRow + 1;
Execution Count:4
4
459 if (newPersistentRow != oldPersistentRow)
evaluated: newPersistentRow != oldPersistentRow
TRUEFALSE
yes
Evaluation Count:18
yes
Evaluation Count:14
14-18
460 newPersistentIndexes[k] = createIndex(newPersistentRow, 18
461 pi.column(), pi.internalPointer());
executed: newPersistentIndexes[k] = createIndex(newPersistentRow, pi.column(), pi.internalPointer());
Execution Count:18
18
462 }
executed: }
Execution Count:32
32
463 }
executed: }
Execution Count:8
8
464 }
executed: }
Execution Count:21
21
465 -
466 if (changed) {
evaluated: changed
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:13
8-13
467 itm->children = lst; -
468 changePersistentIndexList(oldPersistentIndexes, newPersistentIndexes); -
469 layoutChanged(); -
470 }
executed: }
Execution Count:8
8
471}
executed: }
Execution Count:21
21
472bool QTreeModel::itemLessThan(const QPair<QTreeWidgetItem*,int> &left, -
473 const QPair<QTreeWidgetItem*,int> &right) -
474{ -
475 return *(left.first) < *(right.first);
executed: return *(left.first) < *(right.first);
Execution Count:4167
4167
476} -
477bool QTreeModel::itemGreaterThan(const QPair<QTreeWidgetItem*,int> &left, -
478 const QPair<QTreeWidgetItem*,int> &right) -
479{ -
480 return *(right.first) < *(left.first);
executed: return *(right.first) < *(left.first);
Execution Count:3365
3365
481} -
482 -
483 -
484 -
485 -
486QList<QTreeWidgetItem*>::iterator QTreeModel::sortedInsertionIterator( -
487 const QList<QTreeWidgetItem*>::iterator &begin, -
488 const QList<QTreeWidgetItem*>::iterator &end, -
489 Qt::SortOrder order, QTreeWidgetItem *item) -
490{ -
491 if (order == Qt::AscendingOrder)
evaluated: order == Qt::AscendingOrder
TRUEFALSE
yes
Evaluation Count:17
yes
Evaluation Count:4
4-17
492 return std::lower_bound(begin, end, item, QTreeModelLessThan());
executed: return std::lower_bound(begin, end, item, QTreeModelLessThan());
Execution Count:17
17
493 return std::lower_bound(begin, end, item, QTreeModelGreaterThan());
executed: return std::lower_bound(begin, end, item, QTreeModelGreaterThan());
Execution Count:4
4
494} -
495 -
496QStringList QTreeModel::mimeTypes() const -
497{ -
498 return view()->mimeTypes();
executed: return view()->mimeTypes();
Execution Count:53
53
499} -
500 -
501QMimeData *QTreeModel::internalMimeData() const -
502{ -
503 return QAbstractItemModel::mimeData(cachedIndexes);
never executed: return QAbstractItemModel::mimeData(cachedIndexes);
0
504} -
505 -
506QMimeData *QTreeModel::mimeData(const QModelIndexList &indexes) const -
507{ -
508 QList<QTreeWidgetItem*> items; -
509 for (int i = 0; i < indexes.count(); ++i) {
never evaluated: i < indexes.count()
0
510 if (indexes.at(i).column() == 0)
never evaluated: indexes.at(i).column() == 0
0
511 items << item(indexes.at(i));
never executed: items << item(indexes.at(i));
0
512 }
never executed: }
0
513 -
514 -
515 -
516 cachedIndexes = indexes; -
517 QMimeData *mimeData = view()->mimeData(items); -
518 cachedIndexes.clear(); -
519 return mimeData;
never executed: return mimeData;
0
520} -
521 -
522bool QTreeModel::dropMimeData(const QMimeData *data, Qt::DropAction action, -
523 int row, int column, const QModelIndex &parent) -
524{ -
525 if (row == -1 && column == -1)
never evaluated: row == -1
never evaluated: column == -1
0
526 row = rowCount(parent);
never executed: row = rowCount(parent);
0
527 return view()->dropMimeData(item(parent), row, data, action);
never executed: return view()->dropMimeData(item(parent), row, data, action);
0
528} -
529 -
530Qt::DropActions QTreeModel::supportedDropActions() const -
531{ -
532 return view()->supportedDropActions();
executed: return view()->supportedDropActions();
Execution Count:53
53
533} -
534 -
535void QTreeModel::itemChanged(QTreeWidgetItem *item) -
536{ -
537 SkipSorting skipSorting(this); -
538 QModelIndex left = index(item, 0); -
539 QModelIndex right = index(item, item->columnCount() - 1); -
540 dataChanged(left, right); -
541}
executed: }
Execution Count:231
231
542 -
543bool QTreeModel::isChanging() const -
544{ -
545 const QTreeModelPrivate * const d = d_func(); -
546 return !d->changes.isEmpty();
executed: return !d->changes.isEmpty();
Execution Count:4063
4063
547} -
548 -
549 -
550 -
551 -
552 -
553 -
554 -
555void QTreeModel::emitDataChanged(QTreeWidgetItem *item, int column) -
556{ -
557 if (signalsBlocked())
partially evaluated: signalsBlocked()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6187
0-6187
558 return;
never executed: return;
0
559 -
560 if (headerItem == item && column < item->columnCount()) {
evaluated: headerItem == item
TRUEFALSE
yes
Evaluation Count:37
yes
Evaluation Count:6150
partially evaluated: column < item->columnCount()
TRUEFALSE
yes
Evaluation Count:37
no
Evaluation Count:0
0-6150
561 if (column == -1)
partially evaluated: column == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:37
0-37
562 headerDataChanged(Qt::Horizontal, 0, columnCount() - 1);
never executed: headerDataChanged(Qt::Horizontal, 0, columnCount() - 1);
0
563 else -
564 headerDataChanged(Qt::Horizontal, column, column);
executed: headerDataChanged(Qt::Horizontal, column, column);
Execution Count:37
37
565 return;
executed: return;
Execution Count:37
37
566 } -
567 -
568 SkipSorting skipSorting(this); -
569 -
570 QModelIndex bottomRight, topLeft; -
571 if (column == -1) {
partially evaluated: column == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6150
0-6150
572 topLeft = index(item, 0); -
573 bottomRight = createIndex(topLeft.row(), columnCount() - 1, item); -
574 } else {
never executed: }
0
575 topLeft = index(item, column); -
576 bottomRight = topLeft; -
577 }
executed: }
Execution Count:6150
6150
578 dataChanged(topLeft, bottomRight); -
579}
executed: }
Execution Count:6150
6150
580 -
581void QTreeModel::beginInsertItems(QTreeWidgetItem *parent, int row, int count) -
582{ -
583 QModelIndex par = index(parent, 0); -
584 beginInsertRows(par, row, row + count - 1); -
585}
executed: }
Execution Count:68119
68119
586 -
587void QTreeModel::endInsertItems() -
588{ -
589 endInsertRows(); -
590}
executed: }
Execution Count:68119
68119
591 -
592void QTreeModel::beginRemoveItems(QTreeWidgetItem *parent, int row, int count) -
593{ -
594 qt_noop(); -
595 qt_noop(); -
596 beginRemoveRows(index(parent, 0), row, row + count - 1); -
597 if (!parent)
evaluated: !parent
TRUEFALSE
yes
Evaluation Count:1146
yes
Evaluation Count:83
83-1146
598 parent = rootItem;
executed: parent = rootItem;
Execution Count:1146
1146
599 -
600 for (int i = 0; i < iterators.count(); ++i) {
evaluated: i < iterators.count()
TRUEFALSE
yes
Evaluation Count:46
yes
Evaluation Count:1229
46-1229
601 for (int j = 0; j < count; j++) {
evaluated: j < count
TRUEFALSE
yes
Evaluation Count:46
yes
Evaluation Count:46
46
602 QTreeWidgetItem *c = parent->child(row + j); -
603 iterators[i]->d_func()->ensureValidIterator(c); -
604 }
executed: }
Execution Count:46
46
605 }
executed: }
Execution Count:46
46
606}
executed: }
Execution Count:1229
1229
607 -
608void QTreeModel::endRemoveItems() -
609{ -
610 endRemoveRows(); -
611}
executed: }
Execution Count:1217
1217
612 -
613void QTreeModel::sortItems(QList<QTreeWidgetItem*> *items, int column, Qt::SortOrder order) -
614{ -
615 -
616 (void)column;; -
617 if (isChanging())
partially evaluated: isChanging()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3360
0-3360
618 return;
never executed: return;
0
619 -
620 -
621 QVector< QPair<QTreeWidgetItem*,int> > sorting(items->count()); -
622 for (int i = 0; i < sorting.count(); ++i) {
evaluated: i < sorting.count()
TRUEFALSE
yes
Evaluation Count:2912
yes
Evaluation Count:3360
2912-3360
623 sorting[i].first = items->at(i); -
624 sorting[i].second = i; -
625 }
executed: }
Execution Count:2912
2912
626 -
627 -
628 LessThan compare = (order == Qt::AscendingOrder ? &itemLessThan : &itemGreaterThan);
evaluated: order == Qt::AscendingOrder
TRUEFALSE
yes
Evaluation Count:1579
yes
Evaluation Count:1781
1579-1781
629 qStableSort(sorting.begin(), sorting.end(), compare); -
630 -
631 QModelIndexList fromList; -
632 QModelIndexList toList; -
633 int colCount = columnCount(); -
634 for (int r = 0; r < sorting.count(); ++r) {
evaluated: r < sorting.count()
TRUEFALSE
yes
Evaluation Count:2912
yes
Evaluation Count:3360
2912-3360
635 int oldRow = sorting.at(r).second; -
636 if (oldRow == r)
evaluated: oldRow == r
TRUEFALSE
yes
Evaluation Count:2339
yes
Evaluation Count:573
573-2339
637 continue;
executed: continue;
Execution Count:2339
2339
638 QTreeWidgetItem *item = sorting.at(r).first; -
639 items->replace(r, item); -
640 for (int c = 0; c < colCount; ++c) {
evaluated: c < colCount
TRUEFALSE
yes
Evaluation Count:694
yes
Evaluation Count:573
573-694
641 QModelIndex from = createIndex(oldRow, c, item); -
642 if (static_cast<QAbstractItemModelPrivate *>(d_ptr.data())->persistent.indexes.contains(from)) {
evaluated: static_cast<QAbstractItemModelPrivate *>(d_ptr.data())->persistent.indexes.contains(from)
TRUEFALSE
yes
Evaluation Count:43
yes
Evaluation Count:651
43-651
643 QModelIndex to = createIndex(r, c, item); -
644 fromList << from; -
645 toList << to; -
646 }
executed: }
Execution Count:43
43
647 }
executed: }
Execution Count:694
694
648 }
executed: }
Execution Count:573
573
649 changePersistentIndexList(fromList, toList); -
650}
executed: }
Execution Count:3360
3360
651 -
652void QTreeModel::timerEvent(QTimerEvent *ev) -
653{ -
654 if (ev->timerId() == sortPendingTimer.timerId()) {
partially evaluated: ev->timerId() == sortPendingTimer.timerId()
TRUEFALSE
yes
Evaluation Count:51
no
Evaluation Count:0
0-51
655 executePendingSort(); -
656 } else {
executed: }
Execution Count:51
51
657 QAbstractItemModel::timerEvent(ev); -
658 }
never executed: }
0
659} -
660QTreeWidgetItem::QTreeWidgetItem(int type) -
661 : rtti(type), view(0), d(new QTreeWidgetItemPrivate(this)), par(0), -
662 itemFlags(Qt::ItemIsSelectable -
663 |Qt::ItemIsUserCheckable -
664 |Qt::ItemIsEnabled -
665 |Qt::ItemIsDragEnabled -
666 |Qt::ItemIsDropEnabled) -
667{ -
668}
executed: }
Execution Count:829
829
669QTreeWidgetItem::QTreeWidgetItem(const QStringList &strings, int type) -
670 : rtti(type), view(0), d(new QTreeWidgetItemPrivate(this)), par(0), -
671 itemFlags(Qt::ItemIsSelectable -
672 |Qt::ItemIsUserCheckable -
673 |Qt::ItemIsEnabled -
674 |Qt::ItemIsDragEnabled -
675 |Qt::ItemIsDropEnabled) -
676{ -
677 for (int i = 0; i < strings.count(); ++i)
evaluated: i < strings.count()
TRUEFALSE
yes
Evaluation Count:1270
yes
Evaluation Count:1234
1234-1270
678 setText(i, strings.at(i));
executed: setText(i, strings.at(i));
Execution Count:1270
1270
679}
executed: }
Execution Count:1234
1234
680QTreeWidgetItem::QTreeWidgetItem(QTreeWidget *view, int type) -
681 : rtti(type), view(0), d(new QTreeWidgetItemPrivate(this)), par(0), -
682 itemFlags(Qt::ItemIsSelectable -
683 |Qt::ItemIsUserCheckable -
684 |Qt::ItemIsEnabled -
685 |Qt::ItemIsDragEnabled -
686 |Qt::ItemIsDropEnabled) -
687{ -
688 if (view && view->model()) {
evaluated: view
TRUEFALSE
yes
Evaluation Count:361
yes
Evaluation Count:1
partially evaluated: view->model()
TRUEFALSE
yes
Evaluation Count:361
no
Evaluation Count:0
0-361
689 QTreeModel *model = qobject_cast<QTreeModel*>(view->model()); -
690 model->rootItem->addChild(this); -
691 values.reserve(model->headerItem->columnCount()); -
692 }
executed: }
Execution Count:361
361
693}
executed: }
Execution Count:362
362
694QTreeWidgetItem::QTreeWidgetItem(QTreeWidget *view, const QStringList &strings, int type) -
695 : rtti(type), view(0), d(new QTreeWidgetItemPrivate(this)), par(0), -
696 itemFlags(Qt::ItemIsSelectable -
697 |Qt::ItemIsUserCheckable -
698 |Qt::ItemIsEnabled -
699 |Qt::ItemIsDragEnabled -
700 |Qt::ItemIsDropEnabled) -
701{ -
702 for (int i = 0; i < strings.count(); ++i)
evaluated: i < strings.count()
TRUEFALSE
yes
Evaluation Count:2828
yes
Evaluation Count:2828
2828
703 setText(i, strings.at(i));
executed: setText(i, strings.at(i));
Execution Count:2828
2828
704 if (view && view->model()) {
evaluated: view
TRUEFALSE
yes
Evaluation Count:2808
yes
Evaluation Count:20
partially evaluated: view->model()
TRUEFALSE
yes
Evaluation Count:2808
no
Evaluation Count:0
0-2808
705 QTreeModel *model = qobject_cast<QTreeModel*>(view->model()); -
706 model->rootItem->addChild(this); -
707 values.reserve(model->headerItem->columnCount()); -
708 }
executed: }
Execution Count:2808
2808
709}
executed: }
Execution Count:2828
2828
710QTreeWidgetItem::QTreeWidgetItem(QTreeWidget *view, QTreeWidgetItem *after, int type) -
711 : rtti(type), view(0), d(new QTreeWidgetItemPrivate(this)), par(0), -
712 itemFlags(Qt::ItemIsSelectable -
713 |Qt::ItemIsUserCheckable -
714 |Qt::ItemIsEnabled -
715 |Qt::ItemIsDragEnabled -
716 |Qt::ItemIsDropEnabled) -
717{ -
718 if (view) {
partially evaluated: view
TRUEFALSE
yes
Evaluation Count:1103
no
Evaluation Count:0
0-1103
719 QTreeModel *model = qobject_cast<QTreeModel*>(view->model()); -
720 if (model) {
partially evaluated: model
TRUEFALSE
yes
Evaluation Count:1103
no
Evaluation Count:0
0-1103
721 int i = model->rootItem->children.indexOf(after) + 1; -
722 model->rootItem->insertChild(i, this); -
723 values.reserve(model->headerItem->columnCount()); -
724 }
executed: }
Execution Count:1103
1103
725 }
executed: }
Execution Count:1103
1103
726}
executed: }
Execution Count:1103
1103
727 -
728 -
729 -
730 -
731 -
732 -
733QTreeWidgetItem::QTreeWidgetItem(QTreeWidgetItem *parent, int type) -
734 : rtti(type), view(0), d(new QTreeWidgetItemPrivate(this)), par(0), -
735 itemFlags(Qt::ItemIsSelectable -
736 |Qt::ItemIsUserCheckable -
737 |Qt::ItemIsEnabled -
738 |Qt::ItemIsDragEnabled -
739 |Qt::ItemIsDropEnabled) -
740{ -
741 if (parent)
partially evaluated: parent
TRUEFALSE
yes
Evaluation Count:7198
no
Evaluation Count:0
0-7198
742 parent->addChild(this);
executed: parent->addChild(this);
Execution Count:7198
7198
743}
executed: }
Execution Count:7198
7198
744 -
745 -
746 -
747 -
748 -
749 -
750 -
751QTreeWidgetItem::QTreeWidgetItem(QTreeWidgetItem *parent, const QStringList &strings, int type) -
752 : rtti(type), view(0), d(new QTreeWidgetItemPrivate(this)), par(0), -
753 itemFlags(Qt::ItemIsSelectable -
754 |Qt::ItemIsUserCheckable -
755 |Qt::ItemIsEnabled -
756 |Qt::ItemIsDragEnabled -
757 |Qt::ItemIsDropEnabled) -
758{ -
759 for (int i = 0; i < strings.count(); ++i)
evaluated: i < strings.count()
TRUEFALSE
yes
Evaluation Count:54580
yes
Evaluation Count:54575
54575-54580
760 setText(i, strings.at(i));
executed: setText(i, strings.at(i));
Execution Count:54580
54580
761 if (parent)
partially evaluated: parent
TRUEFALSE
yes
Evaluation Count:54575
no
Evaluation Count:0
0-54575
762 parent->addChild(this);
executed: parent->addChild(this);
Execution Count:54575
54575
763}
executed: }
Execution Count:54575
54575
764QTreeWidgetItem::QTreeWidgetItem(QTreeWidgetItem *parent, QTreeWidgetItem *after, int type) -
765 : rtti(type), view(0), d(new QTreeWidgetItemPrivate(this)), par(0), -
766 itemFlags(Qt::ItemIsSelectable -
767 |Qt::ItemIsUserCheckable -
768 |Qt::ItemIsEnabled -
769 |Qt::ItemIsDragEnabled -
770 |Qt::ItemIsDropEnabled) -
771{ -
772 if (parent) {
partially evaluated: parent
TRUEFALSE
yes
Evaluation Count:1000
no
Evaluation Count:0
0-1000
773 int i = parent->children.indexOf(after) + 1; -
774 parent->insertChild(i, this); -
775 }
executed: }
Execution Count:1000
1000
776}
executed: }
Execution Count:1000
1000
777QTreeWidgetItem::~QTreeWidgetItem() -
778{ -
779 QTreeModel *model = (view ? qobject_cast<QTreeModel*>(view->model()) : 0);
evaluated: view
TRUEFALSE
yes
Evaluation Count:1488
yes
Evaluation Count:67614
1488-67614
780 bool wasSkipSort = false; -
781 if (model) {
evaluated: model
TRUEFALSE
yes
Evaluation Count:1488
yes
Evaluation Count:67614
1488-67614
782 wasSkipSort = model->skipPendingSort; -
783 model->skipPendingSort = true; -
784 }
executed: }
Execution Count:1488
1488
785 if (par) {
evaluated: par
TRUEFALSE
yes
Evaluation Count:81
yes
Evaluation Count:69021
81-69021
786 int i = par->children.indexOf(this); -
787 if (i >= 0) {
partially evaluated: i >= 0
TRUEFALSE
yes
Evaluation Count:81
no
Evaluation Count:0
0-81
788 if (model) model->beginRemoveItems(par, i, 1);
executed: model->beginRemoveItems(par, i, 1);
Execution Count:69
evaluated: model
TRUEFALSE
yes
Evaluation Count:69
yes
Evaluation Count:12
12-69
789 -
790 -
791 if (!par->children.isEmpty() && par->children.at(i) == this)
partially evaluated: !par->children.isEmpty()
TRUEFALSE
yes
Evaluation Count:81
no
Evaluation Count:0
partially evaluated: par->children.at(i) == this
TRUEFALSE
yes
Evaluation Count:81
no
Evaluation Count:0
0-81
792 par->children.takeAt(i);
executed: par->children.takeAt(i);
Execution Count:81
81
793 if (model) model->endRemoveItems();
executed: model->endRemoveItems();
Execution Count:69
evaluated: model
TRUEFALSE
yes
Evaluation Count:69
yes
Evaluation Count:12
12-69
794 }
executed: }
Execution Count:81
81
795 } else if (model) {
executed: }
Execution Count:81
evaluated: model
TRUEFALSE
yes
Evaluation Count:1419
yes
Evaluation Count:67602
81-67602
796 if (this == model->headerItem) {
evaluated: this == model->headerItem
TRUEFALSE
yes
Evaluation Count:273
yes
Evaluation Count:1146
273-1146
797 model->headerItem = 0; -
798 } else {
executed: }
Execution Count:273
273
799 int i = model->rootItem->children.indexOf(this); -
800 if (i >= 0) {
partially evaluated: i >= 0
TRUEFALSE
yes
Evaluation Count:1146
no
Evaluation Count:0
0-1146
801 model->beginRemoveItems(0, i, 1); -
802 -
803 -
804 if (!model->rootItem->children.isEmpty() && model->rootItem->children.at(i) == this)
partially evaluated: !model->rootItem->children.isEmpty()
TRUEFALSE
yes
Evaluation Count:1146
no
Evaluation Count:0
partially evaluated: model->rootItem->children.at(i) == this
TRUEFALSE
yes
Evaluation Count:1146
no
Evaluation Count:0
0-1146
805 model->rootItem->children.takeAt(i);
executed: model->rootItem->children.takeAt(i);
Execution Count:1146
1146
806 model->endRemoveItems(); -
807 }
executed: }
Execution Count:1146
1146
808 }
executed: }
Execution Count:1146
1146
809 } -
810 -
811 -
812 for (int i = 0; i < children.count(); ++i) {
evaluated: i < children.count()
TRUEFALSE
yes
Evaluation Count:63018
yes
Evaluation Count:69102
63018-69102
813 QTreeWidgetItem *child = children.at(i); -
814 -
815 child->par = 0; -
816 -
817 child->view = 0; -
818 delete child; -
819 }
executed: }
Execution Count:63018
63018
820 -
821 children.clear(); -
822 delete d; -
823 if (model) {
evaluated: model
TRUEFALSE
yes
Evaluation Count:1488
yes
Evaluation Count:67614
1488-67614
824 model->skipPendingSort = wasSkipSort; -
825 }
executed: }
Execution Count:1488
1488
826}
executed: }
Execution Count:69102
69102
827 -
828 -
829 -
830 -
831QTreeWidgetItem *QTreeWidgetItem::clone() const -
832{ -
833 QTreeWidgetItem *copy = 0; -
834 -
835 QStack<const QTreeWidgetItem*> stack; -
836 QStack<QTreeWidgetItem*> parentStack; -
837 stack.push(this); -
838 parentStack.push(0); -
839 -
840 QTreeWidgetItem *root = 0; -
841 const QTreeWidgetItem *item = 0; -
842 QTreeWidgetItem *parent = 0; -
843 while (!stack.isEmpty()) {
evaluated: !stack.isEmpty()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:3
3-5
844 -
845 item = stack.pop(); -
846 parent = parentStack.pop(); -
847 -
848 -
849 copy = new QTreeWidgetItem(*item); -
850 if (!root)
evaluated: !root
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:2
2-3
851 root = copy;
executed: root = copy;
Execution Count:3
3
852 -
853 -
854 if (parent) {
evaluated: parent
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:3
2-3
855 copy->par = parent; -
856 parent->children.insert(0, copy); -
857 }
executed: }
Execution Count:2
2
858 -
859 for (int i = 0; i < item->childCount(); ++i) {
evaluated: i < item->childCount()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:5
2-5
860 stack.push(item->child(i)); -
861 parentStack.push(copy); -
862 }
executed: }
Execution Count:2
2
863 }
executed: }
Execution Count:5
5
864 return root;
executed: return root;
Execution Count:3
3
865} -
866void QTreeWidgetItem::setChildIndicatorPolicy(QTreeWidgetItem::ChildIndicatorPolicy policy) -
867{ -
868 if (d->policy == policy)
partially evaluated: d->policy == policy
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
869 return;
never executed: return;
0
870 d->policy = policy; -
871 -
872 if (!view)
partially evaluated: !view
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
873 return;
never executed: return;
0
874 -
875 view->scheduleDelayedItemsLayout(); -
876}
executed: }
Execution Count:3
3
877 -
878 -
879 -
880 -
881 -
882 -
883 -
884QTreeWidgetItem::ChildIndicatorPolicy QTreeWidgetItem::childIndicatorPolicy() const -
885{ -
886 return d->policy;
never executed: return d->policy;
0
887} -
888void QTreeWidgetItem::setFlags(Qt::ItemFlags flags) -
889{ -
890 const bool enable = (flags & Qt::ItemIsEnabled); -
891 const bool changedState = bool(itemFlags & Qt::ItemIsEnabled) != enable; -
892 const bool changedExplicit = d->disabled != !enable; -
893 -
894 d->disabled = !enable; -
895 -
896 if (enable && par && !(par->itemFlags & Qt::ItemIsEnabled))
evaluated: enable
TRUEFALSE
yes
Evaluation Count:191
yes
Evaluation Count:33
evaluated: par
TRUEFALSE
yes
Evaluation Count:153
yes
Evaluation Count:38
evaluated: !(par->itemFlags & Qt::ItemIsEnabled)
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:144
9-191
897 itemFlags = flags & ~Qt::ItemIsEnabled;
executed: itemFlags = flags & ~Qt::ItemIsEnabled;
Execution Count:9
9
898 else -
899 itemFlags = flags;
executed: itemFlags = flags;
Execution Count:215
215
900 -
901 if (changedState && changedExplicit) {
evaluated: changedState
TRUEFALSE
yes
Evaluation Count:41
yes
Evaluation Count:183
evaluated: changedExplicit
TRUEFALSE
yes
Evaluation Count:32
yes
Evaluation Count:9
9-183
902 QStack<QTreeWidgetItem*> parents; -
903 parents.push(this); -
904 while (!parents.isEmpty()) {
evaluated: !parents.isEmpty()
TRUEFALSE
yes
Evaluation Count:57
yes
Evaluation Count:32
32-57
905 QTreeWidgetItem *parent = parents.pop(); -
906 for (int i = 0; i < parent->children.count(); ++i) {
evaluated: i < parent->children.count()
TRUEFALSE
yes
Evaluation Count:26
yes
Evaluation Count:57
26-57
907 QTreeWidgetItem *child = parent->children.at(i); -
908 if (!child->d->disabled) {
evaluated: !child->d->disabled
TRUEFALSE
yes
Evaluation Count:25
yes
Evaluation Count:1
1-25
909 parents.push(child); -
910 if (enable)
evaluated: enable
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:13
12-13
911 child->itemFlags = child->itemFlags | Qt::ItemIsEnabled;
executed: child->itemFlags = child->itemFlags | Qt::ItemIsEnabled;
Execution Count:12
12
912 else -
913 child->itemFlags = child->itemFlags & ~Qt::ItemIsEnabled;
executed: child->itemFlags = child->itemFlags & ~Qt::ItemIsEnabled;
Execution Count:13
13
914 child->itemChanged(); -
915 }
executed: }
Execution Count:25
25
916 }
executed: }
Execution Count:26
26
917 }
executed: }
Execution Count:57
57
918 }
executed: }
Execution Count:32
32
919 itemChanged(); -
920}
executed: }
Execution Count:224
224
921 -
922void QTreeWidgetItemPrivate::propagateDisabled(QTreeWidgetItem *item) -
923{ -
924 qt_noop(); -
925 const bool enable = item->par ? (item->par->itemFlags.testFlag(Qt::ItemIsEnabled)) : true;
evaluated: item->par
TRUEFALSE
yes
Evaluation Count:63139
yes
Evaluation Count:36
36-63139
926 -
927 QStack<QTreeWidgetItem*> parents; -
928 parents.push(item); -
929 while (!parents.isEmpty()) {
evaluated: !parents.isEmpty()
TRUEFALSE
yes
Evaluation Count:63192
yes
Evaluation Count:63175
63175-63192
930 QTreeWidgetItem *parent = parents.pop(); -
931 if (!parent->d->disabled) {
partially evaluated: !parent->d->disabled
TRUEFALSE
yes
Evaluation Count:63192
no
Evaluation Count:0
0-63192
932 Qt::ItemFlags oldFlags = parent->itemFlags; -
933 if (enable)
evaluated: enable
TRUEFALSE
yes
Evaluation Count:63169
yes
Evaluation Count:23
23-63169
934 parent->itemFlags = parent->itemFlags | Qt::ItemIsEnabled;
executed: parent->itemFlags = parent->itemFlags | Qt::ItemIsEnabled;
Execution Count:63169
63169
935 else -
936 parent->itemFlags = parent->itemFlags & ~Qt::ItemIsEnabled;
executed: parent->itemFlags = parent->itemFlags & ~Qt::ItemIsEnabled;
Execution Count:23
23
937 if (parent->itemFlags != oldFlags)
evaluated: parent->itemFlags != oldFlags
TRUEFALSE
yes
Evaluation Count:29
yes
Evaluation Count:63163
29-63163
938 parent->itemChanged();
executed: parent->itemChanged();
Execution Count:29
29
939 }
executed: }
Execution Count:63192
63192
940 -
941 for (int i = 0; i < parent->children.count(); ++i) {
evaluated: i < parent->children.count()
TRUEFALSE
yes
Evaluation Count:17
yes
Evaluation Count:63192
17-63192
942 QTreeWidgetItem *child = parent->children.at(i); -
943 parents.push(child); -
944 }
executed: }
Execution Count:17
17
945 }
executed: }
Execution Count:63192
63192
946}
executed: }
Execution Count:63175
63175
947Qt::ItemFlags QTreeWidgetItem::flags() const -
948{ -
949 return itemFlags;
executed: return itemFlags;
Execution Count:17359
17359
950} -
951void QTreeWidgetItem::setData(int column, int role, const QVariant &value) -
952{ -
953 if (column < 0)
evaluated: column < 0
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:65150
1-65150
954 return;
executed: return;
Execution Count:1
1
955 -
956 QTreeModel *model = (view ? qobject_cast<QTreeModel*>(view->model()) : 0);
evaluated: view
TRUEFALSE
yes
Evaluation Count:6410
yes
Evaluation Count:58740
6410-58740
957 switch (role) { -
958 case Qt::EditRole: -
959 case Qt::DisplayRole: { -
960 if (values.count() <= column) {
evaluated: values.count() <= column
TRUEFALSE
yes
Evaluation Count:64174
yes
Evaluation Count:253
253-64174
961 if (model && this == model->headerItem)
evaluated: model
TRUEFALSE
yes
Evaluation Count:5438
yes
Evaluation Count:58736
evaluated: this == model->headerItem
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:5437
1-58736
962 model->setColumnCount(column + 1);
executed: model->setColumnCount(column + 1);
Execution Count:1
1
963 else -
964 values.resize(column + 1);
executed: values.resize(column + 1);
Execution Count:64173
64173
965 } -
966 if (d->display.count() <= column) {
evaluated: d->display.count() <= column
TRUEFALSE
yes
Evaluation Count:64173
yes
Evaluation Count:254
254-64173
967 for (int i = d->display.count() - 1; i < column - 1; ++i)
evaluated: i < column - 1
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:64173
6-64173
968 d->display.append(QVariant());
executed: d->display.append(QVariant());
Execution Count:6
6
969 d->display.append(value); -
970 } else if (d->display[column] != value) {
executed: }
Execution Count:64173
evaluated: d->display[column] != value
TRUEFALSE
yes
Evaluation Count:228
yes
Evaluation Count:26
26-64173
971 d->display[column] = value; -
972 } else {
executed: }
Execution Count:228
228
973 return;
executed: return;
Execution Count:26
26
974 } -
975 } break;
executed: break;
Execution Count:64401
64401
976 case Qt::CheckStateRole: -
977 if (itemFlags & Qt::ItemIsTristate) {
evaluated: itemFlags & Qt::ItemIsTristate
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:124
4-124
978 for (int i = 0; i < children.count(); ++i) {
partially evaluated: i < children.count()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
979 QTreeWidgetItem *child = children.at(i); -
980 if (child->data(column, role).isValid()) {
never evaluated: child->data(column, role).isValid()
0
981 Qt::ItemFlags f = itemFlags; -
982 itemFlags &= ~Qt::ItemIsTristate; -
983 child->setData(column, role, value); -
984 itemFlags = f; -
985 }
never executed: }
0
986 }
never executed: }
0
987 }
executed: }
Execution Count:4
4
988 -
989 default:
code before this statement executed: default:
Execution Count:128
128
990 if (column < values.count()) {
evaluated: column < values.count()
TRUEFALSE
yes
Evaluation Count:708
yes
Evaluation Count:15
15-708
991 bool found = false; -
992 QVector<QWidgetItemData> column_values = values.at(column); -
993 for (int i = 0; i < column_values.count(); ++i) {
evaluated: i < column_values.count()
TRUEFALSE
yes
Evaluation Count:3587
yes
Evaluation Count:111
111-3587
994 if (column_values.at(i).role == role) {
evaluated: column_values.at(i).role == role
TRUEFALSE
yes
Evaluation Count:597
yes
Evaluation Count:2990
597-2990
995 if (column_values.at(i).value == value)
evaluated: column_values.at(i).value == value
TRUEFALSE
yes
Evaluation Count:200
yes
Evaluation Count:397
200-397
996 return;
executed: return;
Execution Count:200
200
997 values[column][i].value = value; -
998 found = true; -
999 break;
executed: break;
Execution Count:397
397
1000 } -
1001 }
executed: }
Execution Count:2990
2990
1002 if (!found)
evaluated: !found
TRUEFALSE
yes
Evaluation Count:111
yes
Evaluation Count:397
111-397
1003 values[column].append(QWidgetItemData(role, value));
executed: values[column].append(QWidgetItemData(role, value));
Execution Count:111
111
1004 } else {
executed: }
Execution Count:508
508
1005 if (model && this == model->headerItem)
evaluated: model
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:2
partially evaluated: this == model->headerItem
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13
0-13
1006 model->setColumnCount(column + 1);
never executed: model->setColumnCount(column + 1);
0
1007 else -
1008 values.resize(column + 1);
executed: values.resize(column + 1);
Execution Count:15
15
1009 values[column].append(QWidgetItemData(role, value)); -
1010 }
executed: }
Execution Count:15
15
1011 } -
1012 -
1013 if (model) {
evaluated: model
TRUEFALSE
yes
Evaluation Count:6184
yes
Evaluation Count:58740
6184-58740
1014 model->emitDataChanged(this, column); -
1015 if (role == Qt::CheckStateRole) {
evaluated: role == Qt::CheckStateRole
TRUEFALSE
yes
Evaluation Count:104
yes
Evaluation Count:6080
104-6080
1016 QTreeWidgetItem *p; -
1017 for (p = par; p && (p->itemFlags & Qt::ItemIsTristate); p = p->par)
evaluated: p
TRUEFALSE
yes
Evaluation Count:57
yes
Evaluation Count:50
evaluated: (p->itemFlags & Qt::ItemIsTristate)
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:54
3-57
1018 model->emitDataChanged(p, column);
executed: model->emitDataChanged(p, column);
Execution Count:3
3
1019 }
executed: }
Execution Count:104
104
1020 }
executed: }
Execution Count:6184
6184
1021}
executed: }
Execution Count:64924
64924
1022 -
1023 -
1024 -
1025 -
1026QVariant QTreeWidgetItem::data(int column, int role) const -
1027{ -
1028 switch (role) { -
1029 case Qt::EditRole: -
1030 case Qt::DisplayRole: -
1031 if (column >= 0 && column < d->display.count())
partially evaluated: column >= 0
TRUEFALSE
yes
Evaluation Count:21885
no
Evaluation Count:0
evaluated: column < d->display.count()
TRUEFALSE
yes
Evaluation Count:21666
yes
Evaluation Count:219
0-21885
1032 return d->display.at(column);
executed: return d->display.at(column);
Execution Count:21666
21666
1033 break;
executed: break;
Execution Count:219
219
1034 case Qt::CheckStateRole: -
1035 -
1036 if (children.count() && (itemFlags & Qt::ItemIsTristate))
evaluated: children.count()
TRUEFALSE
yes
Evaluation Count:708
yes
Evaluation Count:6278
evaluated: (itemFlags & Qt::ItemIsTristate)
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:702
6-6278
1037 return childrenCheckState(column);
executed: return childrenCheckState(column);
Execution Count:6
6
1038 -
1039 default:
code before this statement executed: default:
Execution Count:6980
6980
1040 if (column >= 0 && column < values.size()) {
partially evaluated: column >= 0
TRUEFALSE
yes
Evaluation Count:19151
no
Evaluation Count:0
evaluated: column < values.size()
TRUEFALSE
yes
Evaluation Count:17818
yes
Evaluation Count:1333
0-19151
1041 const QVector<QWidgetItemData> &column_values = values.at(column); -
1042 for (int i = 0; i < column_values.count(); ++i)
evaluated: i < column_values.count()
TRUEFALSE
yes
Evaluation Count:7240
yes
Evaluation Count:16727
7240-16727
1043 if (column_values.at(i).role == role)
evaluated: column_values.at(i).role == role
TRUEFALSE
yes
Evaluation Count:1091
yes
Evaluation Count:6149
1091-6149
1044 return column_values.at(i).value;
executed: return column_values.at(i).value;
Execution Count:1091
1091
1045 }
executed: }
Execution Count:16727
16727
1046 }
executed: }
Execution Count:18060
18060
1047 return QVariant();
executed: return QVariant();
Execution Count:18279
18279
1048} -
1049 -
1050 -
1051 -
1052 -
1053 -
1054 -
1055bool QTreeWidgetItem::operator<(const QTreeWidgetItem &other) const -
1056{ -
1057 int column = view ? view->sortColumn() : 0;
partially evaluated: view
TRUEFALSE
yes
Evaluation Count:7597
no
Evaluation Count:0
0-7597
1058 const QVariant v1 = data(column, Qt::DisplayRole); -
1059 const QVariant v2 = other.data(column, Qt::DisplayRole); -
1060 return QAbstractItemModelPrivate::variantLessThan(v1, v2);
executed: return QAbstractItemModelPrivate::variantLessThan(v1, v2);
Execution Count:7597
7597
1061} -
1062void QTreeWidgetItem::read(QDataStream &in) -
1063{ -
1064 -
1065 if (in.version() < QDataStream::Qt_4_2) {
partially evaluated: in.version() < QDataStream::Qt_4_2
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
1066 d->display.clear(); -
1067 in >> values; -
1068 -
1069 for (int column = 0; column < values.count(); ++column) {
never evaluated: column < values.count()
0
1070 d->display << QVariant(); -
1071 for (int i = 0; i < values.at(column).count(); ++i) {
never evaluated: i < values.at(column).count()
0
1072 if (values.at(column).at(i).role == Qt::DisplayRole) {
never evaluated: values.at(column).at(i).role == Qt::DisplayRole
0
1073 d->display[column] = values.at(column).at(i).value; -
1074 values[column].remove(i--); -
1075 }
never executed: }
0
1076 }
never executed: }
0
1077 }
never executed: }
0
1078 } else {
never executed: }
0
1079 in >> values >> d->display; -
1080 }
executed: }
Execution Count:1
1
1081} -
1082 -
1083 -
1084 -
1085 -
1086 -
1087 -
1088void QTreeWidgetItem::write(QDataStream &out) const -
1089{ -
1090 out << values << d->display; -
1091}
executed: }
Execution Count:1
1
1092QTreeWidgetItem::QTreeWidgetItem(const QTreeWidgetItem &other) -
1093 : rtti(Type), values(other.values), view(0), -
1094 d(new QTreeWidgetItemPrivate(this)), par(0), -
1095 itemFlags(other.itemFlags) -
1096{ -
1097 d->display = other.d->display; -
1098}
executed: }
Execution Count:5
5
1099QTreeWidgetItem &QTreeWidgetItem::operator=(const QTreeWidgetItem &other) -
1100{ -
1101 values = other.values; -
1102 d->display = other.d->display; -
1103 d->policy = other.d->policy; -
1104 itemFlags = other.itemFlags; -
1105 return *this;
executed: return *this;
Execution Count:1
1
1106} -
1107 -
1108 -
1109 -
1110 -
1111 -
1112 -
1113void QTreeWidgetItem::addChild(QTreeWidgetItem *child) -
1114{ -
1115 if (child) {
evaluated: child
TRUEFALSE
yes
Evaluation Count:65123
yes
Evaluation Count:2
2-65123
1116 insertChild(children.count(), child); -
1117 child->d->rowGuess = children.count() - 1; -
1118 }
executed: }
Execution Count:65123
65123
1119}
executed: }
Execution Count:65125
65125
1120 -
1121 -
1122 -
1123 -
1124 -
1125 -
1126void QTreeWidgetItem::insertChild(int index, QTreeWidgetItem *child) -
1127{ -
1128 if (index < 0 || index > children.count() || child == 0 || child->view != 0 || child->par != 0)
evaluated: index < 0
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:68183
evaluated: index > children.count()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:68181
evaluated: child == 0
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:68180
evaluated: child->view != 0
TRUEFALSE
yes
Evaluation Count:20
yes
Evaluation Count:68160
evaluated: child->par != 0
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:68150
1-68183
1129 return;
executed: return;
Execution Count:35
35
1130 -
1131 if (QTreeModel *model = (view ? qobject_cast<QTreeModel*>(view->model()) : 0)) {
evaluated: view
TRUEFALSE
yes
Evaluation Count:68095
yes
Evaluation Count:55
55-68095
1132 const bool wasSkipSort = model->skipPendingSort; -
1133 model->skipPendingSort = true; -
1134 if (model->rootItem == this)
evaluated: model->rootItem == this
TRUEFALSE
yes
Evaluation Count:5214
yes
Evaluation Count:62881
5214-62881
1135 child->par = 0;
executed: child->par = 0;
Execution Count:5214
5214
1136 else -
1137 child->par = this;
executed: child->par = this;
Execution Count:62881
62881
1138 if (view->isSortingEnabled()) {
evaluated: view->isSortingEnabled()
TRUEFALSE
yes
Evaluation Count:1067
yes
Evaluation Count:67028
1067-67028
1139 -
1140 if (!model->sortPendingTimer.isActive())
evaluated: !model->sortPendingTimer.isActive()
TRUEFALSE
yes
Evaluation Count:229
yes
Evaluation Count:838
229-838
1141 model->sortPendingTimer.start(0, model);
executed: model->sortPendingTimer.start(0, model);
Execution Count:229
229
1142 }
executed: }
Execution Count:1067
1067
1143 model->beginInsertItems(this, index, 1); -
1144 int cols = model->columnCount(); -
1145 QStack<QTreeWidgetItem*> stack; -
1146 stack.push(child); -
1147 while (!stack.isEmpty()) {
evaluated: !stack.isEmpty()
TRUEFALSE
yes
Evaluation Count:68104
yes
Evaluation Count:68095
68095-68104
1148 QTreeWidgetItem *i = stack.pop(); -
1149 i->view = view; -
1150 i->values.reserve(cols); -
1151 for (int c = 0; c < i->children.count(); ++c)
evaluated: c < i->children.count()
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:68104
9-68104
1152 stack.push(i->children.at(c));
executed: stack.push(i->children.at(c));
Execution Count:9
9
1153 }
executed: }
Execution Count:68104
68104
1154 children.insert(index, child); -
1155 model->endInsertItems(); -
1156 model->skipPendingSort = wasSkipSort; -
1157 } else {
executed: }
Execution Count:68095
68095
1158 child->par = this; -
1159 children.insert(index, child); -
1160 }
executed: }
Execution Count:55
55
1161 if (child->par)
evaluated: child->par
TRUEFALSE
yes
Evaluation Count:62936
yes
Evaluation Count:5214
5214-62936
1162 d->propagateDisabled(child);
executed: d->propagateDisabled(child);
Execution Count:62936
62936
1163}
executed: }
Execution Count:68150
68150
1164 -
1165 -
1166 -
1167 -
1168 -
1169void QTreeWidgetItem::removeChild(QTreeWidgetItem *child) -
1170{ -
1171 (void)takeChild(children.indexOf(child)); -
1172}
executed: }
Execution Count:2
2
1173 -
1174 -
1175 -
1176 -
1177QTreeWidgetItem *QTreeWidgetItem::takeChild(int index) -
1178{ -
1179 -
1180 -
1181 QTreeModel *model = (view ? qobject_cast<QTreeModel*>(view->model()) : 0);
evaluated: view
TRUEFALSE
yes
Evaluation Count:16
yes
Evaluation Count:1
1-16
1182 if (model) {
evaluated: model
TRUEFALSE
yes
Evaluation Count:16
yes
Evaluation Count:1
1-16
1183 -
1184 -
1185 -
1186 -
1187 model->skipPendingSort = false; -
1188 model->executePendingSort(); -
1189 }
executed: }
Execution Count:16
16
1190 if (index >= 0 && index < children.count()) {
evaluated: index >= 0
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:2
evaluated: index < children.count()
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:2
2-15
1191 if (model) model->beginRemoveItems(this, index, 1);
executed: model->beginRemoveItems(this, index, 1);
Execution Count:12
evaluated: model
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:1
1-12
1192 QTreeWidgetItem *item = children.takeAt(index); -
1193 item->par = 0; -
1194 QStack<QTreeWidgetItem*> stack; -
1195 stack.push(item); -
1196 while (!stack.isEmpty()) {
evaluated: !stack.isEmpty()
TRUEFALSE
yes
Evaluation Count:26
yes
Evaluation Count:13
13-26
1197 QTreeWidgetItem *i = stack.pop(); -
1198 i->view = 0; -
1199 for (int c = 0; c < i->children.count(); ++c)
evaluated: c < i->children.count()
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:26
13-26
1200 stack.push(i->children.at(c));
executed: stack.push(i->children.at(c));
Execution Count:13
13
1201 }
executed: }
Execution Count:26
26
1202 d->propagateDisabled(item); -
1203 if (model) model->endRemoveRows();
executed: model->endRemoveRows();
Execution Count:12
evaluated: model
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:1
1-12
1204 return item;
executed: return item;
Execution Count:13
13
1205 } -
1206 return 0;
executed: return 0;
Execution Count:4
4
1207} -
1208void QTreeWidgetItem::addChildren(const QList<QTreeWidgetItem*> &children) -
1209{ -
1210 insertChildren(this->children.count(), children); -
1211}
executed: }
Execution Count:43
43
1212void QTreeWidgetItem::insertChildren(int index, const QList<QTreeWidgetItem*> &children) -
1213{ -
1214 if (view && view->isSortingEnabled()) {
evaluated: view
TRUEFALSE
yes
Evaluation Count:70
yes
Evaluation Count:21
evaluated: view->isSortingEnabled()
TRUEFALSE
yes
Evaluation Count:24
yes
Evaluation Count:46
21-70
1215 for (int n = 0; n < children.count(); ++n)
evaluated: n < children.count()
TRUEFALSE
yes
Evaluation Count:126
yes
Evaluation Count:24
24-126
1216 insertChild(index, children.at(n));
executed: insertChild(index, children.at(n));
Execution Count:126
126
1217 return;
executed: return;
Execution Count:24
24
1218 } -
1219 QTreeModel *model = (view ? qobject_cast<QTreeModel*>(view->model()) : 0);
evaluated: view
TRUEFALSE
yes
Evaluation Count:46
yes
Evaluation Count:21
21-46
1220 QStack<QTreeWidgetItem*> stack; -
1221 QList<QTreeWidgetItem*> itemsToInsert; -
1222 for (int n = 0; n < children.count(); ++n) {
evaluated: n < children.count()
TRUEFALSE
yes
Evaluation Count:633
yes
Evaluation Count:67
67-633
1223 QTreeWidgetItem *child = children.at(n); -
1224 if (child->view || child->par)
evaluated: child->view
TRUEFALSE
yes
Evaluation Count:200
yes
Evaluation Count:433
evaluated: child->par
TRUEFALSE
yes
Evaluation Count:100
yes
Evaluation Count:333
100-433
1225 continue;
executed: continue;
Execution Count:300
300
1226 itemsToInsert.append(child); -
1227 if (view && model) {
evaluated: view
TRUEFALSE
yes
Evaluation Count:233
yes
Evaluation Count:100
partially evaluated: model
TRUEFALSE
yes
Evaluation Count:233
no
Evaluation Count:0
0-233
1228 if (child->childCount() == 0)
partially evaluated: child->childCount() == 0
TRUEFALSE
yes
Evaluation Count:233
no
Evaluation Count:0
0-233
1229 child->view = view;
executed: child->view = view;
Execution Count:233
233
1230 else -
1231 stack.push(child);
never executed: stack.push(child);
0
1232 } -
1233 if (model && (model->rootItem == this))
evaluated: model
TRUEFALSE
yes
Evaluation Count:233
yes
Evaluation Count:100
evaluated: (model->rootItem == this)
TRUEFALSE
yes
Evaluation Count:130
yes
Evaluation Count:103
100-233
1234 child->par = 0;
executed: child->par = 0;
Execution Count:130
130
1235 else -
1236 child->par = this;
executed: child->par = this;
Execution Count:203
203
1237 } -
1238 if (!itemsToInsert.isEmpty()) {
evaluated: !itemsToInsert.isEmpty()
TRUEFALSE
yes
Evaluation Count:34
yes
Evaluation Count:33
33-34
1239 while (!stack.isEmpty()) {
partially evaluated: !stack.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:34
0-34
1240 QTreeWidgetItem *i = stack.pop(); -
1241 i->view = view; -
1242 for (int c = 0; c < i->children.count(); ++c)
never evaluated: c < i->children.count()
0
1243 stack.push(i->children.at(c));
never executed: stack.push(i->children.at(c));
0
1244 }
never executed: }
0
1245 if (model) model->beginInsertItems(this, index, itemsToInsert.count());
executed: model->beginInsertItems(this, index, itemsToInsert.count());
Execution Count:24
evaluated: model
TRUEFALSE
yes
Evaluation Count:24
yes
Evaluation Count:10
10-24
1246 for (int n = 0; n < itemsToInsert.count(); ++n) {
evaluated: n < itemsToInsert.count()
TRUEFALSE
yes
Evaluation Count:333
yes
Evaluation Count:34
34-333
1247 QTreeWidgetItem *child = itemsToInsert.at(n); -
1248 this->children.insert(index + n, child); -
1249 if (child->par)
evaluated: child->par
TRUEFALSE
yes
Evaluation Count:203
yes
Evaluation Count:130
130-203
1250 d->propagateDisabled(child);
executed: d->propagateDisabled(child);
Execution Count:203
203
1251 }
executed: }
Execution Count:333
333
1252 if (model) model->endInsertItems();
executed: model->endInsertItems();
Execution Count:24
evaluated: model
TRUEFALSE
yes
Evaluation Count:24
yes
Evaluation Count:10
10-24
1253 }
executed: }
Execution Count:34
34
1254}
executed: }
Execution Count:67
67
1255 -
1256 -
1257 -
1258 -
1259 -
1260 -
1261QList<QTreeWidgetItem*> QTreeWidgetItem::takeChildren() -
1262{ -
1263 QList<QTreeWidgetItem*> removed; -
1264 if (children.count() > 0) {
partially evaluated: children.count() > 0
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
1265 QTreeModel *model = (view ? qobject_cast<QTreeModel*>(view->model()) : 0);
evaluated: view
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1
1-2
1266 if (model) {
evaluated: model
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1
1-2
1267 -
1268 -
1269 -
1270 -
1271 model->executePendingSort(); -
1272 }
executed: }
Execution Count:2
2
1273 if (model) model->beginRemoveItems(this, 0, children.count());
executed: model->beginRemoveItems(this, 0, children.count());
Execution Count:2
evaluated: model
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1
1-2
1274 for (int n = 0; n < children.count(); ++n) {
evaluated: n < children.count()
TRUEFALSE
yes
Evaluation Count:23
yes
Evaluation Count:3
3-23
1275 QTreeWidgetItem *item = children.at(n); -
1276 item->par = 0; -
1277 QStack<QTreeWidgetItem*> stack; -
1278 stack.push(item); -
1279 while (!stack.isEmpty()) {
evaluated: !stack.isEmpty()
TRUEFALSE
yes
Evaluation Count:23
yes
Evaluation Count:23
23
1280 QTreeWidgetItem *i = stack.pop(); -
1281 i->view = 0; -
1282 for (int c = 0; c < i->children.count(); ++c)
partially evaluated: c < i->children.count()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:23
0-23
1283 stack.push(i->children.at(c));
never executed: stack.push(i->children.at(c));
0
1284 }
executed: }
Execution Count:23
23
1285 d->propagateDisabled(item); -
1286 }
executed: }
Execution Count:23
23
1287 removed = children; -
1288 children.clear(); -
1289 if (model) model->endRemoveItems();
executed: model->endRemoveItems();
Execution Count:2
evaluated: model
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1
1-2
1290 }
executed: }
Execution Count:3
3
1291 return removed;
executed: return removed;
Execution Count:3
3
1292} -
1293 -
1294 -
1295void QTreeWidgetItemPrivate::sortChildren(int column, Qt::SortOrder order, bool climb) -
1296{ -
1297 QTreeModel *model = (q->view ? qobject_cast<QTreeModel*>(q->view->model()) : 0);
partially evaluated: q->view
TRUEFALSE
yes
Evaluation Count:3360
no
Evaluation Count:0
0-3360
1298 if (!model)
partially evaluated: !model
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3360
0-3360
1299 return;
never executed: return;
0
1300 model->sortItems(&q->children, column, order); -
1301 if (climb) {
evaluated: climb
TRUEFALSE
yes
Evaluation Count:3358
yes
Evaluation Count:2
2-3358
1302 QList<QTreeWidgetItem*>::iterator it = q->children.begin(); -
1303 for (; it != q->children.end(); ++it) {
evaluated: it != q->children.end()
TRUEFALSE
yes
Evaluation Count:2903
yes
Evaluation Count:3358
2903-3358
1304 -
1305 -
1306 (*it)->d->sortChildren(column, order, climb); -
1307 }
executed: }
Execution Count:2903
2903
1308 }
executed: }
Execution Count:3358
3358
1309}
executed: }
Execution Count:3360
3360
1310void QTreeWidgetItem::sortChildren(int column, Qt::SortOrder order, bool climb) -
1311{ -
1312 QTreeModel *model = (view ? qobject_cast<QTreeModel*>(view->model()) : 0);
partially evaluated: view
TRUEFALSE
yes
Evaluation Count:457
no
Evaluation Count:0
0-457
1313 if (!model)
partially evaluated: !model
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:457
0-457
1314 return;
never executed: return;
0
1315 if (model->isChanging())
partially evaluated: model->isChanging()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:457
0-457
1316 return;
never executed: return;
0
1317 QTreeModel::SkipSorting skipSorting(model); -
1318 int oldSortColumn = view->d_func()->explicitSortColumn; -
1319 view->d_func()->explicitSortColumn = column; -
1320 model->layoutAboutToBeChanged(); -
1321 d->sortChildren(column, order, climb); -
1322 model->layoutChanged(); -
1323 view->d_func()->explicitSortColumn = oldSortColumn; -
1324}
executed: }
Execution Count:457
457
1325QVariant QTreeWidgetItem::childrenCheckState(int column) const -
1326{ -
1327 if (column < 0)
partially evaluated: column < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6
0-6
1328 return QVariant();
never executed: return QVariant();
0
1329 bool checkedChildren = false; -
1330 bool uncheckedChildren = false; -
1331 for (int i = 0; i < children.count(); ++i) {
evaluated: i < children.count()
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:5
5-12
1332 QVariant value = children.at(i)->data(column, Qt::CheckStateRole); -
1333 if (!value.isValid())
partially evaluated: !value.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12
0-12
1334 return QVariant();
never executed: return QVariant();
0
1335 -
1336 switch (static_cast<Qt::CheckState>(value.toInt())) -
1337 { -
1338 case Qt::Unchecked: -
1339 uncheckedChildren = true; -
1340 break;
executed: break;
Execution Count:4
4
1341 case Qt::Checked: -
1342 checkedChildren = true; -
1343 break;
executed: break;
Execution Count:7
7
1344 case Qt::PartiallyChecked: -
1345 default: -
1346 return Qt::PartiallyChecked;
executed: return Qt::PartiallyChecked;
Execution Count:1
1
1347 } -
1348 }
executed: }
Execution Count:11
11
1349 -
1350 if (uncheckedChildren && checkedChildren)
evaluated: uncheckedChildren
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:2
evaluated: checkedChildren
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1
1-3
1351 return Qt::PartiallyChecked;
executed: return Qt::PartiallyChecked;
Execution Count:2
2
1352 if (uncheckedChildren)
evaluated: uncheckedChildren
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:2
1-2
1353 return Qt::Unchecked;
executed: return Qt::Unchecked;
Execution Count:1
1
1354 else if (checkedChildren)
partially evaluated: checkedChildren
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
1355 return Qt::Checked;
executed: return Qt::Checked;
Execution Count:2
2
1356 else -
1357 return QVariant();
never executed: return QVariant();
0
1358} -
1359void QTreeWidgetItem::emitDataChanged() -
1360{ -
1361 itemChanged(); -
1362}
executed: }
Execution Count:6
6
1363 -
1364 -
1365 -
1366 -
1367void QTreeWidgetItem::itemChanged() -
1368{ -
1369 if (QTreeModel *model = (view ? qobject_cast<QTreeModel*>(view->model()) : 0))
evaluated: view
TRUEFALSE
yes
Evaluation Count:231
yes
Evaluation Count:53
53-231
1370 model->itemChanged(this);
executed: model->itemChanged(this);
Execution Count:231
231
1371}
executed: }
Execution Count:284
284
1372 -
1373 -
1374 -
1375 -
1376void QTreeWidgetItem::executePendingSort() const -
1377{ -
1378 if (QTreeModel *model = (view ? qobject_cast<QTreeModel*>(view->model()) : 0))
evaluated: view
TRUEFALSE
yes
Evaluation Count:35109
yes
Evaluation Count:331
331-35109
1379 model->executePendingSort();
executed: model->executePendingSort();
Execution Count:35109
35109
1380}
executed: }
Execution Count:35440
35440
1381QDataStream &operator<<(QDataStream &out, const QTreeWidgetItem &item) -
1382{ -
1383 item.write(out); -
1384 return out;
executed: return out;
Execution Count:1
1
1385} -
1386QDataStream &operator>>(QDataStream &in, QTreeWidgetItem &item) -
1387{ -
1388 item.read(in); -
1389 return in;
executed: return in;
Execution Count:1
1
1390} -
1391 -
1392 -
1393 -
1394void QTreeWidgetPrivate::_q_emitItemPressed(const QModelIndex &index) -
1395{ -
1396 QTreeWidget * const q = q_func(); -
1397 q->itemPressed(item(index), index.column()); -
1398}
executed: }
Execution Count:4
4
1399 -
1400void QTreeWidgetPrivate::_q_emitItemClicked(const QModelIndex &index) -
1401{ -
1402 QTreeWidget * const q = q_func(); -
1403 q->itemClicked(item(index), index.column()); -
1404}
executed: }
Execution Count:3
3
1405 -
1406void QTreeWidgetPrivate::_q_emitItemDoubleClicked(const QModelIndex &index) -
1407{ -
1408 QTreeWidget * const q = q_func(); -
1409 q->itemDoubleClicked(item(index), index.column()); -
1410}
never executed: }
0
1411 -
1412void QTreeWidgetPrivate::_q_emitItemActivated(const QModelIndex &index) -
1413{ -
1414 QTreeWidget * const q = q_func(); -
1415 q->itemActivated(item(index), index.column()); -
1416}
never executed: }
0
1417 -
1418void QTreeWidgetPrivate::_q_emitItemEntered(const QModelIndex &index) -
1419{ -
1420 QTreeWidget * const q = q_func(); -
1421 q->itemEntered(item(index), index.column()); -
1422}
executed: }
Execution Count:3
3
1423 -
1424void QTreeWidgetPrivate::_q_emitItemChanged(const QModelIndex &index) -
1425{ -
1426 QTreeWidget * const q = q_func(); -
1427 QTreeWidgetItem *indexItem = item(index); -
1428 if (indexItem)
evaluated: indexItem
TRUEFALSE
yes
Evaluation Count:6380
yes
Evaluation Count:1
1-6380
1429 q->itemChanged(indexItem, index.column());
executed: q->itemChanged(indexItem, index.column());
Execution Count:6380
6380
1430}
executed: }
Execution Count:6381
6381
1431 -
1432void QTreeWidgetPrivate::_q_emitItemExpanded(const QModelIndex &index) -
1433{ -
1434 QTreeWidget * const q = q_func(); -
1435 q->itemExpanded(item(index)); -
1436}
executed: }
Execution Count:132
132
1437 -
1438void QTreeWidgetPrivate::_q_emitItemCollapsed(const QModelIndex &index) -
1439{ -
1440 QTreeWidget * const q = q_func(); -
1441 q->itemCollapsed(item(index)); -
1442}
executed: }
Execution Count:11
11
1443 -
1444void QTreeWidgetPrivate::_q_emitCurrentItemChanged(const QModelIndex &current, -
1445 const QModelIndex &previous) -
1446{ -
1447 QTreeWidget * const q = q_func(); -
1448 QTreeWidgetItem *currentItem = item(current); -
1449 QTreeWidgetItem *previousItem = item(previous); -
1450 q->currentItemChanged(currentItem, previousItem); -
1451}
executed: }
Execution Count:87
87
1452 -
1453void QTreeWidgetPrivate::_q_sort() -
1454{ -
1455 if (sortingEnabled) {
partially evaluated: sortingEnabled
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:11
0-11
1456 int column = header->sortIndicatorSection(); -
1457 Qt::SortOrder order = header->sortIndicatorOrder(); -
1458 treeModel()->sort(column, order); -
1459 }
never executed: }
0
1460}
executed: }
Execution Count:11
11
1461 -
1462void QTreeWidgetPrivate::_q_selectionChanged(const QItemSelection &selected, const QItemSelection &deselected) -
1463{ -
1464 QTreeWidget * const q = q_func(); -
1465 QModelIndexList indices = selected.indexes(); -
1466 int i; -
1467 QTreeModel *m = treeModel(); -
1468 for (i = 0; i < indices.count(); ++i) {
evaluated: i < indices.count()
TRUEFALSE
yes
Evaluation Count:222
yes
Evaluation Count:153
153-222
1469 QTreeWidgetItem *item = m->item(indices.at(i)); -
1470 item->d->selected = true; -
1471 }
executed: }
Execution Count:222
222
1472 -
1473 indices = deselected.indexes(); -
1474 for (i = 0; i < indices.count(); ++i) {
evaluated: i < indices.count()
TRUEFALSE
yes
Evaluation Count:152
yes
Evaluation Count:153
152-153
1475 QTreeWidgetItem *item = m->item(indices.at(i)); -
1476 item->d->selected = false; -
1477 }
executed: }
Execution Count:152
152
1478 -
1479 q->itemSelectionChanged(); -
1480}
executed: }
Execution Count:153
153
1481 -
1482void QTreeWidgetPrivate::_q_dataChanged(const QModelIndex &topLeft, -
1483 const QModelIndex &bottomRight) -
1484{ -
1485 if (sortingEnabled && topLeft.isValid() && bottomRight.isValid()
evaluated: sortingEnabled
TRUEFALSE
yes
Evaluation Count:122
yes
Evaluation Count:6259
partially evaluated: topLeft.isValid()
TRUEFALSE
yes
Evaluation Count:122
no
Evaluation Count:0
partially evaluated: bottomRight.isValid()
TRUEFALSE
yes
Evaluation Count:122
no
Evaluation Count:0
0-6259
1486 && !treeModel()->sortPendingTimer.isActive()) {
evaluated: !treeModel()->sortPendingTimer.isActive()
TRUEFALSE
yes
Evaluation Count:21
yes
Evaluation Count:101
21-101
1487 int column = header->sortIndicatorSection(); -
1488 if (column >= topLeft.column() && column <= bottomRight.column()) {
partially evaluated: column >= topLeft.column()
TRUEFALSE
yes
Evaluation Count:21
no
Evaluation Count:0
partially evaluated: column <= bottomRight.column()
TRUEFALSE
yes
Evaluation Count:21
no
Evaluation Count:0
0-21
1489 Qt::SortOrder order = header->sortIndicatorOrder(); -
1490 treeModel()->ensureSorted(column, order, topLeft.row(), -
1491 bottomRight.row(), topLeft.parent()); -
1492 }
executed: }
Execution Count:21
21
1493 }
executed: }
Execution Count:21
21
1494}
executed: }
Execution Count:6381
6381
1495QTreeWidget::QTreeWidget(QWidget *parent) -
1496 : QTreeView(*new QTreeWidgetPrivate(), parent) -
1497{ -
1498 QTreeView::setModel(new QTreeModel(1, this)); -
1499 connect(this, "2""pressed(QModelIndex)", -
1500 "1""_q_emitItemPressed(QModelIndex)"); -
1501 connect(this, "2""clicked(QModelIndex)", -
1502 "1""_q_emitItemClicked(QModelIndex)"); -
1503 connect(this, "2""doubleClicked(QModelIndex)", -
1504 "1""_q_emitItemDoubleClicked(QModelIndex)"); -
1505 connect(this, "2""activated(QModelIndex)", -
1506 "1""_q_emitItemActivated(QModelIndex)"); -
1507 connect(this, "2""entered(QModelIndex)", -
1508 "1""_q_emitItemEntered(QModelIndex)"); -
1509 connect(this, "2""expanded(QModelIndex)", -
1510 "1""_q_emitItemExpanded(QModelIndex)"); -
1511 connect(this, "2""collapsed(QModelIndex)", -
1512 "1""_q_emitItemCollapsed(QModelIndex)"); -
1513 connect(selectionModel(), "2""currentChanged(QModelIndex,QModelIndex)", -
1514 this, "1""_q_emitCurrentItemChanged(QModelIndex,QModelIndex)"); -
1515 connect(model(), "2""dataChanged(QModelIndex,QModelIndex)", -
1516 this, "1""_q_emitItemChanged(QModelIndex)"); -
1517 connect(model(), "2""dataChanged(QModelIndex,QModelIndex)", -
1518 this, "1""_q_dataChanged(QModelIndex,QModelIndex)"); -
1519 connect(model(), "2""columnsRemoved(QModelIndex,int,int)", -
1520 this, "1""_q_sort()"); -
1521 connect(selectionModel(), "2""selectionChanged(QItemSelection,QItemSelection)", -
1522 this, "1""_q_selectionChanged(QItemSelection,QItemSelection)"); -
1523 header()->setSectionsClickable(false); -
1524}
executed: }
Execution Count:264
264
1525 -
1526 -
1527 -
1528 -
1529 -
1530QTreeWidget::~QTreeWidget() -
1531{ -
1532} -
1533 -
1534 -
1535 -
1536 -
1537 -
1538 -
1539 -
1540int QTreeWidget::columnCount() const -
1541{ -
1542 const QTreeWidgetPrivate * const d = d_func(); -
1543 return d->model->columnCount();
executed: return d->model->columnCount();
Execution Count:372
372
1544} -
1545 -
1546 -
1547 -
1548 -
1549 -
1550void QTreeWidget::setColumnCount(int columns) -
1551{ -
1552 QTreeWidgetPrivate * const d = d_func(); -
1553 if (columns < 0)
evaluated: columns < 0
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:310
2-310
1554 return;
executed: return;
Execution Count:2
2
1555 d->treeModel()->setColumnCount(columns); -
1556}
executed: }
Execution Count:310
310
1557QTreeWidgetItem *QTreeWidget::invisibleRootItem() const -
1558{ -
1559 const QTreeWidgetPrivate * const d = d_func(); -
1560 return d->treeModel()->rootItem;
executed: return d->treeModel()->rootItem;
Execution Count:4
4
1561} -
1562QTreeWidgetItem *QTreeWidget::topLevelItem(int index) const -
1563{ -
1564 const QTreeWidgetPrivate * const d = d_func(); -
1565 return d->treeModel()->rootItem->child(index);
executed: return d->treeModel()->rootItem->child(index);
Execution Count:1345
1345
1566} -
1567int QTreeWidget::topLevelItemCount() const -
1568{ -
1569 const QTreeWidgetPrivate * const d = d_func(); -
1570 return d->treeModel()->rootItem->childCount();
executed: return d->treeModel()->rootItem->childCount();
Execution Count:1691
1691
1571} -
1572void QTreeWidget::insertTopLevelItem(int index, QTreeWidgetItem *item) -
1573{ -
1574 QTreeWidgetPrivate * const d = d_func(); -
1575 d->treeModel()->rootItem->insertChild(index, item); -
1576}
executed: }
Execution Count:829
829
1577void QTreeWidget::addTopLevelItem(QTreeWidgetItem *item) -
1578{ -
1579 insertTopLevelItem(topLevelItemCount(), item); -
1580}
executed: }
Execution Count:652
652
1581QTreeWidgetItem *QTreeWidget::takeTopLevelItem(int index) -
1582{ -
1583 QTreeWidgetPrivate * const d = d_func(); -
1584 return d->treeModel()->rootItem->takeChild(index);
executed: return d->treeModel()->rootItem->takeChild(index);
Execution Count:8
8
1585} -
1586 -
1587 -
1588 -
1589 -
1590 -
1591 -
1592 -
1593int QTreeWidget::indexOfTopLevelItem(QTreeWidgetItem *item) const -
1594{ -
1595 const QTreeWidgetPrivate * const d = d_func(); -
1596 d->treeModel()->executePendingSort(); -
1597 return d->treeModel()->rootItem->children.indexOf(item);
executed: return d->treeModel()->rootItem->children.indexOf(item);
Execution Count:129
129
1598} -
1599void QTreeWidget::insertTopLevelItems(int index, const QList<QTreeWidgetItem*> &items) -
1600{ -
1601 QTreeWidgetPrivate * const d = d_func(); -
1602 d->treeModel()->rootItem->insertChildren(index, items); -
1603}
executed: }
Execution Count:48
48
1604 -
1605 -
1606 -
1607 -
1608 -
1609 -
1610void QTreeWidget::addTopLevelItems(const QList<QTreeWidgetItem*> &items) -
1611{ -
1612 insertTopLevelItems(topLevelItemCount(), items); -
1613}
executed: }
Execution Count:33
33
1614 -
1615 -
1616 -
1617 -
1618 -
1619 -
1620 -
1621QTreeWidgetItem *QTreeWidget::headerItem() const -
1622{ -
1623 const QTreeWidgetPrivate * const d = d_func(); -
1624 return d->treeModel()->headerItem;
executed: return d->treeModel()->headerItem;
Execution Count:6
6
1625} -
1626void QTreeWidget::setHeaderItem(QTreeWidgetItem *item) -
1627{ -
1628 QTreeWidgetPrivate * const d = d_func(); -
1629 if (!item)
evaluated: !item
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:9
2-9
1630 return;
executed: return;
Execution Count:2
2
1631 item->view = this; -
1632 -
1633 int oldCount = columnCount(); -
1634 if (oldCount < item->columnCount())
evaluated: oldCount < item->columnCount()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:4
4-5
1635 d->treeModel()->beginInsertColumns(QModelIndex(), oldCount, item->columnCount());
executed: d->treeModel()->beginInsertColumns(QModelIndex(), oldCount, item->columnCount());
Execution Count:5
5
1636 else -
1637 d->treeModel()->beginRemoveColumns(QModelIndex(), item->columnCount(), oldCount);
executed: d->treeModel()->beginRemoveColumns(QModelIndex(), item->columnCount(), oldCount);
Execution Count:4
4
1638 delete d->treeModel()->headerItem; -
1639 d->treeModel()->headerItem = item; -
1640 if (oldCount < item->columnCount())
evaluated: oldCount < item->columnCount()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:4
4-5
1641 d->treeModel()->endInsertColumns();
executed: d->treeModel()->endInsertColumns();
Execution Count:5
5
1642 else -
1643 d->treeModel()->endRemoveColumns();
executed: d->treeModel()->endRemoveColumns();
Execution Count:4
4
1644 d->treeModel()->headerDataChanged(Qt::Horizontal, 0, oldCount); -
1645}
executed: }
Execution Count:9
9
1646void QTreeWidget::setHeaderLabels(const QStringList &labels) -
1647{ -
1648 QTreeWidgetPrivate * const d = d_func(); -
1649 if (columnCount() < labels.count())
evaluated: columnCount() < labels.count()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:3
1-3
1650 setColumnCount(labels.count());
executed: setColumnCount(labels.count());
Execution Count:1
1
1651 QTreeWidgetItem *item = d->treeModel()->headerItem; -
1652 for (int i = 0; i < labels.count(); ++i)
evaluated: i < labels.count()
TRUEFALSE
yes
Evaluation Count:30
yes
Evaluation Count:4
4-30
1653 item->setText(i, labels.at(i));
executed: item->setText(i, labels.at(i));
Execution Count:30
30
1654}
executed: }
Execution Count:4
4
1655QTreeWidgetItem *QTreeWidget::currentItem() const -
1656{ -
1657 const QTreeWidgetPrivate * const d = d_func(); -
1658 return d->item(currentIndex());
executed: return d->item(currentIndex());
Execution Count:134
134
1659} -
1660 -
1661 -
1662 -
1663 -
1664 -
1665 -
1666 -
1667int QTreeWidget::currentColumn() const -
1668{ -
1669 return currentIndex().column();
executed: return currentIndex().column();
Execution Count:32
32
1670} -
1671void QTreeWidget::setCurrentItem(QTreeWidgetItem *item) -
1672{ -
1673 setCurrentItem(item, 0); -
1674}
executed: }
Execution Count:26
26
1675 -
1676 -
1677 -
1678 -
1679 -
1680 -
1681 -
1682void QTreeWidget::setCurrentItem(QTreeWidgetItem *item, int column) -
1683{ -
1684 QTreeWidgetPrivate * const d = d_func(); -
1685 setCurrentIndex(d->index(item, column)); -
1686}
executed: }
Execution Count:58
58
1687void QTreeWidget::setCurrentItem(QTreeWidgetItem *item, int column, -
1688 QItemSelectionModel::SelectionFlags command) -
1689{ -
1690 QTreeWidgetPrivate * const d = d_func(); -
1691 d->selectionModel->setCurrentIndex(d->index(item, column), command); -
1692}
never executed: }
0
1693QTreeWidgetItem *QTreeWidget::itemAt(const QPoint &p) const -
1694{ -
1695 const QTreeWidgetPrivate * const d = d_func(); -
1696 return d->item(indexAt(p));
never executed: return d->item(indexAt(p));
0
1697} -
1698QRect QTreeWidget::visualItemRect(const QTreeWidgetItem *item) const -
1699{ -
1700 const QTreeWidgetPrivate * const d = d_func(); -
1701 -
1702 -
1703 QModelIndex base = d->index(item); -
1704 const int firstVisiblesection = header()->logicalIndexAt(- header()->offset()); -
1705 const int lastVisibleSection = header()->logicalIndexAt(header()->length() - header()->offset() - 1); -
1706 QModelIndex first = base.sibling(base.row(), header()->logicalIndex(firstVisiblesection)); -
1707 QModelIndex last = base.sibling(base.row(), header()->logicalIndex(lastVisibleSection)); -
1708 return visualRect(first) | visualRect(last);
executed: return visualRect(first) | visualRect(last);
Execution Count:12
12
1709} -
1710int QTreeWidget::sortColumn() const -
1711{ -
1712 const QTreeWidgetPrivate * const d = d_func(); -
1713 return (d->explicitSortColumn != -1 7599
1714 ? d->explicitSortColumn 7599
1715 : header()->sortIndicatorSection());
executed: return (d->explicitSortColumn != -1 ? d->explicitSortColumn : header()->sortIndicatorSection());
Execution Count:7599
7599
1716} -
1717void QTreeWidget::sortItems(int column, Qt::SortOrder order) -
1718{ -
1719 QTreeWidgetPrivate * const d = d_func(); -
1720 header()->setSortIndicator(column, order); -
1721 d->model->sort(column, order); -
1722}
executed: }
Execution Count:87
87
1723 -
1724 -
1725 -
1726 -
1727 -
1728void QTreeWidget::editItem(QTreeWidgetItem *item, int column) -
1729{ -
1730 QTreeWidgetPrivate * const d = d_func(); -
1731 edit(d->index(item, column)); -
1732}
executed: }
Execution Count:22
22
1733 -
1734 -
1735 -
1736 -
1737 -
1738 -
1739 -
1740void QTreeWidget::openPersistentEditor(QTreeWidgetItem *item, int column) -
1741{ -
1742 QTreeWidgetPrivate * const d = d_func(); -
1743 QAbstractItemView::openPersistentEditor(d->index(item, column)); -
1744}
executed: }
Execution Count:20
20
1745void QTreeWidget::closePersistentEditor(QTreeWidgetItem *item, int column) -
1746{ -
1747 QTreeWidgetPrivate * const d = d_func(); -
1748 QAbstractItemView::closePersistentEditor(d->index(item, column)); -
1749}
executed: }
Execution Count:20
20
1750QWidget *QTreeWidget::itemWidget(QTreeWidgetItem *item, int column) const -
1751{ -
1752 const QTreeWidgetPrivate * const d = d_func(); -
1753 return QAbstractItemView::indexWidget(d->index(item, column));
executed: return QAbstractItemView::indexWidget(d->index(item, column));
Execution Count:66
66
1754} -
1755void QTreeWidget::setItemWidget(QTreeWidgetItem *item, int column, QWidget *widget) -
1756{ -
1757 QTreeWidgetPrivate * const d = d_func(); -
1758 QAbstractItemView::setIndexWidget(d->index(item, column), widget); -
1759}
executed: }
Execution Count:42
42
1760bool QTreeWidget::isItemSelected(const QTreeWidgetItem *item) const -
1761{ -
1762 if (!item)
evaluated: !item
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:686
8-686
1763 return false;
executed: return false;
Execution Count:8
8
1764 return item->d->selected;
executed: return item->d->selected;
Execution Count:686
686
1765} -
1766void QTreeWidget::setItemSelected(const QTreeWidgetItem *item, bool select) -
1767{ -
1768 QTreeWidgetPrivate * const d = d_func(); -
1769 -
1770 if (!item)
evaluated: !item
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:93
8-93
1771 return;
executed: return;
Execution Count:8
8
1772 -
1773 selectionModel()->select(d->index(item), (select ? QItemSelectionModel::Select -
1774 : QItemSelectionModel::Deselect) -
1775 |QItemSelectionModel::Rows); -
1776 item->d->selected = select; -
1777}
executed: }
Execution Count:93
93
1778 -
1779 -
1780 -
1781 -
1782 -
1783 -
1784QList<QTreeWidgetItem*> QTreeWidget::selectedItems() const -
1785{ -
1786 const QTreeWidgetPrivate * const d = d_func(); -
1787 QModelIndexList indexes = selectionModel()->selectedIndexes(); -
1788 QList<QTreeWidgetItem*> items; -
1789 items.reserve(indexes.count()); -
1790 QSet<QTreeWidgetItem *> seen; -
1791 seen.reserve(indexes.count()); -
1792 for (int i = 0; i < indexes.count(); ++i) {
evaluated: i < indexes.count()
TRUEFALSE
yes
Evaluation Count:46
yes
Evaluation Count:16
16-46
1793 QTreeWidgetItem *item = d->item(indexes.at(i)); -
1794 if (isItemHidden(item) || seen.contains(item))
evaluated: isItemHidden(item)
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:38
evaluated: seen.contains(item)
TRUEFALSE
yes
Evaluation Count:19
yes
Evaluation Count:19
8-38
1795 continue;
executed: continue;
Execution Count:27
27
1796 seen.insert(item); -
1797 items.append(item); -
1798 }
executed: }
Execution Count:19
19
1799 return items;
executed: return items;
Execution Count:16
16
1800} -
1801 -
1802 -
1803 -
1804 -
1805QList<QTreeWidgetItem*> QTreeWidget::findItems(const QString &text, Qt::MatchFlags flags, int column) const -
1806{ -
1807 const QTreeWidgetPrivate * const d = d_func(); -
1808 QModelIndexList indexes = d->model->match(model()->index(0, column, QModelIndex()), -
1809 Qt::DisplayRole, text, -1, flags); -
1810 QList<QTreeWidgetItem*> items; -
1811 for (int i = 0; i < indexes.size(); ++i)
evaluated: i < indexes.size()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:3
3-5
1812 items.append(d->item(indexes.at(i)));
executed: items.append(d->item(indexes.at(i)));
Execution Count:5
5
1813 return items;
executed: return items;
Execution Count:3
3
1814} -
1815bool QTreeWidget::isItemHidden(const QTreeWidgetItem *item) const -
1816{ -
1817 const QTreeWidgetPrivate * const d = d_func(); -
1818 if (item == d->treeModel()->headerItem)
partially evaluated: item == d->treeModel()->headerItem
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1016
0-1016
1819 return header()->isHidden();
never executed: return header()->isHidden();
0
1820 if (d->hiddenIndexes.isEmpty())
evaluated: d->hiddenIndexes.isEmpty()
TRUEFALSE
yes
Evaluation Count:32
yes
Evaluation Count:984
32-984
1821 return false;
executed: return false;
Execution Count:32
32
1822 QTreeModel::SkipSorting skipSorting(d->treeModel()); -
1823 return d->isRowHidden(d->index(item));
executed: return d->isRowHidden(d->index(item));
Execution Count:984
984
1824} -
1825void QTreeWidget::setItemHidden(const QTreeWidgetItem *item, bool hide) -
1826{ -
1827 QTreeWidgetPrivate * const d = d_func(); -
1828 if (item == d->treeModel()->headerItem) {
partially evaluated: item == d->treeModel()->headerItem
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:50
0-50
1829 header()->setHidden(hide); -
1830 } else {
never executed: }
0
1831 const QModelIndex index = d->index(item); -
1832 setRowHidden(index.row(), index.parent(), hide); -
1833 }
executed: }
Execution Count:50
50
1834} -
1835bool QTreeWidget::isItemExpanded(const QTreeWidgetItem *item) const -
1836{ -
1837 const QTreeWidgetPrivate * const d = d_func(); -
1838 QTreeModel::SkipSorting skipSorting(d->treeModel()); -
1839 return isExpanded(d->index(item));
executed: return isExpanded(d->index(item));
Execution Count:347
347
1840} -
1841void QTreeWidget::setItemExpanded(const QTreeWidgetItem *item, bool expand) -
1842{ -
1843 QTreeWidgetPrivate * const d = d_func(); -
1844 QTreeModel::SkipSorting skipSorting(d->treeModel()); -
1845 setExpanded(d->index(item), expand); -
1846}
executed: }
Execution Count:115
115
1847bool QTreeWidget::isFirstItemColumnSpanned(const QTreeWidgetItem *item) const -
1848{ -
1849 const QTreeWidgetPrivate * const d = d_func(); -
1850 if (item == d->treeModel()->headerItem)
never evaluated: item == d->treeModel()->headerItem
0
1851 return false;
never executed: return false;
0
1852 const QModelIndex index = d->index(item); -
1853 return isFirstColumnSpanned(index.row(), index.parent());
never executed: return isFirstColumnSpanned(index.row(), index.parent());
0
1854} -
1855void QTreeWidget::setFirstItemColumnSpanned(const QTreeWidgetItem *item, bool span) -
1856{ -
1857 QTreeWidgetPrivate * const d = d_func(); -
1858 if (item == d->treeModel()->headerItem)
never evaluated: item == d->treeModel()->headerItem
0
1859 return;
never executed: return;
0
1860 const QModelIndex index = d->index(item); -
1861 setFirstColumnSpanned(index.row(), index.parent(), span); -
1862}
never executed: }
0
1863 -
1864 -
1865 -
1866 -
1867 -
1868 -
1869QTreeWidgetItem *QTreeWidget::itemAbove(const QTreeWidgetItem *item) const -
1870{ -
1871 const QTreeWidgetPrivate * const d = d_func(); -
1872 if (item == d->treeModel()->headerItem)
partially evaluated: item == d->treeModel()->headerItem
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
1873 return 0;
never executed: return 0;
0
1874 const QModelIndex index = d->index(item); -
1875 const QModelIndex above = indexAbove(index); -
1876 return d->item(above);
executed: return d->item(above);
Execution Count:1
1
1877} -
1878 -
1879 -
1880 -
1881 -
1882 -
1883 -
1884QTreeWidgetItem *QTreeWidget::itemBelow(const QTreeWidgetItem *item) const -
1885{ -
1886 const QTreeWidgetPrivate * const d = d_func(); -
1887 if (item == d->treeModel()->headerItem)
partially evaluated: item == d->treeModel()->headerItem
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
1888 return 0;
never executed: return 0;
0
1889 const QModelIndex index = d->index(item); -
1890 const QModelIndex below = indexBelow(index); -
1891 return d->item(below);
executed: return d->item(below);
Execution Count:1
1
1892} -
1893 -
1894 -
1895 -
1896 -
1897void QTreeWidget::setSelectionModel(QItemSelectionModel *selectionModel) -
1898{ -
1899 QTreeWidgetPrivate * const d = d_func(); -
1900 QTreeView::setSelectionModel(selectionModel); -
1901 QItemSelection newSelection = selectionModel->selection(); -
1902 if (!newSelection.isEmpty())
evaluated: !newSelection.isEmpty()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:264
1-264
1903 d->_q_selectionChanged(newSelection, QItemSelection());
executed: d->_q_selectionChanged(newSelection, QItemSelection());
Execution Count:1
1
1904}
executed: }
Execution Count:265
265
1905 -
1906 -
1907 -
1908 -
1909 -
1910 -
1911 -
1912void QTreeWidget::scrollToItem(const QTreeWidgetItem *item, QAbstractItemView::ScrollHint hint) -
1913{ -
1914 QTreeWidgetPrivate * const d = d_func(); -
1915 QTreeView::scrollTo(d->index(item), hint); -
1916}
executed: }
Execution Count:2
2
1917 -
1918 -
1919 -
1920 -
1921 -
1922 -
1923 -
1924void QTreeWidget::expandItem(const QTreeWidgetItem *item) -
1925{ -
1926 QTreeWidgetPrivate * const d = d_func(); -
1927 QTreeModel::SkipSorting skipSorting(d->treeModel()); -
1928 expand(d->index(item)); -
1929}
executed: }
Execution Count:6
6
1930 -
1931 -
1932 -
1933 -
1934 -
1935 -
1936 -
1937void QTreeWidget::collapseItem(const QTreeWidgetItem *item) -
1938{ -
1939 QTreeWidgetPrivate * const d = d_func(); -
1940 QTreeModel::SkipSorting skipSorting(d->treeModel()); -
1941 collapse(d->index(item)); -
1942}
executed: }
Execution Count:17
17
1943void QTreeWidget::clear() -
1944{ -
1945 QTreeWidgetPrivate * const d = d_func(); -
1946 selectionModel()->clear(); -
1947 d->treeModel()->clear(); -
1948}
executed: }
Execution Count:166
166
1949 -
1950 -
1951 -
1952 -
1953 -
1954 -
1955 -
1956QStringList QTreeWidget::mimeTypes() const -
1957{ -
1958 return model()->QAbstractItemModel::mimeTypes();
executed: return model()->QAbstractItemModel::mimeTypes();
Execution Count:53
53
1959} -
1960QMimeData *QTreeWidget::mimeData(const QList<QTreeWidgetItem*> items) const -
1961{ -
1962 const QTreeWidgetPrivate * const d = d_func(); -
1963 if (d->treeModel()->cachedIndexes.isEmpty()) {
never evaluated: d->treeModel()->cachedIndexes.isEmpty()
0
1964 QList<QModelIndex> indexes; -
1965 for (int i = 0; i < items.count(); ++i) {
never evaluated: i < items.count()
0
1966 QTreeWidgetItem *item = items.at(i); -
1967 for (int c = 0; c < item->values.count(); ++c) {
never evaluated: c < item->values.count()
0
1968 indexes << indexFromItem(item, c); -
1969 }
never executed: }
0
1970 }
never executed: }
0
1971 return d->model->QAbstractItemModel::mimeData(indexes);
never executed: return d->model->QAbstractItemModel::mimeData(indexes);
0
1972 } -
1973 return d->treeModel()->internalMimeData();
never executed: return d->treeModel()->internalMimeData();
0
1974} -
1975bool QTreeWidget::dropMimeData(QTreeWidgetItem *parent, int index, -
1976 const QMimeData *data, Qt::DropAction action) -
1977{ -
1978 QModelIndex idx; -
1979 if (parent) idx = indexFromItem(parent);
never executed: idx = indexFromItem(parent);
never evaluated: parent
0
1980 return model()->QAbstractItemModel::dropMimeData(data, action , index, 0, idx);
never executed: return model()->QAbstractItemModel::dropMimeData(data, action , index, 0, idx);
0
1981} -
1982 -
1983 -
1984 -
1985 -
1986 -
1987 -
1988Qt::DropActions QTreeWidget::supportedDropActions() const -
1989{ -
1990 return model()->QAbstractItemModel::supportedDropActions() | Qt::MoveAction;
executed: return model()->QAbstractItemModel::supportedDropActions() | Qt::MoveAction;
Execution Count:53
53
1991} -
1992 -
1993 -
1994 -
1995 -
1996 -
1997 -
1998 -
1999QList<QTreeWidgetItem*> QTreeWidget::items(const QMimeData *data) const -
2000{ -
2001 (void)data;; -
2002 return QList<QTreeWidgetItem*>();
never executed: return QList<QTreeWidgetItem*>();
0
2003} -
2004 -
2005 -
2006 -
2007 -
2008 -
2009 -
2010QModelIndex QTreeWidget::indexFromItem(QTreeWidgetItem *item, int column) const -
2011{ -
2012 const QTreeWidgetPrivate * const d = d_func(); -
2013 return d->index(item, column);
executed: return d->index(item, column);
Execution Count:24
24
2014} -
2015 -
2016 -
2017 -
2018 -
2019 -
2020 -
2021QTreeWidgetItem *QTreeWidget::itemFromIndex(const QModelIndex &index) const -
2022{ -
2023 const QTreeWidgetPrivate * const d = d_func(); -
2024 return d->item(index);
never executed: return d->item(index);
0
2025} -
2026 -
2027 -
2028 -
2029void QTreeWidget::dropEvent(QDropEvent *event) { -
2030 QTreeWidgetPrivate * const d = d_func(); -
2031 if (event->source() == this && (event->dropAction() == Qt::MoveAction ||
never evaluated: event->source() == this
never evaluated: event->dropAction() == Qt::MoveAction
0
2032 dragDropMode() == QAbstractItemView::InternalMove)) {
never evaluated: dragDropMode() == QAbstractItemView::InternalMove
0
2033 QModelIndex topIndex; -
2034 int col = -1; -
2035 int row = -1; -
2036 if (d->dropOn(event, &row, &col, &topIndex)) {
never evaluated: d->dropOn(event, &row, &col, &topIndex)
0
2037 QList<QModelIndex> idxs = selectedIndexes(); -
2038 QList<QPersistentModelIndex> indexes; -
2039 for (int i = 0; i < idxs.count(); i++)
never evaluated: i < idxs.count()
0
2040 indexes.append(idxs.at(i));
never executed: indexes.append(idxs.at(i));
0
2041 -
2042 if (indexes.contains(topIndex))
never evaluated: indexes.contains(topIndex)
0
2043 return;
never executed: return;
0
2044 -
2045 -
2046 QPersistentModelIndex dropRow = model()->index(row, col, topIndex); -
2047 -
2048 -
2049 QList<QTreeWidgetItem *> taken; -
2050 for (int i = indexes.count() - 1; i >= 0; --i) {
never evaluated: i >= 0
0
2051 QTreeWidgetItem *parent = itemFromIndex(indexes.at(i)); -
2052 if (!parent || !parent->parent()) {
never evaluated: !parent
never evaluated: !parent->parent()
0
2053 taken.append(takeTopLevelItem(indexes.at(i).row())); -
2054 } else {
never executed: }
0
2055 taken.append(parent->parent()->takeChild(indexes.at(i).row())); -
2056 }
never executed: }
0
2057 } -
2058 -
2059 -
2060 for (int i = 0; i < indexes.count(); ++i) {
never evaluated: i < indexes.count()
0
2061 -
2062 if (row == -1) {
never evaluated: row == -1
0
2063 if (topIndex.isValid()) {
never evaluated: topIndex.isValid()
0
2064 QTreeWidgetItem *parent = itemFromIndex(topIndex); -
2065 parent->insertChild(parent->childCount(), taken.takeFirst()); -
2066 } else {
never executed: }
0
2067 insertTopLevelItem(topLevelItemCount(), taken.takeFirst()); -
2068 }
never executed: }
0
2069 } else { -
2070 int r = dropRow.row() >= 0 ? dropRow.row() : row;
never evaluated: dropRow.row() >= 0
0
2071 if (topIndex.isValid()) {
never evaluated: topIndex.isValid()
0
2072 QTreeWidgetItem *parent = itemFromIndex(topIndex); -
2073 parent->insertChild(qMin(r, parent->childCount()), taken.takeFirst()); -
2074 } else {
never executed: }
0
2075 insertTopLevelItem(qMin(r, topLevelItemCount()), taken.takeFirst()); -
2076 }
never executed: }
0
2077 } -
2078 } -
2079 -
2080 event->accept(); -
2081 -
2082 event->setDropAction(Qt::CopyAction); -
2083 }
never executed: }
0
2084 }
never executed: }
0
2085 -
2086 QTreeView::dropEvent(event); -
2087}
never executed: }
0
2088 -
2089 -
2090 -
2091 -
2092 -
2093 -
2094void QTreeWidget::setModel(QAbstractItemModel * ) -
2095{ -
2096 qt_noop(); -
2097}
never executed: }
0
2098 -
2099 -
2100 -
2101 -
2102bool QTreeWidget::event(QEvent *e) -
2103{ -
2104 QTreeWidgetPrivate * const d = d_func(); -
2105 if (e->type() == QEvent::Polish)
evaluated: e->type() == QEvent::Polish
TRUEFALSE
yes
Evaluation Count:29
yes
Evaluation Count:2115
29-2115
2106 d->treeModel()->executePendingSort();
executed: d->treeModel()->executePendingSort();
Execution Count:29
29
2107 return QTreeView::event(e);
executed: return QTreeView::event(e);
Execution Count:2144
2144
2108} -
2109 -
2110 -
2111 -
2112 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial