Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/gui/itemmodels/qstandarditemmodel.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
2 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
3 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
4 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
5 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
6 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
7 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
8 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
9 | class QStandardItemModelLessThan | - | ||||||||||||||||||||||||||||||||||||||||||||||||
10 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
11 | public: | - | ||||||||||||||||||||||||||||||||||||||||||||||||
12 | inline QStandardItemModelLessThan() | - | ||||||||||||||||||||||||||||||||||||||||||||||||
13 | { } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
14 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
15 | inline bool operator()(const QPair<QStandardItem*, int> &l, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
16 | const QPair<QStandardItem*, int> &r) const | - | ||||||||||||||||||||||||||||||||||||||||||||||||
17 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
18 | return never executed: *(l.first) < *(r.first);return *(l.first) < *(r.first); never executed: return *(l.first) < *(r.first); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
19 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
20 | }; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
21 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
22 | class QStandardItemModelGreaterThan | - | ||||||||||||||||||||||||||||||||||||||||||||||||
23 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
24 | public: | - | ||||||||||||||||||||||||||||||||||||||||||||||||
25 | inline QStandardItemModelGreaterThan() | - | ||||||||||||||||||||||||||||||||||||||||||||||||
26 | { } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
27 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
28 | inline bool operator()(const QPair<QStandardItem*, int> &l, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
29 | const QPair<QStandardItem*, int> &r) const | - | ||||||||||||||||||||||||||||||||||||||||||||||||
30 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
31 | return never executed: *(r.first) < *(l.first);return *(r.first) < *(l.first); never executed: return *(r.first) < *(l.first); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
32 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
33 | }; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
34 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
35 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
36 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
37 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
38 | QStandardItemPrivate::~QStandardItemPrivate() | - | ||||||||||||||||||||||||||||||||||||||||||||||||
39 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
40 | QVector<QStandardItem*>::const_iterator it; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
41 | for (it = children.constBegin(); it != children.constEnd()
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
42 | QStandardItem *child = *it; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
43 | if (child
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
44 | child->d_func()->setModel(0); never executed: child->d_func()->setModel(0); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
45 | delete child; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
46 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
47 | children.clear(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
48 | if (parent
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
49 | parent->d_func()->childDeleted(q_func()); never executed: parent->d_func()->childDeleted(q_func()); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
50 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
51 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
52 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
53 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
54 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
55 | QPair<int, int> QStandardItemPrivate::position() const | - | ||||||||||||||||||||||||||||||||||||||||||||||||
56 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
57 | if (QStandardItem *par = parent
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
58 | int idx = par->d_func()->childIndex(q_func()); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
59 | if (idx == -1
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
60 | return never executed: QPair<int, int>(-1, -1);return QPair<int, int>(-1, -1); never executed: return QPair<int, int>(-1, -1); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
61 | return never executed: QPair<int, int>(idx / par->columnCount(), idx % par->columnCount());return QPair<int, int>(idx / par->columnCount(), idx % par->columnCount()); never executed: return QPair<int, int>(idx / par->columnCount(), idx % par->columnCount()); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
62 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
63 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
64 | return never executed: QPair<int, int>(-1, -1);return QPair<int, int>(-1, -1); never executed: return QPair<int, int>(-1, -1); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
65 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
66 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
67 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
68 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
69 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
70 | void QStandardItemPrivate::setChild(int row, int column, QStandardItem *item, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
71 | bool emitChanged) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
72 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
73 | QStandardItem * const q = q_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
74 | if (item == q
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
75 | QMessageLogger(__FILE__, 120, __PRETTY_FUNCTION__).warning("QStandardItem::setChild: Can't make an item a child of itself %p", | - | ||||||||||||||||||||||||||||||||||||||||||||||||
76 | item); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
77 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
78 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
79 | if ((
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
80 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
81 | if (rows <= row
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
82 | q->setRowCount(row + 1); never executed: q->setRowCount(row + 1); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
83 | if (columns <= column
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
84 | q->setColumnCount(column + 1); never executed: q->setColumnCount(column + 1); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
85 | int index = childIndex(row, column); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
86 | ((!(index != -1)) ? qt_assert("index != -1",__FILE__,131) : qt_noop()); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
87 | QStandardItem *oldItem = children.at(index); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
88 | if (item == oldItem
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
89 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
90 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
91 | if (model
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
92 | model->layoutAboutToBeChanged(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
93 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
94 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
95 | if (item
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
96 | if (item->d_func()->parent == 0
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
97 | item->d_func()->setParentAndModel(q, model); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
98 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
99 | QMessageLogger(__FILE__, 144, __PRETTY_FUNCTION__).warning("QStandardItem::setChild: Ignoring duplicate insertion of item %p", | - | ||||||||||||||||||||||||||||||||||||||||||||||||
100 | item); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
101 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
102 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
103 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
104 | if (oldItem
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
105 | oldItem->d_func()->setModel(0); never executed: oldItem->d_func()->setModel(0); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
106 | delete oldItem; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
107 | children.replace(index, item); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
108 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
109 | if (model
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
110 | model->layoutChanged(); never executed: model->layoutChanged(); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
111 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
112 | if (emitChanged
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
113 | model->d_func()->itemChanged(item); never executed: model->d_func()->itemChanged(item); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
114 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
115 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
116 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
117 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
118 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
119 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
120 | void QStandardItemPrivate::changeFlags(bool enable, Qt::ItemFlags f) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
121 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
122 | QStandardItem * const q = q_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
123 | Qt::ItemFlags flags = q->flags(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
124 | if (enable
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
125 | flags |= f; never executed: flags |= f; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
126 | else | - | ||||||||||||||||||||||||||||||||||||||||||||||||
127 | flags &= ~f; never executed: flags &= ~f; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
128 | q->setFlags(flags); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
129 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
130 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
131 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
132 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
133 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
134 | void QStandardItemPrivate::childDeleted(QStandardItem *child) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
135 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
136 | int index = childIndex(child); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
137 | ((!(index != -1)) ? qt_assert("index != -1",__FILE__,182) : qt_noop()); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
138 | children.replace(index, 0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
139 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
140 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
141 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
142 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
143 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
144 | void QStandardItemPrivate::setItemData(const QMap<int, QVariant> &roles) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
145 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
146 | QStandardItem * const q = q_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
147 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
148 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
149 | QVector<QStandardItemData> newValues; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
150 | QMap<int, QVariant>::const_iterator it; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
151 | for (it = roles.begin(); it != roles.end()
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
152 | QVariant value = it.value(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
153 | if (value.isValid()
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
154 | int role = it.key(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
155 | role = (
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
156 | QStandardItemData wid(role,it.value()); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
157 | newValues.append(wid); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
158 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
159 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
160 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
161 | if (values!=newValues
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
162 | values=newValues; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
163 | if (model
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
164 | model->d_func()->itemChanged(q); never executed: model->d_func()->itemChanged(q); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
165 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
166 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
167 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
168 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
169 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
170 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
171 | const QMap<int, QVariant> QStandardItemPrivate::itemData() const | - | ||||||||||||||||||||||||||||||||||||||||||||||||
172 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
173 | QMap<int, QVariant> result; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
174 | QVector<QStandardItemData>::const_iterator it; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
175 | for (it = values.begin(); it != values.end()
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
176 | result.insert((*it).role, (*it).value); never executed: result.insert((*it).role, (*it).value); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
177 | return never executed: result;return result; never executed: return result; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
178 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
179 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
180 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
181 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
182 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
183 | void QStandardItemPrivate::sortChildren(int column, Qt::SortOrder order) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
184 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
185 | QStandardItem * const q = q_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
186 | if (column >= columnCount()
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
187 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
188 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
189 | QVector<QPair<QStandardItem*, int> > sortable; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
190 | QVector<int> unsortable; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
191 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
192 | sortable.reserve(rowCount()); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
193 | unsortable.reserve(rowCount()); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
194 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
195 | for (int row = 0; row < rowCount()
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
196 | QStandardItem *itm = q->child(row, column); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
197 | if (itm
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
198 | sortable.append(QPair<QStandardItem*,int>(itm, row)); never executed: sortable.append(QPair<QStandardItem*,int>(itm, row)); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
199 | else | - | ||||||||||||||||||||||||||||||||||||||||||||||||
200 | unsortable.append(row); never executed: unsortable.append(row); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
201 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
202 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
203 | if (order == Qt::AscendingOrder
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
204 | QStandardItemModelLessThan lt; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
205 | std::stable_sort(sortable.begin(), sortable.end(), lt); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
206 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
207 | QStandardItemModelGreaterThan gt; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
208 | std::stable_sort(sortable.begin(), sortable.end(), gt); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
209 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
210 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
211 | QModelIndexList changedPersistentIndexesFrom, changedPersistentIndexesTo; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
212 | QVector<QStandardItem*> sorted_children(children.count()); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
213 | for (int i = 0; i < rowCount()
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
214 | int r = (i < sortable.count()
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
215 | ? sortable.at(i).second | - | ||||||||||||||||||||||||||||||||||||||||||||||||
216 | : unsortable.at(i - sortable.count())); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
217 | for (int c = 0; c < columnCount()
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
218 | QStandardItem *itm = q->child(r, c); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
219 | sorted_children[childIndex(i, c)] = itm; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
220 | if (model
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
221 | QModelIndex from = model->createIndex(r, c, q); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
222 | if (model->d_func()->persistent.indexes.contains(from)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
223 | QModelIndex to = model->createIndex(i, c, q); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
224 | changedPersistentIndexesFrom.append(from); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
225 | changedPersistentIndexesTo.append(to); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
226 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
227 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
228 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
229 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
230 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
231 | children = sorted_children; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
232 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
233 | if (model
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
234 | model->changePersistentIndexList(changedPersistentIndexesFrom, changedPersistentIndexesTo); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
235 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
236 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
237 | QVector<QStandardItem*>::iterator it; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
238 | for (it = children.begin(); it != children.end()
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
239 | if (*
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
240 | (* never executed: it)->d_func()->sortChildren(column, order);(*it)->d_func()->sortChildren(column, order); never executed: (*it)->d_func()->sortChildren(column, order); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
241 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
242 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
243 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
244 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
245 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
246 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
247 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
248 | void QStandardItemPrivate::setModel(QStandardItemModel *mod) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
249 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
250 | if (children.isEmpty()
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
251 | if (model
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
252 | model->d_func()->invalidatePersistentIndex(model->indexFromItem(q_ptr)); never executed: model->d_func()->invalidatePersistentIndex(model->indexFromItem(q_ptr)); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
253 | model = mod; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
254 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
255 | QStack<QStandardItem*> stack; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
256 | stack.push(q_ptr); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
257 | while (!stack.isEmpty()
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
258 | QStandardItem *itm = stack.pop(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
259 | if (itm->d_func()->model
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
260 | itm->d_func()->model->d_func()->invalidatePersistentIndex(itm->d_func()->model->indexFromItem(itm)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
261 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
262 | itm->d_func()->model = mod; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
263 | const QVector<QStandardItem*> &childList = itm->d_func()->children; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
264 | for (int i = 0; i < childList.count()
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
265 | QStandardItem *chi = childList.at(i); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
266 | if (chi
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
267 | stack.push(chi); never executed: stack.push(chi); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
268 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
269 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
270 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
271 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
272 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
273 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
274 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
275 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
276 | QStandardItemModelPrivate::QStandardItemModelPrivate() | - | ||||||||||||||||||||||||||||||||||||||||||||||||
277 | : root(new QStandardItem), | - | ||||||||||||||||||||||||||||||||||||||||||||||||
278 | itemPrototype(0), | - | ||||||||||||||||||||||||||||||||||||||||||||||||
279 | sortRole(Qt::DisplayRole) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
280 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
281 | root->setFlags(Qt::ItemIsDropEnabled); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
282 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
283 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
284 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
285 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
286 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
287 | QStandardItemModelPrivate::~QStandardItemModelPrivate() | - | ||||||||||||||||||||||||||||||||||||||||||||||||
288 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
289 | delete itemPrototype; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
290 | qDeleteAll(columnHeaderItems); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
291 | qDeleteAll(rowHeaderItems); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
292 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
293 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
294 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
295 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
296 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
297 | void QStandardItemModelPrivate::init() | - | ||||||||||||||||||||||||||||||||||||||||||||||||
298 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
299 | QStandardItemModel * const q = q_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
300 | QObject::connect(q, qFlagLocation("2""dataChanged(QModelIndex,QModelIndex)" "\0" __FILE__ ":" "345"), | - | ||||||||||||||||||||||||||||||||||||||||||||||||
301 | q, qFlagLocation("1""_q_emitItemChanged(QModelIndex,QModelIndex)" "\0" __FILE__ ":" "346")); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
302 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
303 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
304 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
305 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
306 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
307 | void QStandardItemModelPrivate::_q_emitItemChanged(const QModelIndex &topLeft, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
308 | const QModelIndex &bottomRight) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
309 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
310 | QStandardItemModel * const q = q_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
311 | QModelIndex parent = topLeft.parent(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
312 | for (int row = topLeft.row(); row <= bottomRight.row()
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
313 | for (int column = topLeft.column(); column <= bottomRight.column()
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
314 | QModelIndex index = q->index(row, column, parent); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
315 | if (QStandardItem *item = itemFromIndex(index)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
316 | q->itemChanged(item); never executed: q->itemChanged(item); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
317 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
318 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
319 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
320 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
321 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
322 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
323 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
324 | bool QStandardItemPrivate::insertRows(int row, const QList<QStandardItem*> &items) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
325 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
326 | QStandardItem * const q = q_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
327 | if ((
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
328 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
329 | int count = items.count(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
330 | if (model
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
331 | model->d_func()->rowsAboutToBeInserted(q, row, row + count - 1); never executed: model->d_func()->rowsAboutToBeInserted(q, row, row + count - 1); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
332 | if (rowCount() == 0
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
333 | if (columnCount() == 0
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
334 | q->setColumnCount(1); never executed: q->setColumnCount(1); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
335 | children.resize(columnCount() * count); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
336 | rows = count; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
337 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
338 | rows += count; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
339 | int index = childIndex(row, 0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
340 | if (index != -1
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
341 | children.insert(index, columnCount() * count, 0); never executed: children.insert(index, columnCount() * count, 0); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
342 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
343 | for (int i = 0; i < items.count()
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
344 | QStandardItem *item = items.at(i); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
345 | item->d_func()->model = model; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
346 | item->d_func()->parent = q; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
347 | int index = childIndex(i + row, 0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
348 | children.replace(index, item); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
349 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
350 | if (model
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
351 | model->d_func()->rowsInserted(q, row, count); never executed: model->d_func()->rowsInserted(q, row, count); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
352 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
353 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
354 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
355 | bool QStandardItemPrivate::insertRows(int row, int count, const QList<QStandardItem*> &items) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
356 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
357 | QStandardItem * const q = q_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
358 | if ((
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
359 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
360 | if (model
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
361 | model->d_func()->rowsAboutToBeInserted(q, row, row + count - 1); never executed: model->d_func()->rowsAboutToBeInserted(q, row, row + count - 1); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
362 | if (rowCount() == 0
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
363 | children.resize(columnCount() * count); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
364 | rows = count; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
365 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
366 | rows += count; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
367 | int index = childIndex(row, 0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
368 | if (index != -1
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
369 | children.insert(index, columnCount() * count, 0); never executed: children.insert(index, columnCount() * count, 0); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
370 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
371 | if (!items.isEmpty()
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
372 | int index = childIndex(row, 0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
373 | int limit = qMin(items.count(), columnCount() * count); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
374 | for (int i = 0; i < limit
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
375 | QStandardItem *item = items.at(i); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
376 | if (item
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
377 | if (item->d_func()->parent == 0
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
378 | item->d_func()->setParentAndModel(q, model); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
379 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
380 | QMessageLogger(__FILE__, 425, __PRETTY_FUNCTION__).warning("QStandardItem::insertRows: Ignoring duplicate insertion of item %p", | - | ||||||||||||||||||||||||||||||||||||||||||||||||
381 | item); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
382 | item = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
383 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
384 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
385 | children.replace(index, item); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
386 | ++index; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
387 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
388 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
389 | if (model
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
390 | model->d_func()->rowsInserted(q, row, count); never executed: model->d_func()->rowsInserted(q, row, count); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
391 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
392 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
393 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
394 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
395 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
396 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
397 | bool QStandardItemPrivate::insertColumns(int column, int count, const QList<QStandardItem*> &items) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
398 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
399 | QStandardItem * const q = q_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
400 | if ((
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
401 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
402 | if (model
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
403 | model->d_func()->columnsAboutToBeInserted(q, column, column + count - 1); never executed: model->d_func()->columnsAboutToBeInserted(q, column, column + count - 1); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
404 | if (columnCount() == 0
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
405 | children.resize(rowCount() * count); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
406 | columns = count; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
407 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
408 | columns += count; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
409 | int index = childIndex(0, column); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
410 | for (int row = 0; row < rowCount()
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
411 | children.insert(index, count, 0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
412 | index += columnCount(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
413 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
414 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
415 | if (!items.isEmpty()
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
416 | int limit = qMin(items.count(), rowCount() * count); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
417 | for (int i = 0; i < limit
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
418 | QStandardItem *item = items.at(i); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
419 | if (item
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
420 | if (item->d_func()->parent == 0
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
421 | item->d_func()->setParentAndModel(q, model); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
422 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
423 | QMessageLogger(__FILE__, 468, __PRETTY_FUNCTION__).warning("QStandardItem::insertColumns: Ignoring duplicate insertion of item %p", | - | ||||||||||||||||||||||||||||||||||||||||||||||||
424 | item); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
425 | item = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
426 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
427 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
428 | int r = i / count; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
429 | int c = column + (i % count); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
430 | int index = childIndex(r, c); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
431 | children.replace(index, item); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
432 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
433 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
434 | if (model
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
435 | model->d_func()->columnsInserted(q, column, count); never executed: model->d_func()->columnsInserted(q, column, count); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
436 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
437 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
438 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
439 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
440 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
441 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
442 | void QStandardItemModelPrivate::itemChanged(QStandardItem *item) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
443 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
444 | QStandardItemModel * const q = q_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
445 | if (item->d_func()->parent == 0
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
446 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
447 | int idx = columnHeaderItems.indexOf(item); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
448 | if (idx != -1
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
449 | q->headerDataChanged(Qt::Horizontal, idx, idx); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
450 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
451 | idx = rowHeaderItems.indexOf(item); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
452 | if (idx != -1
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
453 | q->headerDataChanged(Qt::Vertical, idx, idx); never executed: q->headerDataChanged(Qt::Vertical, idx, idx); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
454 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
455 | } else { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
456 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
457 | QModelIndex index = q->indexFromItem(item); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
458 | q->dataChanged(index, index); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
459 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
460 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
461 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
462 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
463 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
464 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
465 | void QStandardItemModelPrivate::rowsAboutToBeInserted(QStandardItem *parent, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
466 | int start, int end) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
467 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
468 | QStandardItemModel * const q = q_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
469 | QModelIndex index = q->indexFromItem(parent); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
470 | q->beginInsertRows(index, start, end); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
471 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
472 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
473 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
474 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
475 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
476 | void QStandardItemModelPrivate::columnsAboutToBeInserted(QStandardItem *parent, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
477 | int start, int end) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
478 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
479 | QStandardItemModel * const q = q_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
480 | QModelIndex index = q->indexFromItem(parent); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
481 | q->beginInsertColumns(index, start, end); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
482 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
483 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
484 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
485 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
486 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
487 | void QStandardItemModelPrivate::rowsAboutToBeRemoved(QStandardItem *parent, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
488 | int start, int end) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
489 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
490 | QStandardItemModel * const q = q_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
491 | QModelIndex index = q->indexFromItem(parent); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
492 | q->beginRemoveRows(index, start, end); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
493 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
494 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
495 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
496 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
497 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
498 | void QStandardItemModelPrivate::columnsAboutToBeRemoved(QStandardItem *parent, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
499 | int start, int end) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
500 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
501 | QStandardItemModel * const q = q_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
502 | QModelIndex index = q->indexFromItem(parent); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
503 | q->beginRemoveColumns(index, start, end); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
504 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
505 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
506 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
507 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
508 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
509 | void QStandardItemModelPrivate::rowsInserted(QStandardItem *parent, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
510 | int row, int count) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
511 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
512 | QStandardItemModel * const q = q_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
513 | if (parent == root.data()
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
514 | rowHeaderItems.insert(row, count, 0); never executed: rowHeaderItems.insert(row, count, 0); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
515 | q->endInsertRows(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
516 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
517 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
518 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
519 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
520 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
521 | void QStandardItemModelPrivate::columnsInserted(QStandardItem *parent, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
522 | int column, int count) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
523 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
524 | QStandardItemModel * const q = q_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
525 | if (parent == root.data()
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
526 | columnHeaderItems.insert(column, count, 0); never executed: columnHeaderItems.insert(column, count, 0); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
527 | q->endInsertColumns(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
528 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
529 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
530 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
531 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
532 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
533 | void QStandardItemModelPrivate::rowsRemoved(QStandardItem *parent, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
534 | int row, int count) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
535 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
536 | QStandardItemModel * const q = q_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
537 | if (parent == root.data()
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
538 | for (int i = row; i < row + count
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
539 | QStandardItem *oldItem = rowHeaderItems.at(i); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
540 | if (oldItem
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
541 | oldItem->d_func()->setModel(0); never executed: oldItem->d_func()->setModel(0); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
542 | delete oldItem; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
543 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
544 | rowHeaderItems.remove(row, count); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
545 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
546 | q->endRemoveRows(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
547 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
548 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
549 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
550 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
551 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
552 | void QStandardItemModelPrivate::columnsRemoved(QStandardItem *parent, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
553 | int column, int count) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
554 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
555 | QStandardItemModel * const q = q_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
556 | if (parent == root.data()
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
557 | for (int i = column; i < column + count
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
558 | QStandardItem *oldItem = columnHeaderItems.at(i); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
559 | if (oldItem
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
560 | oldItem->d_func()->setModel(0); never executed: oldItem->d_func()->setModel(0); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
561 | delete oldItem; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
562 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
563 | columnHeaderItems.remove(column, count); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
564 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
565 | q->endRemoveColumns(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
566 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
567 | QStandardItem::QStandardItem() | - | ||||||||||||||||||||||||||||||||||||||||||||||||
568 | : d_ptr(new QStandardItemPrivate) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
569 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
570 | QStandardItemPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
571 | d->q_ptr = this; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
572 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
573 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
574 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
575 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
576 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
577 | QStandardItem::QStandardItem(const QString &text) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
578 | : d_ptr(new QStandardItemPrivate) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
579 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
580 | QStandardItemPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
581 | d->q_ptr = this; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
582 | setText(text); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
583 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
584 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
585 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
586 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
587 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
588 | QStandardItem::QStandardItem(const QIcon &icon, const QString &text) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
589 | : d_ptr(new QStandardItemPrivate) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
590 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
591 | QStandardItemPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
592 | d->q_ptr = this; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
593 | setIcon(icon); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
594 | setText(text); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
595 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
596 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
597 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
598 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
599 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
600 | QStandardItem::QStandardItem(int rows, int columns) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
601 | : d_ptr(new QStandardItemPrivate) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
602 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
603 | QStandardItemPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
604 | d->q_ptr = this; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
605 | setRowCount(rows); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
606 | setColumnCount(columns); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
607 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
608 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
609 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
610 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
611 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
612 | QStandardItem::QStandardItem(QStandardItemPrivate &dd) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
613 | : d_ptr(&dd) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
614 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
615 | QStandardItemPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
616 | d->q_ptr = this; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
617 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
618 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
619 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
620 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
621 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
622 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
623 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
624 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
625 | QStandardItem::QStandardItem(const QStandardItem &other) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
626 | : d_ptr(new QStandardItemPrivate) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
627 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
628 | QStandardItemPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
629 | d->q_ptr = this; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
630 | operator=(other); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
631 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
632 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
633 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
634 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
635 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
636 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
637 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
638 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
639 | QStandardItem &QStandardItem::operator=(const QStandardItem &other) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
640 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
641 | QStandardItemPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
642 | d->values = other.d_func()->values; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
643 | return never executed: *this;return *this; never executed: return *this; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
644 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
645 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
646 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
647 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
648 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
649 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
650 | QStandardItem::~QStandardItem() | - | ||||||||||||||||||||||||||||||||||||||||||||||||
651 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
652 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
653 | QStandardItem *QStandardItem::parent() const | - | ||||||||||||||||||||||||||||||||||||||||||||||||
654 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
655 | const QStandardItemPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
656 | if (!d->model
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
657 | return never executed: d->parent;return d->parent; never executed: return d->parent; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
658 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
659 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
660 | void QStandardItem::setData(const QVariant &value, int role) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
661 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
662 | QStandardItemPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
663 | role = (
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
664 | QVector<QStandardItemData>::iterator it; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
665 | for (it = d->values.begin(); it != d->values.end()
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
666 | if ((*
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
667 | if (value.isValid()
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
668 | if ((*
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
669 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
670 | (*it).value = value; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
671 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
672 | d->values.erase(it); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
673 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
674 | if (d->model
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
675 | d->model->d_func()->itemChanged(this); never executed: d->model->d_func()->itemChanged(this); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
676 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
677 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
678 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
679 | d->values.append(QStandardItemData(role, value)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
680 | if (d->model
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
681 | d->model->d_func()->itemChanged(this); never executed: d->model->d_func()->itemChanged(this); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
682 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
683 | QVariant QStandardItem::data(int role) const | - | ||||||||||||||||||||||||||||||||||||||||||||||||
684 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
685 | const QStandardItemPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
686 | role = (
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
687 | QVector<QStandardItemData>::const_iterator it; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
688 | for (it = d->values.begin(); it != d->values.end()
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
689 | if ((*
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
690 | return never executed: (*it).value;return (*it).value; never executed: return (*it).value; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
691 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
692 | return never executed: QVariant();return QVariant(); never executed: return QVariant(); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
693 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
694 | void QStandardItem::emitDataChanged() | - | ||||||||||||||||||||||||||||||||||||||||||||||||
695 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
696 | QStandardItemPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
697 | if (d->model
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
698 | d->model->d_func()->itemChanged(this); never executed: d->model->d_func()->itemChanged(this); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
699 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
700 | void QStandardItem::setFlags(Qt::ItemFlags flags) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
701 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
702 | setData((int)flags, Qt::UserRole - 1); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
703 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
704 | Qt::ItemFlags QStandardItem::flags() const | - | ||||||||||||||||||||||||||||||||||||||||||||||||
705 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
706 | QVariant v = data(Qt::UserRole - 1); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
707 | if (!v.isValid()
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
708 | return never executed: (Qt::ItemIsSelectable|Qt::ItemIsEnabled|Qt::ItemIsEditablereturn (Qt::ItemIsSelectable|Qt::ItemIsEnabled|Qt::ItemIsEditable |Qt::ItemIsDragEnabled|Qt::ItemIsDropEnabled); never executed: return (Qt::ItemIsSelectable|Qt::ItemIsEnabled|Qt::ItemIsEditable |Qt::ItemIsDragEnabled|Qt::ItemIsDropEnabled); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
709 | |Qt::ItemIsDragEnabled|Qt::ItemIsDropEnabled); never executed: return (Qt::ItemIsSelectable|Qt::ItemIsEnabled|Qt::ItemIsEditable |Qt::ItemIsDragEnabled|Qt::ItemIsDropEnabled); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
710 | return never executed: Qt::ItemFlags(v.toInt());return Qt::ItemFlags(v.toInt()); never executed: return Qt::ItemFlags(v.toInt()); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
711 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
712 | void QStandardItem::setEnabled(bool enabled) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
713 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
714 | QStandardItemPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
715 | d->changeFlags(enabled, Qt::ItemIsEnabled); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
716 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
717 | void QStandardItem::setEditable(bool editable) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
718 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
719 | QStandardItemPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
720 | d->changeFlags(editable, Qt::ItemIsEditable); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
721 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
722 | void QStandardItem::setSelectable(bool selectable) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
723 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
724 | QStandardItemPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
725 | d->changeFlags(selectable, Qt::ItemIsSelectable); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
726 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
727 | void QStandardItem::setCheckable(bool checkable) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
728 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
729 | QStandardItemPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
730 | if (checkable
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
731 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
732 | if (!data(Qt::CheckStateRole).isValid()
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
733 | setData(Qt::Unchecked, Qt::CheckStateRole); never executed: setData(Qt::Unchecked, Qt::CheckStateRole); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
734 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
735 | d->changeFlags(checkable, Qt::ItemIsUserCheckable); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
736 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
737 | void QStandardItem::setAutoTristate(bool tristate) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
738 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
739 | QStandardItemPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
740 | d->changeFlags(tristate, Qt::ItemIsAutoTristate); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
741 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
742 | void QStandardItem::setUserTristate(bool tristate) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
743 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
744 | QStandardItemPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
745 | d->changeFlags(tristate, Qt::ItemIsUserTristate); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
746 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
747 | void QStandardItem::setTristate(bool tristate) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
748 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
749 | setAutoTristate(tristate); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
750 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
751 | void QStandardItem::setDragEnabled(bool dragEnabled) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
752 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
753 | QStandardItemPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
754 | d->changeFlags(dragEnabled, Qt::ItemIsDragEnabled); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
755 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
756 | void QStandardItem::setDropEnabled(bool dropEnabled) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
757 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
758 | QStandardItemPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
759 | d->changeFlags(dropEnabled, Qt::ItemIsDropEnabled); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
760 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
761 | int QStandardItem::row() const | - | ||||||||||||||||||||||||||||||||||||||||||||||||
762 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
763 | const QStandardItemPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
764 | QPair<int, int> pos = d->position(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
765 | return never executed: pos.first;return pos.first; never executed: return pos.first; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
766 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
767 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
768 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
769 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
770 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
771 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
772 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
773 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
774 | int QStandardItem::column() const | - | ||||||||||||||||||||||||||||||||||||||||||||||||
775 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
776 | const QStandardItemPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
777 | QPair<int, int> pos = d->position(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
778 | return never executed: pos.second;return pos.second; never executed: return pos.second; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
779 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
780 | QModelIndex QStandardItem::index() const | - | ||||||||||||||||||||||||||||||||||||||||||||||||
781 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
782 | const QStandardItemPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
783 | return never executed: d->modelreturn d->model ? d->model->indexFromItem(this) : QModelIndex();
never executed: return d->model ? d->model->indexFromItem(this) : QModelIndex(); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
784 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
785 | QStandardItemModel *QStandardItem::model() const | - | ||||||||||||||||||||||||||||||||||||||||||||||||
786 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
787 | const QStandardItemPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
788 | return never executed: d->model;return d->model; never executed: return d->model; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
789 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
790 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
791 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
792 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
793 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
794 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
795 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
796 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
797 | void QStandardItem::setRowCount(int rows) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
798 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
799 | int rc = rowCount(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
800 | if (rc == rows
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
801 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
802 | if (rc < rows
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
803 | insertRows(qMax(rc, 0), rows - rc); never executed: insertRows(qMax(rc, 0), rows - rc); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
804 | else | - | ||||||||||||||||||||||||||||||||||||||||||||||||
805 | removeRows(qMax(rows, 0), rc - rows); never executed: removeRows(qMax(rows, 0), rc - rows); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
806 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
807 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
808 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
809 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
810 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
811 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
812 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
813 | int QStandardItem::rowCount() const | - | ||||||||||||||||||||||||||||||||||||||||||||||||
814 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
815 | const QStandardItemPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
816 | return never executed: d->rowCount();return d->rowCount(); never executed: return d->rowCount(); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
817 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
818 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
819 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
820 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
821 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
822 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
823 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
824 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
825 | void QStandardItem::setColumnCount(int columns) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
826 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
827 | int cc = columnCount(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
828 | if (cc == columns
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
829 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
830 | if (cc < columns
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
831 | insertColumns(qMax(cc, 0), columns - cc); never executed: insertColumns(qMax(cc, 0), columns - cc); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
832 | else | - | ||||||||||||||||||||||||||||||||||||||||||||||||
833 | removeColumns(qMax(columns, 0), cc - columns); never executed: removeColumns(qMax(columns, 0), cc - columns); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
834 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
835 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
836 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
837 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
838 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
839 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
840 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
841 | int QStandardItem::columnCount() const | - | ||||||||||||||||||||||||||||||||||||||||||||||||
842 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
843 | const QStandardItemPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
844 | return never executed: d->columnCount();return d->columnCount(); never executed: return d->columnCount(); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
845 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
846 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
847 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
848 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
849 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
850 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
851 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
852 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
853 | void QStandardItem::insertRow(int row, const QList<QStandardItem*> &items) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
854 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
855 | QStandardItemPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
856 | if (row < 0
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
857 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
858 | if (columnCount() < items.count()
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
859 | setColumnCount(items.count()); never executed: setColumnCount(items.count()); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
860 | d->insertRows(row, 1, items); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
861 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
862 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
863 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
864 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
865 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
866 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
867 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
868 | void QStandardItem::insertRows(int row, const QList<QStandardItem*> &items) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
869 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
870 | QStandardItemPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
871 | if (row < 0
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
872 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
873 | d->insertRows(row, items); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
874 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
875 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
876 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
877 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
878 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
879 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
880 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
881 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
882 | void QStandardItem::insertColumn(int column, const QList<QStandardItem*> &items) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
883 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
884 | QStandardItemPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
885 | if (column < 0
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
886 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
887 | if (rowCount() < items.count()
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
888 | setRowCount(items.count()); never executed: setRowCount(items.count()); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
889 | d->insertColumns(column, 1, items); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
890 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
891 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
892 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
893 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
894 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
895 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
896 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
897 | void QStandardItem::insertRows(int row, int count) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
898 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
899 | QStandardItemPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
900 | if (rowCount() < row
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
901 | count += row - rowCount(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
902 | row = rowCount(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
903 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
904 | d->insertRows(row, count, QList<QStandardItem*>()); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
905 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
906 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
907 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
908 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
909 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
910 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
911 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
912 | void QStandardItem::insertColumns(int column, int count) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
913 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
914 | QStandardItemPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
915 | if (columnCount() < column
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
916 | count += column - columnCount(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
917 | column = columnCount(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
918 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
919 | d->insertColumns(column, count, QList<QStandardItem*>()); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
920 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
921 | void QStandardItem::removeRow(int row) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
922 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
923 | removeRows(row, 1); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
924 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
925 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
926 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
927 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
928 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
929 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
930 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
931 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
932 | void QStandardItem::removeColumn(int column) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
933 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
934 | removeColumns(column, 1); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
935 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
936 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
937 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
938 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
939 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
940 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
941 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
942 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
943 | void QStandardItem::removeRows(int row, int count) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
944 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
945 | QStandardItemPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
946 | if ((
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
947 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
948 | if (d->model
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
949 | d->model->d_func()->rowsAboutToBeRemoved(this, row, row + count - 1); never executed: d->model->d_func()->rowsAboutToBeRemoved(this, row, row + count - 1); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
950 | int i = d->childIndex(row, 0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
951 | int n = count * d->columnCount(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
952 | for (int j = i; j < n+i
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
953 | QStandardItem *oldItem = d->children.at(j); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
954 | if (oldItem
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
955 | oldItem->d_func()->setModel(0); never executed: oldItem->d_func()->setModel(0); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
956 | delete oldItem; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
957 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
958 | d->children.remove(qMax(i, 0), n); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
959 | d->rows -= count; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
960 | if (d->model
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
961 | d->model->d_func()->rowsRemoved(this, row, count); never executed: d->model->d_func()->rowsRemoved(this, row, count); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
962 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
963 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
964 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
965 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
966 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
967 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
968 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
969 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
970 | void QStandardItem::removeColumns(int column, int count) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
971 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
972 | QStandardItemPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
973 | if ((
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
974 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
975 | if (d->model
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
976 | d->model->d_func()->columnsAboutToBeRemoved(this, column, column + count - 1); never executed: d->model->d_func()->columnsAboutToBeRemoved(this, column, column + count - 1); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
977 | for (int row = d->rowCount() - 1; row >= 0
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
978 | int i = d->childIndex(row, column); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
979 | for (int j=i; j<i+count
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
980 | QStandardItem *oldItem = d->children.at(j); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
981 | if (oldItem
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
982 | oldItem->d_func()->setModel(0); never executed: oldItem->d_func()->setModel(0); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
983 | delete oldItem; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
984 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
985 | d->children.remove(i, count); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
986 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
987 | d->columns -= count; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
988 | if (d->model
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
989 | d->model->d_func()->columnsRemoved(this, column, count); never executed: d->model->d_func()->columnsRemoved(this, column, count); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
990 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
991 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
992 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
993 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
994 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
995 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
996 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
997 | bool QStandardItem::hasChildren() const | - | ||||||||||||||||||||||||||||||||||||||||||||||||
998 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
999 | return never executed: (return (rowCount() > 0) && (columnCount() > 0);
never executed: return (rowCount() > 0) && (columnCount() > 0); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1000 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1001 | void QStandardItem::setChild(int row, int column, QStandardItem *item) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1002 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1003 | QStandardItemPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1004 | d->setChild(row, column, item, true); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1005 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1006 | QStandardItem *QStandardItem::child(int row, int column) const | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1007 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1008 | const QStandardItemPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1009 | int index = d->childIndex(row, column); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1010 | if (index == -1
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1011 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1012 | return never executed: d->children.at(index);return d->children.at(index); never executed: return d->children.at(index); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1013 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1014 | QStandardItem *QStandardItem::takeChild(int row, int column) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1015 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1016 | QStandardItemPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1017 | QStandardItem *item = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1018 | int index = d->childIndex(row, column); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1019 | if (index != -1
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1020 | item = d->children.at(index); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1021 | if (item
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1022 | item->d_func()->setParentAndModel(0, 0); never executed: item->d_func()->setParentAndModel(0, 0); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1023 | d->children.replace(index, 0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1024 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1025 | return never executed: item;return item; never executed: return item; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1026 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1027 | QList<QStandardItem*> QStandardItem::takeRow(int row) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1028 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1029 | QStandardItemPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1030 | if ((
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1031 | return never executed: QList<QStandardItem*>();return QList<QStandardItem*>(); never executed: return QList<QStandardItem*>(); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1032 | if (d->model
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1033 | d->model->d_func()->rowsAboutToBeRemoved(this, row, row); never executed: d->model->d_func()->rowsAboutToBeRemoved(this, row, row); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1034 | QList<QStandardItem*> items; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1035 | int index = d->childIndex(row, 0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1036 | if (index != -1
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1037 | int col_count = d->columnCount(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1038 | items.reserve(col_count); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1039 | for (int column = 0; column < col_count
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1040 | QStandardItem *ch = d->children.at(index + column); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1041 | if (ch
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1042 | ch->d_func()->setParentAndModel(0, 0); never executed: ch->d_func()->setParentAndModel(0, 0); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1043 | items.append(ch); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1044 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1045 | d->children.remove(index, col_count); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1046 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1047 | d->rows--; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1048 | if (d->model
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1049 | d->model->d_func()->rowsRemoved(this, row, 1); never executed: d->model->d_func()->rowsRemoved(this, row, 1); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1050 | return never executed: items;return items; never executed: return items; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1051 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1052 | QList<QStandardItem*> QStandardItem::takeColumn(int column) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1053 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1054 | QStandardItemPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1055 | if ((
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1056 | return never executed: QList<QStandardItem*>();return QList<QStandardItem*>(); never executed: return QList<QStandardItem*>(); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1057 | if (d->model
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1058 | d->model->d_func()->columnsAboutToBeRemoved(this, column, column); never executed: d->model->d_func()->columnsAboutToBeRemoved(this, column, column); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1059 | QList<QStandardItem*> items; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1060 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1061 | for (int row = d->rowCount() - 1; row >= 0
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1062 | int index = d->childIndex(row, column); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1063 | QStandardItem *ch = d->children.at(index); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1064 | if (ch
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1065 | ch->d_func()->setParentAndModel(0, 0); never executed: ch->d_func()->setParentAndModel(0, 0); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1066 | d->children.remove(index); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1067 | items.prepend(ch); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1068 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1069 | d->columns--; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1070 | if (d->model
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1071 | d->model->d_func()->columnsRemoved(this, column, 1); never executed: d->model->d_func()->columnsRemoved(this, column, 1); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1072 | return never executed: items;return items; never executed: return items; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1073 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1074 | bool QStandardItem::operator<(const QStandardItem &other) const | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1075 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1076 | const int role = model()
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1077 | const QVariant l = data(role), r = other.data(role); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1078 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1079 | if (l.userType() == QVariant::Invalid
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1080 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1081 | if (r.userType() == QVariant::Invalid
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1082 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1083 | switch (l.userType()) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1084 | case never executed: QVariant::Int:case QVariant::Int: never executed: case QVariant::Int: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1085 | return never executed: l.toInt() < r.toInt();return l.toInt() < r.toInt(); never executed: return l.toInt() < r.toInt(); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1086 | case never executed: QVariant::UInt:case QVariant::UInt: never executed: case QVariant::UInt: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1087 | return never executed: l.toUInt() < r.toUInt();return l.toUInt() < r.toUInt(); never executed: return l.toUInt() < r.toUInt(); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1088 | case never executed: QVariant::LongLong:case QVariant::LongLong: never executed: case QVariant::LongLong: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1089 | return never executed: l.toLongLong() < r.toLongLong();return l.toLongLong() < r.toLongLong(); never executed: return l.toLongLong() < r.toLongLong(); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1090 | case never executed: QVariant::ULongLong:case QVariant::ULongLong: never executed: case QVariant::ULongLong: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1091 | return never executed: l.toULongLong() < r.toULongLong();return l.toULongLong() < r.toULongLong(); never executed: return l.toULongLong() < r.toULongLong(); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1092 | case never executed: QMetaType::Float:case QMetaType::Float: never executed: case QMetaType::Float: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1093 | return never executed: l.toFloat() < r.toFloat();return l.toFloat() < r.toFloat(); never executed: return l.toFloat() < r.toFloat(); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1094 | case never executed: QVariant::Double:case QVariant::Double: never executed: case QVariant::Double: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1095 | return never executed: l.toDouble() < r.toDouble();return l.toDouble() < r.toDouble(); never executed: return l.toDouble() < r.toDouble(); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1096 | case never executed: QVariant::Char:case QVariant::Char: never executed: case QVariant::Char: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1097 | return never executed: l.toChar() < r.toChar();return l.toChar() < r.toChar(); never executed: return l.toChar() < r.toChar(); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1098 | case never executed: QVariant::Date:case QVariant::Date: never executed: case QVariant::Date: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1099 | return never executed: l.toDate() < r.toDate();return l.toDate() < r.toDate(); never executed: return l.toDate() < r.toDate(); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1100 | case never executed: QVariant::Time:case QVariant::Time: never executed: case QVariant::Time: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1101 | return never executed: l.toTime() < r.toTime();return l.toTime() < r.toTime(); never executed: return l.toTime() < r.toTime(); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1102 | case never executed: QVariant::DateTime:case QVariant::DateTime: never executed: case QVariant::DateTime: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1103 | return never executed: l.toDateTime() < r.toDateTime();return l.toDateTime() < r.toDateTime(); never executed: return l.toDateTime() < r.toDateTime(); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1104 | case never executed: QVariant::String:case QVariant::String: never executed: case QVariant::String: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1105 | default never executed: :default: never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1106 | return never executed: l.toString().compare(r.toString()) < 0;return l.toString().compare(r.toString()) < 0; never executed: return l.toString().compare(r.toString()) < 0; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1107 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1108 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1109 | void QStandardItem::sortChildren(int column, Qt::SortOrder order) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1110 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1111 | QStandardItemPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1112 | if ((
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1113 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1114 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1115 | QList<QPersistentModelIndex> parents; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1116 | if (d->model
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1117 | parents << index(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1118 | d->model->layoutAboutToBeChanged(parents, QAbstractItemModel::VerticalSortHint); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1119 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1120 | d->sortChildren(column, order); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1121 | if (d->model
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1122 | d->model->layoutChanged(parents, QAbstractItemModel::VerticalSortHint); never executed: d->model->layoutChanged(parents, QAbstractItemModel::VerticalSortHint); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1123 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1124 | QStandardItem *QStandardItem::clone() const | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1125 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1126 | return never executed: new QStandardItem(*this);return new QStandardItem(*this); never executed: return new QStandardItem(*this); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1127 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1128 | int QStandardItem::type() const | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1129 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1130 | return never executed: Type;return Type; never executed: return Type; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1131 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1132 | void QStandardItem::read(QDataStream &in) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1133 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1134 | QStandardItemPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1135 | in >> d->values; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1136 | qint32 flags; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1137 | in >> flags; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1138 | setFlags(Qt::ItemFlags(flags)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1139 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1140 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1141 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1142 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1143 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1144 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1145 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1146 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1147 | void QStandardItem::write(QDataStream &out) const | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1148 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1149 | const QStandardItemPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1150 | out << d->values; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1151 | out << flags(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1152 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1153 | QDataStream &operator>>(QDataStream &in, QStandardItem &item) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1154 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1155 | item.read(in); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1156 | return never executed: in;return in; never executed: return in; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1157 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1158 | QDataStream &operator<<(QDataStream &out, const QStandardItem &item) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1159 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1160 | item.write(out); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1161 | return never executed: out;return out; never executed: return out; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1162 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1163 | QStandardItemModel::QStandardItemModel(QObject *parent) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1164 | : QAbstractItemModel(*new QStandardItemModelPrivate, parent) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1165 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1166 | QStandardItemModelPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1167 | d->init(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1168 | d->root->d_func()->setModel(this); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1169 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1170 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1171 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1172 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1173 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1174 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1175 | QStandardItemModel::QStandardItemModel(int rows, int columns, QObject *parent) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1176 | : QAbstractItemModel(*new QStandardItemModelPrivate, parent) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1177 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1178 | QStandardItemModelPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1179 | d->init(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1180 | d->root->insertColumns(0, columns); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1181 | d->columnHeaderItems.insert(0, columns, 0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1182 | d->root->insertRows(0, rows); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1183 | d->rowHeaderItems.insert(0, rows, 0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1184 | d->root->d_func()->setModel(this); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1185 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1186 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1187 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1188 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1189 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1190 | QStandardItemModel::QStandardItemModel(QStandardItemModelPrivate &dd, QObject *parent) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1191 | : QAbstractItemModel(dd, parent) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1192 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1193 | QStandardItemModelPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1194 | d->init(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1195 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1196 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1197 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1198 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1199 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1200 | QStandardItemModel::~QStandardItemModel() | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1201 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1202 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1203 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1204 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1205 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1206 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1207 | void QStandardItemModel::setItemRoleNames(const QHash<int,QByteArray> &roleNames) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1208 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1209 | QStandardItemModelPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1210 | d->roleNames = roleNames; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1211 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1212 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1213 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1214 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1215 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1216 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1217 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1218 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1219 | void QStandardItemModel::clear() | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1220 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1221 | QStandardItemModelPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1222 | beginResetModel(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1223 | d->root.reset(new QStandardItem); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1224 | d->root->d_func()->setModel(this); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1225 | qDeleteAll(d->columnHeaderItems); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1226 | d->columnHeaderItems.clear(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1227 | qDeleteAll(d->rowHeaderItems); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1228 | d->rowHeaderItems.clear(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1229 | endResetModel(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1230 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1231 | QStandardItem *QStandardItemModel::itemFromIndex(const QModelIndex &index) const | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1232 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1233 | const QStandardItemModelPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1234 | if ((
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1235 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1236 | QStandardItem *parent = static_cast<QStandardItem*>(index.internalPointer()); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1237 | if (parent == 0
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1238 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1239 | QStandardItem *item = parent->child(index.row(), index.column()); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1240 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1241 | if (item == 0
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1242 | item = d->createItem(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1243 | parent->d_func()->setChild(index.row(), index.column(), item); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1244 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1245 | return never executed: item;return item; never executed: return item; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1246 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1247 | QModelIndex QStandardItemModel::indexFromItem(const QStandardItem *item) const | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1248 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1249 | if (item
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1250 | QPair<int, int> pos = item->d_func()->position(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1251 | return never executed: createIndex(pos.first, pos.second, item->d_func()->parent);return createIndex(pos.first, pos.second, item->d_func()->parent); never executed: return createIndex(pos.first, pos.second, item->d_func()->parent); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1252 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1253 | return never executed: QModelIndex();return QModelIndex(); never executed: return QModelIndex(); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1254 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1255 | void QStandardItemModel::setRowCount(int rows) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1256 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1257 | QStandardItemModelPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1258 | d->root->setRowCount(rows); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1259 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1260 | void QStandardItemModel::setColumnCount(int columns) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1261 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1262 | QStandardItemModelPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1263 | d->root->setColumnCount(columns); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1264 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1265 | void QStandardItemModel::setItem(int row, int column, QStandardItem *item) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1266 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1267 | QStandardItemModelPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1268 | d->root->d_func()->setChild(row, column, item, true); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1269 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1270 | QStandardItem *QStandardItemModel::item(int row, int column) const | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1271 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1272 | const QStandardItemModelPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1273 | return never executed: d->root->child(row, column);return d->root->child(row, column); never executed: return d->root->child(row, column); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1274 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1275 | QStandardItem *QStandardItemModel::invisibleRootItem() const | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1276 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1277 | const QStandardItemModelPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1278 | return never executed: d->root.data();return d->root.data(); never executed: return d->root.data(); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1279 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1280 | void QStandardItemModel::setHorizontalHeaderItem(int column, QStandardItem *item) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1281 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1282 | QStandardItemModelPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1283 | if (column < 0
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1284 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1285 | if (columnCount() <= column
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1286 | setColumnCount(column + 1); never executed: setColumnCount(column + 1); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1287 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1288 | QStandardItem *oldItem = d->columnHeaderItems.at(column); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1289 | if (item == oldItem
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1290 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1291 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1292 | if (item
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1293 | if (item->model() == 0
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1294 | item->d_func()->setModel(this); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1295 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1296 | QMessageLogger(__FILE__, 2342, __PRETTY_FUNCTION__).warning("QStandardItem::setHorizontalHeaderItem: Ignoring duplicate insertion of item %p", | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1297 | item); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1298 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1299 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1300 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1301 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1302 | if (oldItem
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1303 | oldItem->d_func()->setModel(0); never executed: oldItem->d_func()->setModel(0); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1304 | delete oldItem; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1305 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1306 | d->columnHeaderItems.replace(column, item); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1307 | headerDataChanged(Qt::Horizontal, column, column); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1308 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1309 | QStandardItem *QStandardItemModel::horizontalHeaderItem(int column) const | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1310 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1311 | const QStandardItemModelPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1312 | if ((
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1313 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1314 | return never executed: d->columnHeaderItems.at(column);return d->columnHeaderItems.at(column); never executed: return d->columnHeaderItems.at(column); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1315 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1316 | void QStandardItemModel::setVerticalHeaderItem(int row, QStandardItem *item) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1317 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1318 | QStandardItemModelPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1319 | if (row < 0
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1320 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1321 | if (rowCount() <= row
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1322 | setRowCount(row + 1); never executed: setRowCount(row + 1); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1323 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1324 | QStandardItem *oldItem = d->rowHeaderItems.at(row); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1325 | if (item == oldItem
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1326 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1327 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1328 | if (item
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1329 | if (item->model() == 0
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1330 | item->d_func()->setModel(this); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1331 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1332 | QMessageLogger(__FILE__, 2398, __PRETTY_FUNCTION__).warning("QStandardItem::setVerticalHeaderItem: Ignoring duplicate insertion of item %p", | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1333 | item); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1334 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1335 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1336 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1337 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1338 | if (oldItem
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1339 | oldItem->d_func()->setModel(0); never executed: oldItem->d_func()->setModel(0); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1340 | delete oldItem; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1341 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1342 | d->rowHeaderItems.replace(row, item); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1343 | headerDataChanged(Qt::Vertical, row, row); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1344 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1345 | QStandardItem *QStandardItemModel::verticalHeaderItem(int row) const | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1346 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1347 | const QStandardItemModelPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1348 | if ((
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1349 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1350 | return never executed: d->rowHeaderItems.at(row);return d->rowHeaderItems.at(row); never executed: return d->rowHeaderItems.at(row); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1351 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1352 | void QStandardItemModel::setHorizontalHeaderLabels(const QStringList &labels) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1353 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1354 | QStandardItemModelPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1355 | if (columnCount() < labels.count()
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1356 | setColumnCount(labels.count()); never executed: setColumnCount(labels.count()); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1357 | for (int i = 0; i < labels.count()
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1358 | QStandardItem *item = horizontalHeaderItem(i); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1359 | if (!item
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1360 | item = d->createItem(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1361 | setHorizontalHeaderItem(i, item); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1362 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1363 | item->setText(labels.at(i)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1364 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1365 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1366 | void QStandardItemModel::setVerticalHeaderLabels(const QStringList &labels) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1367 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1368 | QStandardItemModelPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1369 | if (rowCount() < labels.count()
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1370 | setRowCount(labels.count()); never executed: setRowCount(labels.count()); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1371 | for (int i = 0; i < labels.count()
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1372 | QStandardItem *item = verticalHeaderItem(i); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1373 | if (!item
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1374 | item = d->createItem(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1375 | setVerticalHeaderItem(i, item); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1376 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1377 | item->setText(labels.at(i)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1378 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1379 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1380 | void QStandardItemModel::setItemPrototype(const QStandardItem *item) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1381 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1382 | QStandardItemModelPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1383 | if (d->itemPrototype != item
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1384 | delete d->itemPrototype; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1385 | d->itemPrototype = item; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1386 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1387 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1388 | const QStandardItem *QStandardItemModel::itemPrototype() const | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1389 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1390 | const QStandardItemModelPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1391 | return never executed: d->itemPrototype;return d->itemPrototype; never executed: return d->itemPrototype; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1392 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1393 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1394 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1395 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1396 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1397 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1398 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1399 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1400 | QList<QStandardItem*> QStandardItemModel::findItems(const QString &text, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1401 | Qt::MatchFlags flags, int column) const | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1402 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1403 | QModelIndexList indexes = match(index(0, column, QModelIndex()), | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1404 | Qt::DisplayRole, text, -1, flags); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1405 | QList<QStandardItem*> items; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1406 | const int numIndexes = indexes.size(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1407 | items.reserve(numIndexes); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1408 | for (int i = 0; i < numIndexes
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1409 | items.append(itemFromIndex(indexes.at(i))); never executed: items.append(itemFromIndex(indexes.at(i))); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1410 | return never executed: items;return items; never executed: return items; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1411 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1412 | void QStandardItemModel::appendRow(const QList<QStandardItem*> &items) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1413 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1414 | invisibleRootItem()->appendRow(items); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1415 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1416 | void QStandardItemModel::appendColumn(const QList<QStandardItem*> &items) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1417 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1418 | invisibleRootItem()->appendColumn(items); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1419 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1420 | void QStandardItemModel::insertRow(int row, const QList<QStandardItem*> &items) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1421 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1422 | invisibleRootItem()->insertRow(row, items); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1423 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1424 | void QStandardItemModel::insertColumn(int column, const QList<QStandardItem*> &items) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1425 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1426 | invisibleRootItem()->insertColumn(column, items); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1427 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1428 | QStandardItem *QStandardItemModel::takeItem(int row, int column) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1429 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1430 | QStandardItemModelPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1431 | return never executed: d->root->takeChild(row, column);return d->root->takeChild(row, column); never executed: return d->root->takeChild(row, column); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1432 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1433 | QList<QStandardItem*> QStandardItemModel::takeRow(int row) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1434 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1435 | QStandardItemModelPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1436 | return never executed: d->root->takeRow(row);return d->root->takeRow(row); never executed: return d->root->takeRow(row); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1437 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1438 | QList<QStandardItem*> QStandardItemModel::takeColumn(int column) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1439 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1440 | QStandardItemModelPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1441 | return never executed: d->root->takeColumn(column);return d->root->takeColumn(column); never executed: return d->root->takeColumn(column); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1442 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1443 | QStandardItem *QStandardItemModel::takeHorizontalHeaderItem(int column) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1444 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1445 | QStandardItemModelPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1446 | if ((
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1447 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1448 | QStandardItem *headerItem = d->columnHeaderItems.at(column); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1449 | if (headerItem
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1450 | headerItem->d_func()->setParentAndModel(0, 0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1451 | d->columnHeaderItems.replace(column, 0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1452 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1453 | return never executed: headerItem;return headerItem; never executed: return headerItem; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1454 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1455 | QStandardItem *QStandardItemModel::takeVerticalHeaderItem(int row) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1456 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1457 | QStandardItemModelPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1458 | if ((
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1459 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1460 | QStandardItem *headerItem = d->rowHeaderItems.at(row); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1461 | if (headerItem
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1462 | headerItem->d_func()->setParentAndModel(0, 0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1463 | d->rowHeaderItems.replace(row, 0); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1464 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1465 | return never executed: headerItem;return headerItem; never executed: return headerItem; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1466 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1467 | int QStandardItemModel::sortRole() const | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1468 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1469 | const QStandardItemModelPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1470 | return never executed: d->sortRole;return d->sortRole; never executed: return d->sortRole; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1471 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1472 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1473 | void QStandardItemModel::setSortRole(int role) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1474 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1475 | QStandardItemModelPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1476 | d->sortRole = role; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1477 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1478 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1479 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1480 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1481 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1482 | int QStandardItemModel::columnCount(const QModelIndex &parent) const | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1483 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1484 | const QStandardItemModelPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1485 | QStandardItem *item = d->itemFromIndex(parent); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1486 | return never executed: itemreturn item ? item->columnCount() : 0;
never executed: return item ? item->columnCount() : 0; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1487 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1488 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1489 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1490 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1491 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1492 | QVariant QStandardItemModel::data(const QModelIndex &index, int role) const | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1493 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1494 | const QStandardItemModelPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1495 | QStandardItem *item = d->itemFromIndex(index); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1496 | return never executed: itemreturn item ? item->data(role) : QVariant();
never executed: return item ? item->data(role) : QVariant(); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1497 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1498 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1499 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1500 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1501 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1502 | Qt::ItemFlags QStandardItemModel::flags(const QModelIndex &index) const | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1503 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1504 | const QStandardItemModelPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1505 | if (!d->indexValid(index)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1506 | return never executed: d->root->flags();return d->root->flags(); never executed: return d->root->flags(); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1507 | QStandardItem *item = d->itemFromIndex(index); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1508 | if (item
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1509 | return never executed: item->flags();return item->flags(); never executed: return item->flags(); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1510 | return never executed: Qt::ItemIsSelectablereturn Qt::ItemIsSelectable |Qt::ItemIsEnabled |Qt::ItemIsEditable |Qt::ItemIsDragEnabled |Qt::ItemIsDropEnabled; never executed: return Qt::ItemIsSelectable |Qt::ItemIsEnabled |Qt::ItemIsEditable |Qt::ItemIsDragEnabled |Qt::ItemIsDropEnabled; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1511 | |Qt::ItemIsEnabled never executed: return Qt::ItemIsSelectable |Qt::ItemIsEnabled |Qt::ItemIsEditable |Qt::ItemIsDragEnabled |Qt::ItemIsDropEnabled; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1512 | |Qt::ItemIsEditable never executed: return Qt::ItemIsSelectable |Qt::ItemIsEnabled |Qt::ItemIsEditable |Qt::ItemIsDragEnabled |Qt::ItemIsDropEnabled; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1513 | |Qt::ItemIsDragEnabled never executed: return Qt::ItemIsSelectable |Qt::ItemIsEnabled |Qt::ItemIsEditable |Qt::ItemIsDragEnabled |Qt::ItemIsDropEnabled; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1514 | |Qt::ItemIsDropEnabled; never executed: return Qt::ItemIsSelectable |Qt::ItemIsEnabled |Qt::ItemIsEditable |Qt::ItemIsDragEnabled |Qt::ItemIsDropEnabled; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1515 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1516 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1517 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1518 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1519 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1520 | bool QStandardItemModel::hasChildren(const QModelIndex &parent) const | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1521 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1522 | const QStandardItemModelPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1523 | QStandardItem *item = d->itemFromIndex(parent); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1524 | return never executed: itemreturn item ? item->hasChildren() : false;
never executed: return item ? item->hasChildren() : false; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1525 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1526 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1527 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1528 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1529 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1530 | QModelIndex QStandardItemModel::sibling(int row, int column, const QModelIndex &idx) const | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1531 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1532 | return never executed: QAbstractItemModel::sibling(row, column, idx);return QAbstractItemModel::sibling(row, column, idx); never executed: return QAbstractItemModel::sibling(row, column, idx); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1533 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1534 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1535 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1536 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1537 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1538 | QVariant QStandardItemModel::headerData(int section, Qt::Orientation orientation, int role) const | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1539 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1540 | const QStandardItemModelPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1541 | if ((
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1542 | || ((
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1543 | || ((
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1544 | return never executed: QVariant();return QVariant(); never executed: return QVariant(); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1545 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1546 | QStandardItem *headerItem = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1547 | if (orientation == Qt::Horizontal
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1548 | headerItem = d->columnHeaderItems.at(section); never executed: headerItem = d->columnHeaderItems.at(section); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1549 | else if (orientation == Qt::Vertical
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1550 | headerItem = d->rowHeaderItems.at(section); never executed: headerItem = d->rowHeaderItems.at(section); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1551 | return never executed: headerItemreturn headerItem ? headerItem->data(role) : QAbstractItemModel::headerData(section, orientation, role);
never executed: return headerItem ? headerItem->data(role) : QAbstractItemModel::headerData(section, orientation, role); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1552 | : QAbstractItemModel::headerData(section, orientation, role); never executed: return headerItem ? headerItem->data(role) : QAbstractItemModel::headerData(section, orientation, role); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1553 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1554 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1555 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1556 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1557 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1558 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1559 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1560 | Qt::DropActions QStandardItemModel::supportedDropActions () const | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1561 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1562 | return never executed: Qt::CopyAction | Qt::MoveAction;return Qt::CopyAction | Qt::MoveAction; never executed: return Qt::CopyAction | Qt::MoveAction; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1563 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1564 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1565 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1566 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1567 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1568 | QModelIndex QStandardItemModel::index(int row, int column, const QModelIndex &parent) const | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1569 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1570 | const QStandardItemModelPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1571 | QStandardItem *parentItem = d->itemFromIndex(parent); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1572 | if ((
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1573 | || (
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1574 | || (
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1575 | || (
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1576 | || (
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1577 | return never executed: QModelIndex();return QModelIndex(); never executed: return QModelIndex(); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1578 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1579 | return never executed: createIndex(row, column, parentItem);return createIndex(row, column, parentItem); never executed: return createIndex(row, column, parentItem); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1580 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1581 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1582 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1583 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1584 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1585 | bool QStandardItemModel::insertColumns(int column, int count, const QModelIndex &parent) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1586 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1587 | QStandardItemModelPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1588 | QStandardItem *item = parent.isValid()
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1589 | if (item == 0
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1590 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1591 | return never executed: item->d_func()->insertColumns(column, count, QList<QStandardItem*>());return item->d_func()->insertColumns(column, count, QList<QStandardItem*>()); never executed: return item->d_func()->insertColumns(column, count, QList<QStandardItem*>()); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1592 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1593 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1594 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1595 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1596 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1597 | bool QStandardItemModel::insertRows(int row, int count, const QModelIndex &parent) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1598 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1599 | QStandardItemModelPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1600 | QStandardItem *item = parent.isValid()
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1601 | if (item == 0
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1602 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1603 | return never executed: item->d_func()->insertRows(row, count, QList<QStandardItem*>());return item->d_func()->insertRows(row, count, QList<QStandardItem*>()); never executed: return item->d_func()->insertRows(row, count, QList<QStandardItem*>()); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1604 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1605 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1606 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1607 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1608 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1609 | QMap<int, QVariant> QStandardItemModel::itemData(const QModelIndex &index) const | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1610 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1611 | const QStandardItemModelPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1612 | QStandardItem *item = d->itemFromIndex(index); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1613 | return never executed: itemreturn item ? item->d_func()->itemData() : QMap<int, QVariant>();
never executed: return item ? item->d_func()->itemData() : QMap<int, QVariant>(); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1614 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1615 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1616 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1617 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1618 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1619 | QModelIndex QStandardItemModel::parent(const QModelIndex &child) const | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1620 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1621 | const QStandardItemModelPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1622 | if (!d->indexValid(child)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1623 | return never executed: QModelIndex();return QModelIndex(); never executed: return QModelIndex(); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1624 | QStandardItem *parentItem = static_cast<QStandardItem*>(child.internalPointer()); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1625 | return never executed: indexFromItem(parentItem);return indexFromItem(parentItem); never executed: return indexFromItem(parentItem); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1626 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1627 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1628 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1629 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1630 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1631 | bool QStandardItemModel::removeColumns(int column, int count, const QModelIndex &parent) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1632 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1633 | QStandardItemModelPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1634 | QStandardItem *item = d->itemFromIndex(parent); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1635 | if ((
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1636 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1637 | item->removeColumns(column, count); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1638 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1639 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1640 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1641 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1642 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1643 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1644 | bool QStandardItemModel::removeRows(int row, int count, const QModelIndex &parent) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1645 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1646 | QStandardItemModelPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1647 | QStandardItem *item = d->itemFromIndex(parent); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1648 | if ((
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1649 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1650 | item->removeRows(row, count); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1651 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1652 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1653 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1654 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1655 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1656 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1657 | int QStandardItemModel::rowCount(const QModelIndex &parent) const | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1658 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1659 | const QStandardItemModelPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1660 | QStandardItem *item = d->itemFromIndex(parent); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1661 | return never executed: itemreturn item ? item->rowCount() : 0;
never executed: return item ? item->rowCount() : 0; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1662 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1663 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1664 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1665 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1666 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1667 | bool QStandardItemModel::setData(const QModelIndex &index, const QVariant &value, int role) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1668 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1669 | if (!index.isValid()
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1670 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1671 | QStandardItem *item = itemFromIndex(index); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1672 | if (item == 0
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1673 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1674 | item->setData(value, role); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1675 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1676 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1677 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1678 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1679 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1680 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1681 | bool QStandardItemModel::setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1682 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1683 | QStandardItemModelPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1684 | if ((
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1685 | || ((
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1686 | || ((
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1687 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1688 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1689 | QStandardItem *headerItem = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1690 | if (orientation == Qt::Horizontal
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1691 | headerItem = d->columnHeaderItems.at(section); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1692 | if (headerItem == 0
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1693 | headerItem = d->createItem(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1694 | headerItem->d_func()->setModel(this); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1695 | d->columnHeaderItems.replace(section, headerItem); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1696 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1697 | } never executed: else if (orientation == Qt::Verticalend of block
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1698 | headerItem = d->rowHeaderItems.at(section); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1699 | if (headerItem == 0
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1700 | headerItem = d->createItem(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1701 | headerItem->d_func()->setModel(this); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1702 | d->rowHeaderItems.replace(section, headerItem); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1703 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1704 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1705 | if (headerItem
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1706 | headerItem->setData(value, role); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1707 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1708 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1709 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1710 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1711 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1712 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1713 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1714 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1715 | bool QStandardItemModel::setItemData(const QModelIndex &index, const QMap<int, QVariant> &roles) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1716 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1717 | QStandardItem *item = itemFromIndex(index); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1718 | if (item == 0
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1719 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1720 | item->d_func()->setItemData(roles); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1721 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1722 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1723 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1724 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1725 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1726 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1727 | void QStandardItemModel::sort(int column, Qt::SortOrder order) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1728 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1729 | QStandardItemModelPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1730 | d->root->sortChildren(column, order); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1731 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1732 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1733 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1734 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1735 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1736 | QStringList QStandardItemModel::mimeTypes() const | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1737 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1738 | return never executed: QAbstractItemModel::mimeTypes() << QLatin1String("application/x-qstandarditemmodeldatalist");return QAbstractItemModel::mimeTypes() << QLatin1String("application/x-qstandarditemmodeldatalist"); never executed: return QAbstractItemModel::mimeTypes() << QLatin1String("application/x-qstandarditemmodeldatalist"); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1739 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1740 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1741 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1742 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1743 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1744 | QMimeData *QStandardItemModel::mimeData(const QModelIndexList &indexes) const | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1745 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1746 | QMimeData *data = QAbstractItemModel::mimeData(indexes); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1747 | if(!data
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1748 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1749 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1750 | QString format = QLatin1String("application/x-qstandarditemmodeldatalist"); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1751 | if (!mimeTypes().contains(format)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1752 | return never executed: data;return data; never executed: return data; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1753 | QByteArray encoded; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1754 | QDataStream stream(&encoded, QIODevice::WriteOnly); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1755 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1756 | QSet<QStandardItem*> itemsSet; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1757 | QStack<QStandardItem*> stack; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1758 | itemsSet.reserve(indexes.count()); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1759 | stack.reserve(indexes.count()); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1760 | for (int i = 0; i < indexes.count()
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1761 | if (QStandardItem *item = itemFromIndex(indexes.at(i))
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1762 | itemsSet << item; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1763 | stack.push(item); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1764 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1765 | QMessageLogger(__FILE__, 3002, __PRETTY_FUNCTION__).warning() << "QStandardItemModel::mimeData: No item associated with invalid index"; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1766 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1767 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1768 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1769 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1770 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1771 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1772 | QSet<QStandardItem *> seen; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1773 | while (!stack.isEmpty()
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1774 | QStandardItem *itm = stack.pop(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1775 | if (seen.contains(itm)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1776 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1777 | seen.insert(itm); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1778 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1779 | const QVector<QStandardItem*> &childList = itm->d_func()->children; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1780 | for (int i = 0; i < childList.count()
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1781 | QStandardItem *chi = childList.at(i); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1782 | if (chi
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1783 | QSet<QStandardItem *>::iterator it = itemsSet.find(chi); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1784 | if (it != itemsSet.end()
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1785 | itemsSet.erase(it); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1786 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1787 | stack.push(chi); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1788 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1789 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1790 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1791 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1792 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1793 | stack.reserve(itemsSet.count()); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1794 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(itemsSet)>::type> _container_((itemsSet)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QStandardItem *item = *_container_.i; _container_.control; _container_.control = 0) { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1795 | stack.push(item); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1796 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1797 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1798 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1799 | while (!stack.isEmpty()
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1800 | QStandardItem *item = stack.pop(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1801 | if (itemsSet.contains(item)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1802 | stream << item->row() << item->column(); never executed: stream << item->row() << item->column(); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1803 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1804 | stream << *item << item->columnCount() << item->d_ptr->children.count(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1805 | stack += item->d_ptr->children; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1806 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1807 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1808 | data->setData(format, encoded); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1809 | return never executed: data;return data; never executed: return data; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1810 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1811 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1812 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1813 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1814 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1815 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1816 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1817 | void QStandardItemModelPrivate::decodeDataRecursive(QDataStream &stream, QStandardItem *item) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1818 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1819 | int colCount, childCount; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1820 | stream >> *item; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1821 | stream >> colCount >> childCount; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1822 | item->setColumnCount(colCount); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1823 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1824 | int childPos = childCount; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1825 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1826 | while(childPos > 0
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1827 | childPos--; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1828 | QStandardItem *child = createItem(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1829 | decodeDataRecursive(stream, child); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1830 | item->setChild( childPos / colCount, childPos % colCount, child); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1831 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1832 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1833 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1834 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1835 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1836 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1837 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1838 | bool QStandardItemModel::dropMimeData(const QMimeData *data, Qt::DropAction action, | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1839 | int row, int column, const QModelIndex &parent) | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1840 | { | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1841 | QStandardItemModelPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1842 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1843 | if (!data
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1844 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1845 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1846 | QString format = QLatin1String("application/x-qstandarditemmodeldatalist"); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1847 | if (!data->hasFormat(format)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1848 | return never executed: QAbstractItemModel::dropMimeData(data, action, row, column, parent);return QAbstractItemModel::dropMimeData(data, action, row, column, parent); never executed: return QAbstractItemModel::dropMimeData(data, action, row, column, parent); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1849 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1850 | if (row > rowCount(parent)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1851 | row = rowCount(parent); never executed: row = rowCount(parent); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1852 | if (row == -1
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1853 | row = rowCount(parent); never executed: row = rowCount(parent); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1854 | if (column == -1
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1855 | column = 0; never executed: column = 0; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1856 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1857 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1858 | QByteArray encoded = data->data(format); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1859 | QDataStream stream(&encoded, QIODevice::ReadOnly); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1860 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1861 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1862 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1863 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1864 | int top = 2147483647; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1865 | int left = 2147483647; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1866 | int bottom = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1867 | int right = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1868 | QVector<int> rows, columns; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1869 | QVector<QStandardItem *> items; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1870 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1871 | while (!stream.atEnd()
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1872 | int r, c; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1873 | QStandardItem *item = d->createItem(); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1874 | stream >> r >> c; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1875 | d->decodeDataRecursive(stream, item); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1876 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1877 | rows.append(r); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1878 | columns.append(c); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1879 | items.append(item); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1880 | top = qMin(r, top); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1881 | left = qMin(c, left); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1882 | bottom = qMax(r, bottom); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1883 | right = qMax(c, right); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1884 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1885 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1886 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1887 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1888 | int dragRowCount = 0; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1889 | int dragColumnCount = right - left + 1; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1890 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1891 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1892 | QVector<int> rowsToInsert(bottom + 1); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1893 | for (int i = 0; i < rows.count()
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1894 | rowsToInsert[rows.at(i)] = 1; never executed: rowsToInsert[rows.at(i)] = 1; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1895 | for (int i = 0; i < rowsToInsert.count()
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1896 | if (rowsToInsert[i] == 1
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1897 | rowsToInsert[i] = dragRowCount; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1898 | ++dragRowCount; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1899 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1900 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1901 | for (int i = 0; i < rows.count()
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1902 | rows[i] = top + rowsToInsert[rows[i]]; never executed: rows[i] = top + rowsToInsert[rows[i]]; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1903 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1904 | QBitArray isWrittenTo(dragRowCount * dragColumnCount); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1905 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1906 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1907 | int colCount = columnCount(parent); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1908 | if (colCount < dragColumnCount + column
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1909 | insertColumns(colCount, dragColumnCount + column - colCount, parent); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1910 | colCount = columnCount(parent); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1911 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1912 | insertRows(row, dragRowCount, parent); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1913 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1914 | row = qMax(0, row); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1915 | column = qMax(0, column); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1916 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1917 | QStandardItem *parentItem = itemFromIndex (parent); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1918 | if (!parentItem
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1919 | parentItem = invisibleRootItem(); never executed: parentItem = invisibleRootItem(); | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1920 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1921 | QVector<QPersistentModelIndex> newIndexes(items.size()); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1922 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1923 | for (int j = 0; j < items.size()
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1924 | int relativeRow = rows.at(j) - top; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1925 | int relativeColumn = columns.at(j) - left; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1926 | int destinationRow = relativeRow + row; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1927 | int destinationColumn = relativeColumn + column; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1928 | int flat = (relativeRow * dragColumnCount) + relativeColumn; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1929 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1930 | if (destinationColumn >= colCount
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1931 | destinationColumn = qBound(column, destinationColumn, colCount - 1); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1932 | destinationRow = row + dragRowCount; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1933 | insertRows(row + dragRowCount, 1, parent); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1934 | flat = (dragRowCount * dragColumnCount) + relativeColumn; | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1935 | isWrittenTo.resize(++dragRowCount * dragColumnCount); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1936 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1937 | if (!isWrittenTo.testBit(flat)
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1938 | newIndexes[j] = index(destinationRow, destinationColumn, parentItem->index()); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1939 | isWrittenTo.setBit(flat); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1940 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1941 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1942 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1943 | for(int k = 0; k < newIndexes.size()
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1944 | if (newIndexes.at(k).isValid()
| 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1945 | parentItem->setChild(newIndexes.at(k).row(), newIndexes.at(k).column(), items.at(k)); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1946 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1947 | delete items.at(k); | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1948 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1949 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1950 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1951 | return never executed: true;return true; never executed: return true; | 0 | ||||||||||||||||||||||||||||||||||||||||||||||||
1952 | } | - | ||||||||||||||||||||||||||||||||||||||||||||||||
1953 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1954 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
1955 | - | |||||||||||||||||||||||||||||||||||||||||||||||||
Switch to Source code | Preprocessed file |