Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | | - |
7 | | - |
8 | | - |
9 | | - |
10 | | - |
11 | void QSpanCollection::addSpan(QSpanCollection::Span *span) | - |
12 | { | - |
13 | spans.append(span); | - |
14 | Index::iterator it_y = index.lowerBound(-span->top()); | - |
15 | if (it_y == index.end() || it_y.key() != -span->top()) { evaluated: it_y == index.end() yes Evaluation Count:42 | yes Evaluation Count:76 |
evaluated: it_y.key() != -span->top() yes Evaluation Count:68 | yes Evaluation Count:8 |
| 8-76 |
16 | | - |
17 | SubIndex sub_index; | - |
18 | if (it_y != index.end()) { evaluated: it_y != index.end() yes Evaluation Count:68 | yes Evaluation Count:42 |
| 42-68 |
19 | | - |
20 | | - |
21 | const SubIndex previousList = it_y.value(); | - |
22 | for (QForeachContainer<__typeof__(previousList)> _container_(previousList); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (Span *s = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
23 | | - |
24 | if(s->bottom() >= span->top()) evaluated: s->bottom() >= span->top() yes Evaluation Count:7 | yes Evaluation Count:70 |
| 7-70 |
25 | sub_index.insert(-s->left(), s); executed: sub_index.insert(-s->left(), s); Execution Count:7 | 7 |
26 | } executed: } Execution Count:77 | 77 |
27 | } executed: } Execution Count:68 | 68 |
28 | it_y = index.insert(-span->top(), sub_index); | - |
29 | | - |
30 | } executed: } Execution Count:110 | 110 |
31 | | - |
32 | | - |
33 | while(-it_y.key() <= span->bottom()) { evaluated: -it_y.key() <= span->bottom() yes Evaluation Count:120 | yes Evaluation Count:2 |
| 2-120 |
34 | (*it_y).insert(-span->left(), span); | - |
35 | if(it_y == index.begin()) evaluated: it_y == index.begin() yes Evaluation Count:116 | yes Evaluation Count:4 |
| 4-116 |
36 | break; executed: break; Execution Count:116 | 116 |
37 | --it_y; | - |
38 | } executed: } Execution Count:4 | 4 |
39 | } executed: } Execution Count:118 | 118 |
40 | void QSpanCollection::updateSpan(QSpanCollection::Span *span, int old_height) | - |
41 | { | - |
42 | if (old_height < span->height()) { partially evaluated: old_height < span->height() no Evaluation Count:0 | yes Evaluation Count:5 |
| 0-5 |
43 | | - |
44 | Index::iterator it_y = index.lowerBound(-(span->top() + old_height - 1)); | - |
45 | qt_noop(); | - |
46 | while (-it_y.key() <= span->bottom()) { never evaluated: -it_y.key() <= span->bottom() | 0 |
47 | (*it_y).insert(-span->left(), span); | - |
48 | if(it_y == index.begin()) never evaluated: it_y == index.begin() | 0 |
49 | break; | 0 |
50 | --it_y; | - |
51 | } | 0 |
52 | } else if (old_height > span->height()) { partially evaluated: old_height > span->height() yes Evaluation Count:5 | no Evaluation Count:0 |
| 0-5 |
53 | | - |
54 | Index::iterator it_y = index.lowerBound(-qMax(span->bottom(), span->top())); | - |
55 | qt_noop(); | - |
56 | while (-it_y.key() <= span->top() + old_height -1) { evaluated: -it_y.key() <= span->top() + old_height -1 yes Evaluation Count:6 | yes Evaluation Count:2 |
| 2-6 |
57 | if (-it_y.key() > span->bottom()) { partially evaluated: -it_y.key() > span->bottom() yes Evaluation Count:6 | no Evaluation Count:0 |
| 0-6 |
58 | int removed = (*it_y).remove(-span->left()); | - |
59 | qt_noop(); (void)removed;; | - |
60 | if (it_y->isEmpty()) { evaluated: it_y->isEmpty() yes Evaluation Count:5 | yes Evaluation Count:1 |
| 1-5 |
61 | it_y = index.erase(it_y); | - |
62 | } executed: } Execution Count:5 | 5 |
63 | } executed: } Execution Count:6 | 6 |
64 | if(it_y == index.begin()) evaluated: it_y == index.begin() yes Evaluation Count:3 | yes Evaluation Count:3 |
| 3 |
65 | break; executed: break; Execution Count:3 | 3 |
66 | --it_y; | - |
67 | } executed: } Execution Count:3 | 3 |
68 | } executed: } Execution Count:5 | 5 |
69 | | - |
70 | if (span->width() == 0 && span->height() == 0) { partially evaluated: span->width() == 0 yes Evaluation Count:5 | no Evaluation Count:0 |
partially evaluated: span->height() == 0 yes Evaluation Count:5 | no Evaluation Count:0 |
| 0-5 |
71 | spans.removeOne(span); | - |
72 | delete span; | - |
73 | } executed: } Execution Count:5 | 5 |
74 | } executed: } Execution Count:5 | 5 |
75 | | - |
76 | | - |
77 | | - |
78 | | - |
79 | QSpanCollection::Span *QSpanCollection::spanAt(int x, int y) const | - |
80 | { | - |
81 | Index::const_iterator it_y = index.lowerBound(-y); | - |
82 | if (it_y == index.end()) evaluated: it_y == index.end() yes Evaluation Count:124 | yes Evaluation Count:779 |
| 124-779 |
83 | return 0; executed: return 0; Execution Count:124 | 124 |
84 | SubIndex::const_iterator it_x = (*it_y).lowerBound(-x); | - |
85 | if (it_x == (*it_y).end()) evaluated: it_x == (*it_y).end() yes Evaluation Count:20 | yes Evaluation Count:759 |
| 20-759 |
86 | return 0; executed: return 0; Execution Count:20 | 20 |
87 | Span *span = *it_x; | - |
88 | if (span->right() >= x && span->bottom() >= y) evaluated: span->right() >= x yes Evaluation Count:733 | yes Evaluation Count:26 |
evaluated: span->bottom() >= y yes Evaluation Count:661 | yes Evaluation Count:72 |
| 26-733 |
89 | return span; executed: return span; Execution Count:661 | 661 |
90 | return 0; executed: return 0; Execution Count:98 | 98 |
91 | } | - |
92 | | - |
93 | | - |
94 | | - |
95 | | - |
96 | | - |
97 | void QSpanCollection::clear() | - |
98 | { | - |
99 | qDeleteAll(spans); | - |
100 | index.clear(); | - |
101 | spans.clear(); | - |
102 | } executed: } Execution Count:8 | 8 |
103 | | - |
104 | | - |
105 | | - |
106 | | - |
107 | QList<QSpanCollection::Span *> QSpanCollection::spansInRect(int x, int y, int w, int h) const | - |
108 | { | - |
109 | QSet<Span *> list; | - |
110 | Index::const_iterator it_y = index.lowerBound(-y); | - |
111 | if(it_y == index.end()) evaluated: it_y == index.end() yes Evaluation Count:26 | yes Evaluation Count:478 |
| 26-478 |
112 | --it_y; executed: --it_y; Execution Count:26 | 26 |
113 | while(-it_y.key() <= y + h) { evaluated: -it_y.key() <= y + h yes Evaluation Count:949 | yes Evaluation Count:445 |
| 445-949 |
114 | SubIndex::const_iterator it_x = (*it_y).lowerBound(-x); | - |
115 | if (it_x == (*it_y).end()) evaluated: it_x == (*it_y).end() yes Evaluation Count:31 | yes Evaluation Count:918 |
| 31-918 |
116 | --it_x; executed: --it_x; Execution Count:31 | 31 |
117 | while(-it_x.key() <= x + w) { evaluated: -it_x.key() <= x + w yes Evaluation Count:949 | yes Evaluation Count:10 |
| 10-949 |
118 | Span *s = *it_x; | - |
119 | if (s->bottom() >= y && s->right() >= x) evaluated: s->bottom() >= y yes Evaluation Count:943 | yes Evaluation Count:6 |
evaluated: s->right() >= x yes Evaluation Count:937 | yes Evaluation Count:6 |
| 6-943 |
120 | list << s; executed: list << s; Execution Count:937 | 937 |
121 | if (it_x == (*it_y).begin()) evaluated: it_x == (*it_y).begin() yes Evaluation Count:939 | yes Evaluation Count:10 |
| 10-939 |
122 | break; executed: break; Execution Count:939 | 939 |
123 | --it_x; | - |
124 | } executed: } Execution Count:10 | 10 |
125 | if(it_y == index.begin()) evaluated: it_y == index.begin() yes Evaluation Count:59 | yes Evaluation Count:890 |
| 59-890 |
126 | break; executed: break; Execution Count:59 | 59 |
127 | --it_y; | - |
128 | } executed: } Execution Count:890 | 890 |
129 | return list.toList(); executed: return list.toList(); Execution Count:504 | 504 |
130 | } | - |
131 | void QSpanCollection::updateInsertedRows(int start, int end) | - |
132 | { | - |
133 | | - |
134 | | - |
135 | | - |
136 | | - |
137 | | - |
138 | if (spans.isEmpty()) evaluated: spans.isEmpty() yes Evaluation Count:13237 | yes Evaluation Count:4 |
| 4-13237 |
139 | return; executed: return; Execution Count:13237 | 13237 |
140 | | - |
141 | int delta = end - start + 1; | - |
142 | | - |
143 | | - |
144 | | - |
145 | for (SpanList::iterator it = spans.begin(); it != spans.end(); ++it) { evaluated: it != spans.end() yes Evaluation Count:4 | yes Evaluation Count:4 |
| 4 |
146 | Span *span = *it; | - |
147 | | - |
148 | | - |
149 | | - |
150 | if (span->m_bottom < start) evaluated: span->m_bottom < start yes Evaluation Count:1 | yes Evaluation Count:3 |
| 1-3 |
151 | continue; executed: continue; Execution Count:1 | 1 |
152 | if (span->m_top >= start) evaluated: span->m_top >= start yes Evaluation Count:2 | yes Evaluation Count:1 |
| 1-2 |
153 | span->m_top += delta; executed: span->m_top += delta; Execution Count:2 | 2 |
154 | span->m_bottom += delta; | - |
155 | } executed: } Execution Count:3 | 3 |
156 | | - |
157 | | - |
158 | | - |
159 | | - |
160 | | - |
161 | | - |
162 | | - |
163 | for (Index::iterator it_y = index.begin(); it_y != index.end(); ) { evaluated: it_y != index.end() yes Evaluation Count:4 | yes Evaluation Count:4 |
| 4 |
164 | int y = -it_y.key(); | - |
165 | if (y < start) { evaluated: y < start yes Evaluation Count:2 | yes Evaluation Count:2 |
| 2 |
166 | ++it_y; | - |
167 | continue; executed: continue; Execution Count:2 | 2 |
168 | } | - |
169 | | - |
170 | index.insert(-y - delta, it_y.value()); | - |
171 | it_y = index.erase(it_y); | - |
172 | } executed: } Execution Count:2 | 2 |
173 | | - |
174 | | - |
175 | | - |
176 | } executed: } Execution Count:4 | 4 |
177 | | - |
178 | | - |
179 | | - |
180 | | - |
181 | void QSpanCollection::updateInsertedColumns(int start, int end) | - |
182 | { | - |
183 | | - |
184 | | - |
185 | | - |
186 | | - |
187 | | - |
188 | if (spans.isEmpty()) evaluated: spans.isEmpty() yes Evaluation Count:220 | yes Evaluation Count:4 |
| 4-220 |
189 | return; executed: return; Execution Count:220 | 220 |
190 | | - |
191 | int delta = end - start + 1; | - |
192 | | - |
193 | | - |
194 | | - |
195 | for (SpanList::iterator it = spans.begin(); it != spans.end(); ++it) { evaluated: it != spans.end() yes Evaluation Count:4 | yes Evaluation Count:4 |
| 4 |
196 | Span *span = *it; | - |
197 | | - |
198 | | - |
199 | | - |
200 | if (span->m_right < start) evaluated: span->m_right < start yes Evaluation Count:1 | yes Evaluation Count:3 |
| 1-3 |
201 | continue; executed: continue; Execution Count:1 | 1 |
202 | if (span->m_left >= start) evaluated: span->m_left >= start yes Evaluation Count:2 | yes Evaluation Count:1 |
| 1-2 |
203 | span->m_left += delta; executed: span->m_left += delta; Execution Count:2 | 2 |
204 | span->m_right += delta; | - |
205 | } executed: } Execution Count:3 | 3 |
206 | | - |
207 | | - |
208 | | - |
209 | | - |
210 | | - |
211 | | - |
212 | | - |
213 | for (Index::iterator it_y = index.begin(); it_y != index.end(); ++it_y) { evaluated: it_y != index.end() yes Evaluation Count:4 | yes Evaluation Count:4 |
| 4 |
214 | SubIndex &subindex = it_y.value(); | - |
215 | for (SubIndex::iterator it = subindex.begin(); it != subindex.end(); ) { evaluated: it != subindex.end() yes Evaluation Count:4 | yes Evaluation Count:4 |
| 4 |
216 | int x = -it.key(); | - |
217 | if (x < start) { evaluated: x < start yes Evaluation Count:2 | yes Evaluation Count:2 |
| 2 |
218 | ++it; | - |
219 | continue; executed: continue; Execution Count:2 | 2 |
220 | } | - |
221 | subindex.insert(-x - delta, it.value()); | - |
222 | it = subindex.erase(it); | - |
223 | } executed: } Execution Count:2 | 2 |
224 | } executed: } Execution Count:4 | 4 |
225 | | - |
226 | | - |
227 | | - |
228 | } executed: } Execution Count:4 | 4 |
229 | | - |
230 | | - |
231 | | - |
232 | | - |
233 | | - |
234 | | - |
235 | bool QSpanCollection::cleanSpanSubIndex(QSpanCollection::SubIndex &subindex, int y, bool update) | - |
236 | { | - |
237 | if (subindex.isEmpty()) partially evaluated: subindex.isEmpty() no Evaluation Count:0 | yes Evaluation Count:11 |
| 0-11 |
238 | return true; never executed: return true; | 0 |
239 | | - |
240 | bool should_be_deleted = true; | - |
241 | SubIndex::iterator it = subindex.end(); | - |
242 | do { | - |
243 | --it; | - |
244 | int x = -it.key(); | - |
245 | Span *span = it.value(); | - |
246 | if (span->will_be_deleted) { evaluated: span->will_be_deleted yes Evaluation Count:3 | yes Evaluation Count:11 |
| 3-11 |
247 | it = subindex.erase(it); | - |
248 | continue; executed: continue; Execution Count:3 | 3 |
249 | } | - |
250 | if (update && span->m_left != x) { evaluated: update yes Evaluation Count:6 | yes Evaluation Count:5 |
evaluated: span->m_left != x yes Evaluation Count:4 | yes Evaluation Count:2 |
| 2-6 |
251 | subindex.insert(-span->m_left, span); | - |
252 | it = subindex.erase(it); | - |
253 | } executed: } Execution Count:4 | 4 |
254 | if (should_be_deleted && span->m_top == y) evaluated: should_be_deleted yes Evaluation Count:10 | yes Evaluation Count:1 |
evaluated: span->m_top == y yes Evaluation Count:9 | yes Evaluation Count:1 |
| 1-10 |
255 | should_be_deleted = false; executed: should_be_deleted = false; Execution Count:9 | 9 |
256 | } while (it != subindex.begin()); executed: } Execution Count:11 evaluated: it != subindex.begin() yes Evaluation Count:3 | yes Evaluation Count:11 |
| 3-11 |
257 | | - |
258 | return should_be_deleted; executed: return should_be_deleted; Execution Count:11 | 11 |
259 | } | - |
260 | | - |
261 | | - |
262 | | - |
263 | | - |
264 | void QSpanCollection::updateRemovedRows(int start, int end) | - |
265 | { | - |
266 | | - |
267 | | - |
268 | | - |
269 | | - |
270 | | - |
271 | if (spans.isEmpty()) evaluated: spans.isEmpty() yes Evaluation Count:115 | yes Evaluation Count:3 |
| 3-115 |
272 | return; executed: return; Execution Count:115 | 115 |
273 | | - |
274 | SpanList spansToBeDeleted; | - |
275 | int delta = end - start + 1; | - |
276 | | - |
277 | | - |
278 | | - |
279 | for (SpanList::iterator it = spans.begin(); it != spans.end(); ) { evaluated: it != spans.end() yes Evaluation Count:10 | yes Evaluation Count:3 |
| 3-10 |
280 | Span *span = *it; | - |
281 | | - |
282 | | - |
283 | | - |
284 | if (span->m_bottom < start) { evaluated: span->m_bottom < start yes Evaluation Count:2 | yes Evaluation Count:8 |
| 2-8 |
285 | ++it; | - |
286 | continue; executed: continue; Execution Count:2 | 2 |
287 | } | - |
288 | if (span->m_top < start) { evaluated: span->m_top < start yes Evaluation Count:3 | yes Evaluation Count:5 |
| 3-5 |
289 | if (span->m_bottom <= end) evaluated: span->m_bottom <= end yes Evaluation Count:2 | yes Evaluation Count:1 |
| 1-2 |
290 | span->m_bottom = start - 1; executed: span->m_bottom = start - 1; Execution Count:2 | 2 |
291 | else | - |
292 | span->m_bottom -= delta; executed: span->m_bottom -= delta; Execution Count:1 | 1 |
293 | } else { | - |
294 | if (span->m_bottom > end) { evaluated: span->m_bottom > end yes Evaluation Count:4 | yes Evaluation Count:1 |
| 1-4 |
295 | if (span->m_top <= end) evaluated: span->m_top <= end yes Evaluation Count:1 | yes Evaluation Count:3 |
| 1-3 |
296 | span->m_top = start; executed: span->m_top = start; Execution Count:1 | 1 |
297 | else | - |
298 | span->m_top -= delta; executed: span->m_top -= delta; Execution Count:3 | 3 |
299 | span->m_bottom -= delta; | - |
300 | } else { executed: } Execution Count:4 | 4 |
301 | span->will_be_deleted = true; | - |
302 | } executed: } Execution Count:1 | 1 |
303 | } | - |
304 | if (span->m_top == span->m_bottom && span->m_left == span->m_right) evaluated: span->m_top == span->m_bottom yes Evaluation Count:1 | yes Evaluation Count:7 |
partially evaluated: span->m_left == span->m_right yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-7 |
305 | span->will_be_deleted = true; executed: span->will_be_deleted = true; Execution Count:1 | 1 |
306 | if (span->will_be_deleted) { evaluated: span->will_be_deleted yes Evaluation Count:2 | yes Evaluation Count:6 |
| 2-6 |
307 | spansToBeDeleted.append(span); | - |
308 | it = spans.erase(it); | - |
309 | } else { executed: } Execution Count:2 | 2 |
310 | ++it; | - |
311 | } executed: } Execution Count:6 | 6 |
312 | } | - |
313 | | - |
314 | | - |
315 | | - |
316 | | - |
317 | | - |
318 | | - |
319 | if (spans.isEmpty()) { partially evaluated: spans.isEmpty() no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
320 | qDeleteAll(spansToBeDeleted); | - |
321 | index.clear(); | - |
322 | return; | 0 |
323 | } | - |
324 | | - |
325 | Index::iterator it_y = index.end(); | - |
326 | do { | - |
327 | --it_y; | - |
328 | int y = -it_y.key(); | - |
329 | SubIndex &subindex = it_y.value(); | - |
330 | if (y < start) { evaluated: y < start yes Evaluation Count:4 | yes Evaluation Count:5 |
| 4-5 |
331 | if (cleanSpanSubIndex(subindex, y)) partially evaluated: cleanSpanSubIndex(subindex, y) no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
332 | it_y = index.erase(it_y); never executed: it_y = index.erase(it_y); | 0 |
333 | } else if (y >= start && y <= end) { executed: } Execution Count:4 partially evaluated: y >= start yes Evaluation Count:5 | no Evaluation Count:0 |
evaluated: y <= end yes Evaluation Count:2 | yes Evaluation Count:3 |
| 0-5 |
334 | bool span_at_start = false; | - |
335 | SubIndex spansToBeMoved; | - |
336 | for (SubIndex::iterator it = subindex.begin(); it != subindex.end(); ++it) { evaluated: it != subindex.end() yes Evaluation Count:5 | yes Evaluation Count:2 |
| 2-5 |
337 | Span *span = it.value(); | - |
338 | if (span->will_be_deleted) evaluated: span->will_be_deleted yes Evaluation Count:1 | yes Evaluation Count:4 |
| 1-4 |
339 | continue; executed: continue; Execution Count:1 | 1 |
340 | if (!span_at_start && span->m_top == start) evaluated: !span_at_start yes Evaluation Count:2 | yes Evaluation Count:2 |
partially evaluated: span->m_top == start yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
341 | span_at_start = true; executed: span_at_start = true; Execution Count:2 | 2 |
342 | spansToBeMoved.insert(it.key(), span); | - |
343 | } executed: } Execution Count:4 | 4 |
344 | | - |
345 | if (y == start && span_at_start) evaluated: y == start yes Evaluation Count:1 | yes Evaluation Count:1 |
partially evaluated: span_at_start yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
346 | subindex.clear(); executed: subindex.clear(); Execution Count:1 | 1 |
347 | else | - |
348 | it_y = index.erase(it_y); executed: it_y = index.erase(it_y); Execution Count:1 | 1 |
349 | | - |
350 | if (span_at_start) { partially evaluated: span_at_start yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
351 | Index::iterator it_start; | - |
352 | if (y == start) evaluated: y == start yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
353 | it_start = it_y; executed: it_start = it_y; Execution Count:1 | 1 |
354 | else { | - |
355 | it_start = index.find(-start); | - |
356 | if (it_start == index.end()) partially evaluated: it_start == index.end() yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
357 | it_start = index.insert(-start, SubIndex()); executed: it_start = index.insert(-start, SubIndex()); Execution Count:1 | 1 |
358 | } executed: } Execution Count:1 | 1 |
359 | SubIndex &start_subindex = it_start.value(); | - |
360 | for (SubIndex::iterator it = spansToBeMoved.begin(); it != spansToBeMoved.end(); ++it) evaluated: it != spansToBeMoved.end() yes Evaluation Count:4 | yes Evaluation Count:2 |
| 2-4 |
361 | start_subindex.insert(it.key(), it.value()); executed: start_subindex.insert(it.key(), it.value()); Execution Count:4 | 4 |
362 | } executed: } Execution Count:2 | 2 |
363 | } else { executed: } Execution Count:2 | 2 |
364 | if (y == end + 1) { evaluated: y == end + 1 yes Evaluation Count:1 | yes Evaluation Count:2 |
| 1-2 |
365 | Index::iterator it_top = index.find(-y + delta); | - |
366 | if (it_top == index.end()) partially evaluated: it_top == index.end() no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
367 | it_top = index.insert(-y + delta, SubIndex()); never executed: it_top = index.insert(-y + delta, SubIndex()); | 0 |
368 | for (SubIndex::iterator it = subindex.begin(); it != subindex.end(); ) { evaluated: it != subindex.end() yes Evaluation Count:3 | yes Evaluation Count:1 |
| 1-3 |
369 | Span *span = it.value(); | - |
370 | if (!span->will_be_deleted) partially evaluated: !span->will_be_deleted yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
371 | it_top.value().insert(it.key(), span); executed: it_top.value().insert(it.key(), span); Execution Count:3 | 3 |
372 | ++it; | - |
373 | } executed: } Execution Count:3 | 3 |
374 | } else { executed: } Execution Count:1 | 1 |
375 | index.insert(-y + delta, subindex); | - |
376 | } executed: } Execution Count:2 | 2 |
377 | it_y = index.erase(it_y); | - |
378 | } executed: } Execution Count:3 | 3 |
379 | } while (it_y != index.begin()); evaluated: it_y != index.begin() yes Evaluation Count:6 | yes Evaluation Count:3 |
| 3-6 |
380 | | - |
381 | | - |
382 | | - |
383 | | - |
384 | | - |
385 | | - |
386 | | - |
387 | qDeleteAll(spansToBeDeleted); | - |
388 | } executed: } Execution Count:3 | 3 |
389 | | - |
390 | | - |
391 | | - |
392 | | - |
393 | void QSpanCollection::updateRemovedColumns(int start, int end) | - |
394 | { | - |
395 | | - |
396 | | - |
397 | | - |
398 | | - |
399 | | - |
400 | if (spans.isEmpty()) evaluated: spans.isEmpty() yes Evaluation Count:79 | yes Evaluation Count:1 |
| 1-79 |
401 | return; executed: return; Execution Count:79 | 79 |
402 | | - |
403 | SpanList toBeDeleted; | - |
404 | int delta = end - start + 1; | - |
405 | | - |
406 | | - |
407 | | - |
408 | for (SpanList::iterator it = spans.begin(); it != spans.end(); ) { evaluated: it != spans.end() yes Evaluation Count:8 | yes Evaluation Count:1 |
| 1-8 |
409 | Span *span = *it; | - |
410 | | - |
411 | | - |
412 | | - |
413 | if (span->m_right < start) { evaluated: span->m_right < start yes Evaluation Count:1 | yes Evaluation Count:7 |
| 1-7 |
414 | ++it; | - |
415 | continue; executed: continue; Execution Count:1 | 1 |
416 | } | - |
417 | if (span->m_left < start) { evaluated: span->m_left < start yes Evaluation Count:2 | yes Evaluation Count:5 |
| 2-5 |
418 | if (span->m_right <= end) evaluated: span->m_right <= end yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
419 | span->m_right = start - 1; executed: span->m_right = start - 1; Execution Count:1 | 1 |
420 | else | - |
421 | span->m_right -= delta; executed: span->m_right -= delta; Execution Count:1 | 1 |
422 | } else { | - |
423 | if (span->m_right > end) { evaluated: span->m_right > end yes Evaluation Count:4 | yes Evaluation Count:1 |
| 1-4 |
424 | if (span->m_left <= end) evaluated: span->m_left <= end yes Evaluation Count:1 | yes Evaluation Count:3 |
| 1-3 |
425 | span->m_left = start; executed: span->m_left = start; Execution Count:1 | 1 |
426 | else | - |
427 | span->m_left -= delta; executed: span->m_left -= delta; Execution Count:3 | 3 |
428 | span->m_right -= delta; | - |
429 | } else { executed: } Execution Count:4 | 4 |
430 | span->will_be_deleted = true; | - |
431 | } executed: } Execution Count:1 | 1 |
432 | } | - |
433 | if (span->m_top == span->m_bottom && span->m_left == span->m_right) partially evaluated: span->m_top == span->m_bottom yes Evaluation Count:7 | no Evaluation Count:0 |
evaluated: span->m_left == span->m_right yes Evaluation Count:1 | yes Evaluation Count:6 |
| 0-7 |
434 | span->will_be_deleted = true; executed: span->will_be_deleted = true; Execution Count:1 | 1 |
435 | if (span->will_be_deleted) { evaluated: span->will_be_deleted yes Evaluation Count:2 | yes Evaluation Count:5 |
| 2-5 |
436 | toBeDeleted.append(span); | - |
437 | it = spans.erase(it); | - |
438 | } else { executed: } Execution Count:2 | 2 |
439 | ++it; | - |
440 | } executed: } Execution Count:5 | 5 |
441 | } | - |
442 | | - |
443 | | - |
444 | | - |
445 | | - |
446 | | - |
447 | | - |
448 | if (spans.isEmpty()) { partially evaluated: spans.isEmpty() no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
449 | qDeleteAll(toBeDeleted); | - |
450 | index.clear(); | - |
451 | return; | 0 |
452 | } | - |
453 | | - |
454 | for (Index::iterator it_y = index.begin(); it_y != index.end(); ) { evaluated: it_y != index.end() yes Evaluation Count:7 | yes Evaluation Count:1 |
| 1-7 |
455 | int y = -it_y.key(); | - |
456 | if (cleanSpanSubIndex(it_y.value(), y, true)) evaluated: cleanSpanSubIndex(it_y.value(), y, true) yes Evaluation Count:2 | yes Evaluation Count:5 |
| 2-5 |
457 | it_y = index.erase(it_y); executed: it_y = index.erase(it_y); Execution Count:2 | 2 |
458 | else | - |
459 | ++it_y; executed: ++it_y; Execution Count:5 | 5 |
460 | } | - |
461 | | - |
462 | | - |
463 | | - |
464 | | - |
465 | | - |
466 | | - |
467 | | - |
468 | qDeleteAll(toBeDeleted); | - |
469 | } executed: } Execution Count:1 | 1 |
470 | class QTableCornerButton : public QAbstractButton | - |
471 | { | - |
472 | public: template <typename T> inline void qt_check_for_QOBJECT_macro(const T &_q_argument) const { int i = qYouForgotTheQ_OBJECT_Macro(this, &_q_argument); i = i + 1; } static const QMetaObject staticMetaObject; virtual const QMetaObject *metaObject() const; virtual void *qt_metacast(const char *); static inline QString tr(const char *s, const char *c = 0, int n = -1) { return staticMetaObject.tr(s, c, n); } __attribute__ ((__deprecated__)) static inline QString trUtf8(const char *s, const char *c = 0, int n = -1) { return staticMetaObject.tr(s, c, n); } virtual int qt_metacall(QMetaObject::Call, int, void **); private: __attribute__((visibility("hidden"))) static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **); struct QPrivateSignal {}; | - |
473 | public: | - |
474 | QTableCornerButton(QWidget *parent) : QAbstractButton(parent) {} executed: } Execution Count:482 | 482 |
475 | void paintEvent(QPaintEvent*) { | - |
476 | QStyleOptionHeader opt; | - |
477 | opt.init(this); | - |
478 | QStyle::State state = QStyle::State_None; | - |
479 | if (isEnabled()) partially evaluated: isEnabled() yes Evaluation Count:98 | no Evaluation Count:0 |
| 0-98 |
480 | state |= QStyle::State_Enabled; executed: state |= QStyle::State_Enabled; Execution Count:98 | 98 |
481 | if (isActiveWindow()) evaluated: isActiveWindow() yes Evaluation Count:66 | yes Evaluation Count:32 |
| 32-66 |
482 | state |= QStyle::State_Active; executed: state |= QStyle::State_Active; Execution Count:66 | 66 |
483 | if (isDown()) partially evaluated: isDown() no Evaluation Count:0 | yes Evaluation Count:98 |
| 0-98 |
484 | state |= QStyle::State_Sunken; never executed: state |= QStyle::State_Sunken; | 0 |
485 | opt.state = state; | - |
486 | opt.rect = rect(); | - |
487 | opt.position = QStyleOptionHeader::OnlyOneSection; | - |
488 | QPainter painter(this); | - |
489 | style()->drawControl(QStyle::CE_Header, &opt, &painter, this); | - |
490 | } executed: } Execution Count:98 | 98 |
491 | }; | - |
492 | | - |
493 | void QTableViewPrivate::init() | - |
494 | { | - |
495 | QTableView * const q = q_func(); | - |
496 | | - |
497 | q->setEditTriggers(editTriggers|QAbstractItemView::AnyKeyPressed); | - |
498 | | - |
499 | QHeaderView *vertical = new QHeaderView(Qt::Vertical, q); | - |
500 | vertical->setSectionsClickable(true); | - |
501 | vertical->setHighlightSections(true); | - |
502 | q->setVerticalHeader(vertical); | - |
503 | | - |
504 | QHeaderView *horizontal = new QHeaderView(Qt::Horizontal, q); | - |
505 | horizontal->setSectionsClickable(true); | - |
506 | horizontal->setHighlightSections(true); | - |
507 | q->setHorizontalHeader(horizontal); | - |
508 | | - |
509 | tabKeyNavigation = true; | - |
510 | | - |
511 | cornerWidget = new QTableCornerButton(q); | - |
512 | cornerWidget->setFocusPolicy(Qt::NoFocus); | - |
513 | QObject::connect(cornerWidget, "2""clicked()", q, "1""selectAll()"); | - |
514 | } executed: } Execution Count:482 | 482 |
515 | | - |
516 | | - |
517 | | - |
518 | | - |
519 | | - |
520 | void QTableViewPrivate::trimHiddenSelections(QItemSelectionRange *range) const | - |
521 | { | - |
522 | qt_noop(); | - |
523 | | - |
524 | int top = range->top(); | - |
525 | int left = range->left(); | - |
526 | int bottom = range->bottom(); | - |
527 | int right = range->right(); | - |
528 | | - |
529 | while (bottom >= top && verticalHeader->isSectionHidden(bottom)) evaluated: bottom >= top yes Evaluation Count:1744 | yes Evaluation Count:1 |
evaluated: verticalHeader->isSectionHidden(bottom) yes Evaluation Count:1 | yes Evaluation Count:1743 |
| 1-1744 |
530 | --bottom; executed: --bottom; Execution Count:1 | 1 |
531 | while (right >= left && horizontalHeader->isSectionHidden(right)) evaluated: right >= left yes Evaluation Count:1744 | yes Evaluation Count:1 |
evaluated: horizontalHeader->isSectionHidden(right) yes Evaluation Count:1 | yes Evaluation Count:1743 |
| 1-1744 |
532 | --right; executed: --right; Execution Count:1 | 1 |
533 | | - |
534 | if (top > bottom || left > right) { evaluated: top > bottom yes Evaluation Count:1 | yes Evaluation Count:1743 |
partially evaluated: left > right no Evaluation Count:0 | yes Evaluation Count:1743 |
| 0-1743 |
535 | *range = QItemSelectionRange(); | - |
536 | return; executed: return; Execution Count:1 | 1 |
537 | } | - |
538 | | - |
539 | while (verticalHeader->isSectionHidden(top) && top <= bottom) partially evaluated: verticalHeader->isSectionHidden(top) no Evaluation Count:0 | yes Evaluation Count:1743 |
never evaluated: top <= bottom | 0-1743 |
540 | ++top; | 0 |
541 | while (horizontalHeader->isSectionHidden(left) && left <= right) partially evaluated: horizontalHeader->isSectionHidden(left) no Evaluation Count:0 | yes Evaluation Count:1743 |
never evaluated: left <= right | 0-1743 |
542 | ++left; | 0 |
543 | | - |
544 | if (top > bottom || left > right) { partially evaluated: top > bottom no Evaluation Count:0 | yes Evaluation Count:1743 |
partially evaluated: left > right no Evaluation Count:0 | yes Evaluation Count:1743 |
| 0-1743 |
545 | *range = QItemSelectionRange(); | - |
546 | return; | 0 |
547 | } | - |
548 | | - |
549 | QModelIndex bottomRight = model->index(bottom, right, range->parent()); | - |
550 | QModelIndex topLeft = model->index(top, left, range->parent()); | - |
551 | *range = QItemSelectionRange(topLeft, bottomRight); | - |
552 | } executed: } Execution Count:1743 | 1743 |
553 | | - |
554 | | - |
555 | | - |
556 | | - |
557 | | - |
558 | void QTableViewPrivate::setSpan(int row, int column, int rowSpan, int columnSpan) | - |
559 | { | - |
560 | if (row < 0 || column < 0 || rowSpan <= 0 || columnSpan <= 0) { partially evaluated: row < 0 no Evaluation Count:0 | yes Evaluation Count:126 |
partially evaluated: column < 0 no Evaluation Count:0 | yes Evaluation Count:126 |
partially evaluated: rowSpan <= 0 no Evaluation Count:0 | yes Evaluation Count:126 |
partially evaluated: columnSpan <= 0 no Evaluation Count:0 | yes Evaluation Count:126 |
| 0-126 |
561 | QMessageLogger("itemviews/qtableview.cpp", 681, __PRETTY_FUNCTION__).warning() << "QTableView::setSpan: invalid span given: (" << row << ',' << column << ',' << rowSpan << ',' << columnSpan << ')'; | - |
562 | return; | 0 |
563 | } | - |
564 | QSpanCollection::Span *sp = spans.spanAt(column, row); | - |
565 | if (sp) { evaluated: sp yes Evaluation Count:5 | yes Evaluation Count:121 |
| 5-121 |
566 | if (sp->top() != row || sp->left() != column) { partially evaluated: sp->top() != row no Evaluation Count:0 | yes Evaluation Count:5 |
partially evaluated: sp->left() != column no Evaluation Count:0 | yes Evaluation Count:5 |
| 0-5 |
567 | QMessageLogger("itemviews/qtableview.cpp", 687, __PRETTY_FUNCTION__).warning() << "QTableView::setSpan: span cannot overlap"; | - |
568 | return; | 0 |
569 | } | - |
570 | if (rowSpan == 1 && columnSpan == 1) { partially evaluated: rowSpan == 1 yes Evaluation Count:5 | no Evaluation Count:0 |
partially evaluated: columnSpan == 1 yes Evaluation Count:5 | no Evaluation Count:0 |
| 0-5 |
571 | rowSpan = columnSpan = 0; | - |
572 | } executed: } Execution Count:5 | 5 |
573 | const int old_height = sp->height(); | - |
574 | sp->m_bottom = row + rowSpan - 1; | - |
575 | sp->m_right = column + columnSpan - 1; | - |
576 | spans.updateSpan(sp, old_height); | - |
577 | return; executed: return; Execution Count:5 | 5 |
578 | } else if (rowSpan == 1 && columnSpan == 1) { evaluated: rowSpan == 1 yes Evaluation Count:78 | yes Evaluation Count:43 |
evaluated: columnSpan == 1 yes Evaluation Count:3 | yes Evaluation Count:75 |
| 3-78 |
579 | QMessageLogger("itemviews/qtableview.cpp", 699, __PRETTY_FUNCTION__).warning() << "QTableView::setSpan: single cell span won't be added"; | - |
580 | return; executed: return; Execution Count:3 | 3 |
581 | } | - |
582 | sp = new QSpanCollection::Span(row, column, rowSpan, columnSpan); | - |
583 | spans.addSpan(sp); | - |
584 | } executed: } Execution Count:118 | 118 |
585 | | - |
586 | | - |
587 | | - |
588 | | - |
589 | | - |
590 | QSpanCollection::Span QTableViewPrivate::span(int row, int column) const | - |
591 | { | - |
592 | QSpanCollection::Span *sp = spans.spanAt(column, row); | - |
593 | if (sp) evaluated: sp yes Evaluation Count:656 | yes Evaluation Count:121 |
| 121-656 |
594 | return *sp; executed: return *sp; Execution Count:656 | 656 |
595 | | - |
596 | return QSpanCollection::Span(row, column, 1, 1); executed: return QSpanCollection::Span(row, column, 1, 1); Execution Count:121 | 121 |
597 | } | - |
598 | | - |
599 | | - |
600 | | - |
601 | | - |
602 | | - |
603 | int QTableViewPrivate::sectionSpanEndLogical(const QHeaderView *header, int logical, int span) const | - |
604 | { | - |
605 | int visual = header->visualIndex(logical); | - |
606 | for (int i = 1; i < span; ) { evaluated: i < span yes Evaluation Count:14732 | yes Evaluation Count:7532 |
| 7532-14732 |
607 | if (++visual >= header->count()) evaluated: ++visual >= header->count() yes Evaluation Count:44 | yes Evaluation Count:14688 |
| 44-14688 |
608 | break; executed: break; Execution Count:44 | 44 |
609 | logical = header->logicalIndex(visual); | - |
610 | ++i; | - |
611 | } executed: } Execution Count:14688 | 14688 |
612 | return logical; executed: return logical; Execution Count:7576 | 7576 |
613 | } | - |
614 | | - |
615 | | - |
616 | | - |
617 | | - |
618 | | - |
619 | | - |
620 | int QTableViewPrivate::sectionSpanSize(const QHeaderView *header, int logical, int span) const | - |
621 | { | - |
622 | int endLogical = sectionSpanEndLogical(header, logical, span); | - |
623 | return header->sectionPosition(endLogical) | 998 |
624 | - header->sectionPosition(logical) | 998 |
625 | + header->sectionSize(endLogical); executed: return header->sectionPosition(endLogical) - header->sectionPosition(logical) + header->sectionSize(endLogical); Execution Count:998 | 998 |
626 | } | - |
627 | | - |
628 | | - |
629 | | - |
630 | | - |
631 | | - |
632 | | - |
633 | | - |
634 | bool QTableViewPrivate::spanContainsSection(const QHeaderView *header, int logical, int spanLogical, int span) const | - |
635 | { | - |
636 | if (logical == spanLogical) never evaluated: logical == spanLogical | 0 |
637 | return true; never executed: return true; | 0 |
638 | int visual = header->visualIndex(spanLogical); | - |
639 | for (int i = 1; i < span; ) { never evaluated: i < span | 0 |
640 | if (++visual >= header->count()) never evaluated: ++visual >= header->count() | 0 |
641 | break; | 0 |
642 | spanLogical = header->logicalIndex(visual); | - |
643 | if (logical == spanLogical) never evaluated: logical == spanLogical | 0 |
644 | return true; never executed: return true; | 0 |
645 | ++i; | - |
646 | } | 0 |
647 | return false; never executed: return false; | 0 |
648 | } | - |
649 | | - |
650 | | - |
651 | | - |
652 | | - |
653 | | - |
654 | QRect QTableViewPrivate::visualSpanRect(const QSpanCollection::Span &span) const | - |
655 | { | - |
656 | const QTableView * const q = q_func(); | - |
657 | | - |
658 | int row = span.top(); | - |
659 | int rowp = verticalHeader->sectionViewportPosition(row); | - |
660 | int rowh = rowSpanHeight(row, span.height()); | - |
661 | | - |
662 | int column = span.left(); | - |
663 | int colw = columnSpanWidth(column, span.width()); | - |
664 | if (q->isRightToLeft()) partially evaluated: q->isRightToLeft() no Evaluation Count:0 | yes Evaluation Count:452 |
| 0-452 |
665 | column = span.right(); never executed: column = span.right(); | 0 |
666 | int colp = horizontalHeader->sectionViewportPosition(column); | - |
667 | | - |
668 | const int i = showGrid ? 1 : 0; partially evaluated: showGrid yes Evaluation Count:452 | no Evaluation Count:0 |
| 0-452 |
669 | if (q->isRightToLeft()) partially evaluated: q->isRightToLeft() no Evaluation Count:0 | yes Evaluation Count:452 |
| 0-452 |
670 | return QRect(colp + i, rowp, colw - i, rowh - i); never executed: return QRect(colp + i, rowp, colw - i, rowh - i); | 0 |
671 | return QRect(colp, rowp, colw - i, rowh - i); executed: return QRect(colp, rowp, colw - i, rowh - i); Execution Count:452 | 452 |
672 | } | - |
673 | | - |
674 | | - |
675 | | - |
676 | | - |
677 | | - |
678 | | - |
679 | | - |
680 | void QTableViewPrivate::drawAndClipSpans(const QRegion &area, QPainter *painter, | - |
681 | const QStyleOptionViewItem &option, QBitArray *drawn, | - |
682 | int firstVisualRow, int lastVisualRow, int firstVisualColumn, int lastVisualColumn) | - |
683 | { | - |
684 | bool alternateBase = false; | - |
685 | QRegion region = viewport->rect(); | - |
686 | | - |
687 | QList<QSpanCollection::Span *> visibleSpans; | - |
688 | bool sectionMoved = verticalHeader->sectionsMoved() || horizontalHeader->sectionsMoved(); partially evaluated: verticalHeader->sectionsMoved() no Evaluation Count:0 | yes Evaluation Count:16 |
partially evaluated: horizontalHeader->sectionsMoved() no Evaluation Count:0 | yes Evaluation Count:16 |
| 0-16 |
689 | | - |
690 | if (!sectionMoved) { partially evaluated: !sectionMoved yes Evaluation Count:16 | no Evaluation Count:0 |
| 0-16 |
691 | visibleSpans = spans.spansInRect(logicalColumn(firstVisualColumn), logicalRow(firstVisualRow), | - |
692 | lastVisualColumn - firstVisualColumn + 1, lastVisualRow - firstVisualRow + 1); | - |
693 | } else { executed: } Execution Count:16 | 16 |
694 | QSet<QSpanCollection::Span *> set; | - |
695 | for(int x = firstVisualColumn; x <= lastVisualColumn; x++) never evaluated: x <= lastVisualColumn | 0 |
696 | for(int y = firstVisualRow; y <= lastVisualRow; y++) never evaluated: y <= lastVisualRow | 0 |
697 | set.insert(spans.spanAt(x,y)); never executed: set.insert(spans.spanAt(x,y)); | 0 |
698 | set.remove(0); | - |
699 | visibleSpans = set.toList(); | - |
700 | } | 0 |
701 | | - |
702 | for (QForeachContainer<__typeof__(visibleSpans)> _container_(visibleSpans); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QSpanCollection::Span *span = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
703 | int row = span->top(); | - |
704 | int col = span->left(); | - |
705 | QModelIndex index = model->index(row, col, root); | - |
706 | if (!index.isValid()) partially evaluated: !index.isValid() no Evaluation Count:0 | yes Evaluation Count:23 |
| 0-23 |
707 | continue; never executed: continue; | 0 |
708 | QRect rect = visualSpanRect(*span); | - |
709 | rect.translate(scrollDelayOffset); | - |
710 | if (!area.intersects(rect)) evaluated: !area.intersects(rect) yes Evaluation Count:6 | yes Evaluation Count:17 |
| 6-17 |
711 | continue; executed: continue; Execution Count:6 | 6 |
712 | QStyleOptionViewItem opt = option; | - |
713 | opt.rect = rect; | - |
714 | alternateBase = alternatingColors && (span->top() & 1); partially evaluated: alternatingColors no Evaluation Count:0 | yes Evaluation Count:17 |
never evaluated: (span->top() & 1) | 0-17 |
715 | if (alternateBase) partially evaluated: alternateBase no Evaluation Count:0 | yes Evaluation Count:17 |
| 0-17 |
716 | opt.features |= QStyleOptionViewItem::Alternate; never executed: opt.features |= QStyleOptionViewItem::Alternate; | 0 |
717 | else | - |
718 | opt.features &= ~QStyleOptionViewItem::Alternate; executed: opt.features &= ~QStyleOptionViewItem::Alternate; Execution Count:17 | 17 |
719 | drawCell(painter, opt, index); | - |
720 | region -= rect; | - |
721 | for (int r = span->top(); r <= span->bottom(); ++r) { evaluated: r <= span->bottom() yes Evaluation Count:36 | yes Evaluation Count:17 |
| 17-36 |
722 | const int vr = visualRow(r); | - |
723 | if (vr < firstVisualRow || vr > lastVisualRow) partially evaluated: vr < firstVisualRow no Evaluation Count:0 | yes Evaluation Count:36 |
evaluated: vr > lastVisualRow yes Evaluation Count:4 | yes Evaluation Count:32 |
| 0-36 |
724 | continue; executed: continue; Execution Count:4 | 4 |
725 | for (int c = span->left(); c <= span->right(); ++c) { evaluated: c <= span->right() yes Evaluation Count:76 | yes Evaluation Count:32 |
| 32-76 |
726 | const int vc = visualColumn(c); | - |
727 | if (vc < firstVisualColumn || vc > lastVisualColumn) partially evaluated: vc < firstVisualColumn no Evaluation Count:0 | yes Evaluation Count:76 |
evaluated: vc > lastVisualColumn yes Evaluation Count:10 | yes Evaluation Count:66 |
| 0-76 |
728 | continue; executed: continue; Execution Count:10 | 10 |
729 | drawn->setBit((vr - firstVisualRow) * (lastVisualColumn - firstVisualColumn + 1) | - |
730 | + vc - firstVisualColumn); | - |
731 | } executed: } Execution Count:66 | 66 |
732 | } executed: } Execution Count:32 | 32 |
733 | | - |
734 | } executed: } Execution Count:17 | 17 |
735 | painter->setClipRegion(region); | - |
736 | } executed: } Execution Count:16 | 16 |
737 | | - |
738 | | - |
739 | | - |
740 | | - |
741 | | - |
742 | void QTableViewPrivate::_q_updateSpanInsertedRows(const QModelIndex &parent, int start, int end) | - |
743 | { | - |
744 | (void)parent; | - |
745 | spans.updateInsertedRows(start, end); | - |
746 | } executed: } Execution Count:13241 | 13241 |
747 | | - |
748 | | - |
749 | | - |
750 | | - |
751 | | - |
752 | void QTableViewPrivate::_q_updateSpanInsertedColumns(const QModelIndex &parent, int start, int end) | - |
753 | { | - |
754 | (void)parent; | - |
755 | spans.updateInsertedColumns(start, end); | - |
756 | } executed: } Execution Count:224 | 224 |
757 | | - |
758 | | - |
759 | | - |
760 | | - |
761 | | - |
762 | void QTableViewPrivate::_q_updateSpanRemovedRows(const QModelIndex &parent, int start, int end) | - |
763 | { | - |
764 | (void)parent; | - |
765 | spans.updateRemovedRows(start, end); | - |
766 | } executed: } Execution Count:118 | 118 |
767 | | - |
768 | | - |
769 | | - |
770 | | - |
771 | | - |
772 | void QTableViewPrivate::_q_updateSpanRemovedColumns(const QModelIndex &parent, int start, int end) | - |
773 | { | - |
774 | (void)parent; | - |
775 | spans.updateRemovedColumns(start, end); | - |
776 | } executed: } Execution Count:80 | 80 |
777 | | - |
778 | | - |
779 | | - |
780 | | - |
781 | | - |
782 | void QTableViewPrivate::drawCell(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) | - |
783 | { | - |
784 | QTableView * const q = q_func(); | - |
785 | QStyleOptionViewItem opt = option; | - |
786 | | - |
787 | if (selectionModel && selectionModel->isSelected(index)) partially evaluated: selectionModel yes Evaluation Count:5073 | no Evaluation Count:0 |
evaluated: selectionModel->isSelected(index) yes Evaluation Count:379 | yes Evaluation Count:4694 |
| 0-5073 |
788 | opt.state |= QStyle::State_Selected; executed: opt.state |= QStyle::State_Selected; Execution Count:379 | 379 |
789 | if (index == hover) evaluated: index == hover yes Evaluation Count:46 | yes Evaluation Count:5027 |
| 46-5027 |
790 | opt.state |= QStyle::State_MouseOver; executed: opt.state |= QStyle::State_MouseOver; Execution Count:46 | 46 |
791 | if (option.state & QStyle::State_Enabled) { partially evaluated: option.state & QStyle::State_Enabled yes Evaluation Count:5073 | no Evaluation Count:0 |
| 0-5073 |
792 | QPalette::ColorGroup cg; | - |
793 | if ((model->flags(index) & Qt::ItemIsEnabled) == 0) { evaluated: (model->flags(index) & Qt::ItemIsEnabled) == 0 yes Evaluation Count:170 | yes Evaluation Count:4903 |
| 170-4903 |
794 | opt.state &= ~QStyle::State_Enabled; | - |
795 | cg = QPalette::Disabled; | - |
796 | } else { executed: } Execution Count:170 | 170 |
797 | cg = QPalette::Normal; | - |
798 | } executed: } Execution Count:4903 | 4903 |
799 | opt.palette.setCurrentColorGroup(cg); | - |
800 | } executed: } Execution Count:5073 | 5073 |
801 | | - |
802 | if (index == q->currentIndex()) { evaluated: index == q->currentIndex() yes Evaluation Count:254 | yes Evaluation Count:4819 |
| 254-4819 |
803 | const bool focus = (q->hasFocus() || viewport->hasFocus()) && q->currentIndex().isValid(); evaluated: q->hasFocus() yes Evaluation Count:226 | yes Evaluation Count:28 |
partially evaluated: viewport->hasFocus() no Evaluation Count:0 | yes Evaluation Count:28 |
partially evaluated: q->currentIndex().isValid() yes Evaluation Count:226 | no Evaluation Count:0 |
| 0-226 |
804 | if (focus) evaluated: focus yes Evaluation Count:226 | yes Evaluation Count:28 |
| 28-226 |
805 | opt.state |= QStyle::State_HasFocus; executed: opt.state |= QStyle::State_HasFocus; Execution Count:226 | 226 |
806 | } executed: } Execution Count:254 | 254 |
807 | | - |
808 | q->style()->drawPrimitive(QStyle::PE_PanelItemViewRow, &opt, painter, q); | - |
809 | | - |
810 | q->itemDelegate(index)->paint(painter, opt, index); | - |
811 | } executed: } Execution Count:5073 | 5073 |
812 | QTableView::QTableView(QWidget *parent) | - |
813 | : QAbstractItemView(*new QTableViewPrivate, parent) | - |
814 | { | - |
815 | QTableViewPrivate * const d = d_func(); | - |
816 | d->init(); | - |
817 | } executed: } Execution Count:336 | 336 |
818 | | - |
819 | | - |
820 | | - |
821 | | - |
822 | QTableView::QTableView(QTableViewPrivate &dd, QWidget *parent) | - |
823 | : QAbstractItemView(dd, parent) | - |
824 | { | - |
825 | QTableViewPrivate * const d = d_func(); | - |
826 | d->init(); | - |
827 | } executed: } Execution Count:146 | 146 |
828 | | - |
829 | | - |
830 | | - |
831 | | - |
832 | QTableView::~QTableView() | - |
833 | { | - |
834 | } | - |
835 | | - |
836 | | - |
837 | | - |
838 | | - |
839 | void QTableView::setModel(QAbstractItemModel *model) | - |
840 | { | - |
841 | QTableViewPrivate * const d = d_func(); | - |
842 | if (model == d->model) partially evaluated: model == d->model no Evaluation Count:0 | yes Evaluation Count:521 |
| 0-521 |
843 | return; | 0 |
844 | | - |
845 | if (d->model && d->model != QAbstractItemModelPrivate::staticEmptyModel()) { partially evaluated: d->model yes Evaluation Count:521 | no Evaluation Count:0 |
partially evaluated: d->model != QAbstractItemModelPrivate::staticEmptyModel() no Evaluation Count:0 | yes Evaluation Count:521 |
| 0-521 |
846 | disconnect(d->model, "2""rowsInserted(QModelIndex,int,int)", | - |
847 | this, "1""_q_updateSpanInsertedRows(QModelIndex,int,int)"); | - |
848 | disconnect(d->model, "2""columnsInserted(QModelIndex,int,int)", | - |
849 | this, "1""_q_updateSpanInsertedColumns(QModelIndex,int,int)"); | - |
850 | disconnect(d->model, "2""rowsRemoved(QModelIndex,int,int)", | - |
851 | this, "1""_q_updateSpanRemovedRows(QModelIndex,int,int)"); | - |
852 | disconnect(d->model, "2""columnsRemoved(QModelIndex,int,int)", | - |
853 | this, "1""_q_updateSpanRemovedColumns(QModelIndex,int,int)"); | - |
854 | } | 0 |
855 | if (d->selectionModel) { evaluated: d->selectionModel yes Evaluation Count:53 | yes Evaluation Count:468 |
| 53-468 |
856 | disconnect(d->selectionModel, "2""currentRowChanged(QModelIndex,QModelIndex)", | - |
857 | d->model, "1""submit()"); | - |
858 | } executed: } Execution Count:53 | 53 |
859 | if (model) { evaluated: model yes Evaluation Count:520 | yes Evaluation Count:1 |
| 1-520 |
860 | connect(model, "2""rowsInserted(QModelIndex,int,int)", | - |
861 | this, "1""_q_updateSpanInsertedRows(QModelIndex,int,int)"); | - |
862 | connect(model, "2""columnsInserted(QModelIndex,int,int)", | - |
863 | this, "1""_q_updateSpanInsertedColumns(QModelIndex,int,int)"); | - |
864 | connect(model, "2""rowsRemoved(QModelIndex,int,int)", | - |
865 | this, "1""_q_updateSpanRemovedRows(QModelIndex,int,int)"); | - |
866 | connect(model, "2""columnsRemoved(QModelIndex,int,int)", | - |
867 | this, "1""_q_updateSpanRemovedColumns(QModelIndex,int,int)"); | - |
868 | } executed: } Execution Count:520 | 520 |
869 | d->verticalHeader->setModel(model); | - |
870 | d->horizontalHeader->setModel(model); | - |
871 | QAbstractItemView::setModel(model); | - |
872 | } executed: } Execution Count:521 | 521 |
873 | | - |
874 | | - |
875 | | - |
876 | | - |
877 | void QTableView::setRootIndex(const QModelIndex &index) | - |
878 | { | - |
879 | QTableViewPrivate * const d = d_func(); | - |
880 | if (index == d->root) { evaluated: index == d->root yes Evaluation Count:809 | yes Evaluation Count:3 |
| 3-809 |
881 | viewport()->update(); | - |
882 | return; executed: return; Execution Count:809 | 809 |
883 | } | - |
884 | d->verticalHeader->setRootIndex(index); | - |
885 | d->horizontalHeader->setRootIndex(index); | - |
886 | QAbstractItemView::setRootIndex(index); | - |
887 | } executed: } Execution Count:3 | 3 |
888 | | - |
889 | | - |
890 | | - |
891 | | - |
892 | void QTableView::doItemsLayout() | - |
893 | { | - |
894 | QTableViewPrivate * const d = d_func(); | - |
895 | QAbstractItemView::doItemsLayout(); | - |
896 | if (verticalScrollMode() == QAbstractItemView::ScrollPerItem) evaluated: verticalScrollMode() == QAbstractItemView::ScrollPerItem yes Evaluation Count:356 | yes Evaluation Count:16 |
| 16-356 |
897 | d->verticalHeader->setOffsetToSectionPosition(verticalScrollBar()->value()); executed: d->verticalHeader->setOffsetToSectionPosition(verticalScrollBar()->value()); Execution Count:356 | 356 |
898 | else | - |
899 | d->verticalHeader->setOffset(verticalScrollBar()->value()); executed: d->verticalHeader->setOffset(verticalScrollBar()->value()); Execution Count:16 | 16 |
900 | if (!d->verticalHeader->updatesEnabled()) evaluated: !d->verticalHeader->updatesEnabled() yes Evaluation Count:2 | yes Evaluation Count:370 |
| 2-370 |
901 | d->verticalHeader->setUpdatesEnabled(true); executed: d->verticalHeader->setUpdatesEnabled(true); Execution Count:2 | 2 |
902 | } executed: } Execution Count:372 | 372 |
903 | | - |
904 | | - |
905 | | - |
906 | | - |
907 | void QTableView::setSelectionModel(QItemSelectionModel *selectionModel) | - |
908 | { | - |
909 | QTableViewPrivate * const d = d_func(); | - |
910 | qt_noop(); | - |
911 | if (d->selectionModel) { evaluated: d->selectionModel yes Evaluation Count:53 | yes Evaluation Count:468 |
| 53-468 |
912 | | - |
913 | disconnect(d->selectionModel, "2""currentRowChanged(QModelIndex,QModelIndex)", | - |
914 | d->model, "1""submit()"); | - |
915 | } executed: } Execution Count:53 | 53 |
916 | | - |
917 | d->verticalHeader->setSelectionModel(selectionModel); | - |
918 | d->horizontalHeader->setSelectionModel(selectionModel); | - |
919 | QAbstractItemView::setSelectionModel(selectionModel); | - |
920 | | - |
921 | if (d->selectionModel) { partially evaluated: d->selectionModel yes Evaluation Count:521 | no Evaluation Count:0 |
| 0-521 |
922 | | - |
923 | connect(d->selectionModel, "2""currentRowChanged(QModelIndex,QModelIndex)", | - |
924 | d->model, "1""submit()"); | - |
925 | } executed: } Execution Count:521 | 521 |
926 | } executed: } Execution Count:521 | 521 |
927 | | - |
928 | | - |
929 | | - |
930 | | - |
931 | | - |
932 | | - |
933 | QHeaderView *QTableView::horizontalHeader() const | - |
934 | { | - |
935 | const QTableViewPrivate * const d = d_func(); | - |
936 | return d->horizontalHeader; executed: return d->horizontalHeader; Execution Count:3890 | 3890 |
937 | } | - |
938 | | - |
939 | | - |
940 | | - |
941 | | - |
942 | | - |
943 | | - |
944 | QHeaderView *QTableView::verticalHeader() const | - |
945 | { | - |
946 | const QTableViewPrivate * const d = d_func(); | - |
947 | return d->verticalHeader; executed: return d->verticalHeader; Execution Count:2221 | 2221 |
948 | } | - |
949 | | - |
950 | | - |
951 | | - |
952 | | - |
953 | | - |
954 | | - |
955 | void QTableView::setHorizontalHeader(QHeaderView *header) | - |
956 | { | - |
957 | QTableViewPrivate * const d = d_func(); | - |
958 | | - |
959 | if (!header || header == d->horizontalHeader) evaluated: !header yes Evaluation Count:1 | yes Evaluation Count:487 |
evaluated: header == d->horizontalHeader yes Evaluation Count:1 | yes Evaluation Count:486 |
| 1-487 |
960 | return; executed: return; Execution Count:2 | 2 |
961 | if (d->horizontalHeader && d->horizontalHeader->parent() == this) evaluated: d->horizontalHeader yes Evaluation Count:4 | yes Evaluation Count:482 |
evaluated: d->horizontalHeader->parent() == this yes Evaluation Count:3 | yes Evaluation Count:1 |
| 1-482 |
962 | delete d->horizontalHeader; executed: delete d->horizontalHeader; Execution Count:3 | 3 |
963 | d->horizontalHeader = header; | - |
964 | d->horizontalHeader->setParent(this); | - |
965 | d->horizontalHeader->d_func()->setAllowUserMoveOfSection0(true); | - |
966 | if (!d->horizontalHeader->model()) { evaluated: !d->horizontalHeader->model() yes Evaluation Count:485 | yes Evaluation Count:1 |
| 1-485 |
967 | d->horizontalHeader->setModel(d->model); | - |
968 | if (d->selectionModel) evaluated: d->selectionModel yes Evaluation Count:1 | yes Evaluation Count:484 |
| 1-484 |
969 | d->horizontalHeader->setSelectionModel(d->selectionModel); executed: d->horizontalHeader->setSelectionModel(d->selectionModel); Execution Count:1 | 1 |
970 | } executed: } Execution Count:485 | 485 |
971 | | - |
972 | connect(d->horizontalHeader,"2""sectionResized(int,int,int)", | - |
973 | this, "1""columnResized(int,int,int)"); | - |
974 | connect(d->horizontalHeader, "2""sectionMoved(int,int,int)", | - |
975 | this, "1""columnMoved(int,int,int)"); | - |
976 | connect(d->horizontalHeader, "2""sectionCountChanged(int,int)", | - |
977 | this, "1""columnCountChanged(int,int)"); | - |
978 | connect(d->horizontalHeader, "2""sectionPressed(int)", this, "1""selectColumn(int)"); | - |
979 | connect(d->horizontalHeader, "2""sectionEntered(int)", this, "1""_q_selectColumn(int)"); | - |
980 | connect(d->horizontalHeader, "2""sectionHandleDoubleClicked(int)", | - |
981 | this, "1""resizeColumnToContents(int)"); | - |
982 | connect(d->horizontalHeader, "2""geometriesChanged()", this, "1""updateGeometries()"); | - |
983 | | - |
984 | | - |
985 | setSortingEnabled(d->sortingEnabled); | - |
986 | } executed: } Execution Count:486 | 486 |
987 | | - |
988 | | - |
989 | | - |
990 | | - |
991 | | - |
992 | | - |
993 | void QTableView::setVerticalHeader(QHeaderView *header) | - |
994 | { | - |
995 | QTableViewPrivate * const d = d_func(); | - |
996 | | - |
997 | if (!header || header == d->verticalHeader) evaluated: !header yes Evaluation Count:1 | yes Evaluation Count:539 |
evaluated: header == d->verticalHeader yes Evaluation Count:1 | yes Evaluation Count:538 |
| 1-539 |
998 | return; executed: return; Execution Count:2 | 2 |
999 | if (d->verticalHeader && d->verticalHeader->parent() == this) evaluated: d->verticalHeader yes Evaluation Count:56 | yes Evaluation Count:482 |
evaluated: d->verticalHeader->parent() == this yes Evaluation Count:55 | yes Evaluation Count:1 |
| 1-482 |
1000 | delete d->verticalHeader; executed: delete d->verticalHeader; Execution Count:55 | 55 |
1001 | d->verticalHeader = header; | - |
1002 | d->verticalHeader->setParent(this); | - |
1003 | d->verticalHeader->d_func()->setAllowUserMoveOfSection0(true); | - |
1004 | if (!d->verticalHeader->model()) { evaluated: !d->verticalHeader->model() yes Evaluation Count:485 | yes Evaluation Count:53 |
| 53-485 |
1005 | d->verticalHeader->setModel(d->model); | - |
1006 | if (d->selectionModel) evaluated: d->selectionModel yes Evaluation Count:1 | yes Evaluation Count:484 |
| 1-484 |
1007 | d->verticalHeader->setSelectionModel(d->selectionModel); executed: d->verticalHeader->setSelectionModel(d->selectionModel); Execution Count:1 | 1 |
1008 | } executed: } Execution Count:485 | 485 |
1009 | | - |
1010 | connect(d->verticalHeader, "2""sectionResized(int,int,int)", | - |
1011 | this, "1""rowResized(int,int,int)"); | - |
1012 | connect(d->verticalHeader, "2""sectionMoved(int,int,int)", | - |
1013 | this, "1""rowMoved(int,int,int)"); | - |
1014 | connect(d->verticalHeader, "2""sectionCountChanged(int,int)", | - |
1015 | this, "1""rowCountChanged(int,int)"); | - |
1016 | connect(d->verticalHeader, "2""sectionPressed(int)", this, "1""selectRow(int)"); | - |
1017 | connect(d->verticalHeader, "2""sectionEntered(int)", this, "1""_q_selectRow(int)"); | - |
1018 | connect(d->verticalHeader, "2""sectionHandleDoubleClicked(int)", | - |
1019 | this, "1""resizeRowToContents(int)"); | - |
1020 | connect(d->verticalHeader, "2""geometriesChanged()", this, "1""updateGeometries()"); | - |
1021 | } executed: } Execution Count:538 | 538 |
1022 | | - |
1023 | | - |
1024 | | - |
1025 | | - |
1026 | | - |
1027 | | - |
1028 | void QTableView::scrollContentsBy(int dx, int dy) | - |
1029 | { | - |
1030 | QTableViewPrivate * const d = d_func(); | - |
1031 | | - |
1032 | d->delayedAutoScroll.stop(); | - |
1033 | | - |
1034 | dx = isRightToLeft() ? -dx : dx; partially evaluated: isRightToLeft() no Evaluation Count:0 | yes Evaluation Count:4444 |
| 0-4444 |
1035 | if (dx) { evaluated: dx yes Evaluation Count:4139 | yes Evaluation Count:305 |
| 305-4139 |
1036 | if (horizontalScrollMode() == QAbstractItemView::ScrollPerItem) { evaluated: horizontalScrollMode() == QAbstractItemView::ScrollPerItem yes Evaluation Count:2184 | yes Evaluation Count:1955 |
| 1955-2184 |
1037 | int oldOffset = d->horizontalHeader->offset(); | - |
1038 | if (horizontalScrollBar()->value() == horizontalScrollBar()->maximum()) evaluated: horizontalScrollBar()->value() == horizontalScrollBar()->maximum() yes Evaluation Count:99 | yes Evaluation Count:2085 |
| 99-2085 |
1039 | d->horizontalHeader->setOffsetToLastSection(); executed: d->horizontalHeader->setOffsetToLastSection(); Execution Count:99 | 99 |
1040 | else | - |
1041 | d->horizontalHeader->setOffsetToSectionPosition(horizontalScrollBar()->value()); executed: d->horizontalHeader->setOffsetToSectionPosition(horizontalScrollBar()->value()); Execution Count:2085 | 2085 |
1042 | int newOffset = d->horizontalHeader->offset(); | - |
1043 | dx = isRightToLeft() ? newOffset - oldOffset : oldOffset - newOffset; partially evaluated: isRightToLeft() no Evaluation Count:0 | yes Evaluation Count:2184 |
| 0-2184 |
1044 | } else { executed: } Execution Count:2184 | 2184 |
1045 | d->horizontalHeader->setOffset(horizontalScrollBar()->value()); | - |
1046 | } executed: } Execution Count:1955 | 1955 |
1047 | } | - |
1048 | if (dy) { evaluated: dy yes Evaluation Count:305 | yes Evaluation Count:4139 |
| 305-4139 |
1049 | if (verticalScrollMode() == QAbstractItemView::ScrollPerItem) { evaluated: verticalScrollMode() == QAbstractItemView::ScrollPerItem yes Evaluation Count:223 | yes Evaluation Count:82 |
| 82-223 |
1050 | int oldOffset = d->verticalHeader->offset(); | - |
1051 | if (verticalScrollBar()->value() == verticalScrollBar()->maximum()) evaluated: verticalScrollBar()->value() == verticalScrollBar()->maximum() yes Evaluation Count:16 | yes Evaluation Count:207 |
| 16-207 |
1052 | d->verticalHeader->setOffsetToLastSection(); executed: d->verticalHeader->setOffsetToLastSection(); Execution Count:16 | 16 |
1053 | else | - |
1054 | d->verticalHeader->setOffsetToSectionPosition(verticalScrollBar()->value()); executed: d->verticalHeader->setOffsetToSectionPosition(verticalScrollBar()->value()); Execution Count:207 | 207 |
1055 | int newOffset = d->verticalHeader->offset(); | - |
1056 | dy = oldOffset - newOffset; | - |
1057 | } else { executed: } Execution Count:223 | 223 |
1058 | d->verticalHeader->setOffset(verticalScrollBar()->value()); | - |
1059 | } executed: } Execution Count:82 | 82 |
1060 | } | - |
1061 | d->scrollContentsBy(dx, dy); | - |
1062 | | - |
1063 | if (d->showGrid) { evaluated: d->showGrid yes Evaluation Count:3094 | yes Evaluation Count:1350 |
| 1350-3094 |
1064 | | - |
1065 | | - |
1066 | | - |
1067 | if (dy > 0 && d->horizontalHeader->isHidden() && d->verticalScrollMode == ScrollPerItem) { evaluated: dy > 0 yes Evaluation Count:25 | yes Evaluation Count:3069 |
partially evaluated: d->horizontalHeader->isHidden() no Evaluation Count:0 | yes Evaluation Count:25 |
never evaluated: d->verticalScrollMode == ScrollPerItem | 0-3069 |
1068 | d->viewport->update(0, dy, d->viewport->width(), dy); | - |
1069 | } | 0 |
1070 | if (dx > 0 && d->verticalHeader->isHidden() && d->horizontalScrollMode == ScrollPerItem) { evaluated: dx > 0 yes Evaluation Count:126 | yes Evaluation Count:2968 |
partially evaluated: d->verticalHeader->isHidden() no Evaluation Count:0 | yes Evaluation Count:126 |
never evaluated: d->horizontalScrollMode == ScrollPerItem | 0-2968 |
1071 | d->viewport->update(dx, 0, dx, d->viewport->height()); | - |
1072 | } | 0 |
1073 | } executed: } Execution Count:3094 | 3094 |
1074 | } executed: } Execution Count:4444 | 4444 |
1075 | | - |
1076 | QStyleOptionViewItem QTableViewPrivate::viewOptions() const | - |
1077 | { | - |
1078 | QStyleOptionViewItem option = QAbstractItemViewPrivate::viewOptions(); | - |
1079 | option.showDecorationSelected = true; | - |
1080 | return option; executed: return option; Execution Count:2493 | 2493 |
1081 | } | - |
1082 | | - |
1083 | | - |
1084 | | - |
1085 | | - |
1086 | QStyleOptionViewItem QTableView::viewOptions() const | - |
1087 | { | - |
1088 | const QTableViewPrivate * const d = d_func(); | - |
1089 | return d->viewOptions(); executed: return d->viewOptions(); Execution Count:8 | 8 |
1090 | } | - |
1091 | | - |
1092 | | - |
1093 | | - |
1094 | | - |
1095 | void QTableView::paintEvent(QPaintEvent *event) | - |
1096 | { | - |
1097 | QTableViewPrivate * const d = d_func(); | - |
1098 | | - |
1099 | QStyleOptionViewItem option = d->viewOptions(); | - |
1100 | const QPoint offset = d->scrollDelayOffset; | - |
1101 | const bool showGrid = d->showGrid; | - |
1102 | const int gridSize = showGrid ? 1 : 0; evaluated: showGrid yes Evaluation Count:282 | yes Evaluation Count:88 |
| 88-282 |
1103 | const int gridHint = style()->styleHint(QStyle::SH_Table_GridLineColor, &option, this); | - |
1104 | const QColor gridColor = static_cast<QRgb>(gridHint); | - |
1105 | const QPen gridPen = QPen(gridColor, 0, d->gridStyle); | - |
1106 | const QHeaderView *verticalHeader = d->verticalHeader; | - |
1107 | const QHeaderView *horizontalHeader = d->horizontalHeader; | - |
1108 | const bool alternate = d->alternatingColors; | - |
1109 | const bool rightToLeft = isRightToLeft(); | - |
1110 | | - |
1111 | QPainter painter(d->viewport); | - |
1112 | | - |
1113 | | - |
1114 | if (horizontalHeader->count() == 0 || verticalHeader->count() == 0 || !d->itemDelegate) evaluated: horizontalHeader->count() == 0 yes Evaluation Count:35 | yes Evaluation Count:335 |
partially evaluated: verticalHeader->count() == 0 no Evaluation Count:0 | yes Evaluation Count:335 |
partially evaluated: !d->itemDelegate no Evaluation Count:0 | yes Evaluation Count:335 |
| 0-335 |
1115 | return; executed: return; Execution Count:35 | 35 |
1116 | | - |
1117 | uint x = horizontalHeader->length() - horizontalHeader->offset() - (rightToLeft ? 0 : 1); evaluated: rightToLeft yes Evaluation Count:2 | yes Evaluation Count:333 |
| 2-333 |
1118 | uint y = verticalHeader->length() - verticalHeader->offset() - 1; | - |
1119 | | - |
1120 | const QRegion region = event->region().translated(offset); | - |
1121 | const QVector<QRect> rects = region.rects(); | - |
1122 | | - |
1123 | | - |
1124 | | - |
1125 | int firstVisualRow = qMax(verticalHeader->visualIndexAt(0),0); | - |
1126 | int lastVisualRow = verticalHeader->visualIndexAt(verticalHeader->viewport()->height()); | - |
1127 | if (lastVisualRow == -1) evaluated: lastVisualRow == -1 yes Evaluation Count:109 | yes Evaluation Count:226 |
| 109-226 |
1128 | lastVisualRow = d->model->rowCount(d->root) - 1; executed: lastVisualRow = d->model->rowCount(d->root) - 1; Execution Count:109 | 109 |
1129 | | - |
1130 | int firstVisualColumn = horizontalHeader->visualIndexAt(0); | - |
1131 | int lastVisualColumn = horizontalHeader->visualIndexAt(horizontalHeader->viewport()->width()); | - |
1132 | if (rightToLeft) evaluated: rightToLeft yes Evaluation Count:2 | yes Evaluation Count:333 |
| 2-333 |
1133 | qSwap(firstVisualColumn, lastVisualColumn); executed: qSwap(firstVisualColumn, lastVisualColumn); Execution Count:2 | 2 |
1134 | if (firstVisualColumn == -1) partially evaluated: firstVisualColumn == -1 no Evaluation Count:0 | yes Evaluation Count:335 |
| 0-335 |
1135 | firstVisualColumn = 0; never executed: firstVisualColumn = 0; | 0 |
1136 | if (lastVisualColumn == -1) evaluated: lastVisualColumn == -1 yes Evaluation Count:119 | yes Evaluation Count:216 |
| 119-216 |
1137 | lastVisualColumn = horizontalHeader->count() - 1; executed: lastVisualColumn = horizontalHeader->count() - 1; Execution Count:119 | 119 |
1138 | | - |
1139 | QBitArray drawn((lastVisualRow - firstVisualRow + 1) * (lastVisualColumn - firstVisualColumn + 1)); | - |
1140 | | - |
1141 | if (d->hasSpans()) { evaluated: d->hasSpans() yes Evaluation Count:16 | yes Evaluation Count:319 |
| 16-319 |
1142 | d->drawAndClipSpans(region, &painter, option, &drawn, | - |
1143 | firstVisualRow, lastVisualRow, firstVisualColumn, lastVisualColumn); | - |
1144 | } executed: } Execution Count:16 | 16 |
1145 | | - |
1146 | for (int i = 0; i < rects.size(); ++i) { evaluated: i < rects.size() yes Evaluation Count:642 | yes Evaluation Count:335 |
| 335-642 |
1147 | QRect dirtyArea = rects.at(i); | - |
1148 | dirtyArea.setBottom(qMin(dirtyArea.bottom(), int(y))); | - |
1149 | if (rightToLeft) { evaluated: rightToLeft yes Evaluation Count:2 | yes Evaluation Count:640 |
| 2-640 |
1150 | dirtyArea.setLeft(qMax(dirtyArea.left(), d->viewport->width() - int(x))); | - |
1151 | } else { executed: } Execution Count:2 | 2 |
1152 | dirtyArea.setRight(qMin(dirtyArea.right(), int(x))); | - |
1153 | } executed: } Execution Count:640 | 640 |
1154 | | - |
1155 | | - |
1156 | int left = horizontalHeader->visualIndexAt(dirtyArea.left()); | - |
1157 | int right = horizontalHeader->visualIndexAt(dirtyArea.right()); | - |
1158 | if (rightToLeft) evaluated: rightToLeft yes Evaluation Count:2 | yes Evaluation Count:640 |
| 2-640 |
1159 | qSwap(left, right); executed: qSwap(left, right); Execution Count:2 | 2 |
1160 | if (left == -1) left = 0; never executed: left = 0; partially evaluated: left == -1 no Evaluation Count:0 | yes Evaluation Count:642 |
| 0-642 |
1161 | if (right == -1) right = horizontalHeader->count() - 1; never executed: right = horizontalHeader->count() - 1; partially evaluated: right == -1 no Evaluation Count:0 | yes Evaluation Count:642 |
| 0-642 |
1162 | | - |
1163 | | - |
1164 | int bottom = verticalHeader->visualIndexAt(dirtyArea.bottom()); | - |
1165 | if (bottom == -1) bottom = verticalHeader->count() - 1; never executed: bottom = verticalHeader->count() - 1; partially evaluated: bottom == -1 no Evaluation Count:0 | yes Evaluation Count:642 |
| 0-642 |
1166 | int top = 0; | - |
1167 | bool alternateBase = false; | - |
1168 | if (alternate && verticalHeader->sectionsHidden()) { partially evaluated: alternate no Evaluation Count:0 | yes Evaluation Count:642 |
never evaluated: verticalHeader->sectionsHidden() | 0-642 |
1169 | uint verticalOffset = verticalHeader->offset(); | - |
1170 | int row = verticalHeader->logicalIndex(top); | - |
1171 | for (int y = 0; | - |
1172 | ((uint)(y += verticalHeader->sectionSize(top)) <= verticalOffset) && (top < bottom); never evaluated: ((uint)(y += verticalHeader->sectionSize(top)) <= verticalOffset) never evaluated: (top < bottom) | 0 |
1173 | ++top) { | - |
1174 | row = verticalHeader->logicalIndex(top); | - |
1175 | if (alternate && !verticalHeader->isSectionHidden(row)) never evaluated: alternate never evaluated: !verticalHeader->isSectionHidden(row) | 0 |
1176 | alternateBase = !alternateBase; never executed: alternateBase = !alternateBase; | 0 |
1177 | } | 0 |
1178 | } else { | 0 |
1179 | top = verticalHeader->visualIndexAt(dirtyArea.top()); | - |
1180 | alternateBase = (top & 1) && alternate; evaluated: (top & 1) yes Evaluation Count:212 | yes Evaluation Count:430 |
partially evaluated: alternate no Evaluation Count:0 | yes Evaluation Count:212 |
| 0-430 |
1181 | } executed: } Execution Count:642 | 642 |
1182 | if (top == -1 || top > bottom) partially evaluated: top == -1 no Evaluation Count:0 | yes Evaluation Count:642 |
partially evaluated: top > bottom no Evaluation Count:0 | yes Evaluation Count:642 |
| 0-642 |
1183 | continue; never executed: continue; | 0 |
1184 | | - |
1185 | | - |
1186 | for (int visualRowIndex = top; visualRowIndex <= bottom; ++visualRowIndex) { evaluated: visualRowIndex <= bottom yes Evaluation Count:1379 | yes Evaluation Count:642 |
| 642-1379 |
1187 | int row = verticalHeader->logicalIndex(visualRowIndex); | - |
1188 | if (verticalHeader->isSectionHidden(row)) partially evaluated: verticalHeader->isSectionHidden(row) no Evaluation Count:0 | yes Evaluation Count:1379 |
| 0-1379 |
1189 | continue; never executed: continue; | 0 |
1190 | int rowY = rowViewportPosition(row); | - |
1191 | rowY += offset.y(); | - |
1192 | int rowh = rowHeight(row) - gridSize; | - |
1193 | | - |
1194 | | - |
1195 | for (int visualColumnIndex = left; visualColumnIndex <= right; ++visualColumnIndex) { evaluated: visualColumnIndex <= right yes Evaluation Count:5172 | yes Evaluation Count:1379 |
| 1379-5172 |
1196 | int currentBit = (visualRowIndex - firstVisualRow) * (lastVisualColumn - firstVisualColumn + 1) | - |
1197 | + visualColumnIndex - firstVisualColumn; | - |
1198 | | - |
1199 | if (currentBit < 0 || currentBit >= drawn.size() || drawn.testBit(currentBit)) partially evaluated: currentBit < 0 no Evaluation Count:0 | yes Evaluation Count:5172 |
partially evaluated: currentBit >= drawn.size() no Evaluation Count:0 | yes Evaluation Count:5172 |
evaluated: drawn.testBit(currentBit) yes Evaluation Count:116 | yes Evaluation Count:5056 |
| 0-5172 |
1200 | continue; executed: continue; Execution Count:116 | 116 |
1201 | drawn.setBit(currentBit); | - |
1202 | | - |
1203 | int col = horizontalHeader->logicalIndex(visualColumnIndex); | - |
1204 | if (horizontalHeader->isSectionHidden(col)) partially evaluated: horizontalHeader->isSectionHidden(col) no Evaluation Count:0 | yes Evaluation Count:5056 |
| 0-5056 |
1205 | continue; never executed: continue; | 0 |
1206 | int colp = columnViewportPosition(col); | - |
1207 | colp += offset.x(); | - |
1208 | int colw = columnWidth(col) - gridSize; | - |
1209 | | - |
1210 | const QModelIndex index = d->model->index(row, col, d->root); | - |
1211 | if (index.isValid()) { partially evaluated: index.isValid() yes Evaluation Count:5056 | no Evaluation Count:0 |
| 0-5056 |
1212 | option.rect = QRect(colp + (showGrid && rightToLeft ? 1 : 0), rowY, colw, rowh); | - |
1213 | if (alternate) { partially evaluated: alternate no Evaluation Count:0 | yes Evaluation Count:5056 |
| 0-5056 |
1214 | if (alternateBase) never evaluated: alternateBase | 0 |
1215 | option.features |= QStyleOptionViewItem::Alternate; never executed: option.features |= QStyleOptionViewItem::Alternate; | 0 |
1216 | else | - |
1217 | option.features &= ~QStyleOptionViewItem::Alternate; never executed: option.features &= ~QStyleOptionViewItem::Alternate; | 0 |
1218 | } | - |
1219 | d->drawCell(&painter, option, index); | - |
1220 | } executed: } Execution Count:5056 | 5056 |
1221 | } executed: } Execution Count:5056 | 5056 |
1222 | alternateBase = !alternateBase && alternate; partially evaluated: !alternateBase yes Evaluation Count:1379 | no Evaluation Count:0 |
partially evaluated: alternate no Evaluation Count:0 | yes Evaluation Count:1379 |
| 0-1379 |
1223 | } executed: } Execution Count:1379 | 1379 |
1224 | | - |
1225 | if (showGrid) { evaluated: showGrid yes Evaluation Count:518 | yes Evaluation Count:124 |
| 124-518 |
1226 | | - |
1227 | while (verticalHeader->isSectionHidden(verticalHeader->logicalIndex(bottom))) --bottom; never executed: --bottom; partially evaluated: verticalHeader->isSectionHidden(verticalHeader->logicalIndex(bottom)) no Evaluation Count:0 | yes Evaluation Count:518 |
| 0-518 |
1228 | QPen old = painter.pen(); | - |
1229 | painter.setPen(gridPen); | - |
1230 | | - |
1231 | for (int visualIndex = top; visualIndex <= bottom; ++visualIndex) { evaluated: visualIndex <= bottom yes Evaluation Count:917 | yes Evaluation Count:518 |
| 518-917 |
1232 | int row = verticalHeader->logicalIndex(visualIndex); | - |
1233 | if (verticalHeader->isSectionHidden(row)) partially evaluated: verticalHeader->isSectionHidden(row) no Evaluation Count:0 | yes Evaluation Count:917 |
| 0-917 |
1234 | continue; never executed: continue; | 0 |
1235 | int rowY = rowViewportPosition(row); | - |
1236 | rowY += offset.y(); | - |
1237 | int rowh = rowHeight(row) - gridSize; | - |
1238 | painter.drawLine(dirtyArea.left(), rowY + rowh, dirtyArea.right(), rowY + rowh); | - |
1239 | } executed: } Execution Count:917 | 917 |
1240 | | - |
1241 | | - |
1242 | for (int h = left; h <= right; ++h) { evaluated: h <= right yes Evaluation Count:777 | yes Evaluation Count:518 |
| 518-777 |
1243 | int col = horizontalHeader->logicalIndex(h); | - |
1244 | if (horizontalHeader->isSectionHidden(col)) partially evaluated: horizontalHeader->isSectionHidden(col) no Evaluation Count:0 | yes Evaluation Count:777 |
| 0-777 |
1245 | continue; never executed: continue; | 0 |
1246 | int colp = columnViewportPosition(col); | - |
1247 | colp += offset.x(); | - |
1248 | if (!rightToLeft) evaluated: !rightToLeft yes Evaluation Count:771 | yes Evaluation Count:6 |
| 6-771 |
1249 | colp += columnWidth(col) - gridSize; executed: colp += columnWidth(col) - gridSize; Execution Count:771 | 771 |
1250 | painter.drawLine(colp, dirtyArea.top(), colp, dirtyArea.bottom()); | - |
1251 | } executed: } Execution Count:777 | 777 |
1252 | | - |
1253 | | - |
1254 | | - |
1255 | if (horizontalHeader->isHidden() && verticalScrollMode() == ScrollPerItem) partially evaluated: horizontalHeader->isHidden() no Evaluation Count:0 | yes Evaluation Count:518 |
never evaluated: verticalScrollMode() == ScrollPerItem | 0-518 |
1256 | painter.drawLine(dirtyArea.left(), 0, dirtyArea.right(), 0); never executed: painter.drawLine(dirtyArea.left(), 0, dirtyArea.right(), 0); | 0 |
1257 | if (verticalHeader->isHidden() && horizontalScrollMode() == ScrollPerItem) partially evaluated: verticalHeader->isHidden() no Evaluation Count:0 | yes Evaluation Count:518 |
never evaluated: horizontalScrollMode() == ScrollPerItem | 0-518 |
1258 | painter.drawLine(0, dirtyArea.top(), 0, dirtyArea.bottom()); never executed: painter.drawLine(0, dirtyArea.top(), 0, dirtyArea.bottom()); | 0 |
1259 | painter.setPen(old); | - |
1260 | } executed: } Execution Count:518 | 518 |
1261 | } executed: } Execution Count:642 | 642 |
1262 | | - |
1263 | | - |
1264 | | - |
1265 | d->paintDropIndicator(&painter); | - |
1266 | | - |
1267 | } executed: } Execution Count:335 | 335 |
1268 | | - |
1269 | | - |
1270 | | - |
1271 | | - |
1272 | | - |
1273 | QModelIndex QTableView::indexAt(const QPoint &pos) const | - |
1274 | { | - |
1275 | const QTableViewPrivate * const d = d_func(); | - |
1276 | d->executePostedLayout(); | - |
1277 | int r = rowAt(pos.y()); | - |
1278 | int c = columnAt(pos.x()); | - |
1279 | if (r >= 0 && c >= 0) { evaluated: r >= 0 yes Evaluation Count:6254 | yes Evaluation Count:50 |
evaluated: c >= 0 yes Evaluation Count:6253 | yes Evaluation Count:1 |
| 1-6254 |
1280 | if (d->hasSpans()) { evaluated: d->hasSpans() yes Evaluation Count:141 | yes Evaluation Count:6112 |
| 141-6112 |
1281 | QSpanCollection::Span span = d->span(r, c); | - |
1282 | r = span.top(); | - |
1283 | c = span.left(); | - |
1284 | } executed: } Execution Count:141 | 141 |
1285 | return d->model->index(r, c, d->root); executed: return d->model->index(r, c, d->root); Execution Count:6253 | 6253 |
1286 | } | - |
1287 | return QModelIndex(); executed: return QModelIndex(); Execution Count:51 | 51 |
1288 | } | - |
1289 | int QTableView::horizontalOffset() const | - |
1290 | { | - |
1291 | const QTableViewPrivate * const d = d_func(); | - |
1292 | return d->horizontalHeader->offset(); executed: return d->horizontalHeader->offset(); Execution Count:1470 | 1470 |
1293 | } | - |
1294 | int QTableView::verticalOffset() const | - |
1295 | { | - |
1296 | const QTableViewPrivate * const d = d_func(); | - |
1297 | return d->verticalHeader->offset(); executed: return d->verticalHeader->offset(); Execution Count:1470 | 1470 |
1298 | } | - |
1299 | QModelIndex QTableView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers) | - |
1300 | { | - |
1301 | QTableViewPrivate * const d = d_func(); | - |
1302 | (void)modifiers;; | - |
1303 | | - |
1304 | int bottom = d->model->rowCount(d->root) - 1; | - |
1305 | | - |
1306 | while (bottom >= 0 && isRowHidden(d->logicalRow(bottom))) evaluated: bottom >= 0 yes Evaluation Count:334 | yes Evaluation Count:6 |
evaluated: isRowHidden(d->logicalRow(bottom)) yes Evaluation Count:3 | yes Evaluation Count:331 |
| 3-334 |
1307 | --bottom; executed: --bottom; Execution Count:3 | 3 |
1308 | | - |
1309 | int right = d->model->columnCount(d->root) - 1; | - |
1310 | | - |
1311 | while (right >= 0 && isColumnHidden(d->logicalColumn(right))) evaluated: right >= 0 yes Evaluation Count:340 | yes Evaluation Count:6 |
evaluated: isColumnHidden(d->logicalColumn(right)) yes Evaluation Count:9 | yes Evaluation Count:331 |
| 6-340 |
1312 | --right; executed: --right; Execution Count:9 | 9 |
1313 | | - |
1314 | if (bottom == -1 || right == -1) evaluated: bottom == -1 yes Evaluation Count:6 | yes Evaluation Count:331 |
partially evaluated: right == -1 no Evaluation Count:0 | yes Evaluation Count:331 |
| 0-331 |
1315 | return QModelIndex(); executed: return QModelIndex(); Execution Count:6 | 6 |
1316 | | - |
1317 | QModelIndex current = currentIndex(); | - |
1318 | | - |
1319 | if (!current.isValid()) { evaluated: !current.isValid() yes Evaluation Count:38 | yes Evaluation Count:293 |
| 38-293 |
1320 | int row = 0; | - |
1321 | int column = 0; | - |
1322 | while (column < right && isColumnHidden(d->logicalColumn(column))) evaluated: column < right yes Evaluation Count:26 | yes Evaluation Count:13 |
evaluated: isColumnHidden(d->logicalColumn(column)) yes Evaluation Count:1 | yes Evaluation Count:25 |
| 1-26 |
1323 | ++column; executed: ++column; Execution Count:1 | 1 |
1324 | while (isRowHidden(d->logicalRow(row)) && row < bottom) partially evaluated: isRowHidden(d->logicalRow(row)) no Evaluation Count:0 | yes Evaluation Count:38 |
never evaluated: row < bottom | 0-38 |
1325 | ++row; | 0 |
1326 | d->visualCursor = QPoint(column, row); | - |
1327 | return d->model->index(d->logicalRow(row), d->logicalColumn(column), d->root); executed: return d->model->index(d->logicalRow(row), d->logicalColumn(column), d->root); Execution Count:38 | 38 |
1328 | } | - |
1329 | | - |
1330 | | - |
1331 | QPoint visualCurrent(d->visualColumn(current.column()), d->visualRow(current.row())); | - |
1332 | if (visualCurrent != d->visualCursor) { evaluated: visualCurrent != d->visualCursor yes Evaluation Count:110 | yes Evaluation Count:183 |
| 110-183 |
1333 | if (d->hasSpans()) { evaluated: d->hasSpans() yes Evaluation Count:9 | yes Evaluation Count:101 |
| 9-101 |
1334 | QSpanCollection::Span span = d->span(current.row(), current.column()); | - |
1335 | if (span.top() > d->visualCursor.y() || d->visualCursor.y() > span.bottom() evaluated: span.top() > d->visualCursor.y() yes Evaluation Count:8 | yes Evaluation Count:1 |
partially evaluated: d->visualCursor.y() > span.bottom() no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-8 |
1336 | || span.left() > d->visualCursor.x() || d->visualCursor.x() > span.right()) partially evaluated: span.left() > d->visualCursor.x() yes Evaluation Count:1 | no Evaluation Count:0 |
never evaluated: d->visualCursor.x() > span.right() | 0-1 |
1337 | d->visualCursor = visualCurrent; executed: d->visualCursor = visualCurrent; Execution Count:9 | 9 |
1338 | } else { executed: } Execution Count:9 | 9 |
1339 | d->visualCursor = visualCurrent; | - |
1340 | } executed: } Execution Count:101 | 101 |
1341 | } | - |
1342 | | - |
1343 | int visualRow = d->visualCursor.y(); | - |
1344 | if (visualRow > bottom) partially evaluated: visualRow > bottom no Evaluation Count:0 | yes Evaluation Count:293 |
| 0-293 |
1345 | visualRow = bottom; never executed: visualRow = bottom; | 0 |
1346 | qt_noop(); | - |
1347 | int visualColumn = d->visualCursor.x(); | - |
1348 | if (visualColumn > right) evaluated: visualColumn > right yes Evaluation Count:1 | yes Evaluation Count:292 |
| 1-292 |
1349 | visualColumn = right; executed: visualColumn = right; Execution Count:1 | 1 |
1350 | qt_noop(); | - |
1351 | | - |
1352 | if (isRightToLeft()) { partially evaluated: isRightToLeft() no Evaluation Count:0 | yes Evaluation Count:293 |
| 0-293 |
1353 | if (cursorAction == MoveLeft) never evaluated: cursorAction == MoveLeft | 0 |
1354 | cursorAction = MoveRight; never executed: cursorAction = MoveRight; | 0 |
1355 | else if (cursorAction == MoveRight) never evaluated: cursorAction == MoveRight | 0 |
1356 | cursorAction = MoveLeft; never executed: cursorAction = MoveLeft; | 0 |
1357 | } | - |
1358 | | - |
1359 | switch (cursorAction) { | - |
1360 | case MoveUp: { | - |
1361 | int originalRow = visualRow; | - |
1362 | | - |
1363 | | - |
1364 | | - |
1365 | | - |
1366 | | - |
1367 | int r = d->logicalRow(visualRow); | - |
1368 | int c = d->logicalColumn(visualColumn); | - |
1369 | if (r != -1 && d->hasSpans()) { partially evaluated: r != -1 yes Evaluation Count:59 | no Evaluation Count:0 |
evaluated: d->hasSpans() yes Evaluation Count:2 | yes Evaluation Count:57 |
| 0-59 |
1370 | QSpanCollection::Span span = d->span(r, c); | - |
1371 | if (span.width() > 1 || span.height() > 1) evaluated: span.width() > 1 yes Evaluation Count:1 | yes Evaluation Count:1 |
partially evaluated: span.height() > 1 no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
1372 | visualRow = d->visualRow(span.top()); executed: visualRow = d->visualRow(span.top()); Execution Count:1 | 1 |
1373 | } executed: } Execution Count:2 | 2 |
1374 | while (visualRow >= 0) { partially evaluated: visualRow >= 0 yes Evaluation Count:79 | no Evaluation Count:0 |
| 0-79 |
1375 | --visualRow; | - |
1376 | r = d->logicalRow(visualRow); | - |
1377 | c = d->logicalColumn(visualColumn); | - |
1378 | if (r == -1 || (!isRowHidden(r) && d->isCellEnabled(r, c))) evaluated: r == -1 yes Evaluation Count:15 | yes Evaluation Count:64 |
evaluated: !isRowHidden(r) yes Evaluation Count:62 | yes Evaluation Count:2 |
evaluated: d->isCellEnabled(r, c) yes Evaluation Count:44 | yes Evaluation Count:18 |
| 2-64 |
1379 | break; executed: break; Execution Count:59 | 59 |
1380 | } executed: } Execution Count:20 | 20 |
1381 | if (visualRow < 0) evaluated: visualRow < 0 yes Evaluation Count:15 | yes Evaluation Count:44 |
| 15-44 |
1382 | visualRow = originalRow; executed: visualRow = originalRow; Execution Count:15 | 15 |
1383 | break; executed: break; Execution Count:59 | 59 |
1384 | } | - |
1385 | case MoveDown: { | - |
1386 | int originalRow = visualRow; | - |
1387 | if (d->hasSpans()) { evaluated: d->hasSpans() yes Evaluation Count:49 | yes Evaluation Count:76 |
| 49-76 |
1388 | QSpanCollection::Span span = d->span(current.row(), current.column()); | - |
1389 | visualRow = d->visualRow(d->rowSpanEndLogical(span.top(), span.height())); | - |
1390 | } executed: } Execution Count:49 | 49 |
1391 | | - |
1392 | | - |
1393 | | - |
1394 | | - |
1395 | int r = d->logicalRow(visualRow); | - |
1396 | int c = d->logicalColumn(visualColumn); | - |
1397 | if (r != -1 && d->hasSpans()) { partially evaluated: r != -1 yes Evaluation Count:125 | no Evaluation Count:0 |
evaluated: d->hasSpans() yes Evaluation Count:49 | yes Evaluation Count:76 |
| 0-125 |
1398 | QSpanCollection::Span span = d->span(r, c); | - |
1399 | if (span.width() > 1 || span.height() > 1) evaluated: span.width() > 1 yes Evaluation Count:44 | yes Evaluation Count:5 |
partially evaluated: span.height() > 1 no Evaluation Count:0 | yes Evaluation Count:5 |
| 0-44 |
1400 | visualRow = d->visualRow(d->rowSpanEndLogical(span.top(), span.height())); executed: visualRow = d->visualRow(d->rowSpanEndLogical(span.top(), span.height())); Execution Count:44 | 44 |
1401 | } executed: } Execution Count:49 | 49 |
1402 | while (visualRow <= bottom) { evaluated: visualRow <= bottom yes Evaluation Count:128 | yes Evaluation Count:1 |
| 1-128 |
1403 | ++visualRow; | - |
1404 | r = d->logicalRow(visualRow); | - |
1405 | c = d->logicalColumn(visualColumn); | - |
1406 | if (r == -1 || (!isRowHidden(r) && d->isCellEnabled(r, c))) evaluated: r == -1 yes Evaluation Count:3 | yes Evaluation Count:125 |
evaluated: !isRowHidden(r) yes Evaluation Count:122 | yes Evaluation Count:3 |
evaluated: d->isCellEnabled(r, c) yes Evaluation Count:121 | yes Evaluation Count:1 |
| 1-125 |
1407 | break; executed: break; Execution Count:124 | 124 |
1408 | } executed: } Execution Count:4 | 4 |
1409 | if (visualRow > bottom) evaluated: visualRow > bottom yes Evaluation Count:4 | yes Evaluation Count:121 |
| 4-121 |
1410 | visualRow = originalRow; executed: visualRow = originalRow; Execution Count:4 | 4 |
1411 | break; executed: break; Execution Count:125 | 125 |
1412 | } | - |
1413 | case MovePrevious: | - |
1414 | case MoveLeft: { | - |
1415 | int originalRow = visualRow; | - |
1416 | int originalColumn = visualColumn; | - |
1417 | bool firstTime = true; | - |
1418 | bool looped = false; | - |
1419 | bool wrapped = false; | - |
1420 | do { | - |
1421 | int r = d->logicalRow(visualRow); | - |
1422 | int c = d->logicalColumn(visualColumn); | - |
1423 | if (firstTime && c != -1 && d->hasSpans()) { partially evaluated: firstTime yes Evaluation Count:68 | no Evaluation Count:0 |
evaluated: c != -1 yes Evaluation Count:58 | yes Evaluation Count:10 |
evaluated: d->hasSpans() yes Evaluation Count:2 | yes Evaluation Count:56 |
| 0-68 |
1424 | firstTime = false; | - |
1425 | QSpanCollection::Span span = d->span(r, c); | - |
1426 | if (span.width() > 1 || span.height() > 1) evaluated: span.width() > 1 yes Evaluation Count:1 | yes Evaluation Count:1 |
partially evaluated: span.height() > 1 no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
1427 | visualColumn = d->visualColumn(span.left()); executed: visualColumn = d->visualColumn(span.left()); Execution Count:1 | 1 |
1428 | } executed: } Execution Count:2 | 2 |
1429 | while (visualColumn >= 0) { partially evaluated: visualColumn >= 0 yes Evaluation Count:86 | no Evaluation Count:0 |
| 0-86 |
1430 | --visualColumn; | - |
1431 | r = d->logicalRow(visualRow); | - |
1432 | c = d->logicalColumn(visualColumn); | - |
1433 | if (r == -1 || c == -1 || (!isRowHidden(r) && !isColumnHidden(c) && d->isCellEnabled(r, c))) partially evaluated: r == -1 no Evaluation Count:0 | yes Evaluation Count:86 |
evaluated: c == -1 yes Evaluation Count:28 | yes Evaluation Count:58 |
evaluated: !isRowHidden(r) yes Evaluation Count:54 | yes Evaluation Count:4 |
evaluated: !isColumnHidden(c) yes Evaluation Count:48 | yes Evaluation Count:6 |
evaluated: d->isCellEnabled(r, c) yes Evaluation Count:39 | yes Evaluation Count:9 |
| 0-86 |
1434 | break; executed: break; Execution Count:67 | 67 |
1435 | if (wrapped && (originalRow < visualRow || (originalRow == visualRow && originalColumn <= visualColumn))) { evaluated: wrapped yes Evaluation Count:1 | yes Evaluation Count:18 |
partially evaluated: originalRow < visualRow yes Evaluation Count:1 | no Evaluation Count:0 |
never evaluated: originalRow == visualRow never evaluated: originalColumn <= visualColumn | 0-18 |
1436 | looped = true; | - |
1437 | break; executed: break; Execution Count:1 | 1 |
1438 | } | - |
1439 | } executed: } Execution Count:18 | 18 |
1440 | if (cursorAction == MoveLeft || visualColumn >= 0) evaluated: cursorAction == MoveLeft yes Evaluation Count:45 | yes Evaluation Count:23 |
evaluated: visualColumn >= 0 yes Evaluation Count:13 | yes Evaluation Count:10 |
| 10-45 |
1441 | break; executed: break; Execution Count:58 | 58 |
1442 | visualColumn = right + 1; | - |
1443 | if (visualRow == 0) { evaluated: visualRow == 0 yes Evaluation Count:5 | yes Evaluation Count:5 |
| 5 |
1444 | wrapped = true; | - |
1445 | visualRow = bottom; | - |
1446 | } else { executed: } Execution Count:5 | 5 |
1447 | --visualRow; | - |
1448 | } executed: } Execution Count:5 | 5 |
1449 | } while (!looped); partially evaluated: !looped yes Evaluation Count:10 | no Evaluation Count:0 |
| 0-10 |
1450 | if (visualColumn < 0) evaluated: visualColumn < 0 yes Evaluation Count:18 | yes Evaluation Count:40 |
| 18-40 |
1451 | visualColumn = originalColumn; executed: visualColumn = originalColumn; Execution Count:18 | 18 |
1452 | break; executed: break; Execution Count:58 | 58 |
1453 | } | - |
1454 | case MoveNext: | - |
1455 | case MoveRight: { | - |
1456 | int originalRow = visualRow; | - |
1457 | int originalColumn = visualColumn; | - |
1458 | bool firstTime = true; | - |
1459 | bool looped = false; | - |
1460 | bool wrapped = false; | - |
1461 | do { | - |
1462 | int r = d->logicalRow(visualRow); | - |
1463 | int c = d->logicalColumn(visualColumn); | - |
1464 | if (firstTime && c != -1 && d->hasSpans()) { partially evaluated: firstTime yes Evaluation Count:44 | no Evaluation Count:0 |
evaluated: c != -1 yes Evaluation Count:31 | yes Evaluation Count:13 |
evaluated: d->hasSpans() yes Evaluation Count:4 | yes Evaluation Count:27 |
| 0-44 |
1465 | firstTime = false; | - |
1466 | QSpanCollection::Span span = d->span(r, c); | - |
1467 | if (span.width() > 1 || span.height() > 1) evaluated: span.width() > 1 yes Evaluation Count:1 | yes Evaluation Count:3 |
partially evaluated: span.height() > 1 no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
1468 | visualColumn = d->visualColumn(d->columnSpanEndLogical(span.left(), span.width())); executed: visualColumn = d->visualColumn(d->columnSpanEndLogical(span.left(), span.width())); Execution Count:1 | 1 |
1469 | } executed: } Execution Count:4 | 4 |
1470 | while (visualColumn <= right) { evaluated: visualColumn <= right yes Evaluation Count:90 | yes Evaluation Count:5 |
| 5-90 |
1471 | ++visualColumn; | - |
1472 | r = d->logicalRow(visualRow); | - |
1473 | c = d->logicalColumn(visualColumn); | - |
1474 | if (r == -1 || c == -1 || (!isRowHidden(r) && !isColumnHidden(c) && d->isCellEnabled(r, c))) partially evaluated: r == -1 no Evaluation Count:0 | yes Evaluation Count:90 |
evaluated: c == -1 yes Evaluation Count:14 | yes Evaluation Count:76 |
partially evaluated: !isRowHidden(r) yes Evaluation Count:76 | no Evaluation Count:0 |
evaluated: !isColumnHidden(c) yes Evaluation Count:68 | yes Evaluation Count:8 |
evaluated: d->isCellEnabled(r, c) yes Evaluation Count:24 | yes Evaluation Count:44 |
| 0-90 |
1475 | break; executed: break; Execution Count:38 | 38 |
1476 | if (wrapped && (originalRow > visualRow || (originalRow == visualRow && originalColumn >= visualColumn))) { evaluated: wrapped yes Evaluation Count:1 | yes Evaluation Count:51 |
partially evaluated: originalRow > visualRow yes Evaluation Count:1 | no Evaluation Count:0 |
never evaluated: originalRow == visualRow never evaluated: originalColumn >= visualColumn | 0-51 |
1477 | looped = true; | - |
1478 | break; executed: break; Execution Count:1 | 1 |
1479 | } | - |
1480 | } executed: } Execution Count:51 | 51 |
1481 | if (cursorAction == MoveRight || visualColumn <= right) evaluated: cursorAction == MoveRight yes Evaluation Count:11 | yes Evaluation Count:33 |
evaluated: visualColumn <= right yes Evaluation Count:20 | yes Evaluation Count:13 |
| 11-33 |
1482 | break; executed: break; Execution Count:31 | 31 |
1483 | visualColumn = -1; | - |
1484 | if (visualRow == bottom) { evaluated: visualRow == bottom yes Evaluation Count:4 | yes Evaluation Count:9 |
| 4-9 |
1485 | wrapped = true; | - |
1486 | visualRow = 0; | - |
1487 | } else { executed: } Execution Count:4 | 4 |
1488 | ++visualRow; | - |
1489 | } executed: } Execution Count:9 | 9 |
1490 | } while (!looped); partially evaluated: !looped yes Evaluation Count:13 | no Evaluation Count:0 |
| 0-13 |
1491 | if (visualColumn > right) evaluated: visualColumn > right yes Evaluation Count:6 | yes Evaluation Count:25 |
| 6-25 |
1492 | visualColumn = originalColumn; executed: visualColumn = originalColumn; Execution Count:6 | 6 |
1493 | break; executed: break; Execution Count:31 | 31 |
1494 | } | - |
1495 | case MoveHome: | - |
1496 | visualColumn = 0; | - |
1497 | while (visualColumn < right && d->isVisualColumnHiddenOrDisabled(visualRow, visualColumn)) partially evaluated: visualColumn < right yes Evaluation Count:8 | no Evaluation Count:0 |
evaluated: d->isVisualColumnHiddenOrDisabled(visualRow, visualColumn) yes Evaluation Count:2 | yes Evaluation Count:6 |
| 0-8 |
1498 | ++visualColumn; executed: ++visualColumn; Execution Count:2 | 2 |
1499 | if (modifiers & Qt::ControlModifier) { evaluated: modifiers & Qt::ControlModifier yes Evaluation Count:3 | yes Evaluation Count:3 |
| 3 |
1500 | visualRow = 0; | - |
1501 | while (visualRow < bottom && d->isVisualRowHiddenOrDisabled(visualRow, visualColumn)) partially evaluated: visualRow < bottom yes Evaluation Count:4 | no Evaluation Count:0 |
evaluated: d->isVisualRowHiddenOrDisabled(visualRow, visualColumn) yes Evaluation Count:1 | yes Evaluation Count:3 |
| 0-4 |
1502 | ++visualRow; executed: ++visualRow; Execution Count:1 | 1 |
1503 | } executed: } Execution Count:3 | 3 |
1504 | break; executed: break; Execution Count:6 | 6 |
1505 | case MoveEnd: | - |
1506 | visualColumn = right; | - |
1507 | if (modifiers & Qt::ControlModifier) evaluated: modifiers & Qt::ControlModifier yes Evaluation Count:4 | yes Evaluation Count:3 |
| 3-4 |
1508 | visualRow = bottom; executed: visualRow = bottom; Execution Count:4 | 4 |
1509 | break; executed: break; Execution Count:7 | 7 |
1510 | case MovePageUp: { | - |
1511 | int newRow = rowAt(visualRect(current).top() - d->viewport->height()); | - |
1512 | if (newRow == -1) partially evaluated: newRow == -1 yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
1513 | newRow = d->logicalRow(0); executed: newRow = d->logicalRow(0); Execution Count:3 | 3 |
1514 | return d->model->index(newRow, current.column(), d->root); executed: return d->model->index(newRow, current.column(), d->root); Execution Count:3 | 3 |
1515 | } | - |
1516 | case MovePageDown: { | - |
1517 | int newRow = rowAt(visualRect(current).bottom() + d->viewport->height()); | - |
1518 | if (newRow == -1) evaluated: newRow == -1 yes Evaluation Count:3 | yes Evaluation Count:1 |
| 1-3 |
1519 | newRow = d->logicalRow(bottom); executed: newRow = d->logicalRow(bottom); Execution Count:3 | 3 |
1520 | return d->model->index(newRow, current.column(), d->root); executed: return d->model->index(newRow, current.column(), d->root); Execution Count:4 | 4 |
1521 | }} | - |
1522 | | - |
1523 | d->visualCursor = QPoint(visualColumn, visualRow); | - |
1524 | int logicalRow = d->logicalRow(visualRow); | - |
1525 | int logicalColumn = d->logicalColumn(visualColumn); | - |
1526 | if (!d->model->hasIndex(logicalRow, logicalColumn, d->root)) partially evaluated: !d->model->hasIndex(logicalRow, logicalColumn, d->root) no Evaluation Count:0 | yes Evaluation Count:286 |
| 0-286 |
1527 | return QModelIndex(); never executed: return QModelIndex(); | 0 |
1528 | | - |
1529 | QModelIndex result = d->model->index(logicalRow, logicalColumn, d->root); | - |
1530 | if (!d->isRowHidden(logicalRow) && !d->isColumnHidden(logicalColumn) && d->isIndexEnabled(result)) partially evaluated: !d->isRowHidden(logicalRow) yes Evaluation Count:286 | no Evaluation Count:0 |
evaluated: !d->isColumnHidden(logicalColumn) yes Evaluation Count:285 | yes Evaluation Count:1 |
evaluated: d->isIndexEnabled(result) yes Evaluation Count:283 | yes Evaluation Count:2 |
| 0-286 |
1531 | return result; executed: return result; Execution Count:283 | 283 |
1532 | | - |
1533 | return QModelIndex(); executed: return QModelIndex(); Execution Count:3 | 3 |
1534 | } | - |
1535 | void QTableView::setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags command) | - |
1536 | { | - |
1537 | QTableViewPrivate * const d = d_func(); | - |
1538 | QModelIndex tl = indexAt(QPoint(isRightToLeft() ? qMax(rect.left(), rect.right()) | - |
1539 | : qMin(rect.left(), rect.right()), qMin(rect.top(), rect.bottom()))); | - |
1540 | QModelIndex br = indexAt(QPoint(isRightToLeft() ? qMin(rect.left(), rect.right()) : | - |
1541 | qMax(rect.left(), rect.right()), qMax(rect.top(), rect.bottom()))); | - |
1542 | if (!d->selectionModel || !tl.isValid() || !br.isValid() || !d->isIndexEnabled(tl) || !d->isIndexEnabled(br)) evaluated: !d->selectionModel yes Evaluation Count:2 | yes Evaluation Count:468 |
evaluated: !tl.isValid() yes Evaluation Count:1 | yes Evaluation Count:467 |
partially evaluated: !br.isValid() no Evaluation Count:0 | yes Evaluation Count:467 |
partially evaluated: !d->isIndexEnabled(tl) no Evaluation Count:0 | yes Evaluation Count:467 |
partially evaluated: !d->isIndexEnabled(br) no Evaluation Count:0 | yes Evaluation Count:467 |
| 0-468 |
1543 | return; executed: return; Execution Count:3 | 3 |
1544 | | - |
1545 | bool verticalMoved = verticalHeader()->sectionsMoved(); | - |
1546 | bool horizontalMoved = horizontalHeader()->sectionsMoved(); | - |
1547 | | - |
1548 | QItemSelection selection; | - |
1549 | | - |
1550 | if (d->hasSpans()) { evaluated: d->hasSpans() yes Evaluation Count:47 | yes Evaluation Count:420 |
| 47-420 |
1551 | bool expanded; | - |
1552 | int top = qMin(d->visualRow(tl.row()), d->visualRow(br.row())); | - |
1553 | int left = qMin(d->visualColumn(tl.column()), d->visualColumn(br.column())); | - |
1554 | int bottom = qMax(d->visualRow(tl.row()), d->visualRow(br.row())); | - |
1555 | int right = qMax(d->visualColumn(tl.column()), d->visualColumn(br.column())); | - |
1556 | do { | - |
1557 | expanded = false; | - |
1558 | for (QForeachContainer<__typeof__(d->spans.spans)> _container_(d->spans.spans); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QSpanCollection::Span *it = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
1559 | const QSpanCollection::Span &span = *it; | - |
1560 | int t = d->visualRow(span.top()); | - |
1561 | int l = d->visualColumn(span.left()); | - |
1562 | int b = d->visualRow(d->rowSpanEndLogical(span.top(), span.height())); | - |
1563 | int r = d->visualColumn(d->columnSpanEndLogical(span.left(), span.width())); | - |
1564 | if ((t > bottom) || (l > right) || (top > b) || (left > r)) evaluated: (t > bottom) yes Evaluation Count:1260 | yes Evaluation Count:1982 |
partially evaluated: (l > right) no Evaluation Count:0 | yes Evaluation Count:1982 |
evaluated: (top > b) yes Evaluation Count:1892 | yes Evaluation Count:90 |
partially evaluated: (left > r) no Evaluation Count:0 | yes Evaluation Count:90 |
| 0-1982 |
1565 | continue; executed: continue; Execution Count:3152 | 3152 |
1566 | if (t < top) { partially evaluated: t < top no Evaluation Count:0 | yes Evaluation Count:90 |
| 0-90 |
1567 | top = t; | - |
1568 | expanded = true; | - |
1569 | } | 0 |
1570 | if (l < left) { partially evaluated: l < left no Evaluation Count:0 | yes Evaluation Count:90 |
| 0-90 |
1571 | left = l; | - |
1572 | expanded = true; | - |
1573 | } | 0 |
1574 | if (b > bottom) { partially evaluated: b > bottom no Evaluation Count:0 | yes Evaluation Count:90 |
| 0-90 |
1575 | bottom = b; | - |
1576 | expanded = true; | - |
1577 | } | 0 |
1578 | if (r > right) { evaluated: r > right yes Evaluation Count:44 | yes Evaluation Count:46 |
| 44-46 |
1579 | right = r; | - |
1580 | expanded = true; | - |
1581 | } executed: } Execution Count:44 | 44 |
1582 | if (expanded) evaluated: expanded yes Evaluation Count:44 | yes Evaluation Count:46 |
| 44-46 |
1583 | break; executed: break; Execution Count:44 | 44 |
1584 | } executed: } Execution Count:46 | 46 |
1585 | } while (expanded); executed: } Execution Count:91 evaluated: expanded yes Evaluation Count:44 | yes Evaluation Count:47 |
| 44-91 |
1586 | for (int horizontal = left; horizontal <= right; ++horizontal) { evaluated: horizontal <= right yes Evaluation Count:227 | yes Evaluation Count:47 |
| 47-227 |
1587 | int column = d->logicalColumn(horizontal); | - |
1588 | for (int vertical = top; vertical <= bottom; ++vertical) { evaluated: vertical <= bottom yes Evaluation Count:239 | yes Evaluation Count:227 |
| 227-239 |
1589 | int row = d->logicalRow(vertical); | - |
1590 | QModelIndex index = d->model->index(row, column, d->root); | - |
1591 | selection.append(QItemSelectionRange(index)); | - |
1592 | } executed: } Execution Count:239 | 239 |
1593 | } executed: } Execution Count:227 | 227 |
1594 | } else if (verticalMoved && horizontalMoved) { executed: } Execution Count:47 evaluated: verticalMoved yes Evaluation Count:2 | yes Evaluation Count:418 |
partially evaluated: horizontalMoved no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-418 |
1595 | int top = d->visualRow(tl.row()); | - |
1596 | int left = d->visualColumn(tl.column()); | - |
1597 | int bottom = d->visualRow(br.row()); | - |
1598 | int right = d->visualColumn(br.column()); | - |
1599 | for (int horizontal = left; horizontal <= right; ++horizontal) { never evaluated: horizontal <= right | 0 |
1600 | int column = d->logicalColumn(horizontal); | - |
1601 | for (int vertical = top; vertical <= bottom; ++vertical) { never evaluated: vertical <= bottom | 0 |
1602 | int row = d->logicalRow(vertical); | - |
1603 | QModelIndex index = d->model->index(row, column, d->root); | - |
1604 | selection.append(QItemSelectionRange(index)); | - |
1605 | } | 0 |
1606 | } | 0 |
1607 | } else if (horizontalMoved) { evaluated: horizontalMoved yes Evaluation Count:1 | yes Evaluation Count:419 |
| 0-419 |
1608 | int left = d->visualColumn(tl.column()); | - |
1609 | int right = d->visualColumn(br.column()); | - |
1610 | for (int visual = left; visual <= right; ++visual) { evaluated: visual <= right yes Evaluation Count:3 | yes Evaluation Count:1 |
| 1-3 |
1611 | int column = d->logicalColumn(visual); | - |
1612 | QModelIndex topLeft = d->model->index(tl.row(), column, d->root); | - |
1613 | QModelIndex bottomRight = d->model->index(br.row(), column, d->root); | - |
1614 | selection.append(QItemSelectionRange(topLeft, bottomRight)); | - |
1615 | } executed: } Execution Count:3 | 3 |
1616 | } else if (verticalMoved) { executed: } Execution Count:1 evaluated: verticalMoved yes Evaluation Count:2 | yes Evaluation Count:417 |
| 1-417 |
1617 | int top = d->visualRow(tl.row()); | - |
1618 | int bottom = d->visualRow(br.row()); | - |
1619 | for (int visual = top; visual <= bottom; ++visual) { evaluated: visual <= bottom yes Evaluation Count:4 | yes Evaluation Count:2 |
| 2-4 |
1620 | int row = d->logicalRow(visual); | - |
1621 | QModelIndex topLeft = d->model->index(row, tl.column(), d->root); | - |
1622 | QModelIndex bottomRight = d->model->index(row, br.column(), d->root); | - |
1623 | selection.append(QItemSelectionRange(topLeft, bottomRight)); | - |
1624 | } executed: } Execution Count:4 | 4 |
1625 | } else { executed: } Execution Count:2 | 2 |
1626 | QItemSelectionRange range(tl, br); | - |
1627 | if (!range.isEmpty()) partially evaluated: !range.isEmpty() yes Evaluation Count:417 | no Evaluation Count:0 |
| 0-417 |
1628 | selection.append(range); executed: selection.append(range); Execution Count:417 | 417 |
1629 | } executed: } Execution Count:417 | 417 |
1630 | | - |
1631 | d->selectionModel->select(selection, command); | - |
1632 | } executed: } Execution Count:467 | 467 |
1633 | QRegion QTableView::visualRegionForSelection(const QItemSelection &selection) const | - |
1634 | { | - |
1635 | const QTableViewPrivate * const d = d_func(); | - |
1636 | | - |
1637 | if (selection.isEmpty()) evaluated: selection.isEmpty() yes Evaluation Count:335 | yes Evaluation Count:1394 |
| 335-1394 |
1638 | return QRegion(); executed: return QRegion(); Execution Count:335 | 335 |
1639 | | - |
1640 | QRegion selectionRegion; | - |
1641 | const QRect &viewportRect = d->viewport->rect(); | - |
1642 | bool verticalMoved = verticalHeader()->sectionsMoved(); | - |
1643 | bool horizontalMoved = horizontalHeader()->sectionsMoved(); | - |
1644 | | - |
1645 | if ((verticalMoved && horizontalMoved) || (d->hasSpans() && (verticalMoved || horizontalMoved))) { evaluated: verticalMoved yes Evaluation Count:6 | yes Evaluation Count:1388 |
partially evaluated: horizontalMoved no Evaluation Count:0 | yes Evaluation Count:6 |
evaluated: d->hasSpans() yes Evaluation Count:168 | yes Evaluation Count:1226 |
partially evaluated: verticalMoved no Evaluation Count:0 | yes Evaluation Count:168 |
partially evaluated: horizontalMoved no Evaluation Count:0 | yes Evaluation Count:168 |
| 0-1388 |
1646 | for (int i = 0; i < selection.count(); ++i) { never evaluated: i < selection.count() | 0 |
1647 | QItemSelectionRange range = selection.at(i); | - |
1648 | if (range.parent() != d->root || !range.isValid()) never evaluated: range.parent() != d->root never evaluated: !range.isValid() | 0 |
1649 | continue; never executed: continue; | 0 |
1650 | for (int r = range.top(); r <= range.bottom(); ++r) never evaluated: r <= range.bottom() | 0 |
1651 | for (int c = range.left(); c <= range.right(); ++c) { never evaluated: c <= range.right() | 0 |
1652 | const QRect &rangeRect = visualRect(d->model->index(r, c, d->root)); | - |
1653 | if (viewportRect.intersects(rangeRect)) never evaluated: viewportRect.intersects(rangeRect) | 0 |
1654 | selectionRegion += rangeRect; never executed: selectionRegion += rangeRect; | 0 |
1655 | } | 0 |
1656 | } | 0 |
1657 | } else if (horizontalMoved) { evaluated: horizontalMoved yes Evaluation Count:3 | yes Evaluation Count:1391 |
| 0-1391 |
1658 | for (int i = 0; i < selection.count(); ++i) { evaluated: i < selection.count() yes Evaluation Count:5 | yes Evaluation Count:3 |
| 3-5 |
1659 | QItemSelectionRange range = selection.at(i); | - |
1660 | if (range.parent() != d->root || !range.isValid()) partially evaluated: range.parent() != d->root no Evaluation Count:0 | yes Evaluation Count:5 |
partially evaluated: !range.isValid() no Evaluation Count:0 | yes Evaluation Count:5 |
| 0-5 |
1661 | continue; never executed: continue; | 0 |
1662 | int top = rowViewportPosition(range.top()); | - |
1663 | int bottom = rowViewportPosition(range.bottom()) + rowHeight(range.bottom()); | - |
1664 | if (top > bottom) partially evaluated: top > bottom no Evaluation Count:0 | yes Evaluation Count:5 |
| 0-5 |
1665 | qSwap<int>(top, bottom); never executed: qSwap<int>(top, bottom); | 0 |
1666 | int height = bottom - top; | - |
1667 | for (int c = range.left(); c <= range.right(); ++c) { evaluated: c <= range.right() yes Evaluation Count:5 | yes Evaluation Count:5 |
| 5 |
1668 | const QRect rangeRect(columnViewportPosition(c), top, columnWidth(c), height); | - |
1669 | if (viewportRect.intersects(rangeRect)) evaluated: viewportRect.intersects(rangeRect) yes Evaluation Count:4 | yes Evaluation Count:1 |
| 1-4 |
1670 | selectionRegion += rangeRect; executed: selectionRegion += rangeRect; Execution Count:4 | 4 |
1671 | } executed: } Execution Count:5 | 5 |
1672 | } executed: } Execution Count:5 | 5 |
1673 | } else if (verticalMoved) { executed: } Execution Count:3 evaluated: verticalMoved yes Evaluation Count:6 | yes Evaluation Count:1385 |
| 3-1385 |
1674 | for (int i = 0; i < selection.count(); ++i) { evaluated: i < selection.count() yes Evaluation Count:8 | yes Evaluation Count:6 |
| 6-8 |
1675 | QItemSelectionRange range = selection.at(i); | - |
1676 | if (range.parent() != d->root || !range.isValid()) partially evaluated: !range.isValid() no Evaluation Count:0 | yes Evaluation Count:8 |
partially evaluated: range.parent() != d->root no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
1677 | continue; never executed: continue; | 0 |
1678 | int left = columnViewportPosition(range.left()); | - |
1679 | int right = columnViewportPosition(range.right()) + columnWidth(range.right()); | - |
1680 | if (left > right) partially evaluated: left > right no Evaluation Count:0 | yes Evaluation Count:8 |
| 0-8 |
1681 | qSwap<int>(left, right); never executed: qSwap<int>(left, right); | 0 |
1682 | int width = right - left; | - |
1683 | for (int r = range.top(); r <= range.bottom(); ++r) { evaluated: r <= range.bottom() yes Evaluation Count:8 | yes Evaluation Count:8 |
| 8 |
1684 | const QRect rangeRect(left, rowViewportPosition(r), width, rowHeight(r)); | - |
1685 | if (viewportRect.intersects(rangeRect)) evaluated: viewportRect.intersects(rangeRect) yes Evaluation Count:6 | yes Evaluation Count:2 |
| 2-6 |
1686 | selectionRegion += rangeRect; executed: selectionRegion += rangeRect; Execution Count:6 | 6 |
1687 | } executed: } Execution Count:8 | 8 |
1688 | } executed: } Execution Count:8 | 8 |
1689 | } else { executed: } Execution Count:6 | 6 |
1690 | const int gridAdjust = showGrid() ? 1 : 0; evaluated: showGrid() yes Evaluation Count:1213 | yes Evaluation Count:172 |
| 172-1213 |
1691 | for (int i = 0; i < selection.count(); ++i) { evaluated: i < selection.count() yes Evaluation Count:1744 | yes Evaluation Count:1385 |
| 1385-1744 |
1692 | QItemSelectionRange range = selection.at(i); | - |
1693 | if (range.parent() != d->root || !range.isValid()) partially evaluated: range.parent() != d->root no Evaluation Count:0 | yes Evaluation Count:1744 |
partially evaluated: !range.isValid() no Evaluation Count:0 | yes Evaluation Count:1744 |
| 0-1744 |
1694 | continue; never executed: continue; | 0 |
1695 | d->trimHiddenSelections(&range); | - |
1696 | | - |
1697 | const int rtop = rowViewportPosition(range.top()); | - |
1698 | const int rbottom = rowViewportPosition(range.bottom()) + rowHeight(range.bottom()); | - |
1699 | int rleft; | - |
1700 | int rright; | - |
1701 | if (isLeftToRight()) { evaluated: isLeftToRight() yes Evaluation Count:1743 | yes Evaluation Count:1 |
| 1-1743 |
1702 | rleft = columnViewportPosition(range.left()); | - |
1703 | rright = columnViewportPosition(range.right()) + columnWidth(range.right()); | - |
1704 | } else { executed: } Execution Count:1743 | 1743 |
1705 | rleft = columnViewportPosition(range.right()); | - |
1706 | rright = columnViewportPosition(range.left()) + columnWidth(range.left()); | - |
1707 | } executed: } Execution Count:1 | 1 |
1708 | const QRect rangeRect(QPoint(rleft, rtop), QPoint(rright - 1 - gridAdjust, rbottom - 1 - gridAdjust)); | - |
1709 | if (viewportRect.intersects(rangeRect)) evaluated: viewportRect.intersects(rangeRect) yes Evaluation Count:1519 | yes Evaluation Count:225 |
| 225-1519 |
1710 | selectionRegion += rangeRect; executed: selectionRegion += rangeRect; Execution Count:1519 | 1519 |
1711 | if (d->hasSpans()) { evaluated: d->hasSpans() yes Evaluation Count:488 | yes Evaluation Count:1256 |
| 488-1256 |
1712 | for (QForeachContainer<__typeof__(d->spans.spansInRect(range.left(), range.top(), range.width(), range.height()))> _container_(d->spans.spansInRect(range.left(), range.top(), range.width(), range.height())); !_container_.brk && _container_.i != _container_.e; __extension__ ({ ++_container_.brk; ++_container_.i; })) for (QSpanCollection::Span *s = *_container_.i;; __extension__ ({--_container_.brk; break;})) { | - |
1713 | | - |
1714 | if (range.contains(s->top(), s->left(), range.parent())) { evaluated: range.contains(s->top(), s->left(), range.parent()) yes Evaluation Count:89 | yes Evaluation Count:821 |
| 89-821 |
1715 | const QRect &visualSpanRect = d->visualSpanRect(*s); | - |
1716 | if (viewportRect.intersects(visualSpanRect)) partially evaluated: viewportRect.intersects(visualSpanRect) yes Evaluation Count:89 | no Evaluation Count:0 |
| 0-89 |
1717 | selectionRegion += visualSpanRect; executed: selectionRegion += visualSpanRect; Execution Count:89 | 89 |
1718 | } executed: } Execution Count:89 | 89 |
1719 | } executed: } Execution Count:910 | 910 |
1720 | } executed: } Execution Count:488 | 488 |
1721 | } executed: } Execution Count:1744 | 1744 |
1722 | } executed: } Execution Count:1385 | 1385 |
1723 | | - |
1724 | return selectionRegion; executed: return selectionRegion; Execution Count:1394 | 1394 |
1725 | } | - |
1726 | | - |
1727 | | - |
1728 | | - |
1729 | | - |
1730 | | - |
1731 | QModelIndexList QTableView::selectedIndexes() const | - |
1732 | { | - |
1733 | const QTableViewPrivate * const d = d_func(); | - |
1734 | QModelIndexList viewSelected; | - |
1735 | QModelIndexList modelSelected; | - |
1736 | if (d->selectionModel) evaluated: d->selectionModel yes Evaluation Count:12 | yes Evaluation Count:2 |
| 2-12 |
1737 | modelSelected = d->selectionModel->selectedIndexes(); executed: modelSelected = d->selectionModel->selectedIndexes(); Execution Count:12 | 12 |
1738 | for (int i = 0; i < modelSelected.count(); ++i) { evaluated: i < modelSelected.count() yes Evaluation Count:102 | yes Evaluation Count:14 |
| 14-102 |
1739 | QModelIndex index = modelSelected.at(i); | - |
1740 | if (!isIndexHidden(index) && index.parent() == d->root) evaluated: !isIndexHidden(index) yes Evaluation Count:94 | yes Evaluation Count:8 |
partially evaluated: index.parent() == d->root yes Evaluation Count:94 | no Evaluation Count:0 |
| 0-94 |
1741 | viewSelected.append(index); executed: viewSelected.append(index); Execution Count:94 | 94 |
1742 | } executed: } Execution Count:102 | 102 |
1743 | return viewSelected; executed: return viewSelected; Execution Count:14 | 14 |
1744 | } | - |
1745 | | - |
1746 | | - |
1747 | | - |
1748 | | - |
1749 | | - |
1750 | | - |
1751 | | - |
1752 | void QTableView::rowCountChanged(int oldCount, int newCount ) | - |
1753 | { | - |
1754 | QTableViewPrivate * const d = d_func(); | - |
1755 | | - |
1756 | | - |
1757 | if (newCount < oldCount) evaluated: newCount < oldCount yes Evaluation Count:156 | yes Evaluation Count:14130 |
| 156-14130 |
1758 | d->verticalHeader->setUpdatesEnabled(false); executed: d->verticalHeader->setUpdatesEnabled(false); Execution Count:156 | 156 |
1759 | d->doDelayedItemsLayout(); | - |
1760 | } executed: } Execution Count:14286 | 14286 |
1761 | | - |
1762 | | - |
1763 | | - |
1764 | | - |
1765 | | - |
1766 | | - |
1767 | void QTableView::columnCountChanged(int, int) | - |
1768 | { | - |
1769 | QTableViewPrivate * const d = d_func(); | - |
1770 | updateGeometries(); | - |
1771 | if (horizontalScrollMode() == QAbstractItemView::ScrollPerItem) evaluated: horizontalScrollMode() == QAbstractItemView::ScrollPerItem yes Evaluation Count:1298 | yes Evaluation Count:26 |
| 26-1298 |
1772 | d->horizontalHeader->setOffsetToSectionPosition(horizontalScrollBar()->value()); executed: d->horizontalHeader->setOffsetToSectionPosition(horizontalScrollBar()->value()); Execution Count:1298 | 1298 |
1773 | else | - |
1774 | d->horizontalHeader->setOffset(horizontalScrollBar()->value()); executed: d->horizontalHeader->setOffset(horizontalScrollBar()->value()); Execution Count:26 | 26 |
1775 | d->viewport->update(); | - |
1776 | } executed: } Execution Count:1324 | 1324 |
1777 | | - |
1778 | | - |
1779 | | - |
1780 | | - |
1781 | void QTableView::updateGeometries() | - |
1782 | { | - |
1783 | QTableViewPrivate * const d = d_func(); | - |
1784 | if (d->geometryRecursionBlock) evaluated: d->geometryRecursionBlock yes Evaluation Count:631 | yes Evaluation Count:3033 |
| 631-3033 |
1785 | return; executed: return; Execution Count:631 | 631 |
1786 | d->geometryRecursionBlock = true; | - |
1787 | | - |
1788 | int width = 0; | - |
1789 | if (!d->verticalHeader->isHidden()) { evaluated: !d->verticalHeader->isHidden() yes Evaluation Count:2306 | yes Evaluation Count:727 |
| 727-2306 |
1790 | width = qMax(d->verticalHeader->minimumWidth(), d->verticalHeader->sizeHint().width()); | - |
1791 | width = qMin(width, d->verticalHeader->maximumWidth()); | - |
1792 | } executed: } Execution Count:2306 | 2306 |
1793 | int height = 0; | - |
1794 | if (!d->horizontalHeader->isHidden()) { evaluated: !d->horizontalHeader->isHidden() yes Evaluation Count:2306 | yes Evaluation Count:727 |
| 727-2306 |
1795 | height = qMax(d->horizontalHeader->minimumHeight(), d->horizontalHeader->sizeHint().height()); | - |
1796 | height = qMin(height, d->horizontalHeader->maximumHeight()); | - |
1797 | } executed: } Execution Count:2306 | 2306 |
1798 | bool reverse = isRightToLeft(); | - |
1799 | if (reverse) evaluated: reverse yes Evaluation Count:7 | yes Evaluation Count:3026 |
| 7-3026 |
1800 | setViewportMargins(0, height, width, 0); executed: setViewportMargins(0, height, width, 0); Execution Count:7 | 7 |
1801 | else | - |
1802 | setViewportMargins(width, height, 0, 0); executed: setViewportMargins(width, height, 0, 0); Execution Count:3026 | 3026 |
1803 | | - |
1804 | | - |
1805 | | - |
1806 | QRect vg = d->viewport->geometry(); | - |
1807 | | - |
1808 | int verticalLeft = reverse ? vg.right() + 1 : (vg.left() - width); evaluated: reverse yes Evaluation Count:7 | yes Evaluation Count:3026 |
| 7-3026 |
1809 | d->verticalHeader->setGeometry(verticalLeft, vg.top(), width, vg.height()); | - |
1810 | if (d->verticalHeader->isHidden()) evaluated: d->verticalHeader->isHidden() yes Evaluation Count:727 | yes Evaluation Count:2306 |
| 727-2306 |
1811 | QMetaObject::invokeMethod(d->verticalHeader, "updateGeometries"); executed: QMetaObject::invokeMethod(d->verticalHeader, "updateGeometries"); Execution Count:727 | 727 |
1812 | | - |
1813 | int horizontalTop = vg.top() - height; | - |
1814 | d->horizontalHeader->setGeometry(vg.left(), horizontalTop, vg.width(), height); | - |
1815 | if (d->horizontalHeader->isHidden()) evaluated: d->horizontalHeader->isHidden() yes Evaluation Count:727 | yes Evaluation Count:2306 |
| 727-2306 |
1816 | QMetaObject::invokeMethod(d->horizontalHeader, "updateGeometries"); executed: QMetaObject::invokeMethod(d->horizontalHeader, "updateGeometries"); Execution Count:727 | 727 |
1817 | | - |
1818 | | - |
1819 | if (d->horizontalHeader->isHidden() || d->verticalHeader->isHidden()) { evaluated: d->horizontalHeader->isHidden() yes Evaluation Count:727 | yes Evaluation Count:2306 |
partially evaluated: d->verticalHeader->isHidden() no Evaluation Count:0 | yes Evaluation Count:2306 |
| 0-2306 |
1820 | d->cornerWidget->setHidden(true); | - |
1821 | } else { executed: } Execution Count:727 | 727 |
1822 | d->cornerWidget->setHidden(false); | - |
1823 | d->cornerWidget->setGeometry(verticalLeft, horizontalTop, width, height); | - |
1824 | } executed: } Execution Count:2306 | 2306 |
1825 | | - |
1826 | | - |
1827 | | - |
1828 | | - |
1829 | QSize vsize = d->viewport->size(); | - |
1830 | QSize max = maximumViewportSize(); | - |
1831 | uint horizontalLength = d->horizontalHeader->length(); | - |
1832 | uint verticalLength = d->verticalHeader->length(); | - |
1833 | if ((uint)max.width() >= horizontalLength && (uint)max.height() >= verticalLength) evaluated: (uint)max.width() >= horizontalLength yes Evaluation Count:1764 | yes Evaluation Count:1269 |
evaluated: (uint)max.height() >= verticalLength yes Evaluation Count:1729 | yes Evaluation Count:35 |
| 35-1764 |
1834 | vsize = max; executed: vsize = max; Execution Count:1729 | 1729 |
1835 | | - |
1836 | | - |
1837 | const int columnCount = d->horizontalHeader->count(); | - |
1838 | const int viewportWidth = vsize.width(); | - |
1839 | int columnsInViewport = 0; | - |
1840 | for (int width = 0, column = columnCount - 1; column >= 0; --column) { evaluated: column >= 0 yes Evaluation Count:11217 | yes Evaluation Count:1764 |
| 1764-11217 |
1841 | int logical = d->horizontalHeader->logicalIndex(column); | - |
1842 | if (!d->horizontalHeader->isSectionHidden(logical)) { evaluated: !d->horizontalHeader->isSectionHidden(logical) yes Evaluation Count:11154 | yes Evaluation Count:63 |
| 63-11154 |
1843 | width += d->horizontalHeader->sectionSize(logical); | - |
1844 | if (width > viewportWidth) evaluated: width > viewportWidth yes Evaluation Count:1269 | yes Evaluation Count:9885 |
| 1269-9885 |
1845 | break; executed: break; Execution Count:1269 | 1269 |
1846 | ++columnsInViewport; | - |
1847 | } executed: } Execution Count:9885 | 9885 |
1848 | } executed: } Execution Count:9948 | 9948 |
1849 | columnsInViewport = qMax(columnsInViewport, 1); | - |
1850 | | - |
1851 | if (horizontalScrollMode() == QAbstractItemView::ScrollPerItem) { evaluated: horizontalScrollMode() == QAbstractItemView::ScrollPerItem yes Evaluation Count:2896 | yes Evaluation Count:137 |
| 137-2896 |
1852 | const int visibleColumns = columnCount - d->horizontalHeader->hiddenSectionCount(); | - |
1853 | horizontalScrollBar()->setRange(0, visibleColumns - columnsInViewport); | - |
1854 | horizontalScrollBar()->setPageStep(columnsInViewport); | - |
1855 | if (columnsInViewport >= visibleColumns) evaluated: columnsInViewport >= visibleColumns yes Evaluation Count:1723 | yes Evaluation Count:1173 |
| 1173-1723 |
1856 | d->horizontalHeader->setOffset(0); executed: d->horizontalHeader->setOffset(0); Execution Count:1723 | 1723 |
1857 | horizontalScrollBar()->setSingleStep(1); | - |
1858 | } else { executed: } Execution Count:2896 | 2896 |
1859 | horizontalScrollBar()->setPageStep(vsize.width()); | - |
1860 | horizontalScrollBar()->setRange(0, horizontalLength - vsize.width()); | - |
1861 | horizontalScrollBar()->setSingleStep(qMax(vsize.width() / (columnsInViewport + 1), 2)); | - |
1862 | } executed: } Execution Count:137 | 137 |
1863 | | - |
1864 | | - |
1865 | const int rowCount = d->verticalHeader->count(); | - |
1866 | const int viewportHeight = vsize.height(); | - |
1867 | int rowsInViewport = 0; | - |
1868 | for (int height = 0, row = rowCount - 1; row >= 0; --row) { evaluated: row >= 0 yes Evaluation Count:13722 | yes Evaluation Count:2323 |
| 2323-13722 |
1869 | int logical = d->verticalHeader->logicalIndex(row); | - |
1870 | if (!d->verticalHeader->isSectionHidden(logical)) { evaluated: !d->verticalHeader->isSectionHidden(logical) yes Evaluation Count:13675 | yes Evaluation Count:47 |
| 47-13675 |
1871 | height += d->verticalHeader->sectionSize(logical); | - |
1872 | if (height > viewportHeight) evaluated: height > viewportHeight yes Evaluation Count:710 | yes Evaluation Count:12965 |
| 710-12965 |
1873 | break; executed: break; Execution Count:710 | 710 |
1874 | ++rowsInViewport; | - |
1875 | } executed: } Execution Count:12965 | 12965 |
1876 | } executed: } Execution Count:13012 | 13012 |
1877 | rowsInViewport = qMax(rowsInViewport, 1); | - |
1878 | | - |
1879 | if (verticalScrollMode() == QAbstractItemView::ScrollPerItem) { evaluated: verticalScrollMode() == QAbstractItemView::ScrollPerItem yes Evaluation Count:2919 | yes Evaluation Count:114 |
| 114-2919 |
1880 | const int visibleRows = rowCount - d->verticalHeader->hiddenSectionCount(); | - |
1881 | verticalScrollBar()->setRange(0, visibleRows - rowsInViewport); | - |
1882 | verticalScrollBar()->setPageStep(rowsInViewport); | - |
1883 | if (rowsInViewport >= visibleRows) evaluated: rowsInViewport >= visibleRows yes Evaluation Count:2270 | yes Evaluation Count:649 |
| 649-2270 |
1884 | d->verticalHeader->setOffset(0); executed: d->verticalHeader->setOffset(0); Execution Count:2270 | 2270 |
1885 | verticalScrollBar()->setSingleStep(1); | - |
1886 | } else { executed: } Execution Count:2919 | 2919 |
1887 | verticalScrollBar()->setPageStep(vsize.height()); | - |
1888 | verticalScrollBar()->setRange(0, verticalLength - vsize.height()); | - |
1889 | verticalScrollBar()->setSingleStep(qMax(vsize.height() / (rowsInViewport + 1), 2)); | - |
1890 | } executed: } Execution Count:114 | 114 |
1891 | | - |
1892 | d->geometryRecursionBlock = false; | - |
1893 | QAbstractItemView::updateGeometries(); | - |
1894 | } executed: } Execution Count:3033 | 3033 |
1895 | int QTableView::sizeHintForRow(int row) const | - |
1896 | { | - |
1897 | const QTableViewPrivate * const d = d_func(); | - |
1898 | | - |
1899 | if (!model()) evaluated: !model() yes Evaluation Count:7 | yes Evaluation Count:2045 |
| 7-2045 |
1900 | return -1; executed: return -1; Execution Count:7 | 7 |
1901 | | - |
1902 | ensurePolished(); | - |
1903 | | - |
1904 | int left = qMax(0, d->horizontalHeader->visualIndexAt(0)); | - |
1905 | int right = d->horizontalHeader->visualIndexAt(d->viewport->width()); | - |
1906 | if (right == -1) evaluated: right == -1 yes Evaluation Count:2009 | yes Evaluation Count:36 |
| 36-2009 |
1907 | right = d->model->columnCount(d->root) - 1; executed: right = d->model->columnCount(d->root) - 1; Execution Count:2009 | 2009 |
1908 | | - |
1909 | QStyleOptionViewItem option = d->viewOptions(); | - |
1910 | | - |
1911 | int hint = 0; | - |
1912 | QModelIndex index; | - |
1913 | for (int column = left; column <= right; ++column) { evaluated: column <= right yes Evaluation Count:20215 | yes Evaluation Count:2045 |
| 2045-20215 |
1914 | int logicalColumn = d->horizontalHeader->logicalIndex(column); | - |
1915 | if (d->horizontalHeader->isSectionHidden(logicalColumn)) partially evaluated: d->horizontalHeader->isSectionHidden(logicalColumn) no Evaluation Count:0 | yes Evaluation Count:20215 |
| 0-20215 |
1916 | continue; never executed: continue; | 0 |
1917 | index = d->model->index(row, logicalColumn, d->root); | - |
1918 | if (d->wrapItemText) { partially evaluated: d->wrapItemText yes Evaluation Count:20215 | no Evaluation Count:0 |
| 0-20215 |
1919 | option.rect.setY(rowViewportPosition(index.row())); | - |
1920 | option.rect.setHeight(rowHeight(index.row())); | - |
1921 | option.rect.setX(columnViewportPosition(index.column())); | - |
1922 | option.rect.setWidth(columnWidth(index.column())); | - |
1923 | } executed: } Execution Count:20215 | 20215 |
1924 | | - |
1925 | QWidget *editor = d->editorForIndex(index).widget.data(); | - |
1926 | if (editor && d->persistent.contains(editor)) { partially evaluated: editor no Evaluation Count:0 | yes Evaluation Count:20215 |
never evaluated: d->persistent.contains(editor) | 0-20215 |
1927 | hint = qMax(hint, editor->sizeHint().height()); | - |
1928 | int min = editor->minimumSize().height(); | - |
1929 | int max = editor->maximumSize().height(); | - |
1930 | hint = qBound(min, hint, max); | - |
1931 | } | 0 |
1932 | | - |
1933 | hint = qMax(hint, itemDelegate(index)->sizeHint(option, index).height()); | - |
1934 | } executed: } Execution Count:20215 | 20215 |
1935 | | - |
1936 | return d->showGrid ? hint + 1 : hint; executed: return d->showGrid ? hint + 1 : hint; Execution Count:2045 | 2045 |
1937 | } | - |
1938 | int QTableView::sizeHintForColumn(int column) const | - |
1939 | { | - |
1940 | const QTableViewPrivate * const d = d_func(); | - |
1941 | | - |
1942 | if (!model()) evaluated: !model() yes Evaluation Count:7 | yes Evaluation Count:70 |
| 7-70 |
1943 | return -1; executed: return -1; Execution Count:7 | 7 |
1944 | | - |
1945 | ensurePolished(); | - |
1946 | | - |
1947 | int top = qMax(0, d->verticalHeader->visualIndexAt(0)); | - |
1948 | int bottom = d->verticalHeader->visualIndexAt(d->viewport->height()); | - |
1949 | if (!isVisible() || bottom == -1) evaluated: !isVisible() yes Evaluation Count:69 | yes Evaluation Count:1 |
partially evaluated: bottom == -1 no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-69 |
1950 | bottom = d->model->rowCount(d->root) - 1; executed: bottom = d->model->rowCount(d->root) - 1; Execution Count:69 | 69 |
1951 | | - |
1952 | QStyleOptionViewItem option = d->viewOptions(); | - |
1953 | | - |
1954 | int hint = 0; | - |
1955 | QModelIndex index; | - |
1956 | for (int row = top; row <= bottom; ++row) { evaluated: row <= bottom yes Evaluation Count:20223 | yes Evaluation Count:70 |
| 70-20223 |
1957 | int logicalRow = d->verticalHeader->logicalIndex(row); | - |
1958 | if (d->verticalHeader->isSectionHidden(logicalRow)) partially evaluated: d->verticalHeader->isSectionHidden(logicalRow) no Evaluation Count:0 | yes Evaluation Count:20223 |
| 0-20223 |
1959 | continue; never executed: continue; | 0 |
1960 | index = d->model->index(logicalRow, column, d->root); | - |
1961 | | - |
1962 | QWidget *editor = d->editorForIndex(index).widget.data(); | - |
1963 | if (editor && d->persistent.contains(editor)) { partially evaluated: editor no Evaluation Count:0 | yes Evaluation Count:20223 |
never evaluated: d->persistent.contains(editor) | 0-20223 |
1964 | hint = qMax(hint, editor->sizeHint().width()); | - |
1965 | int min = editor->minimumSize().width(); | - |
1966 | int max = editor->maximumSize().width(); | - |
1967 | hint = qBound(min, hint, max); | - |
1968 | } | 0 |
1969 | | - |
1970 | hint = qMax(hint, itemDelegate(index)->sizeHint(option, index).width()); | - |
1971 | } executed: } Execution Count:20223 | 20223 |
1972 | | - |
1973 | return d->showGrid ? hint + 1 : hint; executed: return d->showGrid ? hint + 1 : hint; Execution Count:70 | 70 |
1974 | } | - |
1975 | | - |
1976 | | - |
1977 | | - |
1978 | | - |
1979 | | - |
1980 | int QTableView::rowViewportPosition(int row) const | - |
1981 | { | - |
1982 | const QTableViewPrivate * const d = d_func(); | - |
1983 | return d->verticalHeader->sectionViewportPosition(row); executed: return d->verticalHeader->sectionViewportPosition(row); Execution Count:55553 | 55553 |
1984 | } | - |
1985 | int QTableView::rowAt(int y) const | - |
1986 | { | - |
1987 | const QTableViewPrivate * const d = d_func(); | - |
1988 | return d->verticalHeader->logicalIndexAt(y); executed: return d->verticalHeader->logicalIndexAt(y); Execution Count:6325 | 6325 |
1989 | } | - |
1990 | | - |
1991 | | - |
1992 | | - |
1993 | | - |
1994 | | - |
1995 | | - |
1996 | void QTableView::setRowHeight(int row, int height) | - |
1997 | { | - |
1998 | const QTableViewPrivate * const d = d_func(); | - |
1999 | d->verticalHeader->resizeSection(row, height); | - |
2000 | } executed: } Execution Count:681 | 681 |
2001 | | - |
2002 | | - |
2003 | | - |
2004 | | - |
2005 | | - |
2006 | | - |
2007 | int QTableView::rowHeight(int row) const | - |
2008 | { | - |
2009 | const QTableViewPrivate * const d = d_func(); | - |
2010 | return d->verticalHeader->sectionSize(row); executed: return d->verticalHeader->sectionSize(row); Execution Count:53492 | 53492 |
2011 | } | - |
2012 | | - |
2013 | | - |
2014 | | - |
2015 | | - |
2016 | | - |
2017 | int QTableView::columnViewportPosition(int column) const | - |
2018 | { | - |
2019 | const QTableViewPrivate * const d = d_func(); | - |
2020 | return d->horizontalHeader->sectionViewportPosition(column); executed: return d->horizontalHeader->sectionViewportPosition(column); Execution Count:58925 | 58925 |
2021 | } | - |
2022 | int QTableView::columnAt(int x) const | - |
2023 | { | - |
2024 | const QTableViewPrivate * const d = d_func(); | - |
2025 | return d->horizontalHeader->logicalIndexAt(x); executed: return d->horizontalHeader->logicalIndexAt(x); Execution Count:6310 | 6310 |
2026 | } | - |
2027 | | - |
2028 | | - |
2029 | | - |
2030 | | - |
2031 | | - |
2032 | | - |
2033 | void QTableView::setColumnWidth(int column, int width) | - |
2034 | { | - |
2035 | const QTableViewPrivate * const d = d_func(); | - |
2036 | d->horizontalHeader->resizeSection(column, width); | - |
2037 | } executed: } Execution Count:684 | 684 |
2038 | | - |
2039 | | - |
2040 | | - |
2041 | | - |
2042 | | - |
2043 | | - |
2044 | int QTableView::columnWidth(int column) const | - |
2045 | { | - |
2046 | const QTableViewPrivate * const d = d_func(); | - |
2047 | return d->horizontalHeader->sectionSize(column); executed: return d->horizontalHeader->sectionSize(column); Execution Count:61056 | 61056 |
2048 | } | - |
2049 | | - |
2050 | | - |
2051 | | - |
2052 | | - |
2053 | | - |
2054 | | - |
2055 | bool QTableView::isRowHidden(int row) const | - |
2056 | { | - |
2057 | const QTableViewPrivate * const d = d_func(); | - |
2058 | return d->verticalHeader->isSectionHidden(row); executed: return d->verticalHeader->isSectionHidden(row); Execution Count:38651 | 38651 |
2059 | } | - |
2060 | | - |
2061 | | - |
2062 | | - |
2063 | | - |
2064 | | - |
2065 | | - |
2066 | void QTableView::setRowHidden(int row, bool hide) | - |
2067 | { | - |
2068 | QTableViewPrivate * const d = d_func(); | - |
2069 | if (row < 0 || row >= d->verticalHeader->count()) partially evaluated: row < 0 no Evaluation Count:0 | yes Evaluation Count:313 |
partially evaluated: row >= d->verticalHeader->count() no Evaluation Count:0 | yes Evaluation Count:313 |
| 0-313 |
2070 | return; | 0 |
2071 | d->verticalHeader->setSectionHidden(row, hide); | - |
2072 | } executed: } Execution Count:313 | 313 |
2073 | | - |
2074 | | - |
2075 | | - |
2076 | | - |
2077 | | - |
2078 | | - |
2079 | bool QTableView::isColumnHidden(int column) const | - |
2080 | { | - |
2081 | const QTableViewPrivate * const d = d_func(); | - |
2082 | return d->horizontalHeader->isSectionHidden(column); executed: return d->horizontalHeader->isSectionHidden(column); Execution Count:38597 | 38597 |
2083 | } | - |
2084 | | - |
2085 | | - |
2086 | | - |
2087 | | - |
2088 | | - |
2089 | | - |
2090 | | - |
2091 | void QTableView::setColumnHidden(int column, bool hide) | - |
2092 | { | - |
2093 | QTableViewPrivate * const d = d_func(); | - |
2094 | if (column < 0 || column >= d->horizontalHeader->count()) partially evaluated: column < 0 no Evaluation Count:0 | yes Evaluation Count:73 |
partially evaluated: column >= d->horizontalHeader->count() no Evaluation Count:0 | yes Evaluation Count:73 |
| 0-73 |
2095 | return; | 0 |
2096 | d->horizontalHeader->setSectionHidden(column, hide); | - |
2097 | } executed: } Execution Count:73 | 73 |
2098 | void QTableView::setSortingEnabled(bool enable) | - |
2099 | { | - |
2100 | QTableViewPrivate * const d = d_func(); | - |
2101 | d->sortingEnabled = enable; | - |
2102 | horizontalHeader()->setSortIndicatorShown(enable); | - |
2103 | if (enable) { evaluated: enable yes Evaluation Count:27 | yes Evaluation Count:486 |
| 27-486 |
2104 | disconnect(d->horizontalHeader, "2""sectionEntered(int)", | - |
2105 | this, "1""_q_selectColumn(int)"); | - |
2106 | disconnect(horizontalHeader(), "2""sectionPressed(int)", | - |
2107 | this, "1""selectColumn(int)"); | - |
2108 | connect(horizontalHeader(), "2""sortIndicatorChanged(int,Qt::SortOrder)", | - |
2109 | this, "1""sortByColumn(int)", Qt::UniqueConnection); | - |
2110 | sortByColumn(horizontalHeader()->sortIndicatorSection(), | - |
2111 | horizontalHeader()->sortIndicatorOrder()); | - |
2112 | } else { executed: } Execution Count:27 | 27 |
2113 | connect(d->horizontalHeader, "2""sectionEntered(int)", | - |
2114 | this, "1""_q_selectColumn(int)", Qt::UniqueConnection); | - |
2115 | connect(horizontalHeader(), "2""sectionPressed(int)", | - |
2116 | this, "1""selectColumn(int)", Qt::UniqueConnection); | - |
2117 | disconnect(horizontalHeader(), "2""sortIndicatorChanged(int,Qt::SortOrder)", | - |
2118 | this, "1""sortByColumn(int)"); | - |
2119 | } executed: } Execution Count:486 | 486 |
2120 | } | - |
2121 | | - |
2122 | bool QTableView::isSortingEnabled() const | - |
2123 | { | - |
2124 | const QTableViewPrivate * const d = d_func(); | - |
2125 | return d->sortingEnabled; executed: return d->sortingEnabled; Execution Count:986 | 986 |
2126 | } | - |
2127 | bool QTableView::showGrid() const | - |
2128 | { | - |
2129 | const QTableViewPrivate * const d = d_func(); | - |
2130 | return d->showGrid; executed: return d->showGrid; Execution Count:30361 | 30361 |
2131 | } | - |
2132 | | - |
2133 | void QTableView::setShowGrid(bool show) | - |
2134 | { | - |
2135 | QTableViewPrivate * const d = d_func(); | - |
2136 | if (d->showGrid != show) { evaluated: d->showGrid != show yes Evaluation Count:45 | yes Evaluation Count:2 |
| 2-45 |
2137 | d->showGrid = show; | - |
2138 | d->viewport->update(); | - |
2139 | } executed: } Execution Count:45 | 45 |
2140 | } executed: } Execution Count:47 | 47 |
2141 | | - |
2142 | | - |
2143 | | - |
2144 | | - |
2145 | | - |
2146 | | - |
2147 | | - |
2148 | Qt::PenStyle QTableView::gridStyle() const | - |
2149 | { | - |
2150 | const QTableViewPrivate * const d = d_func(); | - |
2151 | return d->gridStyle; executed: return d->gridStyle; Execution Count:2 | 2 |
2152 | } | - |
2153 | | - |
2154 | void QTableView::setGridStyle(Qt::PenStyle style) | - |
2155 | { | - |
2156 | QTableViewPrivate * const d = d_func(); | - |
2157 | if (d->gridStyle != style) { evaluated: d->gridStyle != style yes Evaluation Count:2 | yes Evaluation Count:7 |
| 2-7 |
2158 | d->gridStyle = style; | - |
2159 | d->viewport->update(); | - |
2160 | } executed: } Execution Count:2 | 2 |
2161 | } executed: } Execution Count:9 | 9 |
2162 | void QTableView::setWordWrap(bool on) | - |
2163 | { | - |
2164 | QTableViewPrivate * const d = d_func(); | - |
2165 | if (d->wrapItemText == on) never evaluated: d->wrapItemText == on | 0 |
2166 | return; | 0 |
2167 | d->wrapItemText = on; | - |
2168 | QMetaObject::invokeMethod(d->verticalHeader, "resizeSections"); | - |
2169 | QMetaObject::invokeMethod(d->horizontalHeader, "resizeSections"); | - |
2170 | } | 0 |
2171 | | - |
2172 | bool QTableView::wordWrap() const | - |
2173 | { | - |
2174 | const QTableViewPrivate * const d = d_func(); | - |
2175 | return d->wrapItemText; never executed: return d->wrapItemText; | 0 |
2176 | } | - |
2177 | void QTableView::setCornerButtonEnabled(bool enable) | - |
2178 | { | - |
2179 | QTableViewPrivate * const d = d_func(); | - |
2180 | d->cornerWidget->setEnabled(enable); | - |
2181 | } executed: } Execution Count:1 | 1 |
2182 | | - |
2183 | bool QTableView::isCornerButtonEnabled() const | - |
2184 | { | - |
2185 | const QTableViewPrivate * const d = d_func(); | - |
2186 | return d->cornerWidget->isEnabled(); executed: return d->cornerWidget->isEnabled(); Execution Count:2 | 2 |
2187 | } | - |
2188 | QRect QTableView::visualRect(const QModelIndex &index) const | - |
2189 | { | - |
2190 | const QTableViewPrivate * const d = d_func(); | - |
2191 | if (!d->isIndexValid(index) || index.parent() != d->root evaluated: !d->isIndexValid(index) yes Evaluation Count:34 | yes Evaluation Count:29362 |
partially evaluated: index.parent() != d->root no Evaluation Count:0 | yes Evaluation Count:29362 |
| 0-29362 |
2192 | || (!d->hasSpans() && isIndexHidden(index))) evaluated: !d->hasSpans() yes Evaluation Count:29022 | yes Evaluation Count:340 |
evaluated: isIndexHidden(index) yes Evaluation Count:66 | yes Evaluation Count:28956 |
| 66-29022 |
2193 | return QRect(); executed: return QRect(); Execution Count:100 | 100 |
2194 | | - |
2195 | d->executePostedLayout(); | - |
2196 | | - |
2197 | if (d->hasSpans()) { evaluated: d->hasSpans() yes Evaluation Count:340 | yes Evaluation Count:28956 |
| 340-28956 |
2198 | QSpanCollection::Span span = d->span(index.row(), index.column()); | - |
2199 | return d->visualSpanRect(span); executed: return d->visualSpanRect(span); Execution Count:340 | 340 |
2200 | } | - |
2201 | | - |
2202 | int rowp = rowViewportPosition(index.row()); | - |
2203 | int rowh = rowHeight(index.row()); | - |
2204 | int colp = columnViewportPosition(index.column()); | - |
2205 | int colw = columnWidth(index.column()); | - |
2206 | | - |
2207 | const int i = showGrid() ? 1 : 0; evaluated: showGrid() yes Evaluation Count:20180 | yes Evaluation Count:8776 |
| 8776-20180 |
2208 | return QRect(colp, rowp, colw - i, rowh - i); executed: return QRect(colp, rowp, colw - i, rowh - i); Execution Count:28956 | 28956 |
2209 | } | - |
2210 | | - |
2211 | | - |
2212 | | - |
2213 | | - |
2214 | | - |
2215 | | - |
2216 | | - |
2217 | void QTableView::scrollTo(const QModelIndex &index, ScrollHint hint) | - |
2218 | { | - |
2219 | QTableViewPrivate * const d = d_func(); | - |
2220 | | - |
2221 | | - |
2222 | if (!d->isIndexValid(index) evaluated: !d->isIndexValid(index) yes Evaluation Count:35 | yes Evaluation Count:8649 |
| 35-8649 |
2223 | || (d->model->parent(index) != d->root) partially evaluated: (d->model->parent(index) != d->root) no Evaluation Count:0 | yes Evaluation Count:8649 |
| 0-8649 |
2224 | || isRowHidden(index.row()) || isColumnHidden(index.column())) partially evaluated: isRowHidden(index.row()) no Evaluation Count:0 | yes Evaluation Count:8649 |
partially evaluated: isColumnHidden(index.column()) no Evaluation Count:0 | yes Evaluation Count:8649 |
| 0-8649 |
2225 | return; executed: return; Execution Count:35 | 35 |
2226 | | - |
2227 | QSpanCollection::Span span; | - |
2228 | if (d->hasSpans()) evaluated: d->hasSpans() yes Evaluation Count:47 | yes Evaluation Count:8602 |
| 47-8602 |
2229 | span = d->span(index.row(), index.column()); executed: span = d->span(index.row(), index.column()); Execution Count:47 | 47 |
2230 | | - |
2231 | | - |
2232 | | - |
2233 | int viewportWidth = d->viewport->width(); | - |
2234 | int horizontalOffset = d->horizontalHeader->offset(); | - |
2235 | int horizontalPosition = d->horizontalHeader->sectionPosition(index.column()); | - |
2236 | int horizontalIndex = d->horizontalHeader->visualIndex(index.column()); | - |
2237 | int cellWidth = d->hasSpans() evaluated: d->hasSpans() yes Evaluation Count:47 | yes Evaluation Count:8602 |
| 47-8602 |
2238 | ? d->columnSpanWidth(index.column(), span.width()) | - |
2239 | : d->horizontalHeader->sectionSize(index.column()); | - |
2240 | | - |
2241 | if (horizontalScrollMode() == QAbstractItemView::ScrollPerItem) { evaluated: horizontalScrollMode() == QAbstractItemView::ScrollPerItem yes Evaluation Count:4569 | yes Evaluation Count:4080 |
| 4080-4569 |
2242 | | - |
2243 | bool positionAtLeft = (horizontalPosition - horizontalOffset < 0); | - |
2244 | bool positionAtRight = (horizontalPosition - horizontalOffset + cellWidth > viewportWidth); | - |
2245 | | - |
2246 | if (hint == PositionAtCenter || positionAtRight) { partially evaluated: hint == PositionAtCenter no Evaluation Count:0 | yes Evaluation Count:4569 |
evaluated: positionAtRight yes Evaluation Count:2126 | yes Evaluation Count:2443 |
| 0-4569 |
2247 | int w = (hint == PositionAtCenter ? viewportWidth / 2 : viewportWidth); partially evaluated: hint == PositionAtCenter no Evaluation Count:0 | yes Evaluation Count:2126 |
| 0-2126 |
2248 | int x = cellWidth; | - |
2249 | while (horizontalIndex > 0) { evaluated: horizontalIndex > 0 yes Evaluation Count:4237 | yes Evaluation Count:7 |
| 7-4237 |
2250 | x += columnWidth(d->horizontalHeader->logicalIndex(horizontalIndex-1)); | - |
2251 | if (x > w) evaluated: x > w yes Evaluation Count:2119 | yes Evaluation Count:2118 |
| 2118-2119 |
2252 | break; executed: break; Execution Count:2119 | 2119 |
2253 | --horizontalIndex; | - |
2254 | } executed: } Execution Count:2118 | 2118 |
2255 | } executed: } Execution Count:2126 | 2126 |
2256 | | - |
2257 | if (positionAtRight || hint == PositionAtCenter || positionAtLeft) { evaluated: positionAtRight yes Evaluation Count:2126 | yes Evaluation Count:2443 |
partially evaluated: hint == PositionAtCenter no Evaluation Count:0 | yes Evaluation Count:2443 |
evaluated: positionAtLeft yes Evaluation Count:98 | yes Evaluation Count:2345 |
| 0-2443 |
2258 | int hiddenSections = 0; | - |
2259 | if (d->horizontalHeader->sectionsHidden()) { evaluated: d->horizontalHeader->sectionsHidden() yes Evaluation Count:210 | yes Evaluation Count:2014 |
| 210-2014 |
2260 | for (int s = horizontalIndex - 1; s >= 0; --s) { evaluated: s >= 0 yes Evaluation Count:1445 | yes Evaluation Count:210 |
| 210-1445 |
2261 | int column = d->horizontalHeader->logicalIndex(s); | - |
2262 | if (d->horizontalHeader->isSectionHidden(column)) evaluated: d->horizontalHeader->isSectionHidden(column) yes Evaluation Count:76 | yes Evaluation Count:1369 |
| 76-1369 |
2263 | ++hiddenSections; executed: ++hiddenSections; Execution Count:76 | 76 |
2264 | } executed: } Execution Count:1445 | 1445 |
2265 | } executed: } Execution Count:210 | 210 |
2266 | horizontalScrollBar()->setValue(horizontalIndex - hiddenSections); | - |
2267 | } executed: } Execution Count:2224 | 2224 |
2268 | | - |
2269 | } else { executed: } Execution Count:4569 | 4569 |
2270 | if (hint == PositionAtCenter) { partially evaluated: hint == PositionAtCenter no Evaluation Count:0 | yes Evaluation Count:4080 |
| 0-4080 |
2271 | horizontalScrollBar()->setValue(horizontalPosition - ((viewportWidth - cellWidth) / 2)); | - |
2272 | } else { | 0 |
2273 | if (horizontalPosition - horizontalOffset < 0 || cellWidth > viewportWidth) evaluated: horizontalPosition - horizontalOffset < 0 yes Evaluation Count:78 | yes Evaluation Count:4002 |
partially evaluated: cellWidth > viewportWidth no Evaluation Count:0 | yes Evaluation Count:4002 |
| 0-4002 |
2274 | horizontalScrollBar()->setValue(horizontalPosition); executed: horizontalScrollBar()->setValue(horizontalPosition); Execution Count:78 | 78 |
2275 | else if (horizontalPosition - horizontalOffset + cellWidth > viewportWidth) evaluated: horizontalPosition - horizontalOffset + cellWidth > viewportWidth yes Evaluation Count:1872 | yes Evaluation Count:2130 |
| 1872-2130 |
2276 | horizontalScrollBar()->setValue(horizontalPosition - viewportWidth + cellWidth); executed: horizontalScrollBar()->setValue(horizontalPosition - viewportWidth + cellWidth); Execution Count:1872 | 1872 |
2277 | } | - |
2278 | } | - |
2279 | | - |
2280 | | - |
2281 | | - |
2282 | int viewportHeight = d->viewport->height(); | - |
2283 | int verticalOffset = d->verticalHeader->offset(); | - |
2284 | int verticalPosition = d->verticalHeader->sectionPosition(index.row()); | - |
2285 | int verticalIndex = d->verticalHeader->visualIndex(index.row()); | - |
2286 | int cellHeight = d->hasSpans() evaluated: d->hasSpans() yes Evaluation Count:47 | yes Evaluation Count:8602 |
| 47-8602 |
2287 | ? d->rowSpanHeight(index.row(), span.height()) | - |
2288 | : d->verticalHeader->sectionSize(index.row()); | - |
2289 | | - |
2290 | if (verticalPosition - verticalOffset < 0 || cellHeight > viewportHeight) { evaluated: verticalPosition - verticalOffset < 0 yes Evaluation Count:25 | yes Evaluation Count:8624 |
partially evaluated: cellHeight > viewportHeight no Evaluation Count:0 | yes Evaluation Count:8624 |
| 0-8624 |
2291 | if (hint == EnsureVisible) partially evaluated: hint == EnsureVisible yes Evaluation Count:25 | no Evaluation Count:0 |
| 0-25 |
2292 | hint = PositionAtTop; executed: hint = PositionAtTop; Execution Count:25 | 25 |
2293 | } else if (verticalPosition - verticalOffset + cellHeight > viewportHeight) { executed: } Execution Count:25 evaluated: verticalPosition - verticalOffset + cellHeight > viewportHeight yes Evaluation Count:252 | yes Evaluation Count:8372 |
| 25-8372 |
2294 | if (hint == EnsureVisible) evaluated: hint == EnsureVisible yes Evaluation Count:251 | yes Evaluation Count:1 |
| 1-251 |
2295 | hint = PositionAtBottom; executed: hint = PositionAtBottom; Execution Count:251 | 251 |
2296 | } executed: } Execution Count:252 | 252 |
2297 | | - |
2298 | if (verticalScrollMode() == QAbstractItemView::ScrollPerItem) { evaluated: verticalScrollMode() == QAbstractItemView::ScrollPerItem yes Evaluation Count:4562 | yes Evaluation Count:4087 |
| 4087-4562 |
2299 | | - |
2300 | if (hint == PositionAtBottom || hint == PositionAtCenter) { evaluated: hint == PositionAtBottom yes Evaluation Count:184 | yes Evaluation Count:4378 |
partially evaluated: hint == PositionAtCenter no Evaluation Count:0 | yes Evaluation Count:4378 |
| 0-4378 |
2301 | int h = (hint == PositionAtCenter ? viewportHeight / 2 : viewportHeight); partially evaluated: hint == PositionAtCenter no Evaluation Count:0 | yes Evaluation Count:184 |
| 0-184 |
2302 | int y = cellHeight; | - |
2303 | while (verticalIndex > 0) { partially evaluated: verticalIndex > 0 yes Evaluation Count:769 | no Evaluation Count:0 |
| 0-769 |
2304 | int row = d->verticalHeader->logicalIndex(verticalIndex - 1); | - |
2305 | y += d->verticalHeader->sectionSize(row); | - |
2306 | if (y > h) evaluated: y > h yes Evaluation Count:184 | yes Evaluation Count:585 |
| 184-585 |
2307 | break; executed: break; Execution Count:184 | 184 |
2308 | --verticalIndex; | - |
2309 | } executed: } Execution Count:585 | 585 |
2310 | } executed: } Execution Count:184 | 184 |
2311 | | - |
2312 | if (hint == PositionAtBottom || hint == PositionAtCenter || hint == PositionAtTop) { evaluated: hint == PositionAtBottom yes Evaluation Count:184 | yes Evaluation Count:4378 |
partially evaluated: hint == PositionAtCenter no Evaluation Count:0 | yes Evaluation Count:4378 |
evaluated: hint == PositionAtTop yes Evaluation Count:20 | yes Evaluation Count:4358 |
| 0-4378 |
2313 | int hiddenSections = 0; | - |
2314 | if (d->verticalHeader->sectionsHidden()) { evaluated: d->verticalHeader->sectionsHidden() yes Evaluation Count:12 | yes Evaluation Count:192 |
| 12-192 |
2315 | for (int s = verticalIndex - 1; s >= 0; --s) { evaluated: s >= 0 yes Evaluation Count:74 | yes Evaluation Count:12 |
| 12-74 |
2316 | int row = d->verticalHeader->logicalIndex(s); | - |
2317 | if (d->verticalHeader->isSectionHidden(row)) evaluated: d->verticalHeader->isSectionHidden(row) yes Evaluation Count:4 | yes Evaluation Count:70 |
| 4-70 |
2318 | ++hiddenSections; executed: ++hiddenSections; Execution Count:4 | 4 |
2319 | } executed: } Execution Count:74 | 74 |
2320 | } executed: } Execution Count:12 | 12 |
2321 | verticalScrollBar()->setValue(verticalIndex - hiddenSections); | - |
2322 | } executed: } Execution Count:204 | 204 |
2323 | | - |
2324 | } else { executed: } Execution Count:4562 | 4562 |
2325 | if (hint == PositionAtTop) { evaluated: hint == PositionAtTop yes Evaluation Count:17 | yes Evaluation Count:4070 |
| 17-4070 |
2326 | verticalScrollBar()->setValue(verticalPosition); | - |
2327 | } else if (hint == PositionAtBottom) { executed: } Execution Count:17 evaluated: hint == PositionAtBottom yes Evaluation Count:67 | yes Evaluation Count:4003 |
| 17-4003 |
2328 | verticalScrollBar()->setValue(verticalPosition - viewportHeight + cellHeight); | - |
2329 | } else if (hint == PositionAtCenter) { executed: } Execution Count:67 partially evaluated: hint == PositionAtCenter no Evaluation Count:0 | yes Evaluation Count:4003 |
| 0-4003 |
2330 | verticalScrollBar()->setValue(verticalPosition - ((viewportHeight - cellHeight) / 2)); | - |
2331 | } | 0 |
2332 | } | - |
2333 | | - |
2334 | update(index); | - |
2335 | } executed: } Execution Count:8649 | 8649 |
2336 | void QTableView::rowResized(int row, int, int) | - |
2337 | { | - |
2338 | QTableViewPrivate * const d = d_func(); | - |
2339 | d->rowsToUpdate.append(row); | - |
2340 | if (d->rowResizeTimerID == 0) evaluated: d->rowResizeTimerID == 0 yes Evaluation Count:126 | yes Evaluation Count:1059 |
| 126-1059 |
2341 | d->rowResizeTimerID = startTimer(0); executed: d->rowResizeTimerID = startTimer(0); Execution Count:126 | 126 |
2342 | } executed: } Execution Count:1185 | 1185 |
2343 | void QTableView::columnResized(int column, int, int) | - |
2344 | { | - |
2345 | QTableViewPrivate * const d = d_func(); | - |
2346 | d->columnsToUpdate.append(column); | - |
2347 | if (d->columnResizeTimerID == 0) evaluated: d->columnResizeTimerID == 0 yes Evaluation Count:124 | yes Evaluation Count:831 |
| 124-831 |
2348 | d->columnResizeTimerID = startTimer(0); executed: d->columnResizeTimerID = startTimer(0); Execution Count:124 | 124 |
2349 | } executed: } Execution Count:955 | 955 |
2350 | | - |
2351 | | - |
2352 | | - |
2353 | | - |
2354 | void QTableView::timerEvent(QTimerEvent *event) | - |
2355 | { | - |
2356 | QTableViewPrivate * const d = d_func(); | - |
2357 | | - |
2358 | if (event->timerId() == d->columnResizeTimerID) { evaluated: event->timerId() == d->columnResizeTimerID yes Evaluation Count:30 | yes Evaluation Count:153 |
| 30-153 |
2359 | updateGeometries(); | - |
2360 | killTimer(d->columnResizeTimerID); | - |
2361 | d->columnResizeTimerID = 0; | - |
2362 | | - |
2363 | QRect rect; | - |
2364 | int viewportHeight = d->viewport->height(); | - |
2365 | int viewportWidth = d->viewport->width(); | - |
2366 | if (d->hasSpans()) { evaluated: d->hasSpans() yes Evaluation Count:2 | yes Evaluation Count:28 |
| 2-28 |
2367 | rect = QRect(0, 0, viewportWidth, viewportHeight); | - |
2368 | } else { executed: } Execution Count:2 | 2 |
2369 | for (int i = d->columnsToUpdate.size()-1; i >= 0; --i) { evaluated: i >= 0 yes Evaluation Count:384 | yes Evaluation Count:28 |
| 28-384 |
2370 | int column = d->columnsToUpdate.at(i); | - |
2371 | int x = columnViewportPosition(column); | - |
2372 | if (isRightToLeft()) partially evaluated: isRightToLeft() no Evaluation Count:0 | yes Evaluation Count:384 |
| 0-384 |
2373 | rect |= QRect(0, 0, x + columnWidth(column), viewportHeight); never executed: rect |= QRect(0, 0, x + columnWidth(column), viewportHeight); | 0 |
2374 | else | - |
2375 | rect |= QRect(x, 0, viewportWidth - x, viewportHeight); executed: rect |= QRect(x, 0, viewportWidth - x, viewportHeight); Execution Count:384 | 384 |
2376 | } | - |
2377 | } executed: } Execution Count:28 | 28 |
2378 | | - |
2379 | d->viewport->update(rect.normalized()); | - |
2380 | d->columnsToUpdate.clear(); | - |
2381 | } executed: } Execution Count:30 | 30 |
2382 | | - |
2383 | if (event->timerId() == d->rowResizeTimerID) { evaluated: event->timerId() == d->rowResizeTimerID yes Evaluation Count:38 | yes Evaluation Count:145 |
| 38-145 |
2384 | updateGeometries(); | - |
2385 | killTimer(d->rowResizeTimerID); | - |
2386 | d->rowResizeTimerID = 0; | - |
2387 | | - |
2388 | int viewportHeight = d->viewport->height(); | - |
2389 | int viewportWidth = d->viewport->width(); | - |
2390 | int top; | - |
2391 | if (d->hasSpans()) { evaluated: d->hasSpans() yes Evaluation Count:2 | yes Evaluation Count:36 |
| 2-36 |
2392 | top = 0; | - |
2393 | } else { executed: } Execution Count:2 | 2 |
2394 | top = viewportHeight; | - |
2395 | for (int i = d->rowsToUpdate.size()-1; i >= 0; --i) { evaluated: i >= 0 yes Evaluation Count:344 | yes Evaluation Count:36 |
| 36-344 |
2396 | int y = rowViewportPosition(d->rowsToUpdate.at(i)); | - |
2397 | top = qMin(top, y); | - |
2398 | } executed: } Execution Count:344 | 344 |
2399 | } executed: } Execution Count:36 | 36 |
2400 | | - |
2401 | d->viewport->update(QRect(0, top, viewportWidth, viewportHeight - top)); | - |
2402 | d->rowsToUpdate.clear(); | - |
2403 | } executed: } Execution Count:38 | 38 |
2404 | | - |
2405 | QAbstractItemView::timerEvent(event); | - |
2406 | } executed: } Execution Count:183 | 183 |
2407 | void QTableView::rowMoved(int, int oldIndex, int newIndex) | - |
2408 | { | - |
2409 | QTableViewPrivate * const d = d_func(); | - |
2410 | | - |
2411 | updateGeometries(); | - |
2412 | int logicalOldIndex = d->verticalHeader->logicalIndex(oldIndex); | - |
2413 | int logicalNewIndex = d->verticalHeader->logicalIndex(newIndex); | - |
2414 | if (d->hasSpans()) { partially evaluated: d->hasSpans() no Evaluation Count:0 | yes Evaluation Count:111 |
| 0-111 |
2415 | d->viewport->update(); | - |
2416 | } else { | 0 |
2417 | int oldTop = rowViewportPosition(logicalOldIndex); | - |
2418 | int newTop = rowViewportPosition(logicalNewIndex); | - |
2419 | int oldBottom = oldTop + rowHeight(logicalOldIndex); | - |
2420 | int newBottom = newTop + rowHeight(logicalNewIndex); | - |
2421 | int top = qMin(oldTop, newTop); | - |
2422 | int bottom = qMax(oldBottom, newBottom); | - |
2423 | int height = bottom - top; | - |
2424 | d->viewport->update(0, top, d->viewport->width(), height); | - |
2425 | } executed: } Execution Count:111 | 111 |
2426 | } | - |
2427 | void QTableView::columnMoved(int, int oldIndex, int newIndex) | - |
2428 | { | - |
2429 | QTableViewPrivate * const d = d_func(); | - |
2430 | | - |
2431 | updateGeometries(); | - |
2432 | int logicalOldIndex = d->horizontalHeader->logicalIndex(oldIndex); | - |
2433 | int logicalNewIndex = d->horizontalHeader->logicalIndex(newIndex); | - |
2434 | if (d->hasSpans()) { partially evaluated: d->hasSpans() no Evaluation Count:0 | yes Evaluation Count:7 |
| 0-7 |
2435 | d->viewport->update(); | - |
2436 | } else { | 0 |
2437 | int oldLeft = columnViewportPosition(logicalOldIndex); | - |
2438 | int newLeft = columnViewportPosition(logicalNewIndex); | - |
2439 | int oldRight = oldLeft + columnWidth(logicalOldIndex); | - |
2440 | int newRight = newLeft + columnWidth(logicalNewIndex); | - |
2441 | int left = qMin(oldLeft, newLeft); | - |
2442 | int right = qMax(oldRight, newRight); | - |
2443 | int width = right - left; | - |
2444 | d->viewport->update(left, 0, width, d->viewport->height()); | - |
2445 | } executed: } Execution Count:7 | 7 |
2446 | } | - |
2447 | | - |
2448 | | - |
2449 | | - |
2450 | | - |
2451 | | - |
2452 | | - |
2453 | | - |
2454 | void QTableView::selectRow(int row) | - |
2455 | { | - |
2456 | QTableViewPrivate * const d = d_func(); | - |
2457 | d->selectRow(row, true); | - |
2458 | } executed: } Execution Count:13 | 13 |
2459 | | - |
2460 | | - |
2461 | | - |
2462 | | - |
2463 | | - |
2464 | | - |
2465 | | - |
2466 | void QTableView::selectColumn(int column) | - |
2467 | { | - |
2468 | QTableViewPrivate * const d = d_func(); | - |
2469 | d->selectColumn(column, true); | - |
2470 | } executed: } Execution Count:13 | 13 |
2471 | | - |
2472 | | - |
2473 | | - |
2474 | | - |
2475 | | - |
2476 | | - |
2477 | void QTableView::hideRow(int row) | - |
2478 | { | - |
2479 | QTableViewPrivate * const d = d_func(); | - |
2480 | d->verticalHeader->hideSection(row); | - |
2481 | } executed: } Execution Count:111 | 111 |
2482 | | - |
2483 | | - |
2484 | | - |
2485 | | - |
2486 | | - |
2487 | | - |
2488 | void QTableView::hideColumn(int column) | - |
2489 | { | - |
2490 | QTableViewPrivate * const d = d_func(); | - |
2491 | d->horizontalHeader->hideSection(column); | - |
2492 | } executed: } Execution Count:108 | 108 |
2493 | | - |
2494 | | - |
2495 | | - |
2496 | | - |
2497 | | - |
2498 | | - |
2499 | void QTableView::showRow(int row) | - |
2500 | { | - |
2501 | QTableViewPrivate * const d = d_func(); | - |
2502 | d->verticalHeader->showSection(row); | - |
2503 | } executed: } Execution Count:418 | 418 |
2504 | | - |
2505 | | - |
2506 | | - |
2507 | | - |
2508 | | - |
2509 | | - |
2510 | void QTableView::showColumn(int column) | - |
2511 | { | - |
2512 | QTableViewPrivate * const d = d_func(); | - |
2513 | d->horizontalHeader->showSection(column); | - |
2514 | } executed: } Execution Count:418 | 418 |
2515 | | - |
2516 | | - |
2517 | | - |
2518 | | - |
2519 | | - |
2520 | void QTableView::resizeRowToContents(int row) | - |
2521 | { | - |
2522 | QTableViewPrivate * const d = d_func(); | - |
2523 | int content = sizeHintForRow(row); | - |
2524 | int header = d->verticalHeader->sectionSizeHint(row); | - |
2525 | d->verticalHeader->resizeSection(row, qMax(content, header)); | - |
2526 | } executed: } Execution Count:2 | 2 |
2527 | | - |
2528 | | - |
2529 | | - |
2530 | | - |
2531 | | - |
2532 | void QTableView::resizeRowsToContents() | - |
2533 | { | - |
2534 | QTableViewPrivate * const d = d_func(); | - |
2535 | d->verticalHeader->resizeSections(QHeaderView::ResizeToContents); | - |
2536 | } executed: } Execution Count:4 | 4 |
2537 | void QTableView::resizeColumnToContents(int column) | - |
2538 | { | - |
2539 | QTableViewPrivate * const d = d_func(); | - |
2540 | int content = sizeHintForColumn(column); | - |
2541 | int header = d->horizontalHeader->sectionSizeHint(column); | - |
2542 | d->horizontalHeader->resizeSection(column, qMax(content, header)); | - |
2543 | } executed: } Execution Count:3 | 3 |
2544 | | - |
2545 | | - |
2546 | | - |
2547 | | - |
2548 | | - |
2549 | void QTableView::resizeColumnsToContents() | - |
2550 | { | - |
2551 | QTableViewPrivate * const d = d_func(); | - |
2552 | d->horizontalHeader->resizeSections(QHeaderView::ResizeToContents); | - |
2553 | } executed: } Execution Count:4 | 4 |
2554 | | - |
2555 | | - |
2556 | | - |
2557 | | - |
2558 | | - |
2559 | | - |
2560 | | - |
2561 | void QTableView::sortByColumn(int column) | - |
2562 | { | - |
2563 | QTableViewPrivate * const d = d_func(); | - |
2564 | if (column == -1) partially evaluated: column == -1 no Evaluation Count:0 | yes Evaluation Count:50 |
| 0-50 |
2565 | return; | 0 |
2566 | d->model->sort(column, d->horizontalHeader->sortIndicatorOrder()); | - |
2567 | } executed: } Execution Count:50 | 50 |
2568 | void QTableView::sortByColumn(int column, Qt::SortOrder order) | - |
2569 | { | - |
2570 | QTableViewPrivate * const d = d_func(); | - |
2571 | d->horizontalHeader->setSortIndicator(column, order); | - |
2572 | sortByColumn(column); | - |
2573 | } executed: } Execution Count:33 | 33 |
2574 | | - |
2575 | | - |
2576 | | - |
2577 | | - |
2578 | void QTableView::verticalScrollbarAction(int action) | - |
2579 | { | - |
2580 | QAbstractItemView::verticalScrollbarAction(action); | - |
2581 | } executed: } Execution Count:6 | 6 |
2582 | | - |
2583 | | - |
2584 | | - |
2585 | | - |
2586 | void QTableView::horizontalScrollbarAction(int action) | - |
2587 | { | - |
2588 | QAbstractItemView::horizontalScrollbarAction(action); | - |
2589 | } executed: } Execution Count:5 | 5 |
2590 | | - |
2591 | | - |
2592 | | - |
2593 | | - |
2594 | bool QTableView::isIndexHidden(const QModelIndex &index) const | - |
2595 | { | - |
2596 | const QTableViewPrivate * const d = d_func(); | - |
2597 | qt_noop(); | - |
2598 | if (isRowHidden(index.row()) || isColumnHidden(index.column())) evaluated: isRowHidden(index.row()) yes Evaluation Count:77 | yes Evaluation Count:29142 |
evaluated: isColumnHidden(index.column()) yes Evaluation Count:15 | yes Evaluation Count:29127 |
| 15-29142 |
2599 | return true; executed: return true; Execution Count:92 | 92 |
2600 | if (d->hasSpans()) { evaluated: d->hasSpans() yes Evaluation Count:18 | yes Evaluation Count:29109 |
| 18-29109 |
2601 | QSpanCollection::Span span = d->span(index.row(), index.column()); | - |
2602 | return !((span.top() == index.row()) && (span.left() == index.column())); executed: return !((span.top() == index.row()) && (span.left() == index.column())); Execution Count:18 | 18 |
2603 | } | - |
2604 | return false; executed: return false; Execution Count:29109 | 29109 |
2605 | } | - |
2606 | void QTableView::setSpan(int row, int column, int rowSpan, int columnSpan) | - |
2607 | { | - |
2608 | QTableViewPrivate * const d = d_func(); | - |
2609 | if (row < 0 || column < 0 || rowSpan < 0 || columnSpan < 0) evaluated: row < 0 yes Evaluation Count:14 | yes Evaluation Count:126 |
partially evaluated: column < 0 no Evaluation Count:0 | yes Evaluation Count:126 |
partially evaluated: rowSpan < 0 no Evaluation Count:0 | yes Evaluation Count:126 |
partially evaluated: columnSpan < 0 no Evaluation Count:0 | yes Evaluation Count:126 |
| 0-126 |
2610 | return; executed: return; Execution Count:14 | 14 |
2611 | d->setSpan(row, column, rowSpan, columnSpan); | - |
2612 | d->viewport->update(); | - |
2613 | } executed: } Execution Count:126 | 126 |
2614 | int QTableView::rowSpan(int row, int column) const | - |
2615 | { | - |
2616 | const QTableViewPrivate * const d = d_func(); | - |
2617 | return d->rowSpan(row, column); executed: return d->rowSpan(row, column); Execution Count:58 | 58 |
2618 | } | - |
2619 | int QTableView::columnSpan(int row, int column) const | - |
2620 | { | - |
2621 | const QTableViewPrivate * const d = d_func(); | - |
2622 | return d->columnSpan(row, column); executed: return d->columnSpan(row, column); Execution Count:58 | 58 |
2623 | } | - |
2624 | void QTableView::clearSpans() | - |
2625 | { | - |
2626 | QTableViewPrivate * const d = d_func(); | - |
2627 | d->spans.clear(); | - |
2628 | d->viewport->update(); | - |
2629 | } executed: } Execution Count:8 | 8 |
2630 | | - |
2631 | void QTableViewPrivate::_q_selectRow(int row) | - |
2632 | { | - |
2633 | selectRow(row, false); | - |
2634 | } executed: } Execution Count:4 | 4 |
2635 | | - |
2636 | void QTableViewPrivate::_q_selectColumn(int column) | - |
2637 | { | - |
2638 | selectColumn(column, false); | - |
2639 | } executed: } Execution Count:4 | 4 |
2640 | | - |
2641 | void QTableViewPrivate::selectRow(int row, bool anchor) | - |
2642 | { | - |
2643 | QTableView * const q = q_func(); | - |
2644 | | - |
2645 | if (q->selectionBehavior() == QTableView::SelectColumns evaluated: q->selectionBehavior() == QTableView::SelectColumns yes Evaluation Count:4 | yes Evaluation Count:13 |
| 4-13 |
2646 | || (q->selectionMode() == QTableView::SingleSelection evaluated: q->selectionMode() == QTableView::SingleSelection yes Evaluation Count:2 | yes Evaluation Count:11 |
| 2-11 |
2647 | && q->selectionBehavior() == QTableView::SelectItems)) evaluated: q->selectionBehavior() == QTableView::SelectItems yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
2648 | return; executed: return; Execution Count:5 | 5 |
2649 | | - |
2650 | if (row >= 0 && row < model->rowCount(root)) { partially evaluated: row >= 0 yes Evaluation Count:12 | no Evaluation Count:0 |
partially evaluated: row < model->rowCount(root) yes Evaluation Count:12 | no Evaluation Count:0 |
| 0-12 |
2651 | int column = horizontalHeader->logicalIndexAt(q->isRightToLeft() ? viewport->width() : 0); | - |
2652 | QModelIndex index = model->index(row, column, root); | - |
2653 | QItemSelectionModel::SelectionFlags command = q->selectionCommand(index); | - |
2654 | selectionModel->setCurrentIndex(index, QItemSelectionModel::NoUpdate); | - |
2655 | if ((anchor && !(command & QItemSelectionModel::Current)) evaluated: anchor yes Evaluation Count:8 | yes Evaluation Count:4 |
partially evaluated: !(command & QItemSelectionModel::Current) yes Evaluation Count:8 | no Evaluation Count:0 |
| 0-8 |
2656 | || (q->selectionMode() == QTableView::SingleSelection)) partially evaluated: (q->selectionMode() == QTableView::SingleSelection) no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
2657 | rowSectionAnchor = row; executed: rowSectionAnchor = row; Execution Count:8 | 8 |
2658 | | - |
2659 | if (q->selectionMode() != QTableView::SingleSelection evaluated: q->selectionMode() != QTableView::SingleSelection yes Evaluation Count:11 | yes Evaluation Count:1 |
| 1-11 |
2660 | && command.testFlag(QItemSelectionModel::Toggle)) { evaluated: command.testFlag(QItemSelectionModel::Toggle) yes Evaluation Count:7 | yes Evaluation Count:4 |
| 4-7 |
2661 | if (anchor) evaluated: anchor yes Evaluation Count:3 | yes Evaluation Count:4 |
| 3-4 |
2662 | ctrlDragSelectionFlag = verticalHeader->selectionModel()->selectedRows().contains(index) partially evaluated: verticalHeader->selectionModel()->selectedRows().contains(index) no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
2663 | ? QItemSelectionModel::Deselect : QItemSelectionModel::Select; executed: ctrlDragSelectionFlag = verticalHeader->selectionModel()->selectedRows().contains(index) ? QItemSelectionModel::Deselect : QItemSelectionModel::Select; Execution Count:3 | 3 |
2664 | command &= ~QItemSelectionModel::Toggle; | - |
2665 | command |= ctrlDragSelectionFlag; | - |
2666 | if (!anchor) evaluated: !anchor yes Evaluation Count:4 | yes Evaluation Count:3 |
| 3-4 |
2667 | command |= QItemSelectionModel::Current; executed: command |= QItemSelectionModel::Current; Execution Count:4 | 4 |
2668 | } executed: } Execution Count:7 | 7 |
2669 | | - |
2670 | QModelIndex tl = model->index(qMin(rowSectionAnchor, row), logicalColumn(0), root); | - |
2671 | QModelIndex br = model->index(qMax(rowSectionAnchor, row), logicalColumn(model->columnCount(root) - 1), root); | - |
2672 | if ((verticalHeader->sectionsMoved() && tl.row() != br.row()) partially evaluated: verticalHeader->sectionsMoved() no Evaluation Count:0 | yes Evaluation Count:12 |
never evaluated: tl.row() != br.row() | 0-12 |
2673 | || horizontalHeader->sectionsMoved()) { partially evaluated: horizontalHeader->sectionsMoved() no Evaluation Count:0 | yes Evaluation Count:12 |
| 0-12 |
2674 | q->setSelection(q->visualRect(tl)|q->visualRect(br), command); | - |
2675 | } else { | 0 |
2676 | selectionModel->select(QItemSelection(tl, br), command); | - |
2677 | } executed: } Execution Count:12 | 12 |
2678 | } | - |
2679 | } executed: } Execution Count:12 | 12 |
2680 | | - |
2681 | void QTableViewPrivate::selectColumn(int column, bool anchor) | - |
2682 | { | - |
2683 | QTableView * const q = q_func(); | - |
2684 | | - |
2685 | if (q->selectionBehavior() == QTableView::SelectRows evaluated: q->selectionBehavior() == QTableView::SelectRows yes Evaluation Count:4 | yes Evaluation Count:13 |
| 4-13 |
2686 | || (q->selectionMode() == QTableView::SingleSelection evaluated: q->selectionMode() == QTableView::SingleSelection yes Evaluation Count:2 | yes Evaluation Count:11 |
| 2-11 |
2687 | && q->selectionBehavior() == QTableView::SelectItems)) evaluated: q->selectionBehavior() == QTableView::SelectItems yes Evaluation Count:1 | yes Evaluation Count:1 |
| 1 |
2688 | return; executed: return; Execution Count:5 | 5 |
2689 | | - |
2690 | if (column >= 0 && column < model->columnCount(root)) { partially evaluated: column >= 0 yes Evaluation Count:12 | no Evaluation Count:0 |
partially evaluated: column < model->columnCount(root) yes Evaluation Count:12 | no Evaluation Count:0 |
| 0-12 |
2691 | int row = verticalHeader->logicalIndexAt(0); | - |
2692 | QModelIndex index = model->index(row, column, root); | - |
2693 | QItemSelectionModel::SelectionFlags command = q->selectionCommand(index); | - |
2694 | selectionModel->setCurrentIndex(index, QItemSelectionModel::NoUpdate); | - |
2695 | if ((anchor && !(command & QItemSelectionModel::Current)) evaluated: anchor yes Evaluation Count:8 | yes Evaluation Count:4 |
partially evaluated: !(command & QItemSelectionModel::Current) yes Evaluation Count:8 | no Evaluation Count:0 |
| 0-8 |
2696 | || (q->selectionMode() == QTableView::SingleSelection)) partially evaluated: (q->selectionMode() == QTableView::SingleSelection) no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
2697 | columnSectionAnchor = column; executed: columnSectionAnchor = column; Execution Count:8 | 8 |
2698 | | - |
2699 | if (q->selectionMode() != QTableView::SingleSelection evaluated: q->selectionMode() != QTableView::SingleSelection yes Evaluation Count:11 | yes Evaluation Count:1 |
| 1-11 |
2700 | && command.testFlag(QItemSelectionModel::Toggle)) { evaluated: command.testFlag(QItemSelectionModel::Toggle) yes Evaluation Count:7 | yes Evaluation Count:4 |
| 4-7 |
2701 | if (anchor) evaluated: anchor yes Evaluation Count:3 | yes Evaluation Count:4 |
| 3-4 |
2702 | ctrlDragSelectionFlag = horizontalHeader->selectionModel()->selectedColumns().contains(index) partially evaluated: horizontalHeader->selectionModel()->selectedColumns().contains(index) no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
2703 | ? QItemSelectionModel::Deselect : QItemSelectionModel::Select; executed: ctrlDragSelectionFlag = horizontalHeader->selectionModel()->selectedColumns().contains(index) ? QItemSelectionModel::Deselect : QItemSelectionModel::Select; Execution Count:3 | 3 |
2704 | command &= ~QItemSelectionModel::Toggle; | - |
2705 | command |= ctrlDragSelectionFlag; | - |
2706 | if (!anchor) evaluated: !anchor yes Evaluation Count:4 | yes Evaluation Count:3 |
| 3-4 |
2707 | command |= QItemSelectionModel::Current; executed: command |= QItemSelectionModel::Current; Execution Count:4 | 4 |
2708 | } executed: } Execution Count:7 | 7 |
2709 | | - |
2710 | QModelIndex tl = model->index(logicalRow(0), qMin(columnSectionAnchor, column), root); | - |
2711 | QModelIndex br = model->index(logicalRow(model->rowCount(root) - 1), | - |
2712 | qMax(columnSectionAnchor, column), root); | - |
2713 | if ((horizontalHeader->sectionsMoved() && tl.column() != br.column()) partially evaluated: horizontalHeader->sectionsMoved() no Evaluation Count:0 | yes Evaluation Count:12 |
never evaluated: tl.column() != br.column() | 0-12 |
2714 | || verticalHeader->sectionsMoved()) { partially evaluated: verticalHeader->sectionsMoved() no Evaluation Count:0 | yes Evaluation Count:12 |
| 0-12 |
2715 | q->setSelection(q->visualRect(tl)|q->visualRect(br), command); | - |
2716 | } else { | 0 |
2717 | selectionModel->select(QItemSelection(tl, br), command); | - |
2718 | } executed: } Execution Count:12 | 12 |
2719 | } | - |
2720 | } executed: } Execution Count:12 | 12 |
2721 | | - |
2722 | | - |
2723 | | - |
2724 | | - |
2725 | void QTableView::currentChanged(const QModelIndex ¤t, const QModelIndex &previous) | - |
2726 | { | - |
2727 | | - |
2728 | if (QAccessible::isActive()) { evaluated: QAccessible::isActive() yes Evaluation Count:3 | yes Evaluation Count:1939 |
| 3-1939 |
2729 | if (current.isValid()) { partially evaluated: current.isValid() yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-3 |
2730 | QTableViewPrivate * const d = d_func(); | - |
2731 | int entry = d->accessibleTable2Index(current); | - |
2732 | QAccessibleEvent event(this, QAccessible::Focus); | - |
2733 | event.setChild(entry); | - |
2734 | QAccessible::updateAccessibility(&event); | - |
2735 | } executed: } Execution Count:3 | 3 |
2736 | } executed: } Execution Count:3 | 3 |
2737 | | - |
2738 | QAbstractItemView::currentChanged(current, previous); | - |
2739 | } executed: } Execution Count:1942 | 1942 |
2740 | | - |
2741 | | - |
2742 | | - |
2743 | | - |
2744 | void QTableView::selectionChanged(const QItemSelection &selected, | - |
2745 | const QItemSelection &deselected) | - |
2746 | { | - |
2747 | QTableViewPrivate * const d = d_func(); | - |
2748 | (void)d; | - |
2749 | | - |
2750 | if (QAccessible::isActive()) { evaluated: QAccessible::isActive() yes Evaluation Count:2 | yes Evaluation Count:2027 |
| 2-2027 |
2751 | | - |
2752 | QModelIndex sel = selected.indexes().value(0); | - |
2753 | if (sel.isValid()) { partially evaluated: sel.isValid() yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
2754 | int entry = d->accessibleTable2Index(sel); | - |
2755 | QAccessibleEvent event(this, QAccessible::Selection); | - |
2756 | event.setChild(entry); | - |
2757 | QAccessible::updateAccessibility(&event); | - |
2758 | } executed: } Execution Count:2 | 2 |
2759 | QModelIndex desel = deselected.indexes().value(0); | - |
2760 | if (desel.isValid()) { partially evaluated: desel.isValid() no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
2761 | int entry = d->accessibleTable2Index(desel); | - |
2762 | QAccessibleEvent event(this, QAccessible::SelectionRemove); | - |
2763 | event.setChild(entry); | - |
2764 | QAccessible::updateAccessibility(&event); | - |
2765 | } | 0 |
2766 | } executed: } Execution Count:2 | 2 |
2767 | | - |
2768 | QAbstractItemView::selectionChanged(selected, deselected); | - |
2769 | } executed: } Execution Count:2029 | 2029 |
2770 | | - |
2771 | int QTableView::visualIndex(const QModelIndex &index) const | - |
2772 | { | - |
2773 | return index.row(); never executed: return index.row(); | 0 |
2774 | } | - |
2775 | | - |
2776 | | - |
2777 | | - |
2778 | | - |
2779 | | - |
| | |