qstandarditemmodel.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/gui/itemmodels/qstandarditemmodel.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8-
9static inline QString qStandardItemModelDataListMimeType()-
10{-
11 return
never executed: return ([]() -> QString { enum { Size = sizeof(u"" "application/x-qstandarditemmodeldatalist")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "application/x-qstandarditemmodeldatalist" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }());
([]() -> QString { enum { Size = sizeof(u"" "application/x-qstandarditemmodeldatalist")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "application/x-qstandarditemmodeldatalist" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return
never executed: return qstring_literal_temp;
qstring_literal_temp;
never executed: return qstring_literal_temp;
}());
never executed: return ([]() -> QString { enum { Size = sizeof(u"" "application/x-qstandarditemmodeldatalist")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "application/x-qstandarditemmodeldatalist" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return qstring_literal_temp; }());
0
12}-
13-
14class QStandardItemModelLessThan-
15{-
16public:-
17 inline QStandardItemModelLessThan()-
18 { }-
19-
20 inline bool operator()(const QPair<QStandardItem*, int> &l,-
21 const QPair<QStandardItem*, int> &r) const-
22 {-
23 return
never executed: return *(l.first) < *(r.first);
*(l.first) < *(r.first);
never executed: return *(l.first) < *(r.first);
0
24 }-
25};-
26-
27class QStandardItemModelGreaterThan-
28{-
29public:-
30 inline QStandardItemModelGreaterThan()-
31 { }-
32-
33 inline bool operator()(const QPair<QStandardItem*, int> &l,-
34 const QPair<QStandardItem*, int> &r) const-
35 {-
36 return
never executed: return *(r.first) < *(l.first);
*(r.first) < *(l.first);
never executed: return *(r.first) < *(l.first);
0
37 }-
38};-
39-
40-
41-
42-
43QStandardItemPrivate::~QStandardItemPrivate()-
44{-
45 QVector<QStandardItem*>::const_iterator it;-
46 for (it = children.constBegin(); it != children.constEnd()
it != children.constEnd()Description
TRUEnever evaluated
FALSEnever evaluated
; ++it) {
0
47 QStandardItem *child = *it;-
48 if (child
childDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
49 child->d_func()->setModel(0);
never executed: child->d_func()->setModel(0);
0
50 delete child;-
51 }
never executed: end of block
0
52 children.clear();-
53 if (parent
parentDescription
TRUEnever evaluated
FALSEnever evaluated
&& model
modelDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
54 parent->d_func()->childDeleted(q_func());
never executed: parent->d_func()->childDeleted(q_func());
0
55}
never executed: end of block
0
56-
57-
58-
59-
60QPair<int, int> QStandardItemPrivate::position() const-
61{-
62 if (QStandardItem *par = parent
QStandardItem *par = parentDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
63 int idx = par->d_func()->childIndex(q_func());-
64 if (idx == -1
idx == -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
65 return
never executed: return QPair<int, int>(-1, -1);
QPair<int, int>(-1, -1);
never executed: return QPair<int, int>(-1, -1);
0
66 return
never executed: return QPair<int, int>(idx / par->columnCount(), idx % par->columnCount());
QPair<int, int>(idx / par->columnCount(), idx % par->columnCount());
never executed: return QPair<int, int>(idx / par->columnCount(), idx % par->columnCount());
0
67 }-
68-
69 return
never executed: return QPair<int, int>(-1, -1);
QPair<int, int>(-1, -1);
never executed: return QPair<int, int>(-1, -1);
0
70}-
71-
72-
73-
74-
75void QStandardItemPrivate::setChild(int row, int column, QStandardItem *item,-
76 bool emitChanged)-
77{-
78 QStandardItem * const q = q_func();-
79 if (item == q
item == qDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
80 QMessageLogger(__FILE__, 131, __PRETTY_FUNCTION__).warning("QStandardItem::setChild: Can't make an item a child of itself %p",-
81 item);-
82 return;
never executed: return;
0
83 }-
84 if ((
(row < 0)Description
TRUEnever evaluated
FALSEnever evaluated
row < 0)
(row < 0)Description
TRUEnever evaluated
FALSEnever evaluated
|| (
(column < 0)Description
TRUEnever evaluated
FALSEnever evaluated
column < 0)
(column < 0)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
85 return;
never executed: return;
0
86 if (rows <= row
rows <= rowDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
87 q->setRowCount(row + 1);
never executed: q->setRowCount(row + 1);
0
88 if (columns <= column
columns <= columnDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
89 q->setColumnCount(column + 1);
never executed: q->setColumnCount(column + 1);
0
90 int index = childIndex(row, column);-
91 ((!(index != -1)) ? qt_assert("index != -1",__FILE__,142) : qt_noop());-
92 QStandardItem *oldItem = children.at(index);-
93 if (item == oldItem
item == oldItemDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
94 return;
never executed: return;
0
95-
96 if (model
modelDescription
TRUEnever evaluated
FALSEnever evaluated
&& emitChanged
emitChangedDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
97 model->layoutAboutToBeChanged();-
98 }
never executed: end of block
0
99-
100 if (item
itemDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
101 if (item->d_func()->parent == 0
item->d_func()->parent == 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
102 item->d_func()->setParentAndModel(q, model);-
103 }
never executed: end of block
else {
0
104 QMessageLogger(__FILE__, 155, __PRETTY_FUNCTION__).warning("QStandardItem::setChild: Ignoring duplicate insertion of item %p",-
105 item);-
106 return;
never executed: return;
0
107 }-
108 }-
109 if (oldItem
oldItemDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
110 oldItem->d_func()->setModel(0);
never executed: oldItem->d_func()->setModel(0);
0
111 delete oldItem;-
112 children.replace(index, item);-
113-
114 if (model
modelDescription
TRUEnever evaluated
FALSEnever evaluated
&& emitChanged
emitChangedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
115 model->layoutChanged();
never executed: model->layoutChanged();
0
116-
117 if (emitChanged
emitChangedDescription
TRUEnever evaluated
FALSEnever evaluated
&& model
modelDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
118 model->d_func()->itemChanged(item);
never executed: model->d_func()->itemChanged(item);
0
119}
never executed: end of block
0
120-
121-
122-
123-
124-
125void QStandardItemPrivate::changeFlags(bool enable, Qt::ItemFlags f)-
126{-
127 QStandardItem * const q = q_func();-
128 Qt::ItemFlags flags = q->flags();-
129 if (enable
enableDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
130 flags |= f;
never executed: flags |= f;
0
131 else-
132 flags &= ~f;
never executed: flags &= ~f;
0
133 q->setFlags(flags);-
134}
never executed: end of block
0
135-
136-
137-
138-
139void QStandardItemPrivate::childDeleted(QStandardItem *child)-
140{-
141 int index = childIndex(child);-
142 ((!(index != -1)) ? qt_assert("index != -1",__FILE__,193) : qt_noop());-
143 children.replace(index, 0);-
144}
never executed: end of block
0
145-
146-
147-
148-
149void QStandardItemPrivate::setItemData(const QMap<int, QVariant> &roles)-
150{-
151 QStandardItem * const q = q_func();-
152-
153-
154 QVector<QStandardItemData> newValues;-
155 for (auto it = roles.begin(), end = roles.end(); it != end
it != endDescription
TRUEnever evaluated
FALSEnever evaluated
; ++it) {
0
156 const QVariant &value = it.value();-
157 if (value.isValid()
value.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
158 int role = it.key();-
159 role = (
(role == Qt::EditRole)Description
TRUEnever evaluated
FALSEnever evaluated
role == Qt::EditRole)
(role == Qt::EditRole)Description
TRUEnever evaluated
FALSEnever evaluated
? Qt::DisplayRole : role;
0
160 newValues.append(QStandardItemData(role, value));-
161 }
never executed: end of block
0
162 }
never executed: end of block
0
163-
164 if (values!=newValues
values!=newValuesDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
165 values.swap(newValues);-
166 if (model
modelDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
167 model->d_func()->itemChanged(q);
never executed: model->d_func()->itemChanged(q);
0
168 }
never executed: end of block
0
169}
never executed: end of block
0
170-
171-
172-
173-
174const QMap<int, QVariant> QStandardItemPrivate::itemData() const-
175{-
176 QMap<int, QVariant> result;-
177 QVector<QStandardItemData>::const_iterator it;-
178 for (it = values.begin(); it != values.end()
it != values.end()Description
TRUEnever evaluated
FALSEnever evaluated
; ++it)
0
179 result.insert((*it).role, (*it).value);
never executed: result.insert((*it).role, (*it).value);
0
180 return
never executed: return result;
result;
never executed: return result;
0
181}-
182-
183-
184-
185-
186void QStandardItemPrivate::sortChildren(int column, Qt::SortOrder order)-
187{-
188 QStandardItem * const q = q_func();-
189 if (column >= columnCount()
column >= columnCount()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
190 return;
never executed: return;
0
191-
192 QVector<QPair<QStandardItem*, int> > sortable;-
193 QVector<int> unsortable;-
194-
195 sortable.reserve(rowCount());-
196 unsortable.reserve(rowCount());-
197-
198 for (int row = 0; row < rowCount()
row < rowCount()Description
TRUEnever evaluated
FALSEnever evaluated
; ++row) {
0
199 QStandardItem *itm = q->child(row, column);-
200 if (itm
itmDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
201 sortable.append(QPair<QStandardItem*,int>(itm, row));
never executed: sortable.append(QPair<QStandardItem*,int>(itm, row));
0
202 else-
203 unsortable.append(row);
never executed: unsortable.append(row);
0
204 }-
205-
206 if (order == Qt::AscendingOrder
order == Qt::AscendingOrderDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
207 QStandardItemModelLessThan lt;-
208 std::stable_sort(sortable.begin(), sortable.end(), lt);-
209 }
never executed: end of block
else {
0
210 QStandardItemModelGreaterThan gt;-
211 std::stable_sort(sortable.begin(), sortable.end(), gt);-
212 }
never executed: end of block
0
213-
214 QModelIndexList changedPersistentIndexesFrom, changedPersistentIndexesTo;-
215 QVector<QStandardItem*> sorted_children(children.count());-
216 for (int i = 0; i < rowCount()
i < rowCount()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
217 int r = (i < sortable.count()
i < sortable.count()Description
TRUEnever evaluated
FALSEnever evaluated
0
218 ? sortable.at(i).second-
219 : unsortable.at(i - sortable.count()));-
220 for (int c = 0; c < columnCount()
c < columnCount()Description
TRUEnever evaluated
FALSEnever evaluated
; ++c) {
0
221 QStandardItem *itm = q->child(r, c);-
222 sorted_children[childIndex(i, c)] = itm;-
223 if (model
modelDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
224 QModelIndex from = model->createIndex(r, c, q);-
225 if (model->d_func()->persistent.indexes.contains(from)
model->d_func(...contains(from)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
226 QModelIndex to = model->createIndex(i, c, q);-
227 changedPersistentIndexesFrom.append(from);-
228 changedPersistentIndexesTo.append(to);-
229 }
never executed: end of block
0
230 }
never executed: end of block
0
231 }
never executed: end of block
0
232 }
never executed: end of block
0
233-
234 children = sorted_children;-
235-
236 if (model
modelDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
237 model->changePersistentIndexList(changedPersistentIndexesFrom, changedPersistentIndexesTo);-
238 }
never executed: end of block
0
239-
240 QVector<QStandardItem*>::iterator it;-
241 for (it = children.begin(); it != children.end()
it != children.end()Description
TRUEnever evaluated
FALSEnever evaluated
; ++it) {
0
242 if (*
*itDescription
TRUEnever evaluated
FALSEnever evaluated
it
*itDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
243 (*
never executed: (*it)->d_func()->sortChildren(column, order);
it)->d_func()->sortChildren(column, order);
never executed: (*it)->d_func()->sortChildren(column, order);
0
244 }
never executed: end of block
0
245}
never executed: end of block
0
246-
247-
248-
249-
250-
251void QStandardItemPrivate::setModel(QStandardItemModel *mod)-
252{-
253 if (children.isEmpty()
children.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
254 if (model
modelDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
255 model->d_func()->invalidatePersistentIndex(model->indexFromItem(q_ptr));
never executed: model->d_func()->invalidatePersistentIndex(model->indexFromItem(q_ptr));
0
256 model = mod;-
257 }
never executed: end of block
else {
0
258 QStack<QStandardItem*> stack;-
259 stack.push(q_ptr);-
260 while (!stack.isEmpty()
!stack.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
261 QStandardItem *itm = stack.pop();-
262 if (itm->d_func()->model
itm->d_func()->modelDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
263 itm->d_func()->model->d_func()->invalidatePersistentIndex(itm->d_func()->model->indexFromItem(itm));-
264 }
never executed: end of block
0
265 itm->d_func()->model = mod;-
266 const QVector<QStandardItem*> &childList = itm->d_func()->children;-
267 for (int i = 0; i < childList.count()
i < childList.count()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
268 QStandardItem *chi = childList.at(i);-
269 if (chi
chiDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
270 stack.push(chi);
never executed: stack.push(chi);
0
271 }
never executed: end of block
0
272 }
never executed: end of block
0
273 }
never executed: end of block
0
274}-
275-
276-
277-
278-
279QStandardItemModelPrivate::QStandardItemModelPrivate()-
280 : root(new QStandardItem),-
281 itemPrototype(0),-
282 sortRole(Qt::DisplayRole)-
283{-
284 root->setFlags(Qt::ItemIsDropEnabled);-
285}
never executed: end of block
0
286-
287-
288-
289-
290QStandardItemModelPrivate::~QStandardItemModelPrivate()-
291{-
292 delete itemPrototype;-
293 qDeleteAll(columnHeaderItems);-
294 qDeleteAll(rowHeaderItems);-
295}
never executed: end of block
0
296-
297-
298-
299-
300void QStandardItemModelPrivate::init()-
301{-
302 QStandardItemModel * const q = q_func();-
303 QObject::connect(q, qFlagLocation("2""dataChanged(QModelIndex,QModelIndex)" "\0" __FILE__ ":" "354"),-
304 q, qFlagLocation("1""_q_emitItemChanged(QModelIndex,QModelIndex)" "\0" __FILE__ ":" "355"));-
305}
never executed: end of block
0
306-
307-
308-
309-
310void QStandardItemModelPrivate::_q_emitItemChanged(const QModelIndex &topLeft,-
311 const QModelIndex &bottomRight)-
312{-
313 QStandardItemModel * const q = q_func();-
314 QModelIndex parent = topLeft.parent();-
315 for (int row = topLeft.row(); row <= bottomRight.row()
row <= bottomRight.row()Description
TRUEnever evaluated
FALSEnever evaluated
; ++row) {
0
316 for (int column = topLeft.column(); column <= bottomRight.column()
column <= bottomRight.column()Description
TRUEnever evaluated
FALSEnever evaluated
; ++column) {
0
317 QModelIndex index = q->index(row, column, parent);-
318 if (QStandardItem *item = itemFromIndex(index)
QStandardItem ...omIndex(index)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
319 q->itemChanged(item);
never executed: q->itemChanged(item);
0
320 }
never executed: end of block
0
321 }
never executed: end of block
0
322}
never executed: end of block
0
323-
324-
325-
326-
327bool QStandardItemPrivate::insertRows(int row, const QList<QStandardItem*> &items)-
328{-
329 QStandardItem * const q = q_func();-
330 if ((
(row < 0)Description
TRUEnever evaluated
FALSEnever evaluated
row < 0)
(row < 0)Description
TRUEnever evaluated
FALSEnever evaluated
|| (
(row > rowCount())Description
TRUEnever evaluated
FALSEnever evaluated
row > rowCount())
(row > rowCount())Description
TRUEnever evaluated
FALSEnever evaluated
)
0
331 return
never executed: return false;
false;
never executed: return false;
0
332 int count = items.count();-
333 if (model
modelDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
334 model->d_func()->rowsAboutToBeInserted(q, row, row + count - 1);
never executed: model->d_func()->rowsAboutToBeInserted(q, row, row + count - 1);
0
335 if (rowCount() == 0
rowCount() == 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
336 if (columnCount() == 0
columnCount() == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
337 q->setColumnCount(1);
never executed: q->setColumnCount(1);
0
338 children.resize(columnCount() * count);-
339 rows = count;-
340 }
never executed: end of block
else {
0
341 rows += count;-
342 int index = childIndex(row, 0);-
343 if (index != -1
index != -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
344 children.insert(index, columnCount() * count, 0);
never executed: children.insert(index, columnCount() * count, 0);
0
345 }
never executed: end of block
0
346 for (int i = 0; i < items.count()
i < items.count()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
347 QStandardItem *item = items.at(i);-
348 item->d_func()->model = model;-
349 item->d_func()->parent = q;-
350 int index = childIndex(i + row, 0);-
351 children.replace(index, item);-
352 }
never executed: end of block
0
353 if (model
modelDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
354 model->d_func()->rowsInserted(q, row, count);
never executed: model->d_func()->rowsInserted(q, row, count);
0
355 return
never executed: return true;
true;
never executed: return true;
0
356}-
357-
358bool QStandardItemPrivate::insertRows(int row, int count, const QList<QStandardItem*> &items)-
359{-
360 QStandardItem * const q = q_func();-
361 if ((
(count < 1)Description
TRUEnever evaluated
FALSEnever evaluated
count < 1)
(count < 1)Description
TRUEnever evaluated
FALSEnever evaluated
|| (
(row < 0)Description
TRUEnever evaluated
FALSEnever evaluated
row < 0)
(row < 0)Description
TRUEnever evaluated
FALSEnever evaluated
|| (
(row > rowCount())Description
TRUEnever evaluated
FALSEnever evaluated
row > rowCount())
(row > rowCount())Description
TRUEnever evaluated
FALSEnever evaluated
)
0
362 return
never executed: return false;
false;
never executed: return false;
0
363 if (model
modelDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
364 model->d_func()->rowsAboutToBeInserted(q, row, row + count - 1);
never executed: model->d_func()->rowsAboutToBeInserted(q, row, row + count - 1);
0
365 if (rowCount() == 0
rowCount() == 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
366 children.resize(columnCount() * count);-
367 rows = count;-
368 }
never executed: end of block
else {
0
369 rows += count;-
370 int index = childIndex(row, 0);-
371 if (index != -1
index != -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
372 children.insert(index, columnCount() * count, 0);
never executed: children.insert(index, columnCount() * count, 0);
0
373 }
never executed: end of block
0
374 if (!items.isEmpty()
!items.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
375 int index = childIndex(row, 0);-
376 int limit = qMin(items.count(), columnCount() * count);-
377 for (int i = 0; i < limit
i < limitDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
378 QStandardItem *item = items.at(i);-
379 if (item
itemDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
380 if (item->d_func()->parent == 0
item->d_func()->parent == 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
381 item->d_func()->setParentAndModel(q, model);-
382 }
never executed: end of block
else {
0
383 QMessageLogger(__FILE__, 434, __PRETTY_FUNCTION__).warning("QStandardItem::insertRows: Ignoring duplicate insertion of item %p",-
384 item);-
385 item = 0;-
386 }
never executed: end of block
0
387 }-
388 children.replace(index, item);-
389 ++index;-
390 }
never executed: end of block
0
391 }
never executed: end of block
0
392 if (model
modelDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
393 model->d_func()->rowsInserted(q, row, count);
never executed: model->d_func()->rowsInserted(q, row, count);
0
394 return
never executed: return true;
true;
never executed: return true;
0
395}-
396-
397-
398-
399-
400bool QStandardItemPrivate::insertColumns(int column, int count, const QList<QStandardItem*> &items)-
401{-
402 QStandardItem * const q = q_func();-
403 if ((
(count < 1)Description
TRUEnever evaluated
FALSEnever evaluated
count < 1)
(count < 1)Description
TRUEnever evaluated
FALSEnever evaluated
|| (
(column < 0)Description
TRUEnever evaluated
FALSEnever evaluated
column < 0)
(column < 0)Description
TRUEnever evaluated
FALSEnever evaluated
|| (
(column > columnCount())Description
TRUEnever evaluated
FALSEnever evaluated
column > columnCount())
(column > columnCount())Description
TRUEnever evaluated
FALSEnever evaluated
)
0
404 return
never executed: return false;
false;
never executed: return false;
0
405 if (model
modelDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
406 model->d_func()->columnsAboutToBeInserted(q, column, column + count - 1);
never executed: model->d_func()->columnsAboutToBeInserted(q, column, column + count - 1);
0
407 if (columnCount() == 0
columnCount() == 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
408 children.resize(rowCount() * count);-
409 columns = count;-
410 }
never executed: end of block
else {
0
411 columns += count;-
412 int index = childIndex(0, column);-
413 for (int row = 0; row < rowCount()
row < rowCount()Description
TRUEnever evaluated
FALSEnever evaluated
; ++row) {
0
414 children.insert(index, count, 0);-
415 index += columnCount();-
416 }
never executed: end of block
0
417 }
never executed: end of block
0
418 if (!items.isEmpty()
!items.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
419 int limit = qMin(items.count(), rowCount() * count);-
420 for (int i = 0; i < limit
i < limitDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
421 QStandardItem *item = items.at(i);-
422 if (item
itemDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
423 if (item->d_func()->parent == 0
item->d_func()->parent == 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
424 item->d_func()->setParentAndModel(q, model);-
425 }
never executed: end of block
else {
0
426 QMessageLogger(__FILE__, 477, __PRETTY_FUNCTION__).warning("QStandardItem::insertColumns: Ignoring duplicate insertion of item %p",-
427 item);-
428 item = 0;-
429 }
never executed: end of block
0
430 }-
431 int r = i / count;-
432 int c = column + (i % count);-
433 int index = childIndex(r, c);-
434 children.replace(index, item);-
435 }
never executed: end of block
0
436 }
never executed: end of block
0
437 if (model
modelDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
438 model->d_func()->columnsInserted(q, column, count);
never executed: model->d_func()->columnsInserted(q, column, count);
0
439 return
never executed: return true;
true;
never executed: return true;
0
440}-
441-
442-
443-
444-
445void QStandardItemModelPrivate::itemChanged(QStandardItem *item)-
446{-
447 QStandardItemModel * const q = q_func();-
448 if (item->d_func()->parent == 0
item->d_func()->parent == 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
449-
450 int idx = columnHeaderItems.indexOf(item);-
451 if (idx != -1
idx != -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
452 q->headerDataChanged(Qt::Horizontal, idx, idx);-
453 }
never executed: end of block
else {
0
454 idx = rowHeaderItems.indexOf(item);-
455 if (idx != -1
idx != -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
456 q->headerDataChanged(Qt::Vertical, idx, idx);
never executed: q->headerDataChanged(Qt::Vertical, idx, idx);
0
457 }
never executed: end of block
0
458 } else {-
459-
460 QModelIndex index = q->indexFromItem(item);-
461 q->dataChanged(index, index);-
462 }
never executed: end of block
0
463}-
464-
465-
466-
467-
468void QStandardItemModelPrivate::rowsAboutToBeInserted(QStandardItem *parent,-
469 int start, int end)-
470{-
471 QStandardItemModel * const q = q_func();-
472 QModelIndex index = q->indexFromItem(parent);-
473 q->beginInsertRows(index, start, end);-
474}
never executed: end of block
0
475-
476-
477-
478-
479void QStandardItemModelPrivate::columnsAboutToBeInserted(QStandardItem *parent,-
480 int start, int end)-
481{-
482 QStandardItemModel * const q = q_func();-
483 QModelIndex index = q->indexFromItem(parent);-
484 q->beginInsertColumns(index, start, end);-
485}
never executed: end of block
0
486-
487-
488-
489-
490void QStandardItemModelPrivate::rowsAboutToBeRemoved(QStandardItem *parent,-
491 int start, int end)-
492{-
493 QStandardItemModel * const q = q_func();-
494 QModelIndex index = q->indexFromItem(parent);-
495 q->beginRemoveRows(index, start, end);-
496}
never executed: end of block
0
497-
498-
499-
500-
501void QStandardItemModelPrivate::columnsAboutToBeRemoved(QStandardItem *parent,-
502 int start, int end)-
503{-
504 QStandardItemModel * const q = q_func();-
505 QModelIndex index = q->indexFromItem(parent);-
506 q->beginRemoveColumns(index, start, end);-
507}
never executed: end of block
0
508-
509-
510-
511-
512void QStandardItemModelPrivate::rowsInserted(QStandardItem *parent,-
513 int row, int count)-
514{-
515 QStandardItemModel * const q = q_func();-
516 if (parent == root.data()
parent == root.data()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
517 rowHeaderItems.insert(row, count, 0);
never executed: rowHeaderItems.insert(row, count, 0);
0
518 q->endInsertRows();-
519}
never executed: end of block
0
520-
521-
522-
523-
524void QStandardItemModelPrivate::columnsInserted(QStandardItem *parent,-
525 int column, int count)-
526{-
527 QStandardItemModel * const q = q_func();-
528 if (parent == root.data()
parent == root.data()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
529 columnHeaderItems.insert(column, count, 0);
never executed: columnHeaderItems.insert(column, count, 0);
0
530 q->endInsertColumns();-
531}
never executed: end of block
0
532-
533-
534-
535-
536void QStandardItemModelPrivate::rowsRemoved(QStandardItem *parent,-
537 int row, int count)-
538{-
539 QStandardItemModel * const q = q_func();-
540 if (parent == root.data()
parent == root.data()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
541 for (int i = row; i < row + count
i < row + countDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
542 QStandardItem *oldItem = rowHeaderItems.at(i);-
543 if (oldItem
oldItemDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
544 oldItem->d_func()->setModel(0);
never executed: oldItem->d_func()->setModel(0);
0
545 delete oldItem;-
546 }
never executed: end of block
0
547 rowHeaderItems.remove(row, count);-
548 }
never executed: end of block
0
549 q->endRemoveRows();-
550}
never executed: end of block
0
551-
552-
553-
554-
555void QStandardItemModelPrivate::columnsRemoved(QStandardItem *parent,-
556 int column, int count)-
557{-
558 QStandardItemModel * const q = q_func();-
559 if (parent == root.data()
parent == root.data()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
560 for (int i = column; i < column + count
i < column + countDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
561 QStandardItem *oldItem = columnHeaderItems.at(i);-
562 if (oldItem
oldItemDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
563 oldItem->d_func()->setModel(0);
never executed: oldItem->d_func()->setModel(0);
0
564 delete oldItem;-
565 }
never executed: end of block
0
566 columnHeaderItems.remove(column, count);-
567 }
never executed: end of block
0
568 q->endRemoveColumns();-
569}
never executed: end of block
0
570QStandardItem::QStandardItem()-
571 : d_ptr(new QStandardItemPrivate)-
572{-
573 QStandardItemPrivate * const d = d_func();-
574 d->q_ptr = this;-
575}
never executed: end of block
0
576-
577-
578-
579-
580QStandardItem::QStandardItem(const QString &text)-
581 : d_ptr(new QStandardItemPrivate)-
582{-
583 QStandardItemPrivate * const d = d_func();-
584 d->q_ptr = this;-
585 setText(text);-
586}
never executed: end of block
0
587-
588-
589-
590-
591QStandardItem::QStandardItem(const QIcon &icon, const QString &text)-
592 : d_ptr(new QStandardItemPrivate)-
593{-
594 QStandardItemPrivate * const d = d_func();-
595 d->q_ptr = this;-
596 setIcon(icon);-
597 setText(text);-
598}
never executed: end of block
0
599-
600-
601-
602-
603QStandardItem::QStandardItem(int rows, int columns)-
604 : d_ptr(new QStandardItemPrivate)-
605{-
606 QStandardItemPrivate * const d = d_func();-
607 d->q_ptr = this;-
608 setRowCount(rows);-
609 setColumnCount(columns);-
610}
never executed: end of block
0
611-
612-
613-
614-
615QStandardItem::QStandardItem(QStandardItemPrivate &dd)-
616 : d_ptr(&dd)-
617{-
618 QStandardItemPrivate * const d = d_func();-
619 d->q_ptr = this;-
620}
never executed: end of block
0
621-
622-
623-
624-
625-
626-
627-
628QStandardItem::QStandardItem(const QStandardItem &other)-
629 : d_ptr(new QStandardItemPrivate)-
630{-
631 QStandardItemPrivate * const d = d_func();-
632 d->q_ptr = this;-
633 operator=(other);-
634}
never executed: end of block
0
635-
636-
637-
638-
639-
640-
641-
642QStandardItem &QStandardItem::operator=(const QStandardItem &other)-
643{-
644 QStandardItemPrivate * const d = d_func();-
645 d->values = other.d_func()->values;-
646 return
never executed: return *this;
*this;
never executed: return *this;
0
647}-
648-
649-
650-
651-
652-
653QStandardItem::~QStandardItem()-
654{-
655}-
656QStandardItem *QStandardItem::parent() const-
657{-
658 const QStandardItemPrivate * const d = d_func();-
659 if (!d->model
!d->modelDescription
TRUEnever evaluated
FALSEnever evaluated
|| (
(d->model->d_f... != d->parent)Description
TRUEnever evaluated
FALSEnever evaluated
d->model->d_func()->root.data() != d->parent)
(d->model->d_f... != d->parent)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
660 return
never executed: return d->parent;
d->parent;
never executed: return d->parent;
0
661 return
never executed: return 0;
0;
never executed: return 0;
0
662}-
663void QStandardItem::setData(const QVariant &value, int role)-
664{-
665 QStandardItemPrivate * const d = d_func();-
666 role = (
(role == Qt::EditRole)Description
TRUEnever evaluated
FALSEnever evaluated
role == Qt::EditRole)
(role == Qt::EditRole)Description
TRUEnever evaluated
FALSEnever evaluated
? Qt::DisplayRole : role;
0
667 QVector<QStandardItemData>::iterator it;-
668 for (it = d->values.begin(); it != d->values.end()
it != d->values.end()Description
TRUEnever evaluated
FALSEnever evaluated
; ++it) {
0
669 if ((*
(*it).role == roleDescription
TRUEnever evaluated
FALSEnever evaluated
it).role == role
(*it).role == roleDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
670 if (value.isValid()
value.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
671 if ((*
(*it).value.ty...= value.type()Description
TRUEnever evaluated
FALSEnever evaluated
it).value.type() == value.type()
(*it).value.ty...= value.type()Description
TRUEnever evaluated
FALSEnever evaluated
&& (*
(*it).value == valueDescription
TRUEnever evaluated
FALSEnever evaluated
it).value == value
(*it).value == valueDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
672 return;
never executed: return;
0
673 (*it).value = value;-
674 }
never executed: end of block
else {
0
675 d->values.erase(it);-
676 }
never executed: end of block
0
677 if (d->model
d->modelDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
678 d->model->d_func()->itemChanged(this);
never executed: d->model->d_func()->itemChanged(this);
0
679 return;
never executed: return;
0
680 }-
681 }
never executed: end of block
0
682 d->values.append(QStandardItemData(role, value));-
683 if (d->model
d->modelDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
684 d->model->d_func()->itemChanged(this);
never executed: d->model->d_func()->itemChanged(this);
0
685}
never executed: end of block
0
686QVariant QStandardItem::data(int role) const-
687{-
688 const QStandardItemPrivate * const d = d_func();-
689 role = (
(role == Qt::EditRole)Description
TRUEnever evaluated
FALSEnever evaluated
role == Qt::EditRole)
(role == Qt::EditRole)Description
TRUEnever evaluated
FALSEnever evaluated
? Qt::DisplayRole : role;
0
690 QVector<QStandardItemData>::const_iterator it;-
691 for (it = d->values.begin(); it != d->values.end()
it != d->values.end()Description
TRUEnever evaluated
FALSEnever evaluated
; ++it) {
0
692 if ((*
(*it).role == roleDescription
TRUEnever evaluated
FALSEnever evaluated
it).role == role
(*it).role == roleDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
693 return
never executed: return (*it).value;
(*it).value;
never executed: return (*it).value;
0
694 }
never executed: end of block
0
695 return
never executed: return QVariant();
QVariant();
never executed: return QVariant();
0
696}-
697void QStandardItem::emitDataChanged()-
698{-
699 QStandardItemPrivate * const d = d_func();-
700 if (d->model
d->modelDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
701 d->model->d_func()->itemChanged(this);
never executed: d->model->d_func()->itemChanged(this);
0
702}
never executed: end of block
0
703void QStandardItem::setFlags(Qt::ItemFlags flags)-
704{-
705 setData((int)flags, Qt::UserRole - 1);-
706}
never executed: end of block
0
707Qt::ItemFlags QStandardItem::flags() const-
708{-
709 QVariant v = data(Qt::UserRole - 1);-
710 if (!v.isValid()
!v.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
711 return
never executed: return (Qt::ItemIsSelectable|Qt::ItemIsEnabled|Qt::ItemIsEditable |Qt::ItemIsDragEnabled|Qt::ItemIsDropEnabled);
(Qt::ItemIsSelectable|Qt::ItemIsEnabled|Qt::ItemIsEditable
never executed: return (Qt::ItemIsSelectable|Qt::ItemIsEnabled|Qt::ItemIsEditable |Qt::ItemIsDragEnabled|Qt::ItemIsDropEnabled);
0
712 |Qt::ItemIsDragEnabled|Qt::ItemIsDropEnabled);
never executed: return (Qt::ItemIsSelectable|Qt::ItemIsEnabled|Qt::ItemIsEditable |Qt::ItemIsDragEnabled|Qt::ItemIsDropEnabled);
0
713 return
never executed: return Qt::ItemFlags(v.toInt());
Qt::ItemFlags(v.toInt());
never executed: return Qt::ItemFlags(v.toInt());
0
714}-
715void QStandardItem::setEnabled(bool enabled)-
716{-
717 QStandardItemPrivate * const d = d_func();-
718 d->changeFlags(enabled, Qt::ItemIsEnabled);-
719}
never executed: end of block
0
720void QStandardItem::setEditable(bool editable)-
721{-
722 QStandardItemPrivate * const d = d_func();-
723 d->changeFlags(editable, Qt::ItemIsEditable);-
724}
never executed: end of block
0
725void QStandardItem::setSelectable(bool selectable)-
726{-
727 QStandardItemPrivate * const d = d_func();-
728 d->changeFlags(selectable, Qt::ItemIsSelectable);-
729}
never executed: end of block
0
730void QStandardItem::setCheckable(bool checkable)-
731{-
732 QStandardItemPrivate * const d = d_func();-
733 if (checkable
checkableDescription
TRUEnever evaluated
FALSEnever evaluated
&& !isCheckable()
!isCheckable()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
734-
735 if (!data(Qt::CheckStateRole).isValid()
!data(Qt::Chec...ole).isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
736 setData(Qt::Unchecked, Qt::CheckStateRole);
never executed: setData(Qt::Unchecked, Qt::CheckStateRole);
0
737 }
never executed: end of block
0
738 d->changeFlags(checkable, Qt::ItemIsUserCheckable);-
739}
never executed: end of block
0
740void QStandardItem::setAutoTristate(bool tristate)-
741{-
742 QStandardItemPrivate * const d = d_func();-
743 d->changeFlags(tristate, Qt::ItemIsAutoTristate);-
744}
never executed: end of block
0
745void QStandardItem::setUserTristate(bool tristate)-
746{-
747 QStandardItemPrivate * const d = d_func();-
748 d->changeFlags(tristate, Qt::ItemIsUserTristate);-
749}
never executed: end of block
0
750void QStandardItem::setTristate(bool tristate)-
751{-
752 setAutoTristate(tristate);-
753}
never executed: end of block
0
754void QStandardItem::setDragEnabled(bool dragEnabled)-
755{-
756 QStandardItemPrivate * const d = d_func();-
757 d->changeFlags(dragEnabled, Qt::ItemIsDragEnabled);-
758}
never executed: end of block
0
759void QStandardItem::setDropEnabled(bool dropEnabled)-
760{-
761 QStandardItemPrivate * const d = d_func();-
762 d->changeFlags(dropEnabled, Qt::ItemIsDropEnabled);-
763}
never executed: end of block
0
764int QStandardItem::row() const-
765{-
766 const QStandardItemPrivate * const d = d_func();-
767 QPair<int, int> pos = d->position();-
768 return
never executed: return pos.first;
pos.first;
never executed: return pos.first;
0
769}-
770-
771-
772-
773-
774-
775-
776-
777int QStandardItem::column() const-
778{-
779 const QStandardItemPrivate * const d = d_func();-
780 QPair<int, int> pos = d->position();-
781 return
never executed: return pos.second;
pos.second;
never executed: return pos.second;
0
782}-
783QModelIndex QStandardItem::index() const-
784{-
785 const QStandardItemPrivate * const d = d_func();-
786 return
never executed: return d->model ? d->model->indexFromItem(this) : QModelIndex();
d->model ? d->model->indexFromItem(this) : QModelIndex();
never executed: return d->model ? d->model->indexFromItem(this) : QModelIndex();
0
787}-
788QStandardItemModel *QStandardItem::model() const-
789{-
790 const QStandardItemPrivate * const d = d_func();-
791 return
never executed: return d->model;
d->model;
never executed: return d->model;
0
792}-
793-
794-
795-
796-
797-
798-
799-
800void QStandardItem::setRowCount(int rows)-
801{-
802 int rc = rowCount();-
803 if (rc == rows
rc == rowsDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
804 return;
never executed: return;
0
805 if (rc < rows
rc < rowsDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
806 insertRows(qMax(rc, 0), rows - rc);
never executed: insertRows(qMax(rc, 0), rows - rc);
0
807 else-
808 removeRows(qMax(rows, 0), rc - rows);
never executed: removeRows(qMax(rows, 0), rc - rows);
0
809}-
810-
811-
812-
813-
814-
815-
816int QStandardItem::rowCount() const-
817{-
818 const QStandardItemPrivate * const d = d_func();-
819 return
never executed: return d->rowCount();
d->rowCount();
never executed: return d->rowCount();
0
820}-
821-
822-
823-
824-
825-
826-
827-
828void QStandardItem::setColumnCount(int columns)-
829{-
830 int cc = columnCount();-
831 if (cc == columns
cc == columnsDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
832 return;
never executed: return;
0
833 if (cc < columns
cc < columnsDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
834 insertColumns(qMax(cc, 0), columns - cc);
never executed: insertColumns(qMax(cc, 0), columns - cc);
0
835 else-
836 removeColumns(qMax(columns, 0), cc - columns);
never executed: removeColumns(qMax(columns, 0), cc - columns);
0
837}-
838-
839-
840-
841-
842-
843-
844int QStandardItem::columnCount() const-
845{-
846 const QStandardItemPrivate * const d = d_func();-
847 return
never executed: return d->columnCount();
d->columnCount();
never executed: return d->columnCount();
0
848}-
849-
850-
851-
852-
853-
854-
855-
856void QStandardItem::insertRow(int row, const QList<QStandardItem*> &items)-
857{-
858 QStandardItemPrivate * const d = d_func();-
859 if (row < 0
row < 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
860 return;
never executed: return;
0
861 if (columnCount() < items.count()
columnCount() < items.count()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
862 setColumnCount(items.count());
never executed: setColumnCount(items.count());
0
863 d->insertRows(row, 1, items);-
864}
never executed: end of block
0
865-
866-
867-
868-
869-
870-
871void QStandardItem::insertRows(int row, const QList<QStandardItem*> &items)-
872{-
873 QStandardItemPrivate * const d = d_func();-
874 if (row < 0
row < 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
875 return;
never executed: return;
0
876 d->insertRows(row, items);-
877}
never executed: end of block
0
878-
879-
880-
881-
882-
883-
884-
885void QStandardItem::insertColumn(int column, const QList<QStandardItem*> &items)-
886{-
887 QStandardItemPrivate * const d = d_func();-
888 if (column < 0
column < 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
889 return;
never executed: return;
0
890 if (rowCount() < items.count()
rowCount() < items.count()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
891 setRowCount(items.count());
never executed: setRowCount(items.count());
0
892 d->insertColumns(column, 1, items);-
893}
never executed: end of block
0
894-
895-
896-
897-
898-
899-
900void QStandardItem::insertRows(int row, int count)-
901{-
902 QStandardItemPrivate * const d = d_func();-
903 if (rowCount() < row
rowCount() < rowDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
904 count += row - rowCount();-
905 row = rowCount();-
906 }
never executed: end of block
0
907 d->insertRows(row, count, QList<QStandardItem*>());-
908}
never executed: end of block
0
909-
910-
911-
912-
913-
914-
915void QStandardItem::insertColumns(int column, int count)-
916{-
917 QStandardItemPrivate * const d = d_func();-
918 if (columnCount() < column
columnCount() < columnDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
919 count += column - columnCount();-
920 column = columnCount();-
921 }
never executed: end of block
0
922 d->insertColumns(column, count, QList<QStandardItem*>());-
923}
never executed: end of block
0
924void QStandardItem::removeRow(int row)-
925{-
926 removeRows(row, 1);-
927}
never executed: end of block
0
928-
929-
930-
931-
932-
933-
934-
935void QStandardItem::removeColumn(int column)-
936{-
937 removeColumns(column, 1);-
938}
never executed: end of block
0
939-
940-
941-
942-
943-
944-
945-
946void QStandardItem::removeRows(int row, int count)-
947{-
948 QStandardItemPrivate * const d = d_func();-
949 if ((
(count < 1)Description
TRUEnever evaluated
FALSEnever evaluated
count < 1)
(count < 1)Description
TRUEnever evaluated
FALSEnever evaluated
|| (
(row < 0)Description
TRUEnever evaluated
FALSEnever evaluated
row < 0)
(row < 0)Description
TRUEnever evaluated
FALSEnever evaluated
|| ((
((row + count) > rowCount())Description
TRUEnever evaluated
FALSEnever evaluated
row + count) > rowCount())
((row + count) > rowCount())Description
TRUEnever evaluated
FALSEnever evaluated
)
0
950 return;
never executed: return;
0
951 if (d->model
d->modelDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
952 d->model->d_func()->rowsAboutToBeRemoved(this, row, row + count - 1);
never executed: d->model->d_func()->rowsAboutToBeRemoved(this, row, row + count - 1);
0
953 int i = d->childIndex(row, 0);-
954 int n = count * d->columnCount();-
955 for (int j = i; j < n+i
j < n+iDescription
TRUEnever evaluated
FALSEnever evaluated
; ++j) {
0
956 QStandardItem *oldItem = d->children.at(j);-
957 if (oldItem
oldItemDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
958 oldItem->d_func()->setModel(0);
never executed: oldItem->d_func()->setModel(0);
0
959 delete oldItem;-
960 }
never executed: end of block
0
961 d->children.remove(qMax(i, 0), n);-
962 d->rows -= count;-
963 if (d->model
d->modelDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
964 d->model->d_func()->rowsRemoved(this, row, count);
never executed: d->model->d_func()->rowsRemoved(this, row, count);
0
965}
never executed: end of block
0
966-
967-
968-
969-
970-
971-
972-
973void QStandardItem::removeColumns(int column, int count)-
974{-
975 QStandardItemPrivate * const d = d_func();-
976 if ((
(count < 1)Description
TRUEnever evaluated
FALSEnever evaluated
count < 1)
(count < 1)Description
TRUEnever evaluated
FALSEnever evaluated
|| (
(column < 0)Description
TRUEnever evaluated
FALSEnever evaluated
column < 0)
(column < 0)Description
TRUEnever evaluated
FALSEnever evaluated
|| ((
((column + cou...columnCount())Description
TRUEnever evaluated
FALSEnever evaluated
column + count) > columnCount())
((column + cou...columnCount())Description
TRUEnever evaluated
FALSEnever evaluated
)
0
977 return;
never executed: return;
0
978 if (d->model
d->modelDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
979 d->model->d_func()->columnsAboutToBeRemoved(this, column, column + count - 1);
never executed: d->model->d_func()->columnsAboutToBeRemoved(this, column, column + count - 1);
0
980 for (int row = d->rowCount() - 1; row >= 0
row >= 0Description
TRUEnever evaluated
FALSEnever evaluated
; --row) {
0
981 int i = d->childIndex(row, column);-
982 for (int j=i; j<i+count
j<i+countDescription
TRUEnever evaluated
FALSEnever evaluated
; ++j) {
0
983 QStandardItem *oldItem = d->children.at(j);-
984 if (oldItem
oldItemDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
985 oldItem->d_func()->setModel(0);
never executed: oldItem->d_func()->setModel(0);
0
986 delete oldItem;-
987 }
never executed: end of block
0
988 d->children.remove(i, count);-
989 }
never executed: end of block
0
990 d->columns -= count;-
991 if (d->model
d->modelDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
992 d->model->d_func()->columnsRemoved(this, column, count);
never executed: d->model->d_func()->columnsRemoved(this, column, count);
0
993}
never executed: end of block
0
994-
995-
996-
997-
998-
999-
1000bool QStandardItem::hasChildren() const-
1001{-
1002 return
never executed: return (rowCount() > 0) && (columnCount() > 0);
(rowCount() > 0) && (columnCount() > 0);
never executed: return (rowCount() > 0) && (columnCount() > 0);
0
1003}-
1004void QStandardItem::setChild(int row, int column, QStandardItem *item)-
1005{-
1006 QStandardItemPrivate * const d = d_func();-
1007 d->setChild(row, column, item, true);-
1008}
never executed: end of block
0
1009QStandardItem *QStandardItem::child(int row, int column) const-
1010{-
1011 const QStandardItemPrivate * const d = d_func();-
1012 int index = d->childIndex(row, column);-
1013 if (index == -1
index == -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1014 return
never executed: return 0;
0;
never executed: return 0;
0
1015 return
never executed: return d->children.at(index);
d->children.at(index);
never executed: return d->children.at(index);
0
1016}-
1017QStandardItem *QStandardItem::takeChild(int row, int column)-
1018{-
1019 QStandardItemPrivate * const d = d_func();-
1020 QStandardItem *item = 0;-
1021 int index = d->childIndex(row, column);-
1022 if (index != -1
index != -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1023 item = d->children.at(index);-
1024 if (item
itemDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1025 item->d_func()->setParentAndModel(0, 0);
never executed: item->d_func()->setParentAndModel(0, 0);
0
1026 d->children.replace(index, 0);-
1027 }
never executed: end of block
0
1028 return
never executed: return item;
item;
never executed: return item;
0
1029}-
1030QList<QStandardItem*> QStandardItem::takeRow(int row)-
1031{-
1032 QStandardItemPrivate * const d = d_func();-
1033 QList<QStandardItem*> items;-
1034 if ((
(row < 0)Description
TRUEnever evaluated
FALSEnever evaluated
row < 0)
(row < 0)Description
TRUEnever evaluated
FALSEnever evaluated
|| (
(row >= rowCount())Description
TRUEnever evaluated
FALSEnever evaluated
row >= rowCount())
(row >= rowCount())Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1035 return
never executed: return items;
items;
never executed: return items;
0
1036 if (d->model
d->modelDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1037 d->model->d_func()->rowsAboutToBeRemoved(this, row, row);
never executed: d->model->d_func()->rowsAboutToBeRemoved(this, row, row);
0
1038-
1039 int index = d->childIndex(row, 0);-
1040 if (index != -1
index != -1Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1041 int col_count = d->columnCount();-
1042 items.reserve(col_count);-
1043 for (int column = 0; column < col_count
column < col_countDescription
TRUEnever evaluated
FALSEnever evaluated
; ++column) {
0
1044 QStandardItem *ch = d->children.at(index + column);-
1045 if (ch
chDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1046 ch->d_func()->setParentAndModel(0, 0);
never executed: ch->d_func()->setParentAndModel(0, 0);
0
1047 items.append(ch);-
1048 }
never executed: end of block
0
1049 d->children.remove(index, col_count);-
1050 }
never executed: end of block
0
1051 d->rows--;-
1052 if (d->model
d->modelDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1053 d->model->d_func()->rowsRemoved(this, row, 1);
never executed: d->model->d_func()->rowsRemoved(this, row, 1);
0
1054 return
never executed: return items;
items;
never executed: return items;
0
1055}-
1056QList<QStandardItem*> QStandardItem::takeColumn(int column)-
1057{-
1058 QStandardItemPrivate * const d = d_func();-
1059 QList<QStandardItem*> items;-
1060 if ((
(column < 0)Description
TRUEnever evaluated
FALSEnever evaluated
column < 0)
(column < 0)Description
TRUEnever evaluated
FALSEnever evaluated
|| (
(column >= columnCount())Description
TRUEnever evaluated
FALSEnever evaluated
column >= columnCount())
(column >= columnCount())Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1061 return
never executed: return items;
items;
never executed: return items;
0
1062 if (d->model
d->modelDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1063 d->model->d_func()->columnsAboutToBeRemoved(this, column, column);
never executed: d->model->d_func()->columnsAboutToBeRemoved(this, column, column);
0
1064-
1065 const int rowCount = d->rowCount();-
1066 items.reserve(rowCount);-
1067 for (int row = rowCount - 1; row >= 0
row >= 0Description
TRUEnever evaluated
FALSEnever evaluated
; --row) {
0
1068 int index = d->childIndex(row, column);-
1069 QStandardItem *ch = d->children.at(index);-
1070 if (ch
chDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1071 ch->d_func()->setParentAndModel(0, 0);
never executed: ch->d_func()->setParentAndModel(0, 0);
0
1072 d->children.remove(index);-
1073 items.prepend(ch);-
1074 }
never executed: end of block
0
1075 d->columns--;-
1076 if (d->model
d->modelDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1077 d->model->d_func()->columnsRemoved(this, column, 1);
never executed: d->model->d_func()->columnsRemoved(this, column, 1);
0
1078 return
never executed: return items;
items;
never executed: return items;
0
1079}-
1080bool QStandardItem::operator<(const QStandardItem &other) const-
1081{-
1082 const int role = model()
model()Description
TRUEnever evaluated
FALSEnever evaluated
? model()->sortRole() : Qt::DisplayRole;
0
1083 const QVariant l = data(role), r = other.data(role);-
1084-
1085 if (l.userType() == QVariant::Invalid
l.userType() =...riant::InvalidDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1086 return
never executed: return false;
false;
never executed: return false;
0
1087 if (r.userType() == QVariant::Invalid
r.userType() =...riant::InvalidDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1088 return
never executed: return true;
true;
never executed: return true;
0
1089 switch (l.userType()) {-
1090 case
never executed: case QVariant::Int:
QVariant::Int:
never executed: case QVariant::Int:
0
1091 return
never executed: return l.toInt() < r.toInt();
l.toInt() < r.toInt();
never executed: return l.toInt() < r.toInt();
0
1092 case
never executed: case QVariant::UInt:
QVariant::UInt:
never executed: case QVariant::UInt:
0
1093 return
never executed: return l.toUInt() < r.toUInt();
l.toUInt() < r.toUInt();
never executed: return l.toUInt() < r.toUInt();
0
1094 case
never executed: case QVariant::LongLong:
QVariant::LongLong:
never executed: case QVariant::LongLong:
0
1095 return
never executed: return l.toLongLong() < r.toLongLong();
l.toLongLong() < r.toLongLong();
never executed: return l.toLongLong() < r.toLongLong();
0
1096 case
never executed: case QVariant::ULongLong:
QVariant::ULongLong:
never executed: case QVariant::ULongLong:
0
1097 return
never executed: return l.toULongLong() < r.toULongLong();
l.toULongLong() < r.toULongLong();
never executed: return l.toULongLong() < r.toULongLong();
0
1098 case
never executed: case QMetaType::Float:
QMetaType::Float:
never executed: case QMetaType::Float:
0
1099 return
never executed: return l.toFloat() < r.toFloat();
l.toFloat() < r.toFloat();
never executed: return l.toFloat() < r.toFloat();
0
1100 case
never executed: case QVariant::Double:
QVariant::Double:
never executed: case QVariant::Double:
0
1101 return
never executed: return l.toDouble() < r.toDouble();
l.toDouble() < r.toDouble();
never executed: return l.toDouble() < r.toDouble();
0
1102 case
never executed: case QVariant::Char:
QVariant::Char:
never executed: case QVariant::Char:
0
1103 return
never executed: return l.toChar() < r.toChar();
l.toChar() < r.toChar();
never executed: return l.toChar() < r.toChar();
0
1104 case
never executed: case QVariant::Date:
QVariant::Date:
never executed: case QVariant::Date:
0
1105 return
never executed: return l.toDate() < r.toDate();
l.toDate() < r.toDate();
never executed: return l.toDate() < r.toDate();
0
1106 case
never executed: case QVariant::Time:
QVariant::Time:
never executed: case QVariant::Time:
0
1107 return
never executed: return l.toTime() < r.toTime();
l.toTime() < r.toTime();
never executed: return l.toTime() < r.toTime();
0
1108 case
never executed: case QVariant::DateTime:
QVariant::DateTime:
never executed: case QVariant::DateTime:
0
1109 return
never executed: return l.toDateTime() < r.toDateTime();
l.toDateTime() < r.toDateTime();
never executed: return l.toDateTime() < r.toDateTime();
0
1110 case
never executed: case QVariant::String:
QVariant::String:
never executed: case QVariant::String:
0
1111 default
never executed: default:
:
never executed: default:
0
1112 return
never executed: return l.toString().compare(r.toString()) < 0;
l.toString().compare(r.toString()) < 0;
never executed: return l.toString().compare(r.toString()) < 0;
0
1113 }-
1114}-
1115void QStandardItem::sortChildren(int column, Qt::SortOrder order)-
1116{-
1117 QStandardItemPrivate * const d = d_func();-
1118 if ((
(column < 0)Description
TRUEnever evaluated
FALSEnever evaluated
column < 0)
(column < 0)Description
TRUEnever evaluated
FALSEnever evaluated
|| (
(rowCount() == 0)Description
TRUEnever evaluated
FALSEnever evaluated
rowCount() == 0)
(rowCount() == 0)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1119 return;
never executed: return;
0
1120-
1121 QList<QPersistentModelIndex> parents;-
1122 if (d->model
d->modelDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1123 parents << index();-
1124 d->model->layoutAboutToBeChanged(parents, QAbstractItemModel::VerticalSortHint);-
1125 }
never executed: end of block
0
1126 d->sortChildren(column, order);-
1127 if (d->model
d->modelDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1128 d->model->layoutChanged(parents, QAbstractItemModel::VerticalSortHint);
never executed: d->model->layoutChanged(parents, QAbstractItemModel::VerticalSortHint);
0
1129}
never executed: end of block
0
1130QStandardItem *QStandardItem::clone() const-
1131{-
1132 return
never executed: return new QStandardItem(*this);
new QStandardItem(*this);
never executed: return new QStandardItem(*this);
0
1133}-
1134int QStandardItem::type() const-
1135{-
1136 return
never executed: return Type;
Type;
never executed: return Type;
0
1137}-
1138void QStandardItem::read(QDataStream &in)-
1139{-
1140 QStandardItemPrivate * const d = d_func();-
1141 in >> d->values;-
1142 qint32 flags;-
1143 in >> flags;-
1144 setFlags(Qt::ItemFlags(flags));-
1145}
never executed: end of block
0
1146-
1147-
1148-
1149-
1150-
1151-
1152-
1153void QStandardItem::write(QDataStream &out) const-
1154{-
1155 const QStandardItemPrivate * const d = d_func();-
1156 out << d->values;-
1157 out << flags();-
1158}
never executed: end of block
0
1159QDataStream &operator>>(QDataStream &in, QStandardItem &item)-
1160{-
1161 item.read(in);-
1162 return
never executed: return in;
in;
never executed: return in;
0
1163}-
1164QDataStream &operator<<(QDataStream &out, const QStandardItem &item)-
1165{-
1166 item.write(out);-
1167 return
never executed: return out;
out;
never executed: return out;
0
1168}-
1169QStandardItemModel::QStandardItemModel(QObject *parent)-
1170 : QAbstractItemModel(*new QStandardItemModelPrivate, parent)-
1171{-
1172 QStandardItemModelPrivate * const d = d_func();-
1173 d->init();-
1174 d->root->d_func()->setModel(this);-
1175}
never executed: end of block
0
1176-
1177-
1178-
1179-
1180-
1181QStandardItemModel::QStandardItemModel(int rows, int columns, QObject *parent)-
1182 : QAbstractItemModel(*new QStandardItemModelPrivate, parent)-
1183{-
1184 QStandardItemModelPrivate * const d = d_func();-
1185 d->init();-
1186 d->root->insertColumns(0, columns);-
1187 d->columnHeaderItems.insert(0, columns, 0);-
1188 d->root->insertRows(0, rows);-
1189 d->rowHeaderItems.insert(0, rows, 0);-
1190 d->root->d_func()->setModel(this);-
1191}
never executed: end of block
0
1192-
1193-
1194-
1195-
1196QStandardItemModel::QStandardItemModel(QStandardItemModelPrivate &dd, QObject *parent)-
1197 : QAbstractItemModel(dd, parent)-
1198{-
1199 QStandardItemModelPrivate * const d = d_func();-
1200 d->init();-
1201}
never executed: end of block
0
1202-
1203-
1204-
1205-
1206QStandardItemModel::~QStandardItemModel()-
1207{-
1208}-
1209-
1210-
1211-
1212-
1213void QStandardItemModel::setItemRoleNames(const QHash<int,QByteArray> &roleNames)-
1214{-
1215 QStandardItemModelPrivate * const d = d_func();-
1216 d->roleNames = roleNames;-
1217}
never executed: end of block
0
1218-
1219-
1220-
1221-
1222-
1223-
1224-
1225void QStandardItemModel::clear()-
1226{-
1227 QStandardItemModelPrivate * const d = d_func();-
1228 beginResetModel();-
1229 d->root.reset(new QStandardItem);-
1230 d->root->setFlags(Qt::ItemIsDropEnabled);-
1231 d->root->d_func()->setModel(this);-
1232 qDeleteAll(d->columnHeaderItems);-
1233 d->columnHeaderItems.clear();-
1234 qDeleteAll(d->rowHeaderItems);-
1235 d->rowHeaderItems.clear();-
1236 endResetModel();-
1237}
never executed: end of block
0
1238QStandardItem *QStandardItemModel::itemFromIndex(const QModelIndex &index) const-
1239{-
1240 const QStandardItemModelPrivate * const d = d_func();-
1241 if ((
(index.row() < 0)Description
TRUEnever evaluated
FALSEnever evaluated
index.row() < 0)
(index.row() < 0)Description
TRUEnever evaluated
FALSEnever evaluated
|| (
(index.column() < 0)Description
TRUEnever evaluated
FALSEnever evaluated
index.column() < 0)
(index.column() < 0)Description
TRUEnever evaluated
FALSEnever evaluated
|| (
(index.model() != this)Description
TRUEnever evaluated
FALSEnever evaluated
index.model() != this)
(index.model() != this)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1242 return
never executed: return 0;
0;
never executed: return 0;
0
1243 QStandardItem *parent = static_cast<QStandardItem*>(index.internalPointer());-
1244 if (parent == 0
parent == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1245 return
never executed: return 0;
0;
never executed: return 0;
0
1246 QStandardItem *item = parent->child(index.row(), index.column());-
1247-
1248 if (item == 0
item == 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1249 item = d->createItem();-
1250 parent->d_func()->setChild(index.row(), index.column(), item);-
1251 }
never executed: end of block
0
1252 return
never executed: return item;
item;
never executed: return item;
0
1253}-
1254QModelIndex QStandardItemModel::indexFromItem(const QStandardItem *item) const-
1255{-
1256 if (item
itemDescription
TRUEnever evaluated
FALSEnever evaluated
&& item->d_func()->parent
item->d_func()->parentDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1257 QPair<int, int> pos = item->d_func()->position();-
1258 return
never executed: return createIndex(pos.first, pos.second, item->d_func()->parent);
createIndex(pos.first, pos.second, item->d_func()->parent);
never executed: return createIndex(pos.first, pos.second, item->d_func()->parent);
0
1259 }-
1260 return
never executed: return QModelIndex();
QModelIndex();
never executed: return QModelIndex();
0
1261}-
1262void QStandardItemModel::setRowCount(int rows)-
1263{-
1264 QStandardItemModelPrivate * const d = d_func();-
1265 d->root->setRowCount(rows);-
1266}
never executed: end of block
0
1267void QStandardItemModel::setColumnCount(int columns)-
1268{-
1269 QStandardItemModelPrivate * const d = d_func();-
1270 d->root->setColumnCount(columns);-
1271}
never executed: end of block
0
1272void QStandardItemModel::setItem(int row, int column, QStandardItem *item)-
1273{-
1274 QStandardItemModelPrivate * const d = d_func();-
1275 d->root->d_func()->setChild(row, column, item, true);-
1276}
never executed: end of block
0
1277QStandardItem *QStandardItemModel::item(int row, int column) const-
1278{-
1279 const QStandardItemModelPrivate * const d = d_func();-
1280 return
never executed: return d->root->child(row, column);
d->root->child(row, column);
never executed: return d->root->child(row, column);
0
1281}-
1282QStandardItem *QStandardItemModel::invisibleRootItem() const-
1283{-
1284 const QStandardItemModelPrivate * const d = d_func();-
1285 return
never executed: return d->root.data();
d->root.data();
never executed: return d->root.data();
0
1286}-
1287void QStandardItemModel::setHorizontalHeaderItem(int column, QStandardItem *item)-
1288{-
1289 QStandardItemModelPrivate * const d = d_func();-
1290 if (column < 0
column < 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1291 return;
never executed: return;
0
1292 if (columnCount() <= column
columnCount() <= columnDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1293 setColumnCount(column + 1);
never executed: setColumnCount(column + 1);
0
1294-
1295 QStandardItem *oldItem = d->columnHeaderItems.at(column);-
1296 if (item == oldItem
item == oldItemDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1297 return;
never executed: return;
0
1298-
1299 if (item
itemDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1300 if (item->model() == 0
item->model() == 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1301 item->d_func()->setModel(this);-
1302 }
never executed: end of block
else {
0
1303 QMessageLogger(__FILE__, 2355, __PRETTY_FUNCTION__).warning("QStandardItem::setHorizontalHeaderItem: Ignoring duplicate insertion of item %p",-
1304 item);-
1305 return;
never executed: return;
0
1306 }-
1307 }-
1308-
1309 if (oldItem
oldItemDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1310 oldItem->d_func()->setModel(0);
never executed: oldItem->d_func()->setModel(0);
0
1311 delete oldItem;-
1312-
1313 d->columnHeaderItems.replace(column, item);-
1314 headerDataChanged(Qt::Horizontal, column, column);-
1315}
never executed: end of block
0
1316QStandardItem *QStandardItemModel::horizontalHeaderItem(int column) const-
1317{-
1318 const QStandardItemModelPrivate * const d = d_func();-
1319 if ((
(column < 0)Description
TRUEnever evaluated
FALSEnever evaluated
column < 0)
(column < 0)Description
TRUEnever evaluated
FALSEnever evaluated
|| (
(column >= columnCount())Description
TRUEnever evaluated
FALSEnever evaluated
column >= columnCount())
(column >= columnCount())Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1320 return
never executed: return 0;
0;
never executed: return 0;
0
1321 return
never executed: return d->columnHeaderItems.at(column);
d->columnHeaderItems.at(column);
never executed: return d->columnHeaderItems.at(column);
0
1322}-
1323void QStandardItemModel::setVerticalHeaderItem(int row, QStandardItem *item)-
1324{-
1325 QStandardItemModelPrivate * const d = d_func();-
1326 if (row < 0
row < 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1327 return;
never executed: return;
0
1328 if (rowCount() <= row
rowCount() <= rowDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1329 setRowCount(row + 1);
never executed: setRowCount(row + 1);
0
1330-
1331 QStandardItem *oldItem = d->rowHeaderItems.at(row);-
1332 if (item == oldItem
item == oldItemDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1333 return;
never executed: return;
0
1334-
1335 if (item
itemDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1336 if (item->model() == 0
item->model() == 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1337 item->d_func()->setModel(this);-
1338 }
never executed: end of block
else {
0
1339 QMessageLogger(__FILE__, 2411, __PRETTY_FUNCTION__).warning("QStandardItem::setVerticalHeaderItem: Ignoring duplicate insertion of item %p",-
1340 item);-
1341 return;
never executed: return;
0
1342 }-
1343 }-
1344-
1345 if (oldItem
oldItemDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1346 oldItem->d_func()->setModel(0);
never executed: oldItem->d_func()->setModel(0);
0
1347 delete oldItem;-
1348-
1349 d->rowHeaderItems.replace(row, item);-
1350 headerDataChanged(Qt::Vertical, row, row);-
1351}
never executed: end of block
0
1352QStandardItem *QStandardItemModel::verticalHeaderItem(int row) const-
1353{-
1354 const QStandardItemModelPrivate * const d = d_func();-
1355 if ((
(row < 0)Description
TRUEnever evaluated
FALSEnever evaluated
row < 0)
(row < 0)Description
TRUEnever evaluated
FALSEnever evaluated
|| (
(row >= rowCount())Description
TRUEnever evaluated
FALSEnever evaluated
row >= rowCount())
(row >= rowCount())Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1356 return
never executed: return 0;
0;
never executed: return 0;
0
1357 return
never executed: return d->rowHeaderItems.at(row);
d->rowHeaderItems.at(row);
never executed: return d->rowHeaderItems.at(row);
0
1358}-
1359void QStandardItemModel::setHorizontalHeaderLabels(const QStringList &labels)-
1360{-
1361 QStandardItemModelPrivate * const d = d_func();-
1362 if (columnCount() < labels.count()
columnCount() < labels.count()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1363 setColumnCount(labels.count());
never executed: setColumnCount(labels.count());
0
1364 for (int i = 0; i < labels.count()
i < labels.count()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
1365 QStandardItem *item = horizontalHeaderItem(i);-
1366 if (!item
!itemDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1367 item = d->createItem();-
1368 setHorizontalHeaderItem(i, item);-
1369 }
never executed: end of block
0
1370 item->setText(labels.at(i));-
1371 }
never executed: end of block
0
1372}
never executed: end of block
0
1373void QStandardItemModel::setVerticalHeaderLabels(const QStringList &labels)-
1374{-
1375 QStandardItemModelPrivate * const d = d_func();-
1376 if (rowCount() < labels.count()
rowCount() < labels.count()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1377 setRowCount(labels.count());
never executed: setRowCount(labels.count());
0
1378 for (int i = 0; i < labels.count()
i < labels.count()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
1379 QStandardItem *item = verticalHeaderItem(i);-
1380 if (!item
!itemDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1381 item = d->createItem();-
1382 setVerticalHeaderItem(i, item);-
1383 }
never executed: end of block
0
1384 item->setText(labels.at(i));-
1385 }
never executed: end of block
0
1386}
never executed: end of block
0
1387void QStandardItemModel::setItemPrototype(const QStandardItem *item)-
1388{-
1389 QStandardItemModelPrivate * const d = d_func();-
1390 if (d->itemPrototype != item
d->itemPrototype != itemDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1391 delete d->itemPrototype;-
1392 d->itemPrototype = item;-
1393 }
never executed: end of block
0
1394}
never executed: end of block
0
1395const QStandardItem *QStandardItemModel::itemPrototype() const-
1396{-
1397 const QStandardItemModelPrivate * const d = d_func();-
1398 return
never executed: return d->itemPrototype;
d->itemPrototype;
never executed: return d->itemPrototype;
0
1399}-
1400-
1401-
1402-
1403-
1404-
1405-
1406-
1407QList<QStandardItem*> QStandardItemModel::findItems(const QString &text,-
1408 Qt::MatchFlags flags, int column) const-
1409{-
1410 QModelIndexList indexes = match(index(0, column, QModelIndex()),-
1411 Qt::DisplayRole, text, -1, flags);-
1412 QList<QStandardItem*> items;-
1413 const int numIndexes = indexes.size();-
1414 items.reserve(numIndexes);-
1415 for (int i = 0; i < numIndexes
i < numIndexesDescription
TRUEnever evaluated
FALSEnever evaluated
; ++i)
0
1416 items.append(itemFromIndex(indexes.at(i)));
never executed: items.append(itemFromIndex(indexes.at(i)));
0
1417 return
never executed: return items;
items;
never executed: return items;
0
1418}-
1419void QStandardItemModel::appendRow(const QList<QStandardItem*> &items)-
1420{-
1421 invisibleRootItem()->appendRow(items);-
1422}
never executed: end of block
0
1423void QStandardItemModel::appendColumn(const QList<QStandardItem*> &items)-
1424{-
1425 invisibleRootItem()->appendColumn(items);-
1426}
never executed: end of block
0
1427void QStandardItemModel::insertRow(int row, const QList<QStandardItem*> &items)-
1428{-
1429 invisibleRootItem()->insertRow(row, items);-
1430}
never executed: end of block
0
1431void QStandardItemModel::insertColumn(int column, const QList<QStandardItem*> &items)-
1432{-
1433 invisibleRootItem()->insertColumn(column, items);-
1434}
never executed: end of block
0
1435QStandardItem *QStandardItemModel::takeItem(int row, int column)-
1436{-
1437 QStandardItemModelPrivate * const d = d_func();-
1438 return
never executed: return d->root->takeChild(row, column);
d->root->takeChild(row, column);
never executed: return d->root->takeChild(row, column);
0
1439}-
1440QList<QStandardItem*> QStandardItemModel::takeRow(int row)-
1441{-
1442 QStandardItemModelPrivate * const d = d_func();-
1443 return
never executed: return d->root->takeRow(row);
d->root->takeRow(row);
never executed: return d->root->takeRow(row);
0
1444}-
1445QList<QStandardItem*> QStandardItemModel::takeColumn(int column)-
1446{-
1447 QStandardItemModelPrivate * const d = d_func();-
1448 return
never executed: return d->root->takeColumn(column);
d->root->takeColumn(column);
never executed: return d->root->takeColumn(column);
0
1449}-
1450QStandardItem *QStandardItemModel::takeHorizontalHeaderItem(int column)-
1451{-
1452 QStandardItemModelPrivate * const d = d_func();-
1453 if ((
(column < 0)Description
TRUEnever evaluated
FALSEnever evaluated
column < 0)
(column < 0)Description
TRUEnever evaluated
FALSEnever evaluated
|| (
(column >= columnCount())Description
TRUEnever evaluated
FALSEnever evaluated
column >= columnCount())
(column >= columnCount())Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1454 return
never executed: return 0;
0;
never executed: return 0;
0
1455 QStandardItem *headerItem = d->columnHeaderItems.at(column);-
1456 if (headerItem
headerItemDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1457 headerItem->d_func()->setParentAndModel(0, 0);-
1458 d->columnHeaderItems.replace(column, 0);-
1459 }
never executed: end of block
0
1460 return
never executed: return headerItem;
headerItem;
never executed: return headerItem;
0
1461}-
1462QStandardItem *QStandardItemModel::takeVerticalHeaderItem(int row)-
1463{-
1464 QStandardItemModelPrivate * const d = d_func();-
1465 if ((
(row < 0)Description
TRUEnever evaluated
FALSEnever evaluated
row < 0)
(row < 0)Description
TRUEnever evaluated
FALSEnever evaluated
|| (
(row >= rowCount())Description
TRUEnever evaluated
FALSEnever evaluated
row >= rowCount())
(row >= rowCount())Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1466 return
never executed: return 0;
0;
never executed: return 0;
0
1467 QStandardItem *headerItem = d->rowHeaderItems.at(row);-
1468 if (headerItem
headerItemDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1469 headerItem->d_func()->setParentAndModel(0, 0);-
1470 d->rowHeaderItems.replace(row, 0);-
1471 }
never executed: end of block
0
1472 return
never executed: return headerItem;
headerItem;
never executed: return headerItem;
0
1473}-
1474int QStandardItemModel::sortRole() const-
1475{-
1476 const QStandardItemModelPrivate * const d = d_func();-
1477 return
never executed: return d->sortRole;
d->sortRole;
never executed: return d->sortRole;
0
1478}-
1479-
1480void QStandardItemModel::setSortRole(int role)-
1481{-
1482 QStandardItemModelPrivate * const d = d_func();-
1483 d->sortRole = role;-
1484}
never executed: end of block
0
1485-
1486-
1487-
1488-
1489int QStandardItemModel::columnCount(const QModelIndex &parent) const-
1490{-
1491 const QStandardItemModelPrivate * const d = d_func();-
1492 QStandardItem *item = d->itemFromIndex(parent);-
1493 return
never executed: return item ? item->columnCount() : 0;
item ? item->columnCount() : 0;
never executed: return item ? item->columnCount() : 0;
0
1494}-
1495-
1496-
1497-
1498-
1499QVariant QStandardItemModel::data(const QModelIndex &index, int role) const-
1500{-
1501 const QStandardItemModelPrivate * const d = d_func();-
1502 QStandardItem *item = d->itemFromIndex(index);-
1503 return
never executed: return item ? item->data(role) : QVariant();
item ? item->data(role) : QVariant();
never executed: return item ? item->data(role) : QVariant();
0
1504}-
1505-
1506-
1507-
1508-
1509Qt::ItemFlags QStandardItemModel::flags(const QModelIndex &index) const-
1510{-
1511 const QStandardItemModelPrivate * const d = d_func();-
1512 if (!d->indexValid(index)
!d->indexValid(index)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1513 return
never executed: return d->root->flags();
d->root->flags();
never executed: return d->root->flags();
0
1514 QStandardItem *item = d->itemFromIndex(index);-
1515 if (item
itemDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1516 return
never executed: return item->flags();
item->flags();
never executed: return item->flags();
0
1517 return
never executed: return Qt::ItemIsSelectable |Qt::ItemIsEnabled |Qt::ItemIsEditable |Qt::ItemIsDragEnabled |Qt::ItemIsDropEnabled;
Qt::ItemIsSelectable
never executed: return Qt::ItemIsSelectable |Qt::ItemIsEnabled |Qt::ItemIsEditable |Qt::ItemIsDragEnabled |Qt::ItemIsDropEnabled;
0
1518 |Qt::ItemIsEnabled
never executed: return Qt::ItemIsSelectable |Qt::ItemIsEnabled |Qt::ItemIsEditable |Qt::ItemIsDragEnabled |Qt::ItemIsDropEnabled;
0
1519 |Qt::ItemIsEditable
never executed: return Qt::ItemIsSelectable |Qt::ItemIsEnabled |Qt::ItemIsEditable |Qt::ItemIsDragEnabled |Qt::ItemIsDropEnabled;
0
1520 |Qt::ItemIsDragEnabled
never executed: return Qt::ItemIsSelectable |Qt::ItemIsEnabled |Qt::ItemIsEditable |Qt::ItemIsDragEnabled |Qt::ItemIsDropEnabled;
0
1521 |Qt::ItemIsDropEnabled;
never executed: return Qt::ItemIsSelectable |Qt::ItemIsEnabled |Qt::ItemIsEditable |Qt::ItemIsDragEnabled |Qt::ItemIsDropEnabled;
0
1522}-
1523-
1524-
1525-
1526-
1527bool QStandardItemModel::hasChildren(const QModelIndex &parent) const-
1528{-
1529 const QStandardItemModelPrivate * const d = d_func();-
1530 QStandardItem *item = d->itemFromIndex(parent);-
1531 return
never executed: return item ? item->hasChildren() : false;
item ? item->hasChildren() : false;
never executed: return item ? item->hasChildren() : false;
0
1532}-
1533-
1534-
1535-
1536-
1537QModelIndex QStandardItemModel::sibling(int row, int column, const QModelIndex &idx) const-
1538{-
1539 return
never executed: return QAbstractItemModel::sibling(row, column, idx);
QAbstractItemModel::sibling(row, column, idx);
never executed: return QAbstractItemModel::sibling(row, column, idx);
0
1540}-
1541-
1542-
1543-
1544-
1545QVariant QStandardItemModel::headerData(int section, Qt::Orientation orientation, int role) const-
1546{-
1547 const QStandardItemModelPrivate * const d = d_func();-
1548 if ((
(section < 0)Description
TRUEnever evaluated
FALSEnever evaluated
section < 0)
(section < 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1549 || ((
(orientation =...t::Horizontal)Description
TRUEnever evaluated
FALSEnever evaluated
orientation == Qt::Horizontal)
(orientation =...t::Horizontal)Description
TRUEnever evaluated
FALSEnever evaluated
&& (
(section >= columnCount())Description
TRUEnever evaluated
FALSEnever evaluated
section >= columnCount())
(section >= columnCount())Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1550 || ((
(orientation == Qt::Vertical)Description
TRUEnever evaluated
FALSEnever evaluated
orientation == Qt::Vertical)
(orientation == Qt::Vertical)Description
TRUEnever evaluated
FALSEnever evaluated
&& (
(section >= rowCount())Description
TRUEnever evaluated
FALSEnever evaluated
section >= rowCount())
(section >= rowCount())Description
TRUEnever evaluated
FALSEnever evaluated
)) {
0
1551 return
never executed: return QVariant();
QVariant();
never executed: return QVariant();
0
1552 }-
1553 QStandardItem *headerItem = 0;-
1554 if (orientation == Qt::Horizontal
orientation == Qt::HorizontalDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1555 headerItem = d->columnHeaderItems.at(section);
never executed: headerItem = d->columnHeaderItems.at(section);
0
1556 else if (orientation == Qt::Vertical
orientation == Qt::VerticalDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1557 headerItem = d->rowHeaderItems.at(section);
never executed: headerItem = d->rowHeaderItems.at(section);
0
1558 return
never executed: return headerItem ? headerItem->data(role) : QAbstractItemModel::headerData(section, orientation, role);
headerItem ? headerItem->data(role)
never executed: return headerItem ? headerItem->data(role) : QAbstractItemModel::headerData(section, orientation, role);
0
1559 : QAbstractItemModel::headerData(section, orientation, role);
never executed: return headerItem ? headerItem->data(role) : QAbstractItemModel::headerData(section, orientation, role);
0
1560}-
1561-
1562-
1563-
1564-
1565-
1566-
1567Qt::DropActions QStandardItemModel::supportedDropActions () const-
1568{-
1569 return
never executed: return Qt::CopyAction | Qt::MoveAction;
Qt::CopyAction | Qt::MoveAction;
never executed: return Qt::CopyAction | Qt::MoveAction;
0
1570}-
1571-
1572-
1573-
1574-
1575QModelIndex QStandardItemModel::index(int row, int column, const QModelIndex &parent) const-
1576{-
1577 const QStandardItemModelPrivate * const d = d_func();-
1578 QStandardItem *parentItem = d->itemFromIndex(parent);-
1579 if ((
(parentItem == 0)Description
TRUEnever evaluated
FALSEnever evaluated
parentItem == 0)
(parentItem == 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1580 || (
(row < 0)Description
TRUEnever evaluated
FALSEnever evaluated
row < 0)
(row < 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1581 || (
(column < 0)Description
TRUEnever evaluated
FALSEnever evaluated
column < 0)
(column < 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1582 || (
(row >= parent...m->rowCount())Description
TRUEnever evaluated
FALSEnever evaluated
row >= parentItem->rowCount())
(row >= parent...m->rowCount())Description
TRUEnever evaluated
FALSEnever evaluated
0
1583 || (
(column >= par...columnCount())Description
TRUEnever evaluated
FALSEnever evaluated
column >= parentItem->columnCount())
(column >= par...columnCount())Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1584 return
never executed: return QModelIndex();
QModelIndex();
never executed: return QModelIndex();
0
1585 }-
1586 return
never executed: return createIndex(row, column, parentItem);
createIndex(row, column, parentItem);
never executed: return createIndex(row, column, parentItem);
0
1587}-
1588-
1589-
1590-
1591-
1592bool QStandardItemModel::insertColumns(int column, int count, const QModelIndex &parent)-
1593{-
1594 QStandardItemModelPrivate * const d = d_func();-
1595 QStandardItem *item = parent.isValid()
parent.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
? itemFromIndex(parent) : d->root.data();
0
1596 if (item == 0
item == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1597 return
never executed: return false;
false;
never executed: return false;
0
1598 return
never executed: return item->d_func()->insertColumns(column, count, QList<QStandardItem*>());
item->d_func()->insertColumns(column, count, QList<QStandardItem*>());
never executed: return item->d_func()->insertColumns(column, count, QList<QStandardItem*>());
0
1599}-
1600-
1601-
1602-
1603-
1604bool QStandardItemModel::insertRows(int row, int count, const QModelIndex &parent)-
1605{-
1606 QStandardItemModelPrivate * const d = d_func();-
1607 QStandardItem *item = parent.isValid()
parent.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
? itemFromIndex(parent) : d->root.data();
0
1608 if (item == 0
item == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1609 return
never executed: return false;
false;
never executed: return false;
0
1610 return
never executed: return item->d_func()->insertRows(row, count, QList<QStandardItem*>());
item->d_func()->insertRows(row, count, QList<QStandardItem*>());
never executed: return item->d_func()->insertRows(row, count, QList<QStandardItem*>());
0
1611}-
1612-
1613-
1614-
1615-
1616QMap<int, QVariant> QStandardItemModel::itemData(const QModelIndex &index) const-
1617{-
1618 const QStandardItemModelPrivate * const d = d_func();-
1619 QStandardItem *item = d->itemFromIndex(index);-
1620 return
never executed: return item ? item->d_func()->itemData() : QMap<int, QVariant>();
item ? item->d_func()->itemData() : QMap<int, QVariant>();
never executed: return item ? item->d_func()->itemData() : QMap<int, QVariant>();
0
1621}-
1622-
1623-
1624-
1625-
1626QModelIndex QStandardItemModel::parent(const QModelIndex &child) const-
1627{-
1628 const QStandardItemModelPrivate * const d = d_func();-
1629 if (!d->indexValid(child)
!d->indexValid(child)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1630 return
never executed: return QModelIndex();
QModelIndex();
never executed: return QModelIndex();
0
1631 QStandardItem *parentItem = static_cast<QStandardItem*>(child.internalPointer());-
1632 return
never executed: return indexFromItem(parentItem);
indexFromItem(parentItem);
never executed: return indexFromItem(parentItem);
0
1633}-
1634-
1635-
1636-
1637-
1638bool QStandardItemModel::removeColumns(int column, int count, const QModelIndex &parent)-
1639{-
1640 QStandardItemModelPrivate * const d = d_func();-
1641 QStandardItem *item = d->itemFromIndex(parent);-
1642 if ((
(item == 0)Description
TRUEnever evaluated
FALSEnever evaluated
item == 0)
(item == 0)Description
TRUEnever evaluated
FALSEnever evaluated
|| (
(count < 1)Description
TRUEnever evaluated
FALSEnever evaluated
count < 1)
(count < 1)Description
TRUEnever evaluated
FALSEnever evaluated
|| (
(column < 0)Description
TRUEnever evaluated
FALSEnever evaluated
column < 0)
(column < 0)Description
TRUEnever evaluated
FALSEnever evaluated
|| ((
((column + cou...columnCount())Description
TRUEnever evaluated
FALSEnever evaluated
column + count) > item->columnCount())
((column + cou...columnCount())Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1643 return
never executed: return false;
false;
never executed: return false;
0
1644 item->removeColumns(column, count);-
1645 return
never executed: return true;
true;
never executed: return true;
0
1646}-
1647-
1648-
1649-
1650-
1651bool QStandardItemModel::removeRows(int row, int count, const QModelIndex &parent)-
1652{-
1653 QStandardItemModelPrivate * const d = d_func();-
1654 QStandardItem *item = d->itemFromIndex(parent);-
1655 if ((
(item == 0)Description
TRUEnever evaluated
FALSEnever evaluated
item == 0)
(item == 0)Description
TRUEnever evaluated
FALSEnever evaluated
|| (
(count < 1)Description
TRUEnever evaluated
FALSEnever evaluated
count < 1)
(count < 1)Description
TRUEnever evaluated
FALSEnever evaluated
|| (
(row < 0)Description
TRUEnever evaluated
FALSEnever evaluated
row < 0)
(row < 0)Description
TRUEnever evaluated
FALSEnever evaluated
|| ((
((row + count)...m->rowCount())Description
TRUEnever evaluated
FALSEnever evaluated
row + count) > item->rowCount())
((row + count)...m->rowCount())Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1656 return
never executed: return false;
false;
never executed: return false;
0
1657 item->removeRows(row, count);-
1658 return
never executed: return true;
true;
never executed: return true;
0
1659}-
1660-
1661-
1662-
1663-
1664int QStandardItemModel::rowCount(const QModelIndex &parent) const-
1665{-
1666 const QStandardItemModelPrivate * const d = d_func();-
1667 QStandardItem *item = d->itemFromIndex(parent);-
1668 return
never executed: return item ? item->rowCount() : 0;
item ? item->rowCount() : 0;
never executed: return item ? item->rowCount() : 0;
0
1669}-
1670-
1671-
1672-
1673-
1674bool QStandardItemModel::setData(const QModelIndex &index, const QVariant &value, int role)-
1675{-
1676 if (!index.isValid()
!index.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1677 return
never executed: return false;
false;
never executed: return false;
0
1678 QStandardItem *item = itemFromIndex(index);-
1679 if (item == 0
item == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1680 return
never executed: return false;
false;
never executed: return false;
0
1681 item->setData(value, role);-
1682 return
never executed: return true;
true;
never executed: return true;
0
1683}-
1684-
1685-
1686-
1687-
1688bool QStandardItemModel::setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role)-
1689{-
1690 QStandardItemModelPrivate * const d = d_func();-
1691 if ((
(section < 0)Description
TRUEnever evaluated
FALSEnever evaluated
section < 0)
(section < 0)Description
TRUEnever evaluated
FALSEnever evaluated
0
1692 || ((
(orientation =...t::Horizontal)Description
TRUEnever evaluated
FALSEnever evaluated
orientation == Qt::Horizontal)
(orientation =...t::Horizontal)Description
TRUEnever evaluated
FALSEnever evaluated
&& (
(section >= columnCount())Description
TRUEnever evaluated
FALSEnever evaluated
section >= columnCount())
(section >= columnCount())Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1693 || ((
(orientation == Qt::Vertical)Description
TRUEnever evaluated
FALSEnever evaluated
orientation == Qt::Vertical)
(orientation == Qt::Vertical)Description
TRUEnever evaluated
FALSEnever evaluated
&& (
(section >= rowCount())Description
TRUEnever evaluated
FALSEnever evaluated
section >= rowCount())
(section >= rowCount())Description
TRUEnever evaluated
FALSEnever evaluated
)) {
0
1694 return
never executed: return false;
false;
never executed: return false;
0
1695 }-
1696 QStandardItem *headerItem = 0;-
1697 if (orientation == Qt::Horizontal
orientation == Qt::HorizontalDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1698 headerItem = d->columnHeaderItems.at(section);-
1699 if (headerItem == 0
headerItem == 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1700 headerItem = d->createItem();-
1701 headerItem->d_func()->setModel(this);-
1702 d->columnHeaderItems.replace(section, headerItem);-
1703 }
never executed: end of block
0
1704 }
never executed: end of block
else if (orientation == Qt::Vertical
orientation == Qt::VerticalDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1705 headerItem = d->rowHeaderItems.at(section);-
1706 if (headerItem == 0
headerItem == 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1707 headerItem = d->createItem();-
1708 headerItem->d_func()->setModel(this);-
1709 d->rowHeaderItems.replace(section, headerItem);-
1710 }
never executed: end of block
0
1711 }
never executed: end of block
0
1712 if (headerItem
headerItemDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1713 headerItem->setData(value, role);-
1714 return
never executed: return true;
true;
never executed: return true;
0
1715 }-
1716 return
never executed: return false;
false;
never executed: return false;
0
1717}-
1718-
1719-
1720-
1721-
1722bool QStandardItemModel::setItemData(const QModelIndex &index, const QMap<int, QVariant> &roles)-
1723{-
1724 QStandardItem *item = itemFromIndex(index);-
1725 if (item == 0
item == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1726 return
never executed: return false;
false;
never executed: return false;
0
1727 item->d_func()->setItemData(roles);-
1728 return
never executed: return true;
true;
never executed: return true;
0
1729}-
1730-
1731-
1732-
1733-
1734void QStandardItemModel::sort(int column, Qt::SortOrder order)-
1735{-
1736 QStandardItemModelPrivate * const d = d_func();-
1737 d->root->sortChildren(column, order);-
1738}
never executed: end of block
0
1739-
1740-
1741-
1742-
1743QStringList QStandardItemModel::mimeTypes() const-
1744{-
1745 return
never executed: return QAbstractItemModel::mimeTypes() << qStandardItemModelDataListMimeType();
QAbstractItemModel::mimeTypes() << qStandardItemModelDataListMimeType();
never executed: return QAbstractItemModel::mimeTypes() << qStandardItemModelDataListMimeType();
0
1746}-
1747-
1748-
1749-
1750-
1751QMimeData *QStandardItemModel::mimeData(const QModelIndexList &indexes) const-
1752{-
1753 QMimeData *data = QAbstractItemModel::mimeData(indexes);-
1754 if(!data
!dataDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1755 return
never executed: return 0;
0;
never executed: return 0;
0
1756-
1757 const QString format = qStandardItemModelDataListMimeType();-
1758 if (!mimeTypes().contains(format)
!mimeTypes().contains(format)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1759 return
never executed: return data;
data;
never executed: return data;
0
1760 QByteArray encoded;-
1761 QDataStream stream(&encoded, QIODevice::WriteOnly);-
1762-
1763 QSet<QStandardItem*> itemsSet;-
1764 QStack<QStandardItem*> stack;-
1765 itemsSet.reserve(indexes.count());-
1766 stack.reserve(indexes.count());-
1767 for (int i = 0; i < indexes.count()
i < indexes.count()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
1768 if (QStandardItem *item = itemFromIndex(indexes.at(i))
QStandardItem ...indexes.at(i))Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1769 itemsSet << item;-
1770 stack.push(item);-
1771 }
never executed: end of block
else {
0
1772 QMessageLogger(__FILE__, 3015, __PRETTY_FUNCTION__).warning("QStandardItemModel::mimeData: No item associated with invalid index");-
1773 return
never executed: return 0;
0;
never executed: return 0;
0
1774 }-
1775 }-
1776-
1777-
1778 {-
1779 QSet<QStandardItem *> seen;-
1780 while (!stack.isEmpty()
!stack.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1781 QStandardItem *itm = stack.pop();-
1782 if (seen.contains(itm)
seen.contains(itm)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1783 continue;
never executed: continue;
0
1784 seen.insert(itm);-
1785-
1786 const QVector<QStandardItem*> &childList = itm->d_func()->children;-
1787 for (int i = 0; i < childList.count()
i < childList.count()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
1788 QStandardItem *chi = childList.at(i);-
1789 if (chi
chiDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1790 itemsSet.erase(itemsSet.constFind(chi));-
1791 stack.push(chi);-
1792 }
never executed: end of block
0
1793 }
never executed: end of block
0
1794 }
never executed: end of block
0
1795 }-
1796-
1797 stack.reserve(itemsSet.count());-
1798 for (QStandardItem *item : qAsConst(itemsSet))-
1799 stack.push(item);
never executed: stack.push(item);
0
1800-
1801-
1802 while (!stack.isEmpty()
!stack.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1803 QStandardItem *item = stack.pop();-
1804 if (itemsSet.contains(item)
itemsSet.contains(item)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1805 stream << item->row() << item->column();
never executed: stream << item->row() << item->column();
0
1806-
1807 stream << *item << item->columnCount() << item->d_ptr->children.count();-
1808 stack += item->d_ptr->children;-
1809 }
never executed: end of block
0
1810-
1811 data->setData(format, encoded);-
1812 return
never executed: return data;
data;
never executed: return data;
0
1813}-
1814-
1815-
1816-
1817-
1818-
1819-
1820void QStandardItemModelPrivate::decodeDataRecursive(QDataStream &stream, QStandardItem *item)-
1821{-
1822 int colCount, childCount;-
1823 stream >> *item;-
1824 stream >> colCount >> childCount;-
1825 item->setColumnCount(colCount);-
1826-
1827 int childPos = childCount;-
1828-
1829 while(childPos > 0
childPos > 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1830 childPos--;-
1831 QStandardItem *child = createItem();-
1832 decodeDataRecursive(stream, child);-
1833 item->setChild( childPos / colCount, childPos % colCount, child);-
1834 }
never executed: end of block
0
1835}
never executed: end of block
0
1836-
1837-
1838-
1839-
1840-
1841bool QStandardItemModel::dropMimeData(const QMimeData *data, Qt::DropAction action,-
1842 int row, int column, const QModelIndex &parent)-
1843{-
1844 QStandardItemModelPrivate * const d = d_func();-
1845-
1846 if (!data
!dataDescription
TRUEnever evaluated
FALSEnever evaluated
|| !(action == Qt::CopyAction
action == Qt::CopyActionDescription
TRUEnever evaluated
FALSEnever evaluated
|| action == Qt::MoveAction
action == Qt::MoveActionDescription
TRUEnever evaluated
FALSEnever evaluated
))
0
1847 return
never executed: return false;
false;
never executed: return false;
0
1848-
1849 const QString format = qStandardItemModelDataListMimeType();-
1850 if (!data->hasFormat(format)
!data->hasFormat(format)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1851 return
never executed: return QAbstractItemModel::dropMimeData(data, action, row, column, parent);
QAbstractItemModel::dropMimeData(data, action, row, column, parent);
never executed: return QAbstractItemModel::dropMimeData(data, action, row, column, parent);
0
1852-
1853 if (row > rowCount(parent)
row > rowCount(parent)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1854 row = rowCount(parent);
never executed: row = rowCount(parent);
0
1855 if (row == -1
row == -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1856 row = rowCount(parent);
never executed: row = rowCount(parent);
0
1857 if (column == -1
column == -1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
1858 column = 0;
never executed: column = 0;
0
1859-
1860-
1861 QByteArray encoded = data->data(format);-
1862 QDataStream stream(&encoded, QIODevice::ReadOnly);-
1863-
1864-
1865-
1866-
1867 int top = 2147483647;-
1868 int left = 2147483647;-
1869 int bottom = 0;-
1870 int right = 0;-
1871 QVector<int> rows, columns;-
1872 QVector<QStandardItem *> items;-
1873-
1874 while (!stream.atEnd()
!stream.atEnd()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1875 int r, c;-
1876 QStandardItem *item = d->createItem();-
1877 stream >> r >> c;-
1878 d->decodeDataRecursive(stream, item);-
1879-
1880 rows.append(r);-
1881 columns.append(c);-
1882 items.append(item);-
1883 top = qMin(r, top);-
1884 left = qMin(c, left);-
1885 bottom = qMax(r, bottom);-
1886 right = qMax(c, right);-
1887 }
never executed: end of block
0
1888-
1889-
1890-
1891 int dragRowCount = 0;-
1892 int dragColumnCount = right - left + 1;-
1893-
1894-
1895 QVector<int> rowsToInsert(bottom + 1);-
1896 for (int i = 0; i < rows.count()
i < rows.count()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i)
0
1897 rowsToInsert[rows.at(i)] = 1;
never executed: rowsToInsert[rows.at(i)] = 1;
0
1898 for (int i = 0; i < rowsToInsert.count()
i < rowsToInsert.count()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
1899 if (rowsToInsert.at(i) == 1
rowsToInsert.at(i) == 1Description
TRUEnever evaluated
FALSEnever evaluated
){
0
1900 rowsToInsert[i] = dragRowCount;-
1901 ++dragRowCount;-
1902 }
never executed: end of block
0
1903 }
never executed: end of block
0
1904 for (int i = 0; i < rows.count()
i < rows.count()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i)
0
1905 rows[i] = top + rowsToInsert.at(rows.at(i));
never executed: rows[i] = top + rowsToInsert.at(rows.at(i));
0
1906-
1907 QBitArray isWrittenTo(dragRowCount * dragColumnCount);-
1908-
1909-
1910 int colCount = columnCount(parent);-
1911 if (colCount < dragColumnCount + column
colCount < dra...Count + columnDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
1912 insertColumns(colCount, dragColumnCount + column - colCount, parent);-
1913 colCount = columnCount(parent);-
1914 }
never executed: end of block
0
1915 insertRows(row, dragRowCount, parent);-
1916-
1917 row = qMax(0, row);-
1918 column = qMax(0, column);-
1919-
1920 QStandardItem *parentItem = itemFromIndex (parent);-
1921 if (!parentItem
!parentItemDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
1922 parentItem = invisibleRootItem();
never executed: parentItem = invisibleRootItem();
0
1923-
1924 QVector<QPersistentModelIndex> newIndexes(items.size());-
1925-
1926 for (int j = 0; j < items.size()
j < items.size()Description
TRUEnever evaluated
FALSEnever evaluated
; ++j) {
0
1927 int relativeRow = rows.at(j) - top;-
1928 int relativeColumn = columns.at(j) - left;-
1929 int destinationRow = relativeRow + row;-
1930 int destinationColumn = relativeColumn + column;-
1931 int flat = (relativeRow * dragColumnCount) + relativeColumn;-
1932-
1933 if (destinationColumn >= colCount
destinationColumn >= colCountDescription
TRUEnever evaluated
FALSEnever evaluated
|| isWrittenTo.testBit(flat)
isWrittenTo.testBit(flat)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1934 destinationColumn = qBound(column, destinationColumn, colCount - 1);-
1935 destinationRow = row + dragRowCount;-
1936 insertRows(row + dragRowCount, 1, parent);-
1937 flat = (dragRowCount * dragColumnCount) + relativeColumn;-
1938 isWrittenTo.resize(++dragRowCount * dragColumnCount);-
1939 }
never executed: end of block
0
1940 if (!isWrittenTo.testBit(flat)
!isWrittenTo.testBit(flat)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1941 newIndexes[j] = index(destinationRow, destinationColumn, parentItem->index());-
1942 isWrittenTo.setBit(flat);-
1943 }
never executed: end of block
0
1944 }
never executed: end of block
0
1945-
1946 for(int k = 0; k < newIndexes.size()
k < newIndexes.size()Description
TRUEnever evaluated
FALSEnever evaluated
; k++) {
0
1947 if (newIndexes.at(k).isValid()
newIndexes.at(k).isValid()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
1948 parentItem->setChild(newIndexes.at(k).row(), newIndexes.at(k).column(), items.at(k));-
1949 }
never executed: end of block
else {
0
1950 delete items.at(k);-
1951 }
never executed: end of block
0
1952 }-
1953-
1954 return
never executed: return true;
true;
never executed: return true;
0
1955}-
1956-
1957-
1958-
Switch to Source codePreprocessed file

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