itemmodels/qabstractproxymodel.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4 -
5 -
6 -
7void QAbstractProxyModelPrivate::_q_sourceModelDestroyed() -
8{ -
9 model = QAbstractItemModelPrivate::staticEmptyModel(); -
10}
executed: }
Execution Count:220
220
11 -
12 -
13 -
14 -
15 -
16QAbstractProxyModel::QAbstractProxyModel(QObject *parent) -
17 :QAbstractItemModel(*new QAbstractProxyModelPrivate, parent) -
18{ -
19 setSourceModel(QAbstractItemModelPrivate::staticEmptyModel()); -
20}
executed: }
Execution Count:17
17
21 -
22 -
23 -
24 -
25 -
26QAbstractProxyModel::QAbstractProxyModel(QAbstractProxyModelPrivate &dd, QObject *parent) -
27 : QAbstractItemModel(dd, parent) -
28{ -
29 setSourceModel(QAbstractItemModelPrivate::staticEmptyModel()); -
30}
executed: }
Execution Count:640
640
31 -
32 -
33 -
34 -
35QAbstractProxyModel::~QAbstractProxyModel() -
36{ -
37 -
38} -
39void QAbstractProxyModel::setSourceModel(QAbstractItemModel *sourceModel) -
40{ -
41 QAbstractProxyModelPrivate * const d = d_func(); -
42 if (sourceModel != d->model) {
evaluated: sourceModel != d->model
TRUEFALSE
yes
Evaluation Count:1687
yes
Evaluation Count:1
1-1687
43 if (d->model)
evaluated: d->model
TRUEFALSE
yes
Evaluation Count:1030
yes
Evaluation Count:657
657-1030
44 disconnect(d->model, "2""destroyed()", this, "1""_q_sourceModelDestroyed()");
executed: disconnect(d->model, "2""destroyed()", this, "1""_q_sourceModelDestroyed()");
Execution Count:1030
1030
45 -
46 if (sourceModel) {
evaluated: sourceModel
TRUEFALSE
yes
Evaluation Count:1455
yes
Evaluation Count:232
232-1455
47 d->model = sourceModel; -
48 connect(d->model, "2""destroyed()", this, "1""_q_sourceModelDestroyed()"); -
49 } else {
executed: }
Execution Count:1455
1455
50 d->model = QAbstractItemModelPrivate::staticEmptyModel(); -
51 }
executed: }
Execution Count:232
232
52 d->roleNames = d->model->roleNames(); -
53 sourceModelChanged(QPrivateSignal()); -
54 }
executed: }
Execution Count:1687
1687
55}
executed: }
Execution Count:1688
1688
56 -
57 -
58 -
59 -
60QAbstractItemModel *QAbstractProxyModel::sourceModel() const -
61{ -
62 const QAbstractProxyModelPrivate * const d = d_func(); -
63 if (d->model == QAbstractItemModelPrivate::staticEmptyModel())
evaluated: d->model == QAbstractItemModelPrivate::staticEmptyModel()
TRUEFALSE
yes
Evaluation Count:1290
yes
Evaluation Count:15625
1290-15625
64 return 0;
executed: return 0;
Execution Count:1290
1290
65 return d->model;
executed: return d->model;
Execution Count:15625
15625
66} -
67 -
68 -
69 -
70 -
71bool QAbstractProxyModel::submit() -
72{ -
73 QAbstractProxyModelPrivate * const d = d_func(); -
74 return d->model->submit();
executed: return d->model->submit();
Execution Count:181
181
75} -
76 -
77 -
78 -
79 -
80void QAbstractProxyModel::revert() -
81{ -
82 QAbstractProxyModelPrivate * const d = d_func(); -
83 d->model->revert(); -
84}
executed: }
Execution Count:5
5
85QItemSelection QAbstractProxyModel::mapSelectionToSource(const QItemSelection &proxySelection) const -
86{ -
87 QModelIndexList proxyIndexes = proxySelection.indexes(); -
88 QItemSelection sourceSelection; -
89 for (int i = 0; i < proxyIndexes.size(); ++i) {
partially evaluated: i < proxyIndexes.size()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
90 const QModelIndex proxyIdx = mapToSource(proxyIndexes.at(i)); -
91 if (!proxyIdx.isValid())
never evaluated: !proxyIdx.isValid()
0
92 continue;
never executed: continue;
0
93 sourceSelection << QItemSelectionRange(proxyIdx); -
94 }
never executed: }
0
95 return sourceSelection;
executed: return sourceSelection;
Execution Count:3
3
96} -
97 -
98 -
99 -
100 -
101 -
102 -
103QItemSelection QAbstractProxyModel::mapSelectionFromSource(const QItemSelection &sourceSelection) const -
104{ -
105 QModelIndexList sourceIndexes = sourceSelection.indexes(); -
106 QItemSelection proxySelection; -
107 for (int i = 0; i < sourceIndexes.size(); ++i) {
evaluated: i < sourceIndexes.size()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:4
3-4
108 const QModelIndex srcIdx = mapFromSource(sourceIndexes.at(i)); -
109 if (!srcIdx.isValid())
evaluated: !srcIdx.isValid()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1
1-2
110 continue;
executed: continue;
Execution Count:2
2
111 proxySelection << QItemSelectionRange(srcIdx); -
112 }
executed: }
Execution Count:1
1
113 return proxySelection;
executed: return proxySelection;
Execution Count:4
4
114} -
115 -
116 -
117 -
118 -
119QVariant QAbstractProxyModel::data(const QModelIndex &proxyIndex, int role) const -
120{ -
121 const QAbstractProxyModelPrivate * const d = d_func(); -
122 return d->model->data(mapToSource(proxyIndex), role);
executed: return d->model->data(mapToSource(proxyIndex), role);
Execution Count:99
99
123} -
124 -
125 -
126 -
127 -
128QVariant QAbstractProxyModel::headerData(int section, Qt::Orientation orientation, int role) const -
129{ -
130 const QAbstractProxyModelPrivate * const d = d_func(); -
131 int sourceSection; -
132 if (orientation == Qt::Horizontal) {
evaluated: orientation == Qt::Horizontal
TRUEFALSE
yes
Evaluation Count:306
yes
Evaluation Count:1764
306-1764
133 const QModelIndex proxyIndex = index(0, section); -
134 sourceSection = mapToSource(proxyIndex).column(); -
135 } else {
executed: }
Execution Count:306
306
136 const QModelIndex proxyIndex = index(section, 0); -
137 sourceSection = mapToSource(proxyIndex).row(); -
138 }
executed: }
Execution Count:1764
1764
139 return d->model->headerData(sourceSection, orientation, role);
executed: return d->model->headerData(sourceSection, orientation, role);
Execution Count:2070
2070
140} -
141 -
142 -
143 -
144 -
145QMap<int, QVariant> QAbstractProxyModel::itemData(const QModelIndex &proxyIndex) const -
146{ -
147 const QAbstractProxyModelPrivate * const d = d_func(); -
148 return d->model->itemData(mapToSource(proxyIndex));
executed: return d->model->itemData(mapToSource(proxyIndex));
Execution Count:43
43
149} -
150 -
151 -
152 -
153 -
154Qt::ItemFlags QAbstractProxyModel::flags(const QModelIndex &index) const -
155{ -
156 const QAbstractProxyModelPrivate * const d = d_func(); -
157 return d->model->flags(mapToSource(index));
executed: return d->model->flags(mapToSource(index));
Execution Count:355
355
158} -
159 -
160 -
161 -
162 -
163bool QAbstractProxyModel::setData(const QModelIndex &index, const QVariant &value, int role) -
164{ -
165 QAbstractProxyModelPrivate * const d = d_func(); -
166 return d->model->setData(mapToSource(index), value, role);
never executed: return d->model->setData(mapToSource(index), value, role);
0
167} -
168 -
169 -
170 -
171 -
172bool QAbstractProxyModel::setItemData(const QModelIndex &index, const QMap< int, QVariant >& roles) -
173{ -
174 QAbstractProxyModelPrivate * const d = d_func(); -
175 return d->model->setItemData(mapToSource(index), roles);
executed: return d->model->setItemData(mapToSource(index), roles);
Execution Count:3
3
176} -
177 -
178 -
179 -
180 -
181bool QAbstractProxyModel::setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role) -
182{ -
183 QAbstractProxyModelPrivate * const d = d_func(); -
184 int sourceSection; -
185 if (orientation == Qt::Horizontal) {
evaluated: orientation == Qt::Horizontal
TRUEFALSE
yes
Evaluation Count:78
yes
Evaluation Count:10
10-78
186 const QModelIndex proxyIndex = index(0, section); -
187 sourceSection = mapToSource(proxyIndex).column(); -
188 } else {
executed: }
Execution Count:78
78
189 const QModelIndex proxyIndex = index(section, 0); -
190 sourceSection = mapToSource(proxyIndex).row(); -
191 }
executed: }
Execution Count:10
10
192 return d->model->setHeaderData(sourceSection, orientation, value, role);
executed: return d->model->setHeaderData(sourceSection, orientation, value, role);
Execution Count:88
88
193} -
194 -
195 -
196 -
197 -
198QModelIndex QAbstractProxyModel::buddy(const QModelIndex &index) const -
199{ -
200 const QAbstractProxyModelPrivate * const d = d_func(); -
201 return mapFromSource(d->model->buddy(mapToSource(index)));
executed: return mapFromSource(d->model->buddy(mapToSource(index)));
Execution Count:33
33
202} -
203 -
204 -
205 -
206 -
207bool QAbstractProxyModel::canFetchMore(const QModelIndex &parent) const -
208{ -
209 const QAbstractProxyModelPrivate * const d = d_func(); -
210 return d->model->canFetchMore(mapToSource(parent));
executed: return d->model->canFetchMore(mapToSource(parent));
Execution Count:29
29
211} -
212 -
213 -
214 -
215 -
216void QAbstractProxyModel::fetchMore(const QModelIndex &parent) -
217{ -
218 QAbstractProxyModelPrivate * const d = d_func(); -
219 d->model->fetchMore(mapToSource(parent)); -
220}
never executed: }
0
221 -
222 -
223 -
224 -
225void QAbstractProxyModel::sort(int column, Qt::SortOrder order) -
226{ -
227 QAbstractProxyModelPrivate * const d = d_func(); -
228 d->model->sort(column, order); -
229}
never executed: }
0
230 -
231 -
232 -
233 -
234QSize QAbstractProxyModel::span(const QModelIndex &index) const -
235{ -
236 const QAbstractProxyModelPrivate * const d = d_func(); -
237 return d->model->span(mapToSource(index));
never executed: return d->model->span(mapToSource(index));
0
238} -
239 -
240 -
241 -
242 -
243bool QAbstractProxyModel::hasChildren(const QModelIndex &parent) const -
244{ -
245 const QAbstractProxyModelPrivate * const d = d_func(); -
246 return d->model->hasChildren(mapToSource(parent));
executed: return d->model->hasChildren(mapToSource(parent));
Execution Count:97
97
247} -
248 -
249 -
250 -
251 -
252QModelIndex QAbstractProxyModel::sibling(int row, int column, const QModelIndex &idx) const -
253{ -
254 const QAbstractProxyModelPrivate * const d = d_func(); -
255 return mapFromSource(d->model->sibling(row, column, mapToSource(idx)));
executed: return mapFromSource(d->model->sibling(row, column, mapToSource(idx)));
Execution Count:54
54
256} -
257 -
258 -
259 -
260 -
261QMimeData* QAbstractProxyModel::mimeData(const QModelIndexList &indexes) const -
262{ -
263 const QAbstractProxyModelPrivate * const d = d_func(); -
264 QModelIndexList list; -
265 for (QForeachContainer<__typeof__(indexes)> _container_(indexes); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (const QModelIndex &index = *_container_.i;; __extension__ ({--_container_.brk; break;})) -
266 list << mapToSource(index);
never executed: list << mapToSource(index);
0
267 return d->model->mimeData(list);
never executed: return d->model->mimeData(list);
0
268} -
269 -
270 -
271 -
272 -
273QStringList QAbstractProxyModel::mimeTypes() const -
274{ -
275 const QAbstractProxyModelPrivate * const d = d_func(); -
276 return d->model->mimeTypes();
never executed: return d->model->mimeTypes();
0
277} -
278 -
279 -
280 -
281 -
282Qt::DropActions QAbstractProxyModel::supportedDropActions() const -
283{ -
284 const QAbstractProxyModelPrivate * const d = d_func(); -
285 return d->model->supportedDropActions();
never executed: return d->model->supportedDropActions();
0
286} -
287 -
288 -
289 -
290 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial