Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | | - |
7 | class QDataWidgetMapperPrivate: public QObjectPrivate | - |
8 | { | - |
9 | public: | - |
10 | inline QDataWidgetMapper* q_func() { return static_cast<QDataWidgetMapper *>(q_ptr); } inline const QDataWidgetMapper* q_func() const { return static_cast<const QDataWidgetMapper *>(q_ptr); } friend class QDataWidgetMapper; | - |
11 | | - |
12 | QDataWidgetMapperPrivate() | - |
13 | : model(QAbstractItemModelPrivate::staticEmptyModel()), delegate(0), | - |
14 | orientation(Qt::Horizontal), submitPolicy(QDataWidgetMapper::AutoSubmit) | - |
15 | { | - |
16 | } executed: } Execution Count:9 | 9 |
17 | | - |
18 | QAbstractItemModel *model; | - |
19 | QAbstractItemDelegate *delegate; | - |
20 | Qt::Orientation orientation; | - |
21 | QDataWidgetMapper::SubmitPolicy submitPolicy; | - |
22 | QPersistentModelIndex rootIndex; | - |
23 | QPersistentModelIndex currentTopLeft; | - |
24 | | - |
25 | inline int itemCount() | - |
26 | { | - |
27 | return orientation == Qt::Horizontal | 32 |
28 | ? model->rowCount(rootIndex) | 32 |
29 | : model->columnCount(rootIndex); executed: return orientation == Qt::Horizontal ? model->rowCount(rootIndex) : model->columnCount(rootIndex); Execution Count:32 | 32 |
30 | } | - |
31 | | - |
32 | inline int currentIdx() const | - |
33 | { | - |
34 | return orientation == Qt::Horizontal ? currentTopLeft.row() : currentTopLeft.column(); executed: return orientation == Qt::Horizontal ? currentTopLeft.row() : currentTopLeft.column(); Execution Count:85 | 85 |
35 | } | - |
36 | | - |
37 | inline QModelIndex indexAt(int itemPos) | - |
38 | { | - |
39 | return orientation == Qt::Horizontal | 78 |
40 | ? model->index(currentIdx(), itemPos, rootIndex) | 78 |
41 | : model->index(itemPos, currentIdx(), rootIndex); executed: return orientation == Qt::Horizontal ? model->index(currentIdx(), itemPos, rootIndex) : model->index(itemPos, currentIdx(), rootIndex); Execution Count:78 | 78 |
42 | } | - |
43 | | - |
44 | inline void flipEventFilters(QAbstractItemDelegate *oldDelegate, | - |
45 | QAbstractItemDelegate *newDelegate) | - |
46 | { | - |
47 | for (int i = 0; i < widgetMap.count(); ++i) { partially evaluated: i < widgetMap.count() no Evaluation Count:0 | yes Evaluation Count:9 |
| 0-9 |
48 | QWidget *w = widgetMap.at(i).widget; | - |
49 | if (!w) | 0 |
50 | continue; never executed: continue; | 0 |
51 | w->removeEventFilter(oldDelegate); | - |
52 | w->installEventFilter(newDelegate); | - |
53 | } | 0 |
54 | } executed: } Execution Count:9 | 9 |
55 | | - |
56 | void populate(); | - |
57 | | - |
58 | | - |
59 | void _q_dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &); | - |
60 | void _q_commitData(QWidget *); | - |
61 | void _q_closeEditor(QWidget *, QAbstractItemDelegate::EndEditHint); | - |
62 | void _q_modelDestroyed(); | - |
63 | | - |
64 | struct WidgetMapper | - |
65 | { | - |
66 | inline WidgetMapper(QWidget *w = 0, int c = 0, const QModelIndex &i = QModelIndex()) | - |
67 | : widget(w), section(c), currentIndex(i) {} executed: } Execution Count:15 | 15 |
68 | inline WidgetMapper(QWidget *w, int c, const QModelIndex &i, const QByteArray &p) | - |
69 | : widget(w), section(c), currentIndex(i), property(p) {} executed: } Execution Count:4 | 4 |
70 | | - |
71 | QPointer<QWidget> widget; | - |
72 | int section; | - |
73 | QPersistentModelIndex currentIndex; | - |
74 | QByteArray property; | - |
75 | }; | - |
76 | | - |
77 | void populate(WidgetMapper &m); | - |
78 | int findWidget(QWidget *w) const; | - |
79 | | - |
80 | bool commit(const WidgetMapper &m); | - |
81 | | - |
82 | QList<WidgetMapper> widgetMap; | - |
83 | }; | - |
84 | | - |
85 | int QDataWidgetMapperPrivate::findWidget(QWidget *w) const | - |
86 | { | - |
87 | for (int i = 0; i < widgetMap.count(); ++i) { evaluated: i < widgetMap.count() yes Evaluation Count:17 | yes Evaluation Count:17 |
| 17 |
88 | if (widgetMap.at(i).widget == w) evaluated: widgetMap.at(i).widget == w yes Evaluation Count:4 | yes Evaluation Count:13 |
| 4-13 |
89 | return i; executed: return i; Execution Count:4 | 4 |
90 | } executed: } Execution Count:13 | 13 |
91 | return -1; executed: return -1; Execution Count:17 | 17 |
92 | } | - |
93 | | - |
94 | bool QDataWidgetMapperPrivate::commit(const WidgetMapper &m) | - |
95 | { | - |
96 | if (m.widget.isNull()) partially evaluated: m.widget.isNull() no Evaluation Count:0 | yes Evaluation Count:14 |
| 0-14 |
97 | return true; never executed: return true; | 0 |
98 | | - |
99 | if (!m.currentIndex.isValid()) partially evaluated: !m.currentIndex.isValid() no Evaluation Count:0 | yes Evaluation Count:14 |
| 0-14 |
100 | return false; never executed: return false; | 0 |
101 | | - |
102 | | - |
103 | QModelIndex idx = m.currentIndex; | - |
104 | if (m.property.isEmpty()) evaluated: m.property.isEmpty() yes Evaluation Count:10 | yes Evaluation Count:4 |
| 4-10 |
105 | delegate->setModelData(m.widget, model, idx); executed: delegate->setModelData(m.widget, model, idx); Execution Count:10 | 10 |
106 | else | - |
107 | model->setData(idx, m.widget->property(m.property), Qt::EditRole); executed: model->setData(idx, m.widget->property(m.property), Qt::EditRole); Execution Count:4 | 4 |
108 | | - |
109 | return true; executed: return true; Execution Count:14 | 14 |
110 | } | - |
111 | | - |
112 | void QDataWidgetMapperPrivate::populate(WidgetMapper &m) | - |
113 | { | - |
114 | if (m.widget.isNull()) evaluated: m.widget.isNull() yes Evaluation Count:1 | yes Evaluation Count:59 |
| 1-59 |
115 | return; executed: return; Execution Count:1 | 1 |
116 | | - |
117 | m.currentIndex = indexAt(m.section); | - |
118 | if (m.property.isEmpty()) evaluated: m.property.isEmpty() yes Evaluation Count:48 | yes Evaluation Count:11 |
| 11-48 |
119 | delegate->setEditorData(m.widget, m.currentIndex); executed: delegate->setEditorData(m.widget, m.currentIndex); Execution Count:48 | 48 |
120 | else | - |
121 | m.widget->setProperty(m.property, m.currentIndex.data(Qt::EditRole)); executed: m.widget->setProperty(m.property, m.currentIndex.data(Qt::EditRole)); Execution Count:11 | 11 |
122 | } | - |
123 | | - |
124 | void QDataWidgetMapperPrivate::populate() | - |
125 | { | - |
126 | for (int i = 0; i < widgetMap.count(); ++i) evaluated: i < widgetMap.count() yes Evaluation Count:46 | yes Evaluation Count:25 |
| 25-46 |
127 | populate(widgetMap[i]); executed: populate(widgetMap[i]); Execution Count:46 | 46 |
128 | } executed: } Execution Count:25 | 25 |
129 | | - |
130 | static bool qContainsIndex(const QModelIndex &idx, const QModelIndex &topLeft, | - |
131 | const QModelIndex &bottomRight) | - |
132 | { | - |
133 | return idx.row() >= topLeft.row() && idx.row() <= bottomRight.row() | 28 |
134 | && idx.column() >= topLeft.column() && idx.column() <= bottomRight.column(); executed: return idx.row() >= topLeft.row() && idx.row() <= bottomRight.row() && idx.column() >= topLeft.column() && idx.column() <= bottomRight.column(); Execution Count:28 | 28 |
135 | } | - |
136 | | - |
137 | void QDataWidgetMapperPrivate::_q_dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &) | - |
138 | { | - |
139 | if (topLeft.parent() != rootIndex) partially evaluated: topLeft.parent() != rootIndex no Evaluation Count:0 | yes Evaluation Count:11 |
| 0-11 |
140 | return; | 0 |
141 | | - |
142 | for (int i = 0; i < widgetMap.count(); ++i) { evaluated: i < widgetMap.count() yes Evaluation Count:28 | yes Evaluation Count:11 |
| 11-28 |
143 | WidgetMapper &m = widgetMap[i]; | - |
144 | if (qContainsIndex(m.currentIndex, topLeft, bottomRight)) evaluated: qContainsIndex(m.currentIndex, topLeft, bottomRight) yes Evaluation Count:14 | yes Evaluation Count:14 |
| 14 |
145 | populate(m); executed: populate(m); Execution Count:14 | 14 |
146 | } executed: } Execution Count:28 | 28 |
147 | } executed: } Execution Count:11 | 11 |
148 | | - |
149 | void QDataWidgetMapperPrivate::_q_commitData(QWidget *w) | - |
150 | { | - |
151 | if (submitPolicy == QDataWidgetMapper::ManualSubmit) never evaluated: submitPolicy == QDataWidgetMapper::ManualSubmit | 0 |
152 | return; | 0 |
153 | | - |
154 | int idx = findWidget(w); | - |
155 | if (idx == -1) never evaluated: idx == -1 | 0 |
156 | return; | 0 |
157 | | - |
158 | commit(widgetMap.at(idx)); | - |
159 | } | 0 |
160 | | - |
161 | class QFocusHelper: public QWidget | - |
162 | { | - |
163 | public: | - |
164 | bool focusNextPrevChild(bool next) | - |
165 | { | - |
166 | return QWidget::focusNextPrevChild(next); never executed: return QWidget::focusNextPrevChild(next); | 0 |
167 | } | - |
168 | | - |
169 | static inline void focusNextPrevChild(QWidget *w, bool next) | - |
170 | { | - |
171 | static_cast<QFocusHelper *>(w)->focusNextPrevChild(next); | - |
172 | } | 0 |
173 | }; | - |
174 | | - |
175 | void QDataWidgetMapperPrivate::_q_closeEditor(QWidget *w, QAbstractItemDelegate::EndEditHint hint) | - |
176 | { | - |
177 | int idx = findWidget(w); | - |
178 | if (idx == -1) never evaluated: idx == -1 | 0 |
179 | return; | 0 |
180 | | - |
181 | switch (hint) { | - |
182 | case QAbstractItemDelegate::RevertModelCache: { | - |
183 | populate(widgetMap[idx]); | - |
184 | break; } | 0 |
185 | case QAbstractItemDelegate::EditNextItem: | - |
186 | QFocusHelper::focusNextPrevChild(w, true); | - |
187 | break; | 0 |
188 | case QAbstractItemDelegate::EditPreviousItem: | - |
189 | QFocusHelper::focusNextPrevChild(w, false); | - |
190 | break; | 0 |
191 | case QAbstractItemDelegate::SubmitModelCache: | - |
192 | case QAbstractItemDelegate::NoHint: | - |
193 | | - |
194 | break; | 0 |
195 | } | - |
196 | } | 0 |
197 | | - |
198 | void QDataWidgetMapperPrivate::_q_modelDestroyed() | - |
199 | { | - |
200 | QDataWidgetMapper * const q = q_func(); | - |
201 | | - |
202 | model = 0; | - |
203 | q->setModel(QAbstractItemModelPrivate::staticEmptyModel()); | - |
204 | } executed: } Execution Count:1 | 1 |
205 | QDataWidgetMapper::QDataWidgetMapper(QObject *parent) | - |
206 | : QObject(*new QDataWidgetMapperPrivate, parent) | - |
207 | { | - |
208 | setItemDelegate(new QItemDelegate(this)); | - |
209 | } executed: } Execution Count:9 | 9 |
210 | | - |
211 | | - |
212 | | - |
213 | | - |
214 | QDataWidgetMapper::~QDataWidgetMapper() | - |
215 | { | - |
216 | } | - |
217 | | - |
218 | | - |
219 | | - |
220 | | - |
221 | | - |
222 | | - |
223 | | - |
224 | void QDataWidgetMapper::setModel(QAbstractItemModel *model) | - |
225 | { | - |
226 | QDataWidgetMapperPrivate * const d = d_func(); | - |
227 | | - |
228 | if (d->model == model) partially evaluated: d->model == model no Evaluation Count:0 | yes Evaluation Count:10 |
| 0-10 |
229 | return; | 0 |
230 | | - |
231 | if (d->model) { evaluated: d->model yes Evaluation Count:9 | yes Evaluation Count:1 |
| 1-9 |
232 | disconnect(d->model, "2""dataChanged(QModelIndex,QModelIndex,QVector<int>)", this, | - |
233 | "1""_q_dataChanged(QModelIndex,QModelIndex,QVector<int>)"); | - |
234 | disconnect(d->model, "2""destroyed()", this, | - |
235 | "1""_q_modelDestroyed()"); | - |
236 | } executed: } Execution Count:9 | 9 |
237 | clearMapping(); | - |
238 | d->rootIndex = QModelIndex(); | - |
239 | d->currentTopLeft = QModelIndex(); | - |
240 | | - |
241 | d->model = model; | - |
242 | | - |
243 | connect(model, "2""dataChanged(QModelIndex,QModelIndex,QVector<int>)", | - |
244 | "1""_q_dataChanged(QModelIndex,QModelIndex,QVector<int>)"); | - |
245 | connect(model, "2""destroyed()", "1""_q_modelDestroyed()"); | - |
246 | } executed: } Execution Count:10 | 10 |
247 | | - |
248 | | - |
249 | | - |
250 | | - |
251 | | - |
252 | | - |
253 | QAbstractItemModel *QDataWidgetMapper::model() const | - |
254 | { | - |
255 | const QDataWidgetMapperPrivate * const d = d_func(); | - |
256 | return d->model == QAbstractItemModelPrivate::staticEmptyModel() | 3 |
257 | ? static_cast<QAbstractItemModel *>(0) | 3 |
258 | : d->model; executed: return d->model == QAbstractItemModelPrivate::staticEmptyModel() ? static_cast<QAbstractItemModel *>(0) : d->model; Execution Count:3 | 3 |
259 | } | - |
260 | void QDataWidgetMapper::setItemDelegate(QAbstractItemDelegate *delegate) | - |
261 | { | - |
262 | QDataWidgetMapperPrivate * const d = d_func(); | - |
263 | QAbstractItemDelegate *oldDelegate = d->delegate; | - |
264 | if (oldDelegate) { partially evaluated: oldDelegate no Evaluation Count:0 | yes Evaluation Count:9 |
| 0-9 |
265 | disconnect(oldDelegate, "2""commitData(QWidget*)", this, "1""_q_commitData(QWidget*)"); | - |
266 | disconnect(oldDelegate, "2""closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)", | - |
267 | this, "1""_q_closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)"); | - |
268 | } | 0 |
269 | | - |
270 | d->delegate = delegate; | - |
271 | | - |
272 | if (delegate) { partially evaluated: delegate yes Evaluation Count:9 | no Evaluation Count:0 |
| 0-9 |
273 | connect(delegate, "2""commitData(QWidget*)", "1""_q_commitData(QWidget*)"); | - |
274 | connect(delegate, "2""closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)", | - |
275 | "1""_q_closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)"); | - |
276 | } executed: } Execution Count:9 | 9 |
277 | | - |
278 | d->flipEventFilters(oldDelegate, delegate); | - |
279 | } executed: } Execution Count:9 | 9 |
280 | | - |
281 | | - |
282 | | - |
283 | | - |
284 | QAbstractItemDelegate *QDataWidgetMapper::itemDelegate() const | - |
285 | { | - |
286 | const QDataWidgetMapperPrivate * const d = d_func(); | - |
287 | return d->delegate; never executed: return d->delegate; | 0 |
288 | } | - |
289 | void QDataWidgetMapper::setRootIndex(const QModelIndex &index) | - |
290 | { | - |
291 | QDataWidgetMapperPrivate * const d = d_func(); | - |
292 | d->rootIndex = index; | - |
293 | } | 0 |
294 | | - |
295 | | - |
296 | | - |
297 | | - |
298 | | - |
299 | | - |
300 | QModelIndex QDataWidgetMapper::rootIndex() const | - |
301 | { | - |
302 | const QDataWidgetMapperPrivate * const d = d_func(); | - |
303 | return QModelIndex(d->rootIndex); never executed: return QModelIndex(d->rootIndex); | 0 |
304 | } | - |
305 | void QDataWidgetMapper::addMapping(QWidget *widget, int section) | - |
306 | { | - |
307 | QDataWidgetMapperPrivate * const d = d_func(); | - |
308 | | - |
309 | removeMapping(widget); | - |
310 | d->widgetMap.append(QDataWidgetMapperPrivate::WidgetMapper(widget, section, d->indexAt(section))); | - |
311 | widget->installEventFilter(d->delegate); | - |
312 | } executed: } Execution Count:15 | 15 |
313 | void QDataWidgetMapper::addMapping(QWidget *widget, int section, const QByteArray &propertyName) | - |
314 | { | - |
315 | QDataWidgetMapperPrivate * const d = d_func(); | - |
316 | | - |
317 | removeMapping(widget); | - |
318 | d->widgetMap.append(QDataWidgetMapperPrivate::WidgetMapper(widget, section, d->indexAt(section), propertyName)); | - |
319 | widget->installEventFilter(d->delegate); | - |
320 | } executed: } Execution Count:4 | 4 |
321 | | - |
322 | | - |
323 | | - |
324 | | - |
325 | | - |
326 | | - |
327 | void QDataWidgetMapper::removeMapping(QWidget *widget) | - |
328 | { | - |
329 | QDataWidgetMapperPrivate * const d = d_func(); | - |
330 | | - |
331 | int idx = d->findWidget(widget); | - |
332 | if (idx == -1) evaluated: idx == -1 yes Evaluation Count:17 | yes Evaluation Count:3 |
| 3-17 |
333 | return; executed: return; Execution Count:17 | 17 |
334 | | - |
335 | d->widgetMap.removeAt(idx); | - |
336 | widget->removeEventFilter(d->delegate); | - |
337 | } executed: } Execution Count:3 | 3 |
338 | | - |
339 | | - |
340 | | - |
341 | | - |
342 | | - |
343 | | - |
344 | | - |
345 | int QDataWidgetMapper::mappedSection(QWidget *widget) const | - |
346 | { | - |
347 | const QDataWidgetMapperPrivate * const d = d_func(); | - |
348 | | - |
349 | int idx = d->findWidget(widget); | - |
350 | if (idx == -1) partially evaluated: idx == -1 no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
351 | return -1; never executed: return -1; | 0 |
352 | | - |
353 | return d->widgetMap.at(idx).section; executed: return d->widgetMap.at(idx).section; Execution Count:1 | 1 |
354 | } | - |
355 | QByteArray QDataWidgetMapper::mappedPropertyName(QWidget *widget) const | - |
356 | { | - |
357 | const QDataWidgetMapperPrivate * const d = d_func(); | - |
358 | | - |
359 | int idx = d->findWidget(widget); | - |
360 | if (idx == -1) never evaluated: idx == -1 | 0 |
361 | return QByteArray(); never executed: return QByteArray(); | 0 |
362 | const QDataWidgetMapperPrivate::WidgetMapper &m = d->widgetMap.at(idx); | - |
363 | if (m.property.isEmpty()) never evaluated: m.property.isEmpty() | 0 |
364 | return m.widget->metaObject()->userProperty().name(); never executed: return m.widget->metaObject()->userProperty().name(); | 0 |
365 | else | - |
366 | return m.property; never executed: return m.property; | 0 |
367 | } | - |
368 | | - |
369 | | - |
370 | | - |
371 | | - |
372 | | - |
373 | | - |
374 | | - |
375 | QWidget *QDataWidgetMapper::mappedWidgetAt(int section) const | - |
376 | { | - |
377 | const QDataWidgetMapperPrivate * const d = d_func(); | - |
378 | | - |
379 | for (int i = 0; i < d->widgetMap.count(); ++i) { evaluated: i < d->widgetMap.count() yes Evaluation Count:8 | yes Evaluation Count:2 |
| 2-8 |
380 | if (d->widgetMap.at(i).section == section) evaluated: d->widgetMap.at(i).section == section yes Evaluation Count:4 | yes Evaluation Count:4 |
| 4 |
381 | return d->widgetMap.at(i).widget; executed: return d->widgetMap.at(i).widget; Execution Count:4 | 4 |
382 | } executed: } Execution Count:4 | 4 |
383 | | - |
384 | return 0; executed: return 0; Execution Count:2 | 2 |
385 | } | - |
386 | | - |
387 | | - |
388 | | - |
389 | | - |
390 | | - |
391 | | - |
392 | | - |
393 | void QDataWidgetMapper::revert() | - |
394 | { | - |
395 | QDataWidgetMapperPrivate * const d = d_func(); | - |
396 | | - |
397 | d->populate(); | - |
398 | } executed: } Execution Count:1 | 1 |
399 | bool QDataWidgetMapper::submit() | - |
400 | { | - |
401 | QDataWidgetMapperPrivate * const d = d_func(); | - |
402 | | - |
403 | for (int i = 0; i < d->widgetMap.count(); ++i) { evaluated: i < d->widgetMap.count() yes Evaluation Count:14 | yes Evaluation Count:5 |
| 5-14 |
404 | const QDataWidgetMapperPrivate::WidgetMapper &m = d->widgetMap.at(i); | - |
405 | if (!d->commit(m)) partially evaluated: !d->commit(m) no Evaluation Count:0 | yes Evaluation Count:14 |
| 0-14 |
406 | return false; never executed: return false; | 0 |
407 | } executed: } Execution Count:14 | 14 |
408 | | - |
409 | return d->model->submit(); executed: return d->model->submit(); Execution Count:5 | 5 |
410 | } | - |
411 | void QDataWidgetMapper::toFirst() | - |
412 | { | - |
413 | setCurrentIndex(0); | - |
414 | } executed: } Execution Count:13 | 13 |
415 | void QDataWidgetMapper::toLast() | - |
416 | { | - |
417 | QDataWidgetMapperPrivate * const d = d_func(); | - |
418 | setCurrentIndex(d->itemCount() - 1); | - |
419 | } executed: } Execution Count:3 | 3 |
420 | void QDataWidgetMapper::toNext() | - |
421 | { | - |
422 | QDataWidgetMapperPrivate * const d = d_func(); | - |
423 | setCurrentIndex(d->currentIdx() + 1); | - |
424 | } executed: } Execution Count:5 | 5 |
425 | void QDataWidgetMapper::toPrevious() | - |
426 | { | - |
427 | QDataWidgetMapperPrivate * const d = d_func(); | - |
428 | setCurrentIndex(d->currentIdx() - 1); | - |
429 | } executed: } Execution Count:2 | 2 |
430 | void QDataWidgetMapper::setCurrentIndex(int index) | - |
431 | { | - |
432 | QDataWidgetMapperPrivate * const d = d_func(); | - |
433 | | - |
434 | if (index < 0 || index >= d->itemCount()) evaluated: index < 0 yes Evaluation Count:5 | yes Evaluation Count:29 |
evaluated: index >= d->itemCount() yes Evaluation Count:5 | yes Evaluation Count:24 |
| 5-29 |
435 | return; executed: return; Execution Count:10 | 10 |
436 | d->currentTopLeft = d->orientation == Qt::Horizontal evaluated: d->orientation == Qt::Horizontal yes Evaluation Count:19 | yes Evaluation Count:5 |
| 5-19 |
437 | ? d->model->index(index, 0, d->rootIndex) | - |
438 | : d->model->index(0, index, d->rootIndex); | - |
439 | d->populate(); | - |
440 | | - |
441 | currentIndexChanged(index); | - |
442 | } executed: } Execution Count:24 | 24 |
443 | | - |
444 | int QDataWidgetMapper::currentIndex() const | - |
445 | { | - |
446 | const QDataWidgetMapperPrivate * const d = d_func(); | - |
447 | return d->currentIdx(); never executed: return d->currentIdx(); | 0 |
448 | } | - |
449 | void QDataWidgetMapper::setCurrentModelIndex(const QModelIndex &index) | - |
450 | { | - |
451 | QDataWidgetMapperPrivate * const d = d_func(); | - |
452 | | - |
453 | if (!index.isValid() evaluated: !index.isValid() yes Evaluation Count:2 | yes Evaluation Count:2 |
| 2 |
454 | || index.model() != d->model partially evaluated: index.model() != d->model no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
455 | || index.parent() != d->rootIndex) partially evaluated: index.parent() != d->rootIndex no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
456 | return; executed: return; Execution Count:2 | 2 |
457 | | - |
458 | setCurrentIndex(d->orientation == Qt::Horizontal ? index.row() : index.column()); | - |
459 | } executed: } Execution Count:2 | 2 |
460 | | - |
461 | | - |
462 | | - |
463 | | - |
464 | | - |
465 | | - |
466 | void QDataWidgetMapper::clearMapping() | - |
467 | { | - |
468 | QDataWidgetMapperPrivate * const d = d_func(); | - |
469 | | - |
470 | while (!d->widgetMap.isEmpty()) { evaluated: !d->widgetMap.isEmpty() yes Evaluation Count:3 | yes Evaluation Count:11 |
| 3-11 |
471 | QWidget *w = d->widgetMap.takeLast().widget; | - |
472 | if (w) partially evaluated: w yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
473 | w->removeEventFilter(d->delegate); executed: w->removeEventFilter(d->delegate); Execution Count:3 | 3 |
474 | } executed: } Execution Count:3 | 3 |
475 | } executed: } Execution Count:11 | 11 |
476 | void QDataWidgetMapper::setOrientation(Qt::Orientation orientation) | - |
477 | { | - |
478 | QDataWidgetMapperPrivate * const d = d_func(); | - |
479 | | - |
480 | if (d->orientation == orientation) partially evaluated: d->orientation == orientation no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
481 | return; | 0 |
482 | | - |
483 | clearMapping(); | - |
484 | d->orientation = orientation; | - |
485 | } executed: } Execution Count:1 | 1 |
486 | | - |
487 | Qt::Orientation QDataWidgetMapper::orientation() const | - |
488 | { | - |
489 | const QDataWidgetMapperPrivate * const d = d_func(); | - |
490 | return d->orientation; never executed: return d->orientation; | 0 |
491 | } | - |
492 | void QDataWidgetMapper::setSubmitPolicy(SubmitPolicy policy) | - |
493 | { | - |
494 | QDataWidgetMapperPrivate * const d = d_func(); | - |
495 | if (policy == d->submitPolicy) partially evaluated: policy == d->submitPolicy no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
496 | return; | 0 |
497 | | - |
498 | revert(); | - |
499 | d->submitPolicy = policy; | - |
500 | } executed: } Execution Count:1 | 1 |
501 | | - |
502 | QDataWidgetMapper::SubmitPolicy QDataWidgetMapper::submitPolicy() const | - |
503 | { | - |
504 | const QDataWidgetMapperPrivate * const d = d_func(); | - |
505 | return d->submitPolicy; never executed: return d->submitPolicy; | 0 |
506 | } | - |
507 | | - |
508 | | - |
509 | | - |
510 | | - |
| | |