itemviews/qtableview.cpp

Source codeSwitch to Preprocessed file
LineSource CodeCoverage
1/**************************************************************************** -
2** -
3** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -
4** Contact: http://www.qt-project.org/legal -
5** -
6** This file is part of the QtGui module of the Qt Toolkit. -
7** -
8** $QT_BEGIN_LICENSE:LGPL$ -
9** Commercial License Usage -
10** Licensees holding valid commercial Qt licenses may use this file in -
11** accordance with the commercial license agreement provided with the -
12** Software or, alternatively, in accordance with the terms contained in -
13** a written agreement between you and Digia. For licensing terms and -
14** conditions see http://qt.digia.com/licensing. For further information -
15** use the contact form at http://qt.digia.com/contact-us. -
16** -
17** GNU Lesser General Public License Usage -
18** Alternatively, this file may be used under the terms of the GNU Lesser -
19** General Public License version 2.1 as published by the Free Software -
20** Foundation and appearing in the file LICENSE.LGPL included in the -
21** packaging of this file. Please review the following information to -
22** ensure the GNU Lesser General Public License version 2.1 requirements -
23** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -
24** -
25** In addition, as a special exception, Digia gives you certain additional -
26** rights. These rights are described in the Digia Qt LGPL Exception -
27** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -
28** -
29** GNU General Public License Usage -
30** Alternatively, this file may be used under the terms of the GNU -
31** General Public License version 3.0 as published by the Free Software -
32** Foundation and appearing in the file LICENSE.GPL included in the -
33** packaging of this file. Please review the following information to -
34** ensure the GNU General Public License version 3.0 requirements will be -
35** met: http://www.gnu.org/copyleft/gpl.html. -
36** -
37** -
38** $QT_END_LICENSE$ -
39** -
40****************************************************************************/ -
41 -
42#include "qtableview.h" -
43 -
44#ifndef QT_NO_TABLEVIEW -
45#include <qheaderview.h> -
46#include <qitemdelegate.h> -
47#include <qapplication.h> -
48#include <qpainter.h> -
49#include <qstyle.h> -
50#include <qsize.h> -
51#include <qevent.h> -
52#include <qbitarray.h> -
53#include <qscrollbar.h> -
54#include <qabstractbutton.h> -
55#include <private/qtableview_p.h> -
56#include <private/qheaderview_p.h> -
57#ifndef QT_NO_ACCESSIBILITY -
58#include <qaccessible.h> -
59#endif -
60 -
61QT_BEGIN_NAMESPACE -
62 -
63/** \internal -
64 Add a span to the collection. the collection takes the ownership. -
65 */ -
66void QSpanCollection::addSpan(QSpanCollection::Span *span) -
67{ -
68 spans.append(span);
executed (the execution status of this line is deduced): spans.append(span);
-
69 Index::iterator it_y = index.lowerBound(-span->top());
executed (the execution status of this line is deduced): Index::iterator it_y = index.lowerBound(-span->top());
-
70 if (it_y == index.end() || it_y.key() != -span->top()) {
evaluated: it_y == index.end()
TRUEFALSE
yes
Evaluation Count:42
yes
Evaluation Count:76
evaluated: it_y.key() != -span->top()
TRUEFALSE
yes
Evaluation Count:68
yes
Evaluation Count:8
8-76
71 //there is no spans that starts with the row in the index, so create a sublist for it. -
72 SubIndex sub_index;
executed (the execution status of this line is deduced): SubIndex sub_index;
-
73 if (it_y != index.end()) {
evaluated: it_y != index.end()
TRUEFALSE
yes
Evaluation Count:68
yes
Evaluation Count:42
42-68
74 //the previouslist is the list of spans that sarts _before_ the row of the span. -
75 // and which may intersect this row. -
76 const SubIndex previousList = it_y.value();
executed (the execution status of this line is deduced): const SubIndex previousList = it_y.value();
-
77 foreach(Span *s, previousList) {
executed (the execution status of this line is deduced): 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;})) {
-
78 //If a subspans intersect the row, we need to split it into subspans -
79 if(s->bottom() >= span->top())
evaluated: s->bottom() >= span->top()
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:70
7-70
80 sub_index.insert(-s->left(), s);
executed: sub_index.insert(-s->left(), s);
Execution Count:7
7
81 }
executed: }
Execution Count:77
77
82 }
executed: }
Execution Count:68
68
83 it_y = index.insert(-span->top(), sub_index);
executed (the execution status of this line is deduced): it_y = index.insert(-span->top(), sub_index);
-
84 //we will insert span to *it_y in the later loop -
85 }
executed: }
Execution Count:110
110
86 -
87 //insert the span as supspan in all the lists that intesects the span -
88 while(-it_y.key() <= span->bottom()) {
evaluated: -it_y.key() <= span->bottom()
TRUEFALSE
yes
Evaluation Count:120
yes
Evaluation Count:2
2-120
89 (*it_y).insert(-span->left(), span);
executed (the execution status of this line is deduced): (*it_y).insert(-span->left(), span);
-
90 if(it_y == index.begin())
evaluated: it_y == index.begin()
TRUEFALSE
yes
Evaluation Count:116
yes
Evaluation Count:4
4-116
91 break;
executed: break;
Execution Count:116
116
92 --it_y;
executed (the execution status of this line is deduced): --it_y;
-
93 }
executed: }
Execution Count:4
4
94}
executed: }
Execution Count:118
118
95 -
96 -
97/** \internal -
98* Has to be called after the height and width of a span is changed. -
99* -
100* old_height is the height before the change -
101* -
102* if the size of the span is now 0x0 the span will be deleted. -
103*/ -
104void QSpanCollection::updateSpan(QSpanCollection::Span *span, int old_height) -
105{ -
106 if (old_height < span->height()) {
partially evaluated: old_height < span->height()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
107 //add the span as subspan in all the lists that intersect the new covered columns -
108 Index::iterator it_y = index.lowerBound(-(span->top() + old_height - 1));
never executed (the execution status of this line is deduced): Index::iterator it_y = index.lowerBound(-(span->top() + old_height - 1));
-
109 Q_ASSERT(it_y != index.end()); //it_y must exist since the span is in the list
never executed (the execution status of this line is deduced): qt_noop();
-
110 while (-it_y.key() <= span->bottom()) {
never evaluated: -it_y.key() <= span->bottom()
0
111 (*it_y).insert(-span->left(), span);
never executed (the execution status of this line is deduced): (*it_y).insert(-span->left(), span);
-
112 if(it_y == index.begin())
never evaluated: it_y == index.begin()
0
113 break;
never executed: break;
0
114 --it_y;
never executed (the execution status of this line is deduced): --it_y;
-
115 }
never executed: }
0
116 } else if (old_height > span->height()) {
never executed: }
partially evaluated: old_height > span->height()
TRUEFALSE
yes
Evaluation Count:5
no
Evaluation Count:0
0-5
117 //remove the span from all the subspans lists that intersect the columns not covered anymore -
118 Index::iterator it_y = index.lowerBound(-qMax(span->bottom(), span->top())); //qMax useful if height is 0
executed (the execution status of this line is deduced): Index::iterator it_y = index.lowerBound(-qMax(span->bottom(), span->top()));
-
119 Q_ASSERT(it_y != index.end()); //it_y must exist since the span is in the list
executed (the execution status of this line is deduced): qt_noop();
-
120 while (-it_y.key() <= span->top() + old_height -1) {
evaluated: -it_y.key() <= span->top() + old_height -1
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:2
2-6
121 if (-it_y.key() > span->bottom()) {
partially evaluated: -it_y.key() > span->bottom()
TRUEFALSE
yes
Evaluation Count:6
no
Evaluation Count:0
0-6
122 int removed = (*it_y).remove(-span->left());
executed (the execution status of this line is deduced): int removed = (*it_y).remove(-span->left());
-
123 Q_ASSERT(removed == 1); Q_UNUSED(removed);
executed (the execution status of this line is deduced): qt_noop(); (void)removed;;
-
124 if (it_y->isEmpty()) {
evaluated: it_y->isEmpty()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:1
1-5
125 it_y = index.erase(it_y);
executed (the execution status of this line is deduced): it_y = index.erase(it_y);
-
126 }
executed: }
Execution Count:5
5
127 }
executed: }
Execution Count:6
6
128 if(it_y == index.begin())
evaluated: it_y == index.begin()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:3
3
129 break;
executed: break;
Execution Count:3
3
130 --it_y;
executed (the execution status of this line is deduced): --it_y;
-
131 }
executed: }
Execution Count:3
3
132 }
executed: }
Execution Count:5
5
133 -
134 if (span->width() == 0 && span->height() == 0) {
partially evaluated: span->width() == 0
TRUEFALSE
yes
Evaluation Count:5
no
Evaluation Count:0
partially evaluated: span->height() == 0
TRUEFALSE
yes
Evaluation Count:5
no
Evaluation Count:0
0-5
135 spans.removeOne(span);
executed (the execution status of this line is deduced): spans.removeOne(span);
-
136 delete span;
executed (the execution status of this line is deduced): delete span;
-
137 }
executed: }
Execution Count:5
5
138}
executed: }
Execution Count:5
5
139 -
140/** \internal -
141 * \return a spans that spans over cell x,y (column,row) or 0 if there is none. -
142 */ -
143QSpanCollection::Span *QSpanCollection::spanAt(int x, int y) const -
144{ -
145 Index::const_iterator it_y = index.lowerBound(-y);
executed (the execution status of this line is deduced): Index::const_iterator it_y = index.lowerBound(-y);
-
146 if (it_y == index.end())
evaluated: it_y == index.end()
TRUEFALSE
yes
Evaluation Count:124
yes
Evaluation Count:779
124-779
147 return 0;
executed: return 0;
Execution Count:124
124
148 SubIndex::const_iterator it_x = (*it_y).lowerBound(-x);
executed (the execution status of this line is deduced): SubIndex::const_iterator it_x = (*it_y).lowerBound(-x);
-
149 if (it_x == (*it_y).end())
evaluated: it_x == (*it_y).end()
TRUEFALSE
yes
Evaluation Count:20
yes
Evaluation Count:759
20-759
150 return 0;
executed: return 0;
Execution Count:20
20
151 Span *span = *it_x;
executed (the execution status of this line is deduced): Span *span = *it_x;
-
152 if (span->right() >= x && span->bottom() >= y)
evaluated: span->right() >= x
TRUEFALSE
yes
Evaluation Count:733
yes
Evaluation Count:26
evaluated: span->bottom() >= y
TRUEFALSE
yes
Evaluation Count:661
yes
Evaluation Count:72
26-733
153 return span;
executed: return span;
Execution Count:661
661
154 return 0;
executed: return 0;
Execution Count:98
98
155} -
156 -
157 -
158/** \internal -
159* remove and deletes all spans inside the collection -
160*/ -
161void QSpanCollection::clear() -
162{ -
163 qDeleteAll(spans);
executed (the execution status of this line is deduced): qDeleteAll(spans);
-
164 index.clear();
executed (the execution status of this line is deduced): index.clear();
-
165 spans.clear();
executed (the execution status of this line is deduced): spans.clear();
-
166}
executed: }
Execution Count:8
8
167 -
168/** \internal -
169 * return a list to all the spans that spans over cells in the given rectangle -
170 */ -
171QList<QSpanCollection::Span *> QSpanCollection::spansInRect(int x, int y, int w, int h) const -
172{ -
173 QSet<Span *> list;
executed (the execution status of this line is deduced): QSet<Span *> list;
-
174 Index::const_iterator it_y = index.lowerBound(-y);
executed (the execution status of this line is deduced): Index::const_iterator it_y = index.lowerBound(-y);
-
175 if(it_y == index.end())
evaluated: it_y == index.end()
TRUEFALSE
yes
Evaluation Count:26
yes
Evaluation Count:478
26-478
176 --it_y;
executed: --it_y;
Execution Count:26
26
177 while(-it_y.key() <= y + h) {
evaluated: -it_y.key() <= y + h
TRUEFALSE
yes
Evaluation Count:949
yes
Evaluation Count:445
445-949
178 SubIndex::const_iterator it_x = (*it_y).lowerBound(-x);
executed (the execution status of this line is deduced): SubIndex::const_iterator it_x = (*it_y).lowerBound(-x);
-
179 if (it_x == (*it_y).end())
evaluated: it_x == (*it_y).end()
TRUEFALSE
yes
Evaluation Count:31
yes
Evaluation Count:918
31-918
180 --it_x;
executed: --it_x;
Execution Count:31
31
181 while(-it_x.key() <= x + w) {
evaluated: -it_x.key() <= x + w
TRUEFALSE
yes
Evaluation Count:949
yes
Evaluation Count:10
10-949
182 Span *s = *it_x;
executed (the execution status of this line is deduced): Span *s = *it_x;
-
183 if (s->bottom() >= y && s->right() >= x)
evaluated: s->bottom() >= y
TRUEFALSE
yes
Evaluation Count:943
yes
Evaluation Count:6
evaluated: s->right() >= x
TRUEFALSE
yes
Evaluation Count:937
yes
Evaluation Count:6
6-943
184 list << s;
executed: list << s;
Execution Count:937
937
185 if (it_x == (*it_y).begin())
evaluated: it_x == (*it_y).begin()
TRUEFALSE
yes
Evaluation Count:939
yes
Evaluation Count:10
10-939
186 break;
executed: break;
Execution Count:939
939
187 --it_x;
executed (the execution status of this line is deduced): --it_x;
-
188 }
executed: }
Execution Count:10
10
189 if(it_y == index.begin())
evaluated: it_y == index.begin()
TRUEFALSE
yes
Evaluation Count:59
yes
Evaluation Count:890
59-890
190 break;
executed: break;
Execution Count:59
59
191 --it_y;
executed (the execution status of this line is deduced): --it_y;
-
192 }
executed: }
Execution Count:890
890
193 return list.toList();
executed: return list.toList();
Execution Count:504
504
194} -
195 -
196#undef DEBUG_SPAN_UPDATE -
197 -
198#ifdef DEBUG_SPAN_UPDATE -
199QDebug operator<<(QDebug str, const QSpanCollection::Span &span) -
200{ -
201 str << "(" << span.top() << "," << span.left() << "," << span.bottom() << "," << span.right() << ")"; -
202 return str; -
203} -
204#endif -
205 -
206/** \internal -
207* Updates the span collection after row insertion. -
208*/ -
209void QSpanCollection::updateInsertedRows(int start, int end) -
210{ -
211#ifdef DEBUG_SPAN_UPDATE -
212 qDebug() << Q_FUNC_INFO; -
213 qDebug() << start << end; -
214 qDebug() << index; -
215#endif -
216 if (spans.isEmpty())
evaluated: spans.isEmpty()
TRUEFALSE
yes
Evaluation Count:13237
yes
Evaluation Count:4
4-13237
217 return;
executed: return;
Execution Count:13237
13237
218 -
219 int delta = end - start + 1;
executed (the execution status of this line is deduced): int delta = end - start + 1;
-
220#ifdef DEBUG_SPAN_UPDATE -
221 qDebug("Before"); -
222#endif -
223 for (SpanList::iterator it = spans.begin(); it != spans.end(); ++it) {
evaluated: it != spans.end()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:4
4
224 Span *span = *it;
executed (the execution status of this line is deduced): Span *span = *it;
-
225#ifdef DEBUG_SPAN_UPDATE -
226 qDebug() << span << *span; -
227#endif -
228 if (span->m_bottom < start)
evaluated: span->m_bottom < start
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:3
1-3
229 continue;
executed: continue;
Execution Count:1
1
230 if (span->m_top >= start)
evaluated: span->m_top >= start
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1
1-2
231 span->m_top += delta;
executed: span->m_top += delta;
Execution Count:2
2
232 span->m_bottom += delta;
executed (the execution status of this line is deduced): span->m_bottom += delta;
-
233 }
executed: }
Execution Count:3
3
234 -
235#ifdef DEBUG_SPAN_UPDATE -
236 qDebug("After"); -
237 foreach (QSpanCollection::Span *span, spans) -
238 qDebug() << span << *span; -
239#endif -
240 -
241 for (Index::iterator it_y = index.begin(); it_y != index.end(); ) {
evaluated: it_y != index.end()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:4
4
242 int y = -it_y.key();
executed (the execution status of this line is deduced): int y = -it_y.key();
-
243 if (y < start) {
evaluated: y < start
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2
2
244 ++it_y;
executed (the execution status of this line is deduced): ++it_y;
-
245 continue;
executed: continue;
Execution Count:2
2
246 } -
247 -
248 index.insert(-y - delta, it_y.value());
executed (the execution status of this line is deduced): index.insert(-y - delta, it_y.value());
-
249 it_y = index.erase(it_y);
executed (the execution status of this line is deduced): it_y = index.erase(it_y);
-
250 }
executed: }
Execution Count:2
2
251#ifdef DEBUG_SPAN_UPDATE -
252 qDebug() << index; -
253#endif -
254}
executed: }
Execution Count:4
4
255 -
256/** \internal -
257* Updates the span collection after column insertion. -
258*/ -
259void QSpanCollection::updateInsertedColumns(int start, int end) -
260{ -
261#ifdef DEBUG_SPAN_UPDATE -
262 qDebug() << Q_FUNC_INFO; -
263 qDebug() << start << end; -
264 qDebug() << index; -
265#endif -
266 if (spans.isEmpty())
evaluated: spans.isEmpty()
TRUEFALSE
yes
Evaluation Count:220
yes
Evaluation Count:4
4-220
267 return;
executed: return;
Execution Count:220
220
268 -
269 int delta = end - start + 1;
executed (the execution status of this line is deduced): int delta = end - start + 1;
-
270#ifdef DEBUG_SPAN_UPDATE -
271 qDebug("Before"); -
272#endif -
273 for (SpanList::iterator it = spans.begin(); it != spans.end(); ++it) {
evaluated: it != spans.end()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:4
4
274 Span *span = *it;
executed (the execution status of this line is deduced): Span *span = *it;
-
275#ifdef DEBUG_SPAN_UPDATE -
276 qDebug() << span << *span; -
277#endif -
278 if (span->m_right < start)
evaluated: span->m_right < start
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:3
1-3
279 continue;
executed: continue;
Execution Count:1
1
280 if (span->m_left >= start)
evaluated: span->m_left >= start
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1
1-2
281 span->m_left += delta;
executed: span->m_left += delta;
Execution Count:2
2
282 span->m_right += delta;
executed (the execution status of this line is deduced): span->m_right += delta;
-
283 }
executed: }
Execution Count:3
3
284 -
285#ifdef DEBUG_SPAN_UPDATE -
286 qDebug("After"); -
287 foreach (QSpanCollection::Span *span, spans) -
288 qDebug() << span << *span; -
289#endif -
290 -
291 for (Index::iterator it_y = index.begin(); it_y != index.end(); ++it_y) {
evaluated: it_y != index.end()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:4
4
292 SubIndex &subindex = it_y.value();
executed (the execution status of this line is deduced): SubIndex &subindex = it_y.value();
-
293 for (SubIndex::iterator it = subindex.begin(); it != subindex.end(); ) {
evaluated: it != subindex.end()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:4
4
294 int x = -it.key();
executed (the execution status of this line is deduced): int x = -it.key();
-
295 if (x < start) {
evaluated: x < start
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2
2
296 ++it;
executed (the execution status of this line is deduced): ++it;
-
297 continue;
executed: continue;
Execution Count:2
2
298 } -
299 subindex.insert(-x - delta, it.value());
executed (the execution status of this line is deduced): subindex.insert(-x - delta, it.value());
-
300 it = subindex.erase(it);
executed (the execution status of this line is deduced): it = subindex.erase(it);
-
301 }
executed: }
Execution Count:2
2
302 }
executed: }
Execution Count:4
4
303#ifdef DEBUG_SPAN_UPDATE -
304 qDebug() << index; -
305#endif -
306}
executed: }
Execution Count:4
4
307 -
308/** \internal -
309* Cleans a subindex from to be deleted spans. The update argument is used -
310* to move the spans inside the subindex, in case their anchor changed. -
311* \return true if no span in this subindex starts at y, and should thus be deleted. -
312*/ -
313bool QSpanCollection::cleanSpanSubIndex(QSpanCollection::SubIndex &subindex, int y, bool update) -
314{ -
315 if (subindex.isEmpty())
partially evaluated: subindex.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:11
0-11
316 return true;
never executed: return true;
0
317 -
318 bool should_be_deleted = true;
executed (the execution status of this line is deduced): bool should_be_deleted = true;
-
319 SubIndex::iterator it = subindex.end();
executed (the execution status of this line is deduced): SubIndex::iterator it = subindex.end();
-
320 do { -
321 --it;
executed (the execution status of this line is deduced): --it;
-
322 int x = -it.key();
executed (the execution status of this line is deduced): int x = -it.key();
-
323 Span *span = it.value();
executed (the execution status of this line is deduced): Span *span = it.value();
-
324 if (span->will_be_deleted) {
evaluated: span->will_be_deleted
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:11
3-11
325 it = subindex.erase(it);
executed (the execution status of this line is deduced): it = subindex.erase(it);
-
326 continue;
executed: continue;
Execution Count:3
3
327 } -
328 if (update && span->m_left != x) {
evaluated: update
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:5
evaluated: span->m_left != x
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:2
2-6
329 subindex.insert(-span->m_left, span);
executed (the execution status of this line is deduced): subindex.insert(-span->m_left, span);
-
330 it = subindex.erase(it);
executed (the execution status of this line is deduced): it = subindex.erase(it);
-
331 }
executed: }
Execution Count:4
4
332 if (should_be_deleted && span->m_top == y)
evaluated: should_be_deleted
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:1
evaluated: span->m_top == y
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:1
1-10
333 should_be_deleted = false;
executed: should_be_deleted = false;
Execution Count:9
9
334 } while (it != subindex.begin());
executed: }
Execution Count:11
evaluated: it != subindex.begin()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:11
3-11
335 -
336 return should_be_deleted;
executed: return should_be_deleted;
Execution Count:11
11
337} -
338 -
339/** \internal -
340* Updates the span collection after row removal. -
341*/ -
342void QSpanCollection::updateRemovedRows(int start, int end) -
343{ -
344#ifdef DEBUG_SPAN_UPDATE -
345 qDebug() << Q_FUNC_INFO; -
346 qDebug() << start << end; -
347 qDebug() << index; -
348#endif -
349 if (spans.isEmpty())
evaluated: spans.isEmpty()
TRUEFALSE
yes
Evaluation Count:115
yes
Evaluation Count:3
3-115
350 return;
executed: return;
Execution Count:115
115
351 -
352 SpanList spansToBeDeleted;
executed (the execution status of this line is deduced): SpanList spansToBeDeleted;
-
353 int delta = end - start + 1;
executed (the execution status of this line is deduced): int delta = end - start + 1;
-
354#ifdef DEBUG_SPAN_UPDATE -
355 qDebug("Before"); -
356#endif -
357 for (SpanList::iterator it = spans.begin(); it != spans.end(); ) {
evaluated: it != spans.end()
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:3
3-10
358 Span *span = *it;
executed (the execution status of this line is deduced): Span *span = *it;
-
359#ifdef DEBUG_SPAN_UPDATE -
360 qDebug() << span << *span; -
361#endif -
362 if (span->m_bottom < start) {
evaluated: span->m_bottom < start
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:8
2-8
363 ++it;
executed (the execution status of this line is deduced): ++it;
-
364 continue;
executed: continue;
Execution Count:2
2
365 } -
366 if (span->m_top < start) {
evaluated: span->m_top < start
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:5
3-5
367 if (span->m_bottom <= end)
evaluated: span->m_bottom <= end
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:1
1-2
368 span->m_bottom = start - 1;
executed: span->m_bottom = start - 1;
Execution Count:2
2
369 else -
370 span->m_bottom -= delta;
executed: span->m_bottom -= delta;
Execution Count:1
1
371 } else { -
372 if (span->m_bottom > end) {
evaluated: span->m_bottom > end
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:1
1-4
373 if (span->m_top <= end)
evaluated: span->m_top <= end
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:3
1-3
374 span->m_top = start;
executed: span->m_top = start;
Execution Count:1
1
375 else -
376 span->m_top -= delta;
executed: span->m_top -= delta;
Execution Count:3
3
377 span->m_bottom -= delta;
executed (the execution status of this line is deduced): span->m_bottom -= delta;
-
378 } else {
executed: }
Execution Count:4
4
379 span->will_be_deleted = true;
executed (the execution status of this line is deduced): span->will_be_deleted = true;
-
380 }
executed: }
Execution Count:1
1
381 } -
382 if (span->m_top == span->m_bottom && span->m_left == span->m_right)
evaluated: span->m_top == span->m_bottom
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:7
partially evaluated: span->m_left == span->m_right
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-7
383 span->will_be_deleted = true;
executed: span->will_be_deleted = true;
Execution Count:1
1
384 if (span->will_be_deleted) {
evaluated: span->will_be_deleted
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:6
2-6
385 spansToBeDeleted.append(span);
executed (the execution status of this line is deduced): spansToBeDeleted.append(span);
-
386 it = spans.erase(it);
executed (the execution status of this line is deduced): it = spans.erase(it);
-
387 } else {
executed: }
Execution Count:2
2
388 ++it;
executed (the execution status of this line is deduced): ++it;
-
389 }
executed: }
Execution Count:6
6
390 } -
391 -
392#ifdef DEBUG_SPAN_UPDATE -
393 qDebug("After"); -
394 foreach (QSpanCollection::Span *span, spans) -
395 qDebug() << span << *span; -
396#endif -
397 if (spans.isEmpty()) {
partially evaluated: spans.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
398 qDeleteAll(spansToBeDeleted);
never executed (the execution status of this line is deduced): qDeleteAll(spansToBeDeleted);
-
399 index.clear();
never executed (the execution status of this line is deduced): index.clear();
-
400 return;
never executed: return;
0
401 } -
402 -
403 Index::iterator it_y = index.end();
executed (the execution status of this line is deduced): Index::iterator it_y = index.end();
-
404 do { -
405 --it_y;
executed (the execution status of this line is deduced): --it_y;
-
406 int y = -it_y.key();
executed (the execution status of this line is deduced): int y = -it_y.key();
-
407 SubIndex &subindex = it_y.value();
executed (the execution status of this line is deduced): SubIndex &subindex = it_y.value();
-
408 if (y < start) {
evaluated: y < start
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:5
4-5
409 if (cleanSpanSubIndex(subindex, y))
partially evaluated: cleanSpanSubIndex(subindex, y)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
410 it_y = index.erase(it_y);
never executed: it_y = index.erase(it_y);
0
411 } else if (y >= start && y <= end) {
executed: }
Execution Count:4
partially evaluated: y >= start
TRUEFALSE
yes
Evaluation Count:5
no
Evaluation Count:0
evaluated: y <= end
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:3
0-5
412 bool span_at_start = false;
executed (the execution status of this line is deduced): bool span_at_start = false;
-
413 SubIndex spansToBeMoved;
executed (the execution status of this line is deduced): SubIndex spansToBeMoved;
-
414 for (SubIndex::iterator it = subindex.begin(); it != subindex.end(); ++it) {
evaluated: it != subindex.end()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:2
2-5
415 Span *span = it.value();
executed (the execution status of this line is deduced): Span *span = it.value();
-
416 if (span->will_be_deleted)
evaluated: span->will_be_deleted
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:4
1-4
417 continue;
executed: continue;
Execution Count:1
1
418 if (!span_at_start && span->m_top == start)
evaluated: !span_at_start
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2
partially evaluated: span->m_top == start
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
419 span_at_start = true;
executed: span_at_start = true;
Execution Count:2
2
420 spansToBeMoved.insert(it.key(), span);
executed (the execution status of this line is deduced): spansToBeMoved.insert(it.key(), span);
-
421 }
executed: }
Execution Count:4
4
422 -
423 if (y == start && span_at_start)
evaluated: y == start
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
partially evaluated: span_at_start
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
424 subindex.clear();
executed: subindex.clear();
Execution Count:1
1
425 else -
426 it_y = index.erase(it_y);
executed: it_y = index.erase(it_y);
Execution Count:1
1
427 -
428 if (span_at_start) {
partially evaluated: span_at_start
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
429 Index::iterator it_start;
executed (the execution status of this line is deduced): Index::iterator it_start;
-
430 if (y == start)
evaluated: y == start
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1
431 it_start = it_y;
executed: it_start = it_y;
Execution Count:1
1
432 else { -
433 it_start = index.find(-start);
executed (the execution status of this line is deduced): it_start = index.find(-start);
-
434 if (it_start == index.end())
partially evaluated: it_start == index.end()
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
435 it_start = index.insert(-start, SubIndex());
executed: it_start = index.insert(-start, SubIndex());
Execution Count:1
1
436 }
executed: }
Execution Count:1
1
437 SubIndex &start_subindex = it_start.value();
executed (the execution status of this line is deduced): SubIndex &start_subindex = it_start.value();
-
438 for (SubIndex::iterator it = spansToBeMoved.begin(); it != spansToBeMoved.end(); ++it)
evaluated: it != spansToBeMoved.end()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:2
2-4
439 start_subindex.insert(it.key(), it.value());
executed: start_subindex.insert(it.key(), it.value());
Execution Count:4
4
440 }
executed: }
Execution Count:2
2
441 } else {
executed: }
Execution Count:2
2
442 if (y == end + 1) {
evaluated: y == end + 1
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:2
1-2
443 Index::iterator it_top = index.find(-y + delta);
executed (the execution status of this line is deduced): Index::iterator it_top = index.find(-y + delta);
-
444 if (it_top == index.end())
partially evaluated: it_top == index.end()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
445 it_top = index.insert(-y + delta, SubIndex());
never executed: it_top = index.insert(-y + delta, SubIndex());
0
446 for (SubIndex::iterator it = subindex.begin(); it != subindex.end(); ) {
evaluated: it != subindex.end()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:1
1-3
447 Span *span = it.value();
executed (the execution status of this line is deduced): Span *span = it.value();
-
448 if (!span->will_be_deleted)
partially evaluated: !span->will_be_deleted
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
449 it_top.value().insert(it.key(), span);
executed: it_top.value().insert(it.key(), span);
Execution Count:3
3
450 ++it;
executed (the execution status of this line is deduced): ++it;
-
451 }
executed: }
Execution Count:3
3
452 } else {
executed: }
Execution Count:1
1
453 index.insert(-y + delta, subindex);
executed (the execution status of this line is deduced): index.insert(-y + delta, subindex);
-
454 }
executed: }
Execution Count:2
2
455 it_y = index.erase(it_y);
executed (the execution status of this line is deduced): it_y = index.erase(it_y);
-
456 }
executed: }
Execution Count:3
3
457 } while (it_y != index.begin());
evaluated: it_y != index.begin()
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:3
3-6
458 -
459#ifdef DEBUG_SPAN_UPDATE -
460 qDebug() << index; -
461 qDebug("Deleted"); -
462 foreach (QSpanCollection::Span *span, spansToBeDeleted) -
463 qDebug() << span << *span; -
464#endif -
465 qDeleteAll(spansToBeDeleted);
executed (the execution status of this line is deduced): qDeleteAll(spansToBeDeleted);
-
466}
executed: }
Execution Count:3
3
467 -
468/** \internal -
469* Updates the span collection after column removal. -
470*/ -
471void QSpanCollection::updateRemovedColumns(int start, int end) -
472{ -
473#ifdef DEBUG_SPAN_UPDATE -
474 qDebug() << Q_FUNC_INFO; -
475 qDebug() << start << end; -
476 qDebug() << index; -
477#endif -
478 if (spans.isEmpty())
evaluated: spans.isEmpty()
TRUEFALSE
yes
Evaluation Count:79
yes
Evaluation Count:1
1-79
479 return;
executed: return;
Execution Count:79
79
480 -
481 SpanList toBeDeleted;
executed (the execution status of this line is deduced): SpanList toBeDeleted;
-
482 int delta = end - start + 1;
executed (the execution status of this line is deduced): int delta = end - start + 1;
-
483#ifdef DEBUG_SPAN_UPDATE -
484 qDebug("Before"); -
485#endif -
486 for (SpanList::iterator it = spans.begin(); it != spans.end(); ) {
evaluated: it != spans.end()
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:1
1-8
487 Span *span = *it;
executed (the execution status of this line is deduced): Span *span = *it;
-
488#ifdef DEBUG_SPAN_UPDATE -
489 qDebug() << span << *span; -
490#endif -
491 if (span->m_right < start) {
evaluated: span->m_right < start
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:7
1-7
492 ++it;
executed (the execution status of this line is deduced): ++it;
-
493 continue;
executed: continue;
Execution Count:1
1
494 } -
495 if (span->m_left < start) {
evaluated: span->m_left < start
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:5
2-5
496 if (span->m_right <= end)
evaluated: span->m_right <= end
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1
497 span->m_right = start - 1;
executed: span->m_right = start - 1;
Execution Count:1
1
498 else -
499 span->m_right -= delta;
executed: span->m_right -= delta;
Execution Count:1
1
500 } else { -
501 if (span->m_right > end) {
evaluated: span->m_right > end
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:1
1-4
502 if (span->m_left <= end)
evaluated: span->m_left <= end
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:3
1-3
503 span->m_left = start;
executed: span->m_left = start;
Execution Count:1
1
504 else -
505 span->m_left -= delta;
executed: span->m_left -= delta;
Execution Count:3
3
506 span->m_right -= delta;
executed (the execution status of this line is deduced): span->m_right -= delta;
-
507 } else {
executed: }
Execution Count:4
4
508 span->will_be_deleted = true;
executed (the execution status of this line is deduced): span->will_be_deleted = true;
-
509 }
executed: }
Execution Count:1
1
510 } -
511 if (span->m_top == span->m_bottom && span->m_left == span->m_right)
partially evaluated: span->m_top == span->m_bottom
TRUEFALSE
yes
Evaluation Count:7
no
Evaluation Count:0
evaluated: span->m_left == span->m_right
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:6
0-7
512 span->will_be_deleted = true;
executed: span->will_be_deleted = true;
Execution Count:1
1
513 if (span->will_be_deleted) {
evaluated: span->will_be_deleted
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:5
2-5
514 toBeDeleted.append(span);
executed (the execution status of this line is deduced): toBeDeleted.append(span);
-
515 it = spans.erase(it);
executed (the execution status of this line is deduced): it = spans.erase(it);
-
516 } else {
executed: }
Execution Count:2
2
517 ++it;
executed (the execution status of this line is deduced): ++it;
-
518 }
executed: }
Execution Count:5
5
519 } -
520 -
521#ifdef DEBUG_SPAN_UPDATE -
522 qDebug("After"); -
523 foreach (QSpanCollection::Span *span, spans) -
524 qDebug() << span << *span; -
525#endif -
526 if (spans.isEmpty()) {
partially evaluated: spans.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
527 qDeleteAll(toBeDeleted);
never executed (the execution status of this line is deduced): qDeleteAll(toBeDeleted);
-
528 index.clear();
never executed (the execution status of this line is deduced): index.clear();
-
529 return;
never executed: return;
0
530 } -
531 -
532 for (Index::iterator it_y = index.begin(); it_y != index.end(); ) {
evaluated: it_y != index.end()
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:1
1-7
533 int y = -it_y.key();
executed (the execution status of this line is deduced): int y = -it_y.key();
-
534 if (cleanSpanSubIndex(it_y.value(), y, true))
evaluated: cleanSpanSubIndex(it_y.value(), y, true)
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:5
2-5
535 it_y = index.erase(it_y);
executed: it_y = index.erase(it_y);
Execution Count:2
2
536 else -
537 ++it_y;
executed: ++it_y;
Execution Count:5
5
538 } -
539 -
540#ifdef DEBUG_SPAN_UPDATE -
541 qDebug() << index; -
542 qDebug("Deleted"); -
543 foreach (QSpanCollection::Span *span, toBeDeleted) -
544 qDebug() << span << *span; -
545#endif -
546 qDeleteAll(toBeDeleted);
executed (the execution status of this line is deduced): qDeleteAll(toBeDeleted);
-
547}
executed: }
Execution Count:1
1
548 -
549#ifdef QT_BUILD_INTERNAL -
550/*! -
551 \internal -
552 Checks whether the span index structure is self-consistent, and consistent with the spans list. -
553*/ -
554bool QSpanCollection::checkConsistency() const -
555{ -
556 for (Index::const_iterator it_y = index.begin(); it_y != index.end(); ++it_y) { -
557 int y = -it_y.key(); -
558 const SubIndex &subIndex = it_y.value(); -
559 for (SubIndex::const_iterator it = subIndex.begin(); it != subIndex.end(); ++it) { -
560 int x = -it.key(); -
561 Span *span = it.value(); -
562 if (!spans.contains(span) || span->left() != x -
563 || y < span->top() || y > span->bottom()) -
564 return false; -
565 } -
566 } -
567 -
568 foreach (const Span *span, spans) { -
569 if (span->width() < 1 || span->height() < 1 -
570 || (span->width() == 1 && span->height() == 1)) -
571 return false; -
572 for (int y = span->top(); y <= span->bottom(); ++y) { -
573 Index::const_iterator it_y = index.find(-y); -
574 if (it_y == index.end()) { -
575 if (y == span->top()) -
576 return false; -
577 else -
578 continue; -
579 } -
580 const SubIndex &subIndex = it_y.value(); -
581 SubIndex::const_iterator it = subIndex.find(-span->left()); -
582 if (it == subIndex.end() || it.value() != span) -
583 return false; -
584 } -
585 } -
586 return true; -
587} -
588#endif -
589 -
590class QTableCornerButton : public QAbstractButton -
591{ -
592 Q_OBJECT -
593public: -
594 QTableCornerButton(QWidget *parent) : QAbstractButton(parent) {}
executed: }
Execution Count:482
482
595 void paintEvent(QPaintEvent*) { -
596 QStyleOptionHeader opt;
executed (the execution status of this line is deduced): QStyleOptionHeader opt;
-
597 opt.init(this);
executed (the execution status of this line is deduced): opt.init(this);
-
598 QStyle::State state = QStyle::State_None;
executed (the execution status of this line is deduced): QStyle::State state = QStyle::State_None;
-
599 if (isEnabled())
partially evaluated: isEnabled()
TRUEFALSE
yes
Evaluation Count:98
no
Evaluation Count:0
0-98
600 state |= QStyle::State_Enabled;
executed: state |= QStyle::State_Enabled;
Execution Count:98
98
601 if (isActiveWindow())
evaluated: isActiveWindow()
TRUEFALSE
yes
Evaluation Count:66
yes
Evaluation Count:32
32-66
602 state |= QStyle::State_Active;
executed: state |= QStyle::State_Active;
Execution Count:66
66
603 if (isDown())
partially evaluated: isDown()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:98
0-98
604 state |= QStyle::State_Sunken;
never executed: state |= QStyle::State_Sunken;
0
605 opt.state = state;
executed (the execution status of this line is deduced): opt.state = state;
-
606 opt.rect = rect();
executed (the execution status of this line is deduced): opt.rect = rect();
-
607 opt.position = QStyleOptionHeader::OnlyOneSection;
executed (the execution status of this line is deduced): opt.position = QStyleOptionHeader::OnlyOneSection;
-
608 QPainter painter(this);
executed (the execution status of this line is deduced): QPainter painter(this);
-
609 style()->drawControl(QStyle::CE_Header, &opt, &painter, this);
executed (the execution status of this line is deduced): style()->drawControl(QStyle::CE_Header, &opt, &painter, this);
-
610 }
executed: }
Execution Count:98
98
611}; -
612 -
613void QTableViewPrivate::init() -
614{ -
615 Q_Q(QTableView);
executed (the execution status of this line is deduced): QTableView * const q = q_func();
-
616 -
617 q->setEditTriggers(editTriggers|QAbstractItemView::AnyKeyPressed);
executed (the execution status of this line is deduced): q->setEditTriggers(editTriggers|QAbstractItemView::AnyKeyPressed);
-
618 -
619 QHeaderView *vertical = new QHeaderView(Qt::Vertical, q);
executed (the execution status of this line is deduced): QHeaderView *vertical = new QHeaderView(Qt::Vertical, q);
-
620 vertical->setSectionsClickable(true);
executed (the execution status of this line is deduced): vertical->setSectionsClickable(true);
-
621 vertical->setHighlightSections(true);
executed (the execution status of this line is deduced): vertical->setHighlightSections(true);
-
622 q->setVerticalHeader(vertical);
executed (the execution status of this line is deduced): q->setVerticalHeader(vertical);
-
623 -
624 QHeaderView *horizontal = new QHeaderView(Qt::Horizontal, q);
executed (the execution status of this line is deduced): QHeaderView *horizontal = new QHeaderView(Qt::Horizontal, q);
-
625 horizontal->setSectionsClickable(true);
executed (the execution status of this line is deduced): horizontal->setSectionsClickable(true);
-
626 horizontal->setHighlightSections(true);
executed (the execution status of this line is deduced): horizontal->setHighlightSections(true);
-
627 q->setHorizontalHeader(horizontal);
executed (the execution status of this line is deduced): q->setHorizontalHeader(horizontal);
-
628 -
629 tabKeyNavigation = true;
executed (the execution status of this line is deduced): tabKeyNavigation = true;
-
630 -
631 cornerWidget = new QTableCornerButton(q);
executed (the execution status of this line is deduced): cornerWidget = new QTableCornerButton(q);
-
632 cornerWidget->setFocusPolicy(Qt::NoFocus);
executed (the execution status of this line is deduced): cornerWidget->setFocusPolicy(Qt::NoFocus);
-
633 QObject::connect(cornerWidget, SIGNAL(clicked()), q, SLOT(selectAll()));
executed (the execution status of this line is deduced): QObject::connect(cornerWidget, "2""clicked()", q, "1""selectAll()");
-
634}
executed: }
Execution Count:482
482
635 -
636/*! -
637 \internal -
638 Trims away indices that are hidden in the treeview due to hidden horizontal or vertical sections. -
639*/ -
640void QTableViewPrivate::trimHiddenSelections(QItemSelectionRange *range) const -
641{ -
642 Q_ASSERT(range && range->isValid());
executed (the execution status of this line is deduced): qt_noop();
-
643 -
644 int top = range->top();
executed (the execution status of this line is deduced): int top = range->top();
-
645 int left = range->left();
executed (the execution status of this line is deduced): int left = range->left();
-
646 int bottom = range->bottom();
executed (the execution status of this line is deduced): int bottom = range->bottom();
-
647 int right = range->right();
executed (the execution status of this line is deduced): int right = range->right();
-
648 -
649 while (bottom >= top && verticalHeader->isSectionHidden(bottom))
evaluated: bottom >= top
TRUEFALSE
yes
Evaluation Count:1744
yes
Evaluation Count:1
evaluated: verticalHeader->isSectionHidden(bottom)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1743
1-1744
650 --bottom;
executed: --bottom;
Execution Count:1
1
651 while (right >= left && horizontalHeader->isSectionHidden(right))
evaluated: right >= left
TRUEFALSE
yes
Evaluation Count:1744
yes
Evaluation Count:1
evaluated: horizontalHeader->isSectionHidden(right)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1743
1-1744
652 --right;
executed: --right;
Execution Count:1
1
653 -
654 if (top > bottom || left > right) { // everything is hidden
evaluated: top > bottom
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1743
partially evaluated: left > right
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1743
0-1743
655 *range = QItemSelectionRange();
executed (the execution status of this line is deduced): *range = QItemSelectionRange();
-
656 return;
executed: return;
Execution Count:1
1
657 } -
658 -
659 while (verticalHeader->isSectionHidden(top) && top <= bottom)
partially evaluated: verticalHeader->isSectionHidden(top)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1743
never evaluated: top <= bottom
0-1743
660 ++top;
never executed: ++top;
0
661 while (horizontalHeader->isSectionHidden(left) && left <= right)
partially evaluated: horizontalHeader->isSectionHidden(left)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1743
never evaluated: left <= right
0-1743
662 ++left;
never executed: ++left;
0
663 -
664 if (top > bottom || left > right) { // everything is hidden
partially evaluated: top > bottom
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1743
partially evaluated: left > right
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1743
0-1743
665 *range = QItemSelectionRange();
never executed (the execution status of this line is deduced): *range = QItemSelectionRange();
-
666 return;
never executed: return;
0
667 } -
668 -
669 QModelIndex bottomRight = model->index(bottom, right, range->parent());
executed (the execution status of this line is deduced): QModelIndex bottomRight = model->index(bottom, right, range->parent());
-
670 QModelIndex topLeft = model->index(top, left, range->parent());
executed (the execution status of this line is deduced): QModelIndex topLeft = model->index(top, left, range->parent());
-
671 *range = QItemSelectionRange(topLeft, bottomRight);
executed (the execution status of this line is deduced): *range = QItemSelectionRange(topLeft, bottomRight);
-
672}
executed: }
Execution Count:1743
1743
673 -
674/*! -
675 \internal -
676 Sets the span for the cell at (\a row, \a column). -
677*/ -
678void QTableViewPrivate::setSpan(int row, int column, int rowSpan, int columnSpan) -
679{ -
680 if (row < 0 || column < 0 || rowSpan <= 0 || columnSpan <= 0) {
partially evaluated: row < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:126
partially evaluated: column < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:126
partially evaluated: rowSpan <= 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:126
partially evaluated: columnSpan <= 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:126
0-126
681 qWarning() << "QTableView::setSpan: invalid span given: (" << row << ',' << column << ',' << rowSpan << ',' << columnSpan << ')';
never executed (the execution status of this line is deduced): QMessageLogger("itemviews/qtableview.cpp", 681, __PRETTY_FUNCTION__).warning() << "QTableView::setSpan: invalid span given: (" << row << ',' << column << ',' << rowSpan << ',' << columnSpan << ')';
-
682 return;
never executed: return;
0
683 } -
684 QSpanCollection::Span *sp = spans.spanAt(column, row);
executed (the execution status of this line is deduced): QSpanCollection::Span *sp = spans.spanAt(column, row);
-
685 if (sp) {
evaluated: sp
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:121
5-121
686 if (sp->top() != row || sp->left() != column) {
partially evaluated: sp->top() != row
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
partially evaluated: sp->left() != column
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
687 qWarning() << "QTableView::setSpan: span cannot overlap";
never executed (the execution status of this line is deduced): QMessageLogger("itemviews/qtableview.cpp", 687, __PRETTY_FUNCTION__).warning() << "QTableView::setSpan: span cannot overlap";
-
688 return;
never executed: return;
0
689 } -
690 if (rowSpan == 1 && columnSpan == 1) {
partially evaluated: rowSpan == 1
TRUEFALSE
yes
Evaluation Count:5
no
Evaluation Count:0
partially evaluated: columnSpan == 1
TRUEFALSE
yes
Evaluation Count:5
no
Evaluation Count:0
0-5
691 rowSpan = columnSpan = 0;
executed (the execution status of this line is deduced): rowSpan = columnSpan = 0;
-
692 }
executed: }
Execution Count:5
5
693 const int old_height = sp->height();
executed (the execution status of this line is deduced): const int old_height = sp->height();
-
694 sp->m_bottom = row + rowSpan - 1;
executed (the execution status of this line is deduced): sp->m_bottom = row + rowSpan - 1;
-
695 sp->m_right = column + columnSpan - 1;
executed (the execution status of this line is deduced): sp->m_right = column + columnSpan - 1;
-
696 spans.updateSpan(sp, old_height);
executed (the execution status of this line is deduced): spans.updateSpan(sp, old_height);
-
697 return;
executed: return;
Execution Count:5
5
698 } else if (rowSpan == 1 && columnSpan == 1) {
evaluated: rowSpan == 1
TRUEFALSE
yes
Evaluation Count:78
yes
Evaluation Count:43
evaluated: columnSpan == 1
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:75
3-78
699 qWarning() << "QTableView::setSpan: single cell span won't be added";
executed (the execution status of this line is deduced): QMessageLogger("itemviews/qtableview.cpp", 699, __PRETTY_FUNCTION__).warning() << "QTableView::setSpan: single cell span won't be added";
-
700 return;
executed: return;
Execution Count:3
3
701 } -
702 sp = new QSpanCollection::Span(row, column, rowSpan, columnSpan);
executed (the execution status of this line is deduced): sp = new QSpanCollection::Span(row, column, rowSpan, columnSpan);
-
703 spans.addSpan(sp);
executed (the execution status of this line is deduced): spans.addSpan(sp);
-
704}
executed: }
Execution Count:118
118
705 -
706/*! -
707 \internal -
708 Gets the span information for the cell at (\a row, \a column). -
709*/ -
710QSpanCollection::Span QTableViewPrivate::span(int row, int column) const -
711{ -
712 QSpanCollection::Span *sp = spans.spanAt(column, row);
executed (the execution status of this line is deduced): QSpanCollection::Span *sp = spans.spanAt(column, row);
-
713 if (sp)
evaluated: sp
TRUEFALSE
yes
Evaluation Count:656
yes
Evaluation Count:121
121-656
714 return *sp;
executed: return *sp;
Execution Count:656
656
715 -
716 return QSpanCollection::Span(row, column, 1, 1);
executed: return QSpanCollection::Span(row, column, 1, 1);
Execution Count:121
121
717} -
718 -
719/*! -
720 \internal -
721 Returns the logical index of the last section that's part of the span. -
722*/ -
723int QTableViewPrivate::sectionSpanEndLogical(const QHeaderView *header, int logical, int span) const -
724{ -
725 int visual = header->visualIndex(logical);
executed (the execution status of this line is deduced): int visual = header->visualIndex(logical);
-
726 for (int i = 1; i < span; ) {
evaluated: i < span
TRUEFALSE
yes
Evaluation Count:14732
yes
Evaluation Count:7532
7532-14732
727 if (++visual >= header->count())
evaluated: ++visual >= header->count()
TRUEFALSE
yes
Evaluation Count:44
yes
Evaluation Count:14688
44-14688
728 break;
executed: break;
Execution Count:44
44
729 logical = header->logicalIndex(visual);
executed (the execution status of this line is deduced): logical = header->logicalIndex(visual);
-
730 ++i;
executed (the execution status of this line is deduced): ++i;
-
731 }
executed: }
Execution Count:14688
14688
732 return logical;
executed: return logical;
Execution Count:7576
7576
733} -
734 -
735/*! -
736 \internal -
737 Returns the size of the span starting at logical index \a logical -
738 and spanning \a span sections. -
739*/ -
740int QTableViewPrivate::sectionSpanSize(const QHeaderView *header, int logical, int span) const -
741{ -
742 int endLogical = sectionSpanEndLogical(header, logical, span);
executed (the execution status of this line is deduced): int endLogical = sectionSpanEndLogical(header, logical, span);
-
743 return header->sectionPosition(endLogical)
executed: return header->sectionPosition(endLogical) - header->sectionPosition(logical) + header->sectionSize(endLogical);
Execution Count:998
998
744 - header->sectionPosition(logical)
executed: return header->sectionPosition(endLogical) - header->sectionPosition(logical) + header->sectionSize(endLogical);
Execution Count:998
998
745 + header->sectionSize(endLogical);
executed: return header->sectionPosition(endLogical) - header->sectionPosition(logical) + header->sectionSize(endLogical);
Execution Count:998
998
746} -
747 -
748/*! -
749 \internal -
750 Returns true if the section at logical index \a logical is part of the span -
751 starting at logical index \a spanLogical and spanning \a span sections; -
752 otherwise, returns false. -
753*/ -
754bool QTableViewPrivate::spanContainsSection(const QHeaderView *header, int logical, int spanLogical, int span) const -
755{ -
756 if (logical == spanLogical)
never evaluated: logical == spanLogical
0
757 return true; // it's the start of the span
never executed: return true;
0
758 int visual = header->visualIndex(spanLogical);
never executed (the execution status of this line is deduced): int visual = header->visualIndex(spanLogical);
-
759 for (int i = 1; i < span; ) {
never evaluated: i < span
0
760 if (++visual >= header->count())
never evaluated: ++visual >= header->count()
0
761 break;
never executed: break;
0
762 spanLogical = header->logicalIndex(visual);
never executed (the execution status of this line is deduced): spanLogical = header->logicalIndex(visual);
-
763 if (logical == spanLogical)
never evaluated: logical == spanLogical
0
764 return true;
never executed: return true;
0
765 ++i;
never executed (the execution status of this line is deduced): ++i;
-
766 }
never executed: }
0
767 return false;
never executed: return false;
0
768} -
769 -
770/*! -
771 \internal -
772 Returns the visual rect for the given \a span. -
773*/ -
774QRect QTableViewPrivate::visualSpanRect(const QSpanCollection::Span &span) const -
775{ -
776 Q_Q(const QTableView);
executed (the execution status of this line is deduced): const QTableView * const q = q_func();
-
777 // vertical -
778 int row = span.top();
executed (the execution status of this line is deduced): int row = span.top();
-
779 int rowp = verticalHeader->sectionViewportPosition(row);
executed (the execution status of this line is deduced): int rowp = verticalHeader->sectionViewportPosition(row);
-
780 int rowh = rowSpanHeight(row, span.height());
executed (the execution status of this line is deduced): int rowh = rowSpanHeight(row, span.height());
-
781 // horizontal -
782 int column = span.left();
executed (the execution status of this line is deduced): int column = span.left();
-
783 int colw = columnSpanWidth(column, span.width());
executed (the execution status of this line is deduced): int colw = columnSpanWidth(column, span.width());
-
784 if (q->isRightToLeft())
partially evaluated: q->isRightToLeft()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:452
0-452
785 column = span.right();
never executed: column = span.right();
0
786 int colp = horizontalHeader->sectionViewportPosition(column);
executed (the execution status of this line is deduced): int colp = horizontalHeader->sectionViewportPosition(column);
-
787 -
788 const int i = showGrid ? 1 : 0;
partially evaluated: showGrid
TRUEFALSE
yes
Evaluation Count:452
no
Evaluation Count:0
0-452
789 if (q->isRightToLeft())
partially evaluated: q->isRightToLeft()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:452
0-452
790 return QRect(colp + i, rowp, colw - i, rowh - i);
never executed: return QRect(colp + i, rowp, colw - i, rowh - i);
0
791 return QRect(colp, rowp, colw - i, rowh - i);
executed: return QRect(colp, rowp, colw - i, rowh - i);
Execution Count:452
452
792} -
793 -
794/*! -
795 \internal -
796 Draws the spanning cells within rect \a area, and clips them off as -
797 preparation for the main drawing loop. -
798 \a drawn is a QBitArray of visualRowCountxvisualCoulumnCount which say if particular cell has been drawn -
799*/ -
800void QTableViewPrivate::drawAndClipSpans(const QRegion &area, QPainter *painter, -
801 const QStyleOptionViewItem &option, QBitArray *drawn, -
802 int firstVisualRow, int lastVisualRow, int firstVisualColumn, int lastVisualColumn) -
803{ -
804 bool alternateBase = false;
executed (the execution status of this line is deduced): bool alternateBase = false;
-
805 QRegion region = viewport->rect();
executed (the execution status of this line is deduced): QRegion region = viewport->rect();
-
806 -
807 QList<QSpanCollection::Span *> visibleSpans;
executed (the execution status of this line is deduced): QList<QSpanCollection::Span *> visibleSpans;
-
808 bool sectionMoved = verticalHeader->sectionsMoved() || horizontalHeader->sectionsMoved();
partially evaluated: verticalHeader->sectionsMoved()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:16
partially evaluated: horizontalHeader->sectionsMoved()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:16
0-16
809 -
810 if (!sectionMoved) {
partially evaluated: !sectionMoved
TRUEFALSE
yes
Evaluation Count:16
no
Evaluation Count:0
0-16
811 visibleSpans = spans.spansInRect(logicalColumn(firstVisualColumn), logicalRow(firstVisualRow),
executed (the execution status of this line is deduced): visibleSpans = spans.spansInRect(logicalColumn(firstVisualColumn), logicalRow(firstVisualRow),
-
812 lastVisualColumn - firstVisualColumn + 1, lastVisualRow - firstVisualRow + 1);
executed (the execution status of this line is deduced): lastVisualColumn - firstVisualColumn + 1, lastVisualRow - firstVisualRow + 1);
-
813 } else {
executed: }
Execution Count:16
16
814 QSet<QSpanCollection::Span *> set;
never executed (the execution status of this line is deduced): QSet<QSpanCollection::Span *> set;
-
815 for(int x = firstVisualColumn; x <= lastVisualColumn; x++)
never evaluated: x <= lastVisualColumn
0
816 for(int y = firstVisualRow; y <= lastVisualRow; y++)
never evaluated: y <= lastVisualRow
0
817 set.insert(spans.spanAt(x,y));
never executed: set.insert(spans.spanAt(x,y));
0
818 set.remove(0);
never executed (the execution status of this line is deduced): set.remove(0);
-
819 visibleSpans = set.toList();
never executed (the execution status of this line is deduced): visibleSpans = set.toList();
-
820 }
never executed: }
0
821 -
822 foreach (QSpanCollection::Span *span, visibleSpans) {
executed (the execution status of this line is deduced): 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;})) {
-
823 int row = span->top();
executed (the execution status of this line is deduced): int row = span->top();
-
824 int col = span->left();
executed (the execution status of this line is deduced): int col = span->left();
-
825 QModelIndex index = model->index(row, col, root);
executed (the execution status of this line is deduced): QModelIndex index = model->index(row, col, root);
-
826 if (!index.isValid())
partially evaluated: !index.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:23
0-23
827 continue;
never executed: continue;
0
828 QRect rect = visualSpanRect(*span);
executed (the execution status of this line is deduced): QRect rect = visualSpanRect(*span);
-
829 rect.translate(scrollDelayOffset);
executed (the execution status of this line is deduced): rect.translate(scrollDelayOffset);
-
830 if (!area.intersects(rect))
evaluated: !area.intersects(rect)
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:17
6-17
831 continue;
executed: continue;
Execution Count:6
6
832 QStyleOptionViewItem opt = option;
executed (the execution status of this line is deduced): QStyleOptionViewItem opt = option;
-
833 opt.rect = rect;
executed (the execution status of this line is deduced): opt.rect = rect;
-
834 alternateBase = alternatingColors && (span->top() & 1);
partially evaluated: alternatingColors
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:17
never evaluated: (span->top() & 1)
0-17
835 if (alternateBase)
partially evaluated: alternateBase
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:17
0-17
836 opt.features |= QStyleOptionViewItem::Alternate;
never executed: opt.features |= QStyleOptionViewItem::Alternate;
0
837 else -
838 opt.features &= ~QStyleOptionViewItem::Alternate;
executed: opt.features &= ~QStyleOptionViewItem::Alternate;
Execution Count:17
17
839 drawCell(painter, opt, index);
executed (the execution status of this line is deduced): drawCell(painter, opt, index);
-
840 region -= rect;
executed (the execution status of this line is deduced): region -= rect;
-
841 for (int r = span->top(); r <= span->bottom(); ++r) {
evaluated: r <= span->bottom()
TRUEFALSE
yes
Evaluation Count:36
yes
Evaluation Count:17
17-36
842 const int vr = visualRow(r);
executed (the execution status of this line is deduced): const int vr = visualRow(r);
-
843 if (vr < firstVisualRow || vr > lastVisualRow)
partially evaluated: vr < firstVisualRow
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:36
evaluated: vr > lastVisualRow
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:32
0-36
844 continue;
executed: continue;
Execution Count:4
4
845 for (int c = span->left(); c <= span->right(); ++c) {
evaluated: c <= span->right()
TRUEFALSE
yes
Evaluation Count:76
yes
Evaluation Count:32
32-76
846 const int vc = visualColumn(c);
executed (the execution status of this line is deduced): const int vc = visualColumn(c);
-
847 if (vc < firstVisualColumn || vc > lastVisualColumn)
partially evaluated: vc < firstVisualColumn
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:76
evaluated: vc > lastVisualColumn
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:66
0-76
848 continue;
executed: continue;
Execution Count:10
10
849 drawn->setBit((vr - firstVisualRow) * (lastVisualColumn - firstVisualColumn + 1)
executed (the execution status of this line is deduced): drawn->setBit((vr - firstVisualRow) * (lastVisualColumn - firstVisualColumn + 1)
-
850 + vc - firstVisualColumn);
executed (the execution status of this line is deduced): + vc - firstVisualColumn);
-
851 }
executed: }
Execution Count:66
66
852 }
executed: }
Execution Count:32
32
853 -
854 }
executed: }
Execution Count:17
17
855 painter->setClipRegion(region);
executed (the execution status of this line is deduced): painter->setClipRegion(region);
-
856}
executed: }
Execution Count:16
16
857 -
858/*! -
859 \internal -
860 Updates spans after row insertion. -
861*/ -
862void QTableViewPrivate::_q_updateSpanInsertedRows(const QModelIndex &parent, int start, int end) -
863{ -
864 Q_UNUSED(parent)
executed (the execution status of this line is deduced): (void)parent;
-
865 spans.updateInsertedRows(start, end);
executed (the execution status of this line is deduced): spans.updateInsertedRows(start, end);
-
866}
executed: }
Execution Count:13241
13241
867 -
868/*! -
869 \internal -
870 Updates spans after column insertion. -
871*/ -
872void QTableViewPrivate::_q_updateSpanInsertedColumns(const QModelIndex &parent, int start, int end) -
873{ -
874 Q_UNUSED(parent)
executed (the execution status of this line is deduced): (void)parent;
-
875 spans.updateInsertedColumns(start, end);
executed (the execution status of this line is deduced): spans.updateInsertedColumns(start, end);
-
876}
executed: }
Execution Count:224
224
877 -
878/*! -
879 \internal -
880 Updates spans after row removal. -
881*/ -
882void QTableViewPrivate::_q_updateSpanRemovedRows(const QModelIndex &parent, int start, int end) -
883{ -
884 Q_UNUSED(parent)
executed (the execution status of this line is deduced): (void)parent;
-
885 spans.updateRemovedRows(start, end);
executed (the execution status of this line is deduced): spans.updateRemovedRows(start, end);
-
886}
executed: }
Execution Count:118
118
887 -
888/*! -
889 \internal -
890 Updates spans after column removal. -
891*/ -
892void QTableViewPrivate::_q_updateSpanRemovedColumns(const QModelIndex &parent, int start, int end) -
893{ -
894 Q_UNUSED(parent)
executed (the execution status of this line is deduced): (void)parent;
-
895 spans.updateRemovedColumns(start, end);
executed (the execution status of this line is deduced): spans.updateRemovedColumns(start, end);
-
896}
executed: }
Execution Count:80
80
897 -
898/*! -
899 \internal -
900 Draws a table cell. -
901*/ -
902void QTableViewPrivate::drawCell(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) -
903{ -
904 Q_Q(QTableView);
executed (the execution status of this line is deduced): QTableView * const q = q_func();
-
905 QStyleOptionViewItem opt = option;
executed (the execution status of this line is deduced): QStyleOptionViewItem opt = option;
-
906 -
907 if (selectionModel && selectionModel->isSelected(index))
partially evaluated: selectionModel
TRUEFALSE
yes
Evaluation Count:5073
no
Evaluation Count:0
evaluated: selectionModel->isSelected(index)
TRUEFALSE
yes
Evaluation Count:379
yes
Evaluation Count:4694
0-5073
908 opt.state |= QStyle::State_Selected;
executed: opt.state |= QStyle::State_Selected;
Execution Count:379
379
909 if (index == hover)
evaluated: index == hover
TRUEFALSE
yes
Evaluation Count:46
yes
Evaluation Count:5027
46-5027
910 opt.state |= QStyle::State_MouseOver;
executed: opt.state |= QStyle::State_MouseOver;
Execution Count:46
46
911 if (option.state & QStyle::State_Enabled) {
partially evaluated: option.state & QStyle::State_Enabled
TRUEFALSE
yes
Evaluation Count:5073
no
Evaluation Count:0
0-5073
912 QPalette::ColorGroup cg;
executed (the execution status of this line is deduced): QPalette::ColorGroup cg;
-
913 if ((model->flags(index) & Qt::ItemIsEnabled) == 0) {
evaluated: (model->flags(index) & Qt::ItemIsEnabled) == 0
TRUEFALSE
yes
Evaluation Count:170
yes
Evaluation Count:4903
170-4903
914 opt.state &= ~QStyle::State_Enabled;
executed (the execution status of this line is deduced): opt.state &= ~QStyle::State_Enabled;
-
915 cg = QPalette::Disabled;
executed (the execution status of this line is deduced): cg = QPalette::Disabled;
-
916 } else {
executed: }
Execution Count:170
170
917 cg = QPalette::Normal;
executed (the execution status of this line is deduced): cg = QPalette::Normal;
-
918 }
executed: }
Execution Count:4903
4903
919 opt.palette.setCurrentColorGroup(cg);
executed (the execution status of this line is deduced): opt.palette.setCurrentColorGroup(cg);
-
920 }
executed: }
Execution Count:5073
5073
921 -
922 if (index == q->currentIndex()) {
evaluated: index == q->currentIndex()
TRUEFALSE
yes
Evaluation Count:254
yes
Evaluation Count:4819
254-4819
923 const bool focus = (q->hasFocus() || viewport->hasFocus()) && q->currentIndex().isValid();
evaluated: q->hasFocus()
TRUEFALSE
yes
Evaluation Count:226
yes
Evaluation Count:28
partially evaluated: viewport->hasFocus()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:28
partially evaluated: q->currentIndex().isValid()
TRUEFALSE
yes
Evaluation Count:226
no
Evaluation Count:0
0-226
924 if (focus)
evaluated: focus
TRUEFALSE
yes
Evaluation Count:226
yes
Evaluation Count:28
28-226
925 opt.state |= QStyle::State_HasFocus;
executed: opt.state |= QStyle::State_HasFocus;
Execution Count:226
226
926 }
executed: }
Execution Count:254
254
927 -
928 q->style()->drawPrimitive(QStyle::PE_PanelItemViewRow, &opt, painter, q);
executed (the execution status of this line is deduced): q->style()->drawPrimitive(QStyle::PE_PanelItemViewRow, &opt, painter, q);
-
929 -
930 q->itemDelegate(index)->paint(painter, opt, index);
executed (the execution status of this line is deduced): q->itemDelegate(index)->paint(painter, opt, index);
-
931}
executed: }
Execution Count:5073
5073
932 -
933/*! -
934 \class QTableView -
935 -
936 \brief The QTableView class provides a default model/view -
937 implementation of a table view. -
938 -
939 \ingroup model-view -
940 \ingroup advanced -
941 \inmodule QtWidgets -
942 -
943 A QTableView implements a table view that displays items from a -
944 model. This class is used to provide standard tables that were -
945 previously provided by the QTable class, but using the more -
946 flexible approach provided by Qt's model/view architecture. -
947 -
948 The QTableView class is one of the \l{Model/View Classes} -
949 and is part of Qt's \l{Model/View Programming}{model/view framework}. -
950 -
951 QTableView implements the interfaces defined by the -
952 QAbstractItemView class to allow it to display data provided by -
953 models derived from the QAbstractItemModel class. -
954 -
955 \section1 Navigation -
956 -
957 You can navigate the cells in the table by clicking on a cell with the -
958 mouse, or by using the arrow keys. Because QTableView enables -
959 \l{QAbstractItemView::tabKeyNavigation}{tabKeyNavigation} by default, you -
960 can also hit Tab and Backtab to move from cell to cell. -
961 -
962 \section1 Visual Appearance -
963 -
964 The table has a vertical header that can be obtained using the -
965 verticalHeader() function, and a horizontal header that is available -
966 through the horizontalHeader() function. The height of each row in the -
967 table can be found by using rowHeight(); similarly, the width of -
968 columns can be found using columnWidth(). Since both of these are plain -
969 widgets, you can hide either of them using their hide() functions. -
970 -
971 Rows and columns can be hidden and shown with hideRow(), hideColumn(), -
972 showRow(), and showColumn(). They can be selected with selectRow() -
973 and selectColumn(). The table will show a grid depending on the -
974 \l showGrid property. -
975 -
976 The items shown in a table view, like those in the other item views, are -
977 rendered and edited using standard \l{QItemDelegate}{delegates}. However, -
978 for some tasks it is sometimes useful to be able to insert widgets in a -
979 table instead. Widgets are set for particular indexes with the -
980 \l{QAbstractItemView::}{setIndexWidget()} function, and -
981 later retrieved with \l{QAbstractItemView::}{indexWidget()}. -
982 -
983 \table -
984 \row \li \inlineimage qtableview-resized.png -
985 \li By default, the cells in a table do not expand to fill the available space. -
986 -
987 You can make the cells fill the available space by stretching the last -
988 header section. Access the relevant header using horizontalHeader() -
989 or verticalHeader() and set the header's \l{QHeaderView::}{stretchLastSection} -
990 property. -
991 -
992 To distribute the available space according to the space requirement of -
993 each column or row, call the view's resizeColumnsToContents() or -
994 resizeRowsToContents() functions. -
995 \endtable -
996 -
997 \section1 Coordinate Systems -
998 -
999 For some specialized forms of tables it is useful to be able to -
1000 convert between row and column indexes and widget coordinates. -
1001 The rowAt() function provides the y-coordinate within the view of the -
1002 specified row; the row index can be used to obtain a corresponding -
1003 y-coordinate with rowViewportPosition(). The columnAt() and -
1004 columnViewportPosition() functions provide the equivalent conversion -
1005 operations between x-coordinates and column indexes. -
1006 -
1007 \section1 Styles -
1008 -
1009 QTableView is styled appropriately for each platform. The following images show -
1010 how it looks on three different platforms. Go to the \l{Qt Widget Gallery} to see -
1011 its appearance in other styles. -
1012 -
1013 \table 100% -
1014 \row \li \inlineimage windowsvista-tableview.png Screenshot of a Windows Vista style table view -
1015 \li \inlineimage macintosh-tableview.png Screenshot of a Macintosh style table view -
1016 \li \inlineimage fusion-tableview.png Screenshot of a Fusion style table view -
1017 \row \li A \l{Windows Vista Style Widget Gallery}{Windows Vista style} table view. -
1018 \li A \l{Macintosh Style Widget Gallery}{Macintosh style} table view. -
1019 \li A \l{Fusion Style Widget Gallery}{Fusion style} table view. -
1020 \endtable -
1021 -
1022 \sa QTableWidget, {View Classes}, QAbstractItemModel, QAbstractItemView, -
1023 {Chart Example}, {Pixelator Example}, {Table Model Example} -
1024*/ -
1025 -
1026/*! -
1027 Constructs a table view with a \a parent to represent the data. -
1028 -
1029 \sa QAbstractItemModel -
1030*/ -
1031 -
1032QTableView::QTableView(QWidget *parent) -
1033 : QAbstractItemView(*new QTableViewPrivate, parent) -
1034{ -
1035 Q_D(QTableView);
executed (the execution status of this line is deduced): QTableViewPrivate * const d = d_func();
-
1036 d->init();
executed (the execution status of this line is deduced): d->init();
-
1037}
executed: }
Execution Count:336
336
1038 -
1039/*! -
1040 \internal -
1041*/ -
1042QTableView::QTableView(QTableViewPrivate &dd, QWidget *parent) -
1043 : QAbstractItemView(dd, parent) -
1044{ -
1045 Q_D(QTableView);
executed (the execution status of this line is deduced): QTableViewPrivate * const d = d_func();
-
1046 d->init();
executed (the execution status of this line is deduced): d->init();
-
1047}
executed: }
Execution Count:146
146
1048 -
1049/*! -
1050 Destroys the table view. -
1051*/ -
1052QTableView::~QTableView() -
1053{ -
1054} -
1055 -
1056/*! -
1057 \reimp -
1058*/ -
1059void QTableView::setModel(QAbstractItemModel *model) -
1060{ -
1061 Q_D(QTableView);
executed (the execution status of this line is deduced): QTableViewPrivate * const d = d_func();
-
1062 if (model == d->model)
partially evaluated: model == d->model
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:521
0-521
1063 return;
never executed: return;
0
1064 //let's disconnect from the old model -
1065 if (d->model && d->model != QAbstractItemModelPrivate::staticEmptyModel()) {
partially evaluated: d->model
TRUEFALSE
yes
Evaluation Count:521
no
Evaluation Count:0
partially evaluated: d->model != QAbstractItemModelPrivate::staticEmptyModel()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:521
0-521
1066 disconnect(d->model, SIGNAL(rowsInserted(QModelIndex,int,int)),
never executed (the execution status of this line is deduced): disconnect(d->model, "2""rowsInserted(QModelIndex,int,int)",
-
1067 this, SLOT(_q_updateSpanInsertedRows(QModelIndex,int,int)));
never executed (the execution status of this line is deduced): this, "1""_q_updateSpanInsertedRows(QModelIndex,int,int)");
-
1068 disconnect(d->model, SIGNAL(columnsInserted(QModelIndex,int,int)),
never executed (the execution status of this line is deduced): disconnect(d->model, "2""columnsInserted(QModelIndex,int,int)",
-
1069 this, SLOT(_q_updateSpanInsertedColumns(QModelIndex,int,int)));
never executed (the execution status of this line is deduced): this, "1""_q_updateSpanInsertedColumns(QModelIndex,int,int)");
-
1070 disconnect(d->model, SIGNAL(rowsRemoved(QModelIndex,int,int)),
never executed (the execution status of this line is deduced): disconnect(d->model, "2""rowsRemoved(QModelIndex,int,int)",
-
1071 this, SLOT(_q_updateSpanRemovedRows(QModelIndex,int,int)));
never executed (the execution status of this line is deduced): this, "1""_q_updateSpanRemovedRows(QModelIndex,int,int)");
-
1072 disconnect(d->model, SIGNAL(columnsRemoved(QModelIndex,int,int)),
never executed (the execution status of this line is deduced): disconnect(d->model, "2""columnsRemoved(QModelIndex,int,int)",
-
1073 this, SLOT(_q_updateSpanRemovedColumns(QModelIndex,int,int)));
never executed (the execution status of this line is deduced): this, "1""_q_updateSpanRemovedColumns(QModelIndex,int,int)");
-
1074 }
never executed: }
0
1075 if (d->selectionModel) { // support row editing
evaluated: d->selectionModel
TRUEFALSE
yes
Evaluation Count:53
yes
Evaluation Count:468
53-468
1076 disconnect(d->selectionModel, SIGNAL(currentRowChanged(QModelIndex,QModelIndex)),
executed (the execution status of this line is deduced): disconnect(d->selectionModel, "2""currentRowChanged(QModelIndex,QModelIndex)",
-
1077 d->model, SLOT(submit()));
executed (the execution status of this line is deduced): d->model, "1""submit()");
-
1078 }
executed: }
Execution Count:53
53
1079 if (model) { //and connect to the new one
evaluated: model
TRUEFALSE
yes
Evaluation Count:520
yes
Evaluation Count:1
1-520
1080 connect(model, SIGNAL(rowsInserted(QModelIndex,int,int)),
executed (the execution status of this line is deduced): connect(model, "2""rowsInserted(QModelIndex,int,int)",
-
1081 this, SLOT(_q_updateSpanInsertedRows(QModelIndex,int,int)));
executed (the execution status of this line is deduced): this, "1""_q_updateSpanInsertedRows(QModelIndex,int,int)");
-
1082 connect(model, SIGNAL(columnsInserted(QModelIndex,int,int)),
executed (the execution status of this line is deduced): connect(model, "2""columnsInserted(QModelIndex,int,int)",
-
1083 this, SLOT(_q_updateSpanInsertedColumns(QModelIndex,int,int)));
executed (the execution status of this line is deduced): this, "1""_q_updateSpanInsertedColumns(QModelIndex,int,int)");
-
1084 connect(model, SIGNAL(rowsRemoved(QModelIndex,int,int)),
executed (the execution status of this line is deduced): connect(model, "2""rowsRemoved(QModelIndex,int,int)",
-
1085 this, SLOT(_q_updateSpanRemovedRows(QModelIndex,int,int)));
executed (the execution status of this line is deduced): this, "1""_q_updateSpanRemovedRows(QModelIndex,int,int)");
-
1086 connect(model, SIGNAL(columnsRemoved(QModelIndex,int,int)),
executed (the execution status of this line is deduced): connect(model, "2""columnsRemoved(QModelIndex,int,int)",
-
1087 this, SLOT(_q_updateSpanRemovedColumns(QModelIndex,int,int)));
executed (the execution status of this line is deduced): this, "1""_q_updateSpanRemovedColumns(QModelIndex,int,int)");
-
1088 }
executed: }
Execution Count:520
520
1089 d->verticalHeader->setModel(model);
executed (the execution status of this line is deduced): d->verticalHeader->setModel(model);
-
1090 d->horizontalHeader->setModel(model);
executed (the execution status of this line is deduced): d->horizontalHeader->setModel(model);
-
1091 QAbstractItemView::setModel(model);
executed (the execution status of this line is deduced): QAbstractItemView::setModel(model);
-
1092}
executed: }
Execution Count:521
521
1093 -
1094/*! -
1095 \reimp -
1096*/ -
1097void QTableView::setRootIndex(const QModelIndex &index) -
1098{ -
1099 Q_D(QTableView);
executed (the execution status of this line is deduced): QTableViewPrivate * const d = d_func();
-
1100 if (index == d->root) {
evaluated: index == d->root
TRUEFALSE
yes
Evaluation Count:809
yes
Evaluation Count:3
3-809
1101 viewport()->update();
executed (the execution status of this line is deduced): viewport()->update();
-
1102 return;
executed: return;
Execution Count:809
809
1103 } -
1104 d->verticalHeader->setRootIndex(index);
executed (the execution status of this line is deduced): d->verticalHeader->setRootIndex(index);
-
1105 d->horizontalHeader->setRootIndex(index);
executed (the execution status of this line is deduced): d->horizontalHeader->setRootIndex(index);
-
1106 QAbstractItemView::setRootIndex(index);
executed (the execution status of this line is deduced): QAbstractItemView::setRootIndex(index);
-
1107}
executed: }
Execution Count:3
3
1108 -
1109/*! -
1110 \internal -
1111*/ -
1112void QTableView::doItemsLayout() -
1113{ -
1114 Q_D(QTableView);
executed (the execution status of this line is deduced): QTableViewPrivate * const d = d_func();
-
1115 QAbstractItemView::doItemsLayout();
executed (the execution status of this line is deduced): QAbstractItemView::doItemsLayout();
-
1116 if (verticalScrollMode() == QAbstractItemView::ScrollPerItem)
evaluated: verticalScrollMode() == QAbstractItemView::ScrollPerItem
TRUEFALSE
yes
Evaluation Count:356
yes
Evaluation Count:16
16-356
1117 d->verticalHeader->setOffsetToSectionPosition(verticalScrollBar()->value());
executed: d->verticalHeader->setOffsetToSectionPosition(verticalScrollBar()->value());
Execution Count:356
356
1118 else -
1119 d->verticalHeader->setOffset(verticalScrollBar()->value());
executed: d->verticalHeader->setOffset(verticalScrollBar()->value());
Execution Count:16
16
1120 if (!d->verticalHeader->updatesEnabled())
evaluated: !d->verticalHeader->updatesEnabled()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:370
2-370
1121 d->verticalHeader->setUpdatesEnabled(true);
executed: d->verticalHeader->setUpdatesEnabled(true);
Execution Count:2
2
1122}
executed: }
Execution Count:372
372
1123 -
1124/*! -
1125 \reimp -
1126*/ -
1127void QTableView::setSelectionModel(QItemSelectionModel *selectionModel) -
1128{ -
1129 Q_D(QTableView);
executed (the execution status of this line is deduced): QTableViewPrivate * const d = d_func();
-
1130 Q_ASSERT(selectionModel);
executed (the execution status of this line is deduced): qt_noop();
-
1131 if (d->selectionModel) {
evaluated: d->selectionModel
TRUEFALSE
yes
Evaluation Count:53
yes
Evaluation Count:468
53-468
1132 // support row editing -
1133 disconnect(d->selectionModel, SIGNAL(currentRowChanged(QModelIndex,QModelIndex)),
executed (the execution status of this line is deduced): disconnect(d->selectionModel, "2""currentRowChanged(QModelIndex,QModelIndex)",
-
1134 d->model, SLOT(submit()));
executed (the execution status of this line is deduced): d->model, "1""submit()");
-
1135 }
executed: }
Execution Count:53
53
1136 -
1137 d->verticalHeader->setSelectionModel(selectionModel);
executed (the execution status of this line is deduced): d->verticalHeader->setSelectionModel(selectionModel);
-
1138 d->horizontalHeader->setSelectionModel(selectionModel);
executed (the execution status of this line is deduced): d->horizontalHeader->setSelectionModel(selectionModel);
-
1139 QAbstractItemView::setSelectionModel(selectionModel);
executed (the execution status of this line is deduced): QAbstractItemView::setSelectionModel(selectionModel);
-
1140 -
1141 if (d->selectionModel) {
partially evaluated: d->selectionModel
TRUEFALSE
yes
Evaluation Count:521
no
Evaluation Count:0
0-521
1142 // support row editing -
1143 connect(d->selectionModel, SIGNAL(currentRowChanged(QModelIndex,QModelIndex)),
executed (the execution status of this line is deduced): connect(d->selectionModel, "2""currentRowChanged(QModelIndex,QModelIndex)",
-
1144 d->model, SLOT(submit()));
executed (the execution status of this line is deduced): d->model, "1""submit()");
-
1145 }
executed: }
Execution Count:521
521
1146}
executed: }
Execution Count:521
521
1147 -
1148/*! -
1149 Returns the table view's horizontal header. -
1150 -
1151 \sa setHorizontalHeader(), verticalHeader(), QAbstractItemModel::headerData() -
1152*/ -
1153QHeaderView *QTableView::horizontalHeader() const -
1154{ -
1155 Q_D(const QTableView);
executed (the execution status of this line is deduced): const QTableViewPrivate * const d = d_func();
-
1156 return d->horizontalHeader;
executed: return d->horizontalHeader;
Execution Count:3890
3890
1157} -
1158 -
1159/*! -
1160 Returns the table view's vertical header. -
1161 -
1162 \sa setVerticalHeader(), horizontalHeader(), QAbstractItemModel::headerData() -
1163*/ -
1164QHeaderView *QTableView::verticalHeader() const -
1165{ -
1166 Q_D(const QTableView);
executed (the execution status of this line is deduced): const QTableViewPrivate * const d = d_func();
-
1167 return d->verticalHeader;
executed: return d->verticalHeader;
Execution Count:2221
2221
1168} -
1169 -
1170/*! -
1171 Sets the widget to use for the horizontal header to \a header. -
1172 -
1173 \sa horizontalHeader(), setVerticalHeader() -
1174*/ -
1175void QTableView::setHorizontalHeader(QHeaderView *header) -
1176{ -
1177 Q_D(QTableView);
executed (the execution status of this line is deduced): QTableViewPrivate * const d = d_func();
-
1178 -
1179 if (!header || header == d->horizontalHeader)
evaluated: !header
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:487
evaluated: header == d->horizontalHeader
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:486
1-487
1180 return;
executed: return;
Execution Count:2
2
1181 if (d->horizontalHeader && d->horizontalHeader->parent() == this)
evaluated: d->horizontalHeader
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:482
evaluated: d->horizontalHeader->parent() == this
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:1
1-482
1182 delete d->horizontalHeader;
executed: delete d->horizontalHeader;
Execution Count:3
3
1183 d->horizontalHeader = header;
executed (the execution status of this line is deduced): d->horizontalHeader = header;
-
1184 d->horizontalHeader->setParent(this);
executed (the execution status of this line is deduced): d->horizontalHeader->setParent(this);
-
1185 d->horizontalHeader->d_func()->setAllowUserMoveOfSection0(true);
executed (the execution status of this line is deduced): d->horizontalHeader->d_func()->setAllowUserMoveOfSection0(true);
-
1186 if (!d->horizontalHeader->model()) {
evaluated: !d->horizontalHeader->model()
TRUEFALSE
yes
Evaluation Count:485
yes
Evaluation Count:1
1-485
1187 d->horizontalHeader->setModel(d->model);
executed (the execution status of this line is deduced): d->horizontalHeader->setModel(d->model);
-
1188 if (d->selectionModel)
evaluated: d->selectionModel
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:484
1-484
1189 d->horizontalHeader->setSelectionModel(d->selectionModel);
executed: d->horizontalHeader->setSelectionModel(d->selectionModel);
Execution Count:1
1
1190 }
executed: }
Execution Count:485
485
1191 -
1192 connect(d->horizontalHeader,SIGNAL(sectionResized(int,int,int)),
executed (the execution status of this line is deduced): connect(d->horizontalHeader,"2""sectionResized(int,int,int)",
-
1193 this, SLOT(columnResized(int,int,int)));
executed (the execution status of this line is deduced): this, "1""columnResized(int,int,int)");
-
1194 connect(d->horizontalHeader, SIGNAL(sectionMoved(int,int,int)),
executed (the execution status of this line is deduced): connect(d->horizontalHeader, "2""sectionMoved(int,int,int)",
-
1195 this, SLOT(columnMoved(int,int,int)));
executed (the execution status of this line is deduced): this, "1""columnMoved(int,int,int)");
-
1196 connect(d->horizontalHeader, SIGNAL(sectionCountChanged(int,int)),
executed (the execution status of this line is deduced): connect(d->horizontalHeader, "2""sectionCountChanged(int,int)",
-
1197 this, SLOT(columnCountChanged(int,int)));
executed (the execution status of this line is deduced): this, "1""columnCountChanged(int,int)");
-
1198 connect(d->horizontalHeader, SIGNAL(sectionPressed(int)), this, SLOT(selectColumn(int)));
executed (the execution status of this line is deduced): connect(d->horizontalHeader, "2""sectionPressed(int)", this, "1""selectColumn(int)");
-
1199 connect(d->horizontalHeader, SIGNAL(sectionEntered(int)), this, SLOT(_q_selectColumn(int)));
executed (the execution status of this line is deduced): connect(d->horizontalHeader, "2""sectionEntered(int)", this, "1""_q_selectColumn(int)");
-
1200 connect(d->horizontalHeader, SIGNAL(sectionHandleDoubleClicked(int)),
executed (the execution status of this line is deduced): connect(d->horizontalHeader, "2""sectionHandleDoubleClicked(int)",
-
1201 this, SLOT(resizeColumnToContents(int)));
executed (the execution status of this line is deduced): this, "1""resizeColumnToContents(int)");
-
1202 connect(d->horizontalHeader, SIGNAL(geometriesChanged()), this, SLOT(updateGeometries()));
executed (the execution status of this line is deduced): connect(d->horizontalHeader, "2""geometriesChanged()", this, "1""updateGeometries()");
-
1203 -
1204 //update the sorting enabled states on the new header -
1205 setSortingEnabled(d->sortingEnabled);
executed (the execution status of this line is deduced): setSortingEnabled(d->sortingEnabled);
-
1206}
executed: }
Execution Count:486
486
1207 -
1208/*! -
1209 Sets the widget to use for the vertical header to \a header. -
1210 -
1211 \sa verticalHeader(), setHorizontalHeader() -
1212*/ -
1213void QTableView::setVerticalHeader(QHeaderView *header) -
1214{ -
1215 Q_D(QTableView);
executed (the execution status of this line is deduced): QTableViewPrivate * const d = d_func();
-
1216 -
1217 if (!header || header == d->verticalHeader)
evaluated: !header
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:539
evaluated: header == d->verticalHeader
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:538
1-539
1218 return;
executed: return;
Execution Count:2
2
1219 if (d->verticalHeader && d->verticalHeader->parent() == this)
evaluated: d->verticalHeader
TRUEFALSE
yes
Evaluation Count:56
yes
Evaluation Count:482
evaluated: d->verticalHeader->parent() == this
TRUEFALSE
yes
Evaluation Count:55
yes
Evaluation Count:1
1-482
1220 delete d->verticalHeader;
executed: delete d->verticalHeader;
Execution Count:55
55
1221 d->verticalHeader = header;
executed (the execution status of this line is deduced): d->verticalHeader = header;
-
1222 d->verticalHeader->setParent(this);
executed (the execution status of this line is deduced): d->verticalHeader->setParent(this);
-
1223 d->verticalHeader->d_func()->setAllowUserMoveOfSection0(true);
executed (the execution status of this line is deduced): d->verticalHeader->d_func()->setAllowUserMoveOfSection0(true);
-
1224 if (!d->verticalHeader->model()) {
evaluated: !d->verticalHeader->model()
TRUEFALSE
yes
Evaluation Count:485
yes
Evaluation Count:53
53-485
1225 d->verticalHeader->setModel(d->model);
executed (the execution status of this line is deduced): d->verticalHeader->setModel(d->model);
-
1226 if (d->selectionModel)
evaluated: d->selectionModel
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:484
1-484
1227 d->verticalHeader->setSelectionModel(d->selectionModel);
executed: d->verticalHeader->setSelectionModel(d->selectionModel);
Execution Count:1
1
1228 }
executed: }
Execution Count:485
485
1229 -
1230 connect(d->verticalHeader, SIGNAL(sectionResized(int,int,int)),
executed (the execution status of this line is deduced): connect(d->verticalHeader, "2""sectionResized(int,int,int)",
-
1231 this, SLOT(rowResized(int,int,int)));
executed (the execution status of this line is deduced): this, "1""rowResized(int,int,int)");
-
1232 connect(d->verticalHeader, SIGNAL(sectionMoved(int,int,int)),
executed (the execution status of this line is deduced): connect(d->verticalHeader, "2""sectionMoved(int,int,int)",
-
1233 this, SLOT(rowMoved(int,int,int)));
executed (the execution status of this line is deduced): this, "1""rowMoved(int,int,int)");
-
1234 connect(d->verticalHeader, SIGNAL(sectionCountChanged(int,int)),
executed (the execution status of this line is deduced): connect(d->verticalHeader, "2""sectionCountChanged(int,int)",
-
1235 this, SLOT(rowCountChanged(int,int)));
executed (the execution status of this line is deduced): this, "1""rowCountChanged(int,int)");
-
1236 connect(d->verticalHeader, SIGNAL(sectionPressed(int)), this, SLOT(selectRow(int)));
executed (the execution status of this line is deduced): connect(d->verticalHeader, "2""sectionPressed(int)", this, "1""selectRow(int)");
-
1237 connect(d->verticalHeader, SIGNAL(sectionEntered(int)), this, SLOT(_q_selectRow(int)));
executed (the execution status of this line is deduced): connect(d->verticalHeader, "2""sectionEntered(int)", this, "1""_q_selectRow(int)");
-
1238 connect(d->verticalHeader, SIGNAL(sectionHandleDoubleClicked(int)),
executed (the execution status of this line is deduced): connect(d->verticalHeader, "2""sectionHandleDoubleClicked(int)",
-
1239 this, SLOT(resizeRowToContents(int)));
executed (the execution status of this line is deduced): this, "1""resizeRowToContents(int)");
-
1240 connect(d->verticalHeader, SIGNAL(geometriesChanged()), this, SLOT(updateGeometries()));
executed (the execution status of this line is deduced): connect(d->verticalHeader, "2""geometriesChanged()", this, "1""updateGeometries()");
-
1241}
executed: }
Execution Count:538
538
1242 -
1243/*! -
1244 \internal -
1245 -
1246 Scroll the contents of the table view by (\a dx, \a dy). -
1247*/ -
1248void QTableView::scrollContentsBy(int dx, int dy) -
1249{ -
1250 Q_D(QTableView);
executed (the execution status of this line is deduced): QTableViewPrivate * const d = d_func();
-
1251 -
1252 d->delayedAutoScroll.stop(); // auto scroll was canceled by the user scrolling
executed (the execution status of this line is deduced): d->delayedAutoScroll.stop();
-
1253 -
1254 dx = isRightToLeft() ? -dx : dx;
partially evaluated: isRightToLeft()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4444
0-4444
1255 if (dx) {
evaluated: dx
TRUEFALSE
yes
Evaluation Count:4139
yes
Evaluation Count:305
305-4139
1256 if (horizontalScrollMode() == QAbstractItemView::ScrollPerItem) {
evaluated: horizontalScrollMode() == QAbstractItemView::ScrollPerItem
TRUEFALSE
yes
Evaluation Count:2184
yes
Evaluation Count:1955
1955-2184
1257 int oldOffset = d->horizontalHeader->offset();
executed (the execution status of this line is deduced): int oldOffset = d->horizontalHeader->offset();
-
1258 if (horizontalScrollBar()->value() == horizontalScrollBar()->maximum())
evaluated: horizontalScrollBar()->value() == horizontalScrollBar()->maximum()
TRUEFALSE
yes
Evaluation Count:99
yes
Evaluation Count:2085
99-2085
1259 d->horizontalHeader->setOffsetToLastSection();
executed: d->horizontalHeader->setOffsetToLastSection();
Execution Count:99
99
1260 else -
1261 d->horizontalHeader->setOffsetToSectionPosition(horizontalScrollBar()->value());
executed: d->horizontalHeader->setOffsetToSectionPosition(horizontalScrollBar()->value());
Execution Count:2085
2085
1262 int newOffset = d->horizontalHeader->offset();
executed (the execution status of this line is deduced): int newOffset = d->horizontalHeader->offset();
-
1263 dx = isRightToLeft() ? newOffset - oldOffset : oldOffset - newOffset;
partially evaluated: isRightToLeft()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2184
0-2184
1264 } else {
executed: }
Execution Count:2184
2184
1265 d->horizontalHeader->setOffset(horizontalScrollBar()->value());
executed (the execution status of this line is deduced): d->horizontalHeader->setOffset(horizontalScrollBar()->value());
-
1266 }
executed: }
Execution Count:1955
1955
1267 } -
1268 if (dy) {
evaluated: dy
TRUEFALSE
yes
Evaluation Count:305
yes
Evaluation Count:4139
305-4139
1269 if (verticalScrollMode() == QAbstractItemView::ScrollPerItem) {
evaluated: verticalScrollMode() == QAbstractItemView::ScrollPerItem
TRUEFALSE
yes
Evaluation Count:223
yes
Evaluation Count:82
82-223
1270 int oldOffset = d->verticalHeader->offset();
executed (the execution status of this line is deduced): int oldOffset = d->verticalHeader->offset();
-
1271 if (verticalScrollBar()->value() == verticalScrollBar()->maximum())
evaluated: verticalScrollBar()->value() == verticalScrollBar()->maximum()
TRUEFALSE
yes
Evaluation Count:16
yes
Evaluation Count:207
16-207
1272 d->verticalHeader->setOffsetToLastSection();
executed: d->verticalHeader->setOffsetToLastSection();
Execution Count:16
16
1273 else -
1274 d->verticalHeader->setOffsetToSectionPosition(verticalScrollBar()->value());
executed: d->verticalHeader->setOffsetToSectionPosition(verticalScrollBar()->value());
Execution Count:207
207
1275 int newOffset = d->verticalHeader->offset();
executed (the execution status of this line is deduced): int newOffset = d->verticalHeader->offset();
-
1276 dy = oldOffset - newOffset;
executed (the execution status of this line is deduced): dy = oldOffset - newOffset;
-
1277 } else {
executed: }
Execution Count:223
223
1278 d->verticalHeader->setOffset(verticalScrollBar()->value());
executed (the execution status of this line is deduced): d->verticalHeader->setOffset(verticalScrollBar()->value());
-
1279 }
executed: }
Execution Count:82
82
1280 } -
1281 d->scrollContentsBy(dx, dy);
executed (the execution status of this line is deduced): d->scrollContentsBy(dx, dy);
-
1282 -
1283 if (d->showGrid) {
evaluated: d->showGrid
TRUEFALSE
yes
Evaluation Count:3094
yes
Evaluation Count:1350
1350-3094
1284 //we need to update the first line of the previous top item in the view -
1285 //because it has the grid drawn if the header is invisible. -
1286 //It is strictly related to what's done at then end of the paintEvent -
1287 if (dy > 0 && d->horizontalHeader->isHidden() && d->verticalScrollMode == ScrollPerItem) {
evaluated: dy > 0
TRUEFALSE
yes
Evaluation Count:25
yes
Evaluation Count:3069
partially evaluated: d->horizontalHeader->isHidden()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:25
never evaluated: d->verticalScrollMode == ScrollPerItem
0-3069
1288 d->viewport->update(0, dy, d->viewport->width(), dy);
never executed (the execution status of this line is deduced): d->viewport->update(0, dy, d->viewport->width(), dy);
-
1289 }
never executed: }
0
1290 if (dx > 0 && d->verticalHeader->isHidden() && d->horizontalScrollMode == ScrollPerItem) {
evaluated: dx > 0
TRUEFALSE
yes
Evaluation Count:126
yes
Evaluation Count:2968
partially evaluated: d->verticalHeader->isHidden()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:126
never evaluated: d->horizontalScrollMode == ScrollPerItem
0-2968
1291 d->viewport->update(dx, 0, dx, d->viewport->height());
never executed (the execution status of this line is deduced): d->viewport->update(dx, 0, dx, d->viewport->height());
-
1292 }
never executed: }
0
1293 }
executed: }
Execution Count:3094
3094
1294}
executed: }
Execution Count:4444
4444
1295 -
1296QStyleOptionViewItem QTableViewPrivate::viewOptions() const -
1297{ -
1298 QStyleOptionViewItem option = QAbstractItemViewPrivate::viewOptions();
executed (the execution status of this line is deduced): QStyleOptionViewItem option = QAbstractItemViewPrivate::viewOptions();
-
1299 option.showDecorationSelected = true;
executed (the execution status of this line is deduced): option.showDecorationSelected = true;
-
1300 return option;
executed: return option;
Execution Count:2493
2493
1301} -
1302 -
1303/*! -
1304 \reimp -
1305*/ -
1306QStyleOptionViewItem QTableView::viewOptions() const -
1307{ -
1308 Q_D(const QTableView);
executed (the execution status of this line is deduced): const QTableViewPrivate * const d = d_func();
-
1309 return d->viewOptions();
executed: return d->viewOptions();
Execution Count:8
8
1310} -
1311 -
1312/*! -
1313 Paints the table on receipt of the given paint event \a event. -
1314*/ -
1315void QTableView::paintEvent(QPaintEvent *event) -
1316{ -
1317 Q_D(QTableView);
executed (the execution status of this line is deduced): QTableViewPrivate * const d = d_func();
-
1318 // setup temp variables for the painting -
1319 QStyleOptionViewItem option = d->viewOptions();
executed (the execution status of this line is deduced): QStyleOptionViewItem option = d->viewOptions();
-
1320 const QPoint offset = d->scrollDelayOffset;
executed (the execution status of this line is deduced): const QPoint offset = d->scrollDelayOffset;
-
1321 const bool showGrid = d->showGrid;
executed (the execution status of this line is deduced): const bool showGrid = d->showGrid;
-
1322 const int gridSize = showGrid ? 1 : 0;
evaluated: showGrid
TRUEFALSE
yes
Evaluation Count:282
yes
Evaluation Count:88
88-282
1323 const int gridHint = style()->styleHint(QStyle::SH_Table_GridLineColor, &option, this);
executed (the execution status of this line is deduced): const int gridHint = style()->styleHint(QStyle::SH_Table_GridLineColor, &option, this);
-
1324 const QColor gridColor = static_cast<QRgb>(gridHint);
executed (the execution status of this line is deduced): const QColor gridColor = static_cast<QRgb>(gridHint);
-
1325 const QPen gridPen = QPen(gridColor, 0, d->gridStyle);
executed (the execution status of this line is deduced): const QPen gridPen = QPen(gridColor, 0, d->gridStyle);
-
1326 const QHeaderView *verticalHeader = d->verticalHeader;
executed (the execution status of this line is deduced): const QHeaderView *verticalHeader = d->verticalHeader;
-
1327 const QHeaderView *horizontalHeader = d->horizontalHeader;
executed (the execution status of this line is deduced): const QHeaderView *horizontalHeader = d->horizontalHeader;
-
1328 const bool alternate = d->alternatingColors;
executed (the execution status of this line is deduced): const bool alternate = d->alternatingColors;
-
1329 const bool rightToLeft = isRightToLeft();
executed (the execution status of this line is deduced): const bool rightToLeft = isRightToLeft();
-
1330 -
1331 QPainter painter(d->viewport);
executed (the execution status of this line is deduced): QPainter painter(d->viewport);
-
1332 -
1333 // if there's nothing to do, clear the area and return -
1334 if (horizontalHeader->count() == 0 || verticalHeader->count() == 0 || !d->itemDelegate)
evaluated: horizontalHeader->count() == 0
TRUEFALSE
yes
Evaluation Count:35
yes
Evaluation Count:335
partially evaluated: verticalHeader->count() == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:335
partially evaluated: !d->itemDelegate
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:335
0-335
1335 return;
executed: return;
Execution Count:35
35
1336 -
1337 uint x = horizontalHeader->length() - horizontalHeader->offset() - (rightToLeft ? 0 : 1);
evaluated: rightToLeft
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:333
2-333
1338 uint y = verticalHeader->length() - verticalHeader->offset() - 1;
executed (the execution status of this line is deduced): uint y = verticalHeader->length() - verticalHeader->offset() - 1;
-
1339 -
1340 const QRegion region = event->region().translated(offset);
executed (the execution status of this line is deduced): const QRegion region = event->region().translated(offset);
-
1341 const QVector<QRect> rects = region.rects();
executed (the execution status of this line is deduced): const QVector<QRect> rects = region.rects();
-
1342 -
1343 //firstVisualRow is the visual index of the first visible row. lastVisualRow is the visual index of the last visible Row. -
1344 //same goes for ...VisualColumn -
1345 int firstVisualRow = qMax(verticalHeader->visualIndexAt(0),0);
executed (the execution status of this line is deduced): int firstVisualRow = qMax(verticalHeader->visualIndexAt(0),0);
-
1346 int lastVisualRow = verticalHeader->visualIndexAt(verticalHeader->viewport()->height());
executed (the execution status of this line is deduced): int lastVisualRow = verticalHeader->visualIndexAt(verticalHeader->viewport()->height());
-
1347 if (lastVisualRow == -1)
evaluated: lastVisualRow == -1
TRUEFALSE
yes
Evaluation Count:109
yes
Evaluation Count:226
109-226
1348 lastVisualRow = d->model->rowCount(d->root) - 1;
executed: lastVisualRow = d->model->rowCount(d->root) - 1;
Execution Count:109
109
1349 -
1350 int firstVisualColumn = horizontalHeader->visualIndexAt(0);
executed (the execution status of this line is deduced): int firstVisualColumn = horizontalHeader->visualIndexAt(0);
-
1351 int lastVisualColumn = horizontalHeader->visualIndexAt(horizontalHeader->viewport()->width());
executed (the execution status of this line is deduced): int lastVisualColumn = horizontalHeader->visualIndexAt(horizontalHeader->viewport()->width());
-
1352 if (rightToLeft)
evaluated: rightToLeft
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:333
2-333
1353 qSwap(firstVisualColumn, lastVisualColumn);
executed: qSwap(firstVisualColumn, lastVisualColumn);
Execution Count:2
2
1354 if (firstVisualColumn == -1)
partially evaluated: firstVisualColumn == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:335
0-335
1355 firstVisualColumn = 0;
never executed: firstVisualColumn = 0;
0
1356 if (lastVisualColumn == -1)
evaluated: lastVisualColumn == -1
TRUEFALSE
yes
Evaluation Count:119
yes
Evaluation Count:216
119-216
1357 lastVisualColumn = horizontalHeader->count() - 1;
executed: lastVisualColumn = horizontalHeader->count() - 1;
Execution Count:119
119
1358 -
1359 QBitArray drawn((lastVisualRow - firstVisualRow + 1) * (lastVisualColumn - firstVisualColumn + 1));
executed (the execution status of this line is deduced): QBitArray drawn((lastVisualRow - firstVisualRow + 1) * (lastVisualColumn - firstVisualColumn + 1));
-
1360 -
1361 if (d->hasSpans()) {
evaluated: d->hasSpans()
TRUEFALSE
yes
Evaluation Count:16
yes
Evaluation Count:319
16-319
1362 d->drawAndClipSpans(region, &painter, option, &drawn,
executed (the execution status of this line is deduced): d->drawAndClipSpans(region, &painter, option, &drawn,
-
1363 firstVisualRow, lastVisualRow, firstVisualColumn, lastVisualColumn);
executed (the execution status of this line is deduced): firstVisualRow, lastVisualRow, firstVisualColumn, lastVisualColumn);
-
1364 }
executed: }
Execution Count:16
16
1365 -
1366 for (int i = 0; i < rects.size(); ++i) {
evaluated: i < rects.size()
TRUEFALSE
yes
Evaluation Count:642
yes
Evaluation Count:335
335-642
1367 QRect dirtyArea = rects.at(i);
executed (the execution status of this line is deduced): QRect dirtyArea = rects.at(i);
-
1368 dirtyArea.setBottom(qMin(dirtyArea.bottom(), int(y)));
executed (the execution status of this line is deduced): dirtyArea.setBottom(qMin(dirtyArea.bottom(), int(y)));
-
1369 if (rightToLeft) {
evaluated: rightToLeft
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:640
2-640
1370 dirtyArea.setLeft(qMax(dirtyArea.left(), d->viewport->width() - int(x)));
executed (the execution status of this line is deduced): dirtyArea.setLeft(qMax(dirtyArea.left(), d->viewport->width() - int(x)));
-
1371 } else {
executed: }
Execution Count:2
2
1372 dirtyArea.setRight(qMin(dirtyArea.right(), int(x)));
executed (the execution status of this line is deduced): dirtyArea.setRight(qMin(dirtyArea.right(), int(x)));
-
1373 }
executed: }
Execution Count:640
640
1374 -
1375 // get the horizontal start and end visual sections -
1376 int left = horizontalHeader->visualIndexAt(dirtyArea.left());
executed (the execution status of this line is deduced): int left = horizontalHeader->visualIndexAt(dirtyArea.left());
-
1377 int right = horizontalHeader->visualIndexAt(dirtyArea.right());
executed (the execution status of this line is deduced): int right = horizontalHeader->visualIndexAt(dirtyArea.right());
-
1378 if (rightToLeft)
evaluated: rightToLeft
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:640
2-640
1379 qSwap(left, right);
executed: qSwap(left, right);
Execution Count:2
2
1380 if (left == -1) left = 0;
never executed: left = 0;
partially evaluated: left == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:642
0-642
1381 if (right == -1) right = horizontalHeader->count() - 1;
never executed: right = horizontalHeader->count() - 1;
partially evaluated: right == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:642
0-642
1382 -
1383 // get the vertical start and end visual sections and if alternate color -
1384 int bottom = verticalHeader->visualIndexAt(dirtyArea.bottom());
executed (the execution status of this line is deduced): int bottom = verticalHeader->visualIndexAt(dirtyArea.bottom());
-
1385 if (bottom == -1) bottom = verticalHeader->count() - 1;
never executed: bottom = verticalHeader->count() - 1;
partially evaluated: bottom == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:642
0-642
1386 int top = 0;
executed (the execution status of this line is deduced): int top = 0;
-
1387 bool alternateBase = false;
executed (the execution status of this line is deduced): bool alternateBase = false;
-
1388 if (alternate && verticalHeader->sectionsHidden()) {
partially evaluated: alternate
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:642
never evaluated: verticalHeader->sectionsHidden()
0-642
1389 uint verticalOffset = verticalHeader->offset();
never executed (the execution status of this line is deduced): uint verticalOffset = verticalHeader->offset();
-
1390 int row = verticalHeader->logicalIndex(top);
never executed (the execution status of this line is deduced): int row = verticalHeader->logicalIndex(top);
-
1391 for (int y = 0;
never executed (the execution status of this line is deduced): for (int y = 0;
-
1392 ((uint)(y += verticalHeader->sectionSize(top)) <= verticalOffset) && (top < bottom);
never evaluated: ((uint)(y += verticalHeader->sectionSize(top)) <= verticalOffset)
never evaluated: (top < bottom)
0
1393 ++top) {
never executed (the execution status of this line is deduced): ++top) {
-
1394 row = verticalHeader->logicalIndex(top);
never executed (the execution status of this line is deduced): row = verticalHeader->logicalIndex(top);
-
1395 if (alternate && !verticalHeader->isSectionHidden(row))
never evaluated: alternate
never evaluated: !verticalHeader->isSectionHidden(row)
0
1396 alternateBase = !alternateBase;
never executed: alternateBase = !alternateBase;
0
1397 }
never executed: }
0
1398 } else {
never executed: }
0
1399 top = verticalHeader->visualIndexAt(dirtyArea.top());
executed (the execution status of this line is deduced): top = verticalHeader->visualIndexAt(dirtyArea.top());
-
1400 alternateBase = (top & 1) && alternate;
evaluated: (top & 1)
TRUEFALSE
yes
Evaluation Count:212
yes
Evaluation Count:430
partially evaluated: alternate
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:212
0-430
1401 }
executed: }
Execution Count:642
642
1402 if (top == -1 || top > bottom)
partially evaluated: top == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:642
partially evaluated: top > bottom
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:642
0-642
1403 continue;
never executed: continue;
0
1404 -
1405 // Paint each row item -
1406 for (int visualRowIndex = top; visualRowIndex <= bottom; ++visualRowIndex) {
evaluated: visualRowIndex <= bottom
TRUEFALSE
yes
Evaluation Count:1379
yes
Evaluation Count:642
642-1379
1407 int row = verticalHeader->logicalIndex(visualRowIndex);
executed (the execution status of this line is deduced): int row = verticalHeader->logicalIndex(visualRowIndex);
-
1408 if (verticalHeader->isSectionHidden(row))
partially evaluated: verticalHeader->isSectionHidden(row)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1379
0-1379
1409 continue;
never executed: continue;
0
1410 int rowY = rowViewportPosition(row);
executed (the execution status of this line is deduced): int rowY = rowViewportPosition(row);
-
1411 rowY += offset.y();
executed (the execution status of this line is deduced): rowY += offset.y();
-
1412 int rowh = rowHeight(row) - gridSize;
executed (the execution status of this line is deduced): int rowh = rowHeight(row) - gridSize;
-
1413 -
1414 // Paint each column item -
1415 for (int visualColumnIndex = left; visualColumnIndex <= right; ++visualColumnIndex) {
evaluated: visualColumnIndex <= right
TRUEFALSE
yes
Evaluation Count:5172
yes
Evaluation Count:1379
1379-5172
1416 int currentBit = (visualRowIndex - firstVisualRow) * (lastVisualColumn - firstVisualColumn + 1)
executed (the execution status of this line is deduced): int currentBit = (visualRowIndex - firstVisualRow) * (lastVisualColumn - firstVisualColumn + 1)
-
1417 + visualColumnIndex - firstVisualColumn;
executed (the execution status of this line is deduced): + visualColumnIndex - firstVisualColumn;
-
1418 -
1419 if (currentBit < 0 || currentBit >= drawn.size() || drawn.testBit(currentBit))
partially evaluated: currentBit < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5172
partially evaluated: currentBit >= drawn.size()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5172
evaluated: drawn.testBit(currentBit)
TRUEFALSE
yes
Evaluation Count:116
yes
Evaluation Count:5056
0-5172
1420 continue;
executed: continue;
Execution Count:116
116
1421 drawn.setBit(currentBit);
executed (the execution status of this line is deduced): drawn.setBit(currentBit);
-
1422 -
1423 int col = horizontalHeader->logicalIndex(visualColumnIndex);
executed (the execution status of this line is deduced): int col = horizontalHeader->logicalIndex(visualColumnIndex);
-
1424 if (horizontalHeader->isSectionHidden(col))
partially evaluated: horizontalHeader->isSectionHidden(col)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5056
0-5056
1425 continue;
never executed: continue;
0
1426 int colp = columnViewportPosition(col);
executed (the execution status of this line is deduced): int colp = columnViewportPosition(col);
-
1427 colp += offset.x();
executed (the execution status of this line is deduced): colp += offset.x();
-
1428 int colw = columnWidth(col) - gridSize;
executed (the execution status of this line is deduced): int colw = columnWidth(col) - gridSize;
-
1429 -
1430 const QModelIndex index = d->model->index(row, col, d->root);
executed (the execution status of this line is deduced): const QModelIndex index = d->model->index(row, col, d->root);
-
1431 if (index.isValid()) {
partially evaluated: index.isValid()
TRUEFALSE
yes
Evaluation Count:5056
no
Evaluation Count:0
0-5056
1432 option.rect = QRect(colp + (showGrid && rightToLeft ? 1 : 0), rowY, colw, rowh);
executed (the execution status of this line is deduced): option.rect = QRect(colp + (showGrid && rightToLeft ? 1 : 0), rowY, colw, rowh);
-
1433 if (alternate) {
partially evaluated: alternate
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5056
0-5056
1434 if (alternateBase)
never evaluated: alternateBase
0
1435 option.features |= QStyleOptionViewItem::Alternate;
never executed: option.features |= QStyleOptionViewItem::Alternate;
0
1436 else -
1437 option.features &= ~QStyleOptionViewItem::Alternate;
never executed: option.features &= ~QStyleOptionViewItem::Alternate;
0
1438 } -
1439 d->drawCell(&painter, option, index);
executed (the execution status of this line is deduced): d->drawCell(&painter, option, index);
-
1440 }
executed: }
Execution Count:5056
5056
1441 }
executed: }
Execution Count:5056
5056
1442 alternateBase = !alternateBase && alternate;
partially evaluated: !alternateBase
TRUEFALSE
yes
Evaluation Count:1379
no
Evaluation Count:0
partially evaluated: alternate
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1379
0-1379
1443 }
executed: }
Execution Count:1379
1379
1444 -
1445 if (showGrid) {
evaluated: showGrid
TRUEFALSE
yes
Evaluation Count:518
yes
Evaluation Count:124
124-518
1446 // Find the bottom right (the last rows/columns might be hidden) -
1447 while (verticalHeader->isSectionHidden(verticalHeader->logicalIndex(bottom))) --bottom;
never executed: --bottom;
partially evaluated: verticalHeader->isSectionHidden(verticalHeader->logicalIndex(bottom))
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:518
0-518
1448 QPen old = painter.pen();
executed (the execution status of this line is deduced): QPen old = painter.pen();
-
1449 painter.setPen(gridPen);
executed (the execution status of this line is deduced): painter.setPen(gridPen);
-
1450 // Paint each row -
1451 for (int visualIndex = top; visualIndex <= bottom; ++visualIndex) {
evaluated: visualIndex <= bottom
TRUEFALSE
yes
Evaluation Count:917
yes
Evaluation Count:518
518-917
1452 int row = verticalHeader->logicalIndex(visualIndex);
executed (the execution status of this line is deduced): int row = verticalHeader->logicalIndex(visualIndex);
-
1453 if (verticalHeader->isSectionHidden(row))
partially evaluated: verticalHeader->isSectionHidden(row)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:917
0-917
1454 continue;
never executed: continue;
0
1455 int rowY = rowViewportPosition(row);
executed (the execution status of this line is deduced): int rowY = rowViewportPosition(row);
-
1456 rowY += offset.y();
executed (the execution status of this line is deduced): rowY += offset.y();
-
1457 int rowh = rowHeight(row) - gridSize;
executed (the execution status of this line is deduced): int rowh = rowHeight(row) - gridSize;
-
1458 painter.drawLine(dirtyArea.left(), rowY + rowh, dirtyArea.right(), rowY + rowh);
executed (the execution status of this line is deduced): painter.drawLine(dirtyArea.left(), rowY + rowh, dirtyArea.right(), rowY + rowh);
-
1459 }
executed: }
Execution Count:917
917
1460 -
1461 // Paint each column -
1462 for (int h = left; h <= right; ++h) {
evaluated: h <= right
TRUEFALSE
yes
Evaluation Count:777
yes
Evaluation Count:518
518-777
1463 int col = horizontalHeader->logicalIndex(h);
executed (the execution status of this line is deduced): int col = horizontalHeader->logicalIndex(h);
-
1464 if (horizontalHeader->isSectionHidden(col))
partially evaluated: horizontalHeader->isSectionHidden(col)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:777
0-777
1465 continue;
never executed: continue;
0
1466 int colp = columnViewportPosition(col);
executed (the execution status of this line is deduced): int colp = columnViewportPosition(col);
-
1467 colp += offset.x();
executed (the execution status of this line is deduced): colp += offset.x();
-
1468 if (!rightToLeft)
evaluated: !rightToLeft
TRUEFALSE
yes
Evaluation Count:771
yes
Evaluation Count:6
6-771
1469 colp += columnWidth(col) - gridSize;
executed: colp += columnWidth(col) - gridSize;
Execution Count:771
771
1470 painter.drawLine(colp, dirtyArea.top(), colp, dirtyArea.bottom());
executed (the execution status of this line is deduced): painter.drawLine(colp, dirtyArea.top(), colp, dirtyArea.bottom());
-
1471 }
executed: }
Execution Count:777
777
1472 -
1473 //draw the top & left grid lines if the headers are not visible. -
1474 //We do update this line when subsequent scroll happen (see scrollContentsBy) -
1475 if (horizontalHeader->isHidden() && verticalScrollMode() == ScrollPerItem)
partially evaluated: horizontalHeader->isHidden()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:518
never evaluated: verticalScrollMode() == ScrollPerItem
0-518
1476 painter.drawLine(dirtyArea.left(), 0, dirtyArea.right(), 0);
never executed: painter.drawLine(dirtyArea.left(), 0, dirtyArea.right(), 0);
0
1477 if (verticalHeader->isHidden() && horizontalScrollMode() == ScrollPerItem)
partially evaluated: verticalHeader->isHidden()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:518
never evaluated: horizontalScrollMode() == ScrollPerItem
0-518
1478 painter.drawLine(0, dirtyArea.top(), 0, dirtyArea.bottom());
never executed: painter.drawLine(0, dirtyArea.top(), 0, dirtyArea.bottom());
0
1479 painter.setPen(old);
executed (the execution status of this line is deduced): painter.setPen(old);
-
1480 }
executed: }
Execution Count:518
518
1481 }
executed: }
Execution Count:642
642
1482 -
1483#ifndef QT_NO_DRAGANDDROP -
1484 // Paint the dropIndicator -
1485 d->paintDropIndicator(&painter);
executed (the execution status of this line is deduced): d->paintDropIndicator(&painter);
-
1486#endif -
1487}
executed: }
Execution Count:335
335
1488 -
1489/*! -
1490 Returns the index position of the model item corresponding to the -
1491 table item at position \a pos in contents coordinates. -
1492*/ -
1493QModelIndex QTableView::indexAt(const QPoint &pos) const -
1494{ -
1495 Q_D(const QTableView);
executed (the execution status of this line is deduced): const QTableViewPrivate * const d = d_func();
-
1496 d->executePostedLayout();
executed (the execution status of this line is deduced): d->executePostedLayout();
-
1497 int r = rowAt(pos.y());
executed (the execution status of this line is deduced): int r = rowAt(pos.y());
-
1498 int c = columnAt(pos.x());
executed (the execution status of this line is deduced): int c = columnAt(pos.x());
-
1499 if (r >= 0 && c >= 0) {
evaluated: r >= 0
TRUEFALSE
yes
Evaluation Count:6254
yes
Evaluation Count:50
evaluated: c >= 0
TRUEFALSE
yes
Evaluation Count:6253
yes
Evaluation Count:1
1-6254
1500 if (d->hasSpans()) {
evaluated: d->hasSpans()
TRUEFALSE
yes
Evaluation Count:141
yes
Evaluation Count:6112
141-6112
1501 QSpanCollection::Span span = d->span(r, c);
executed (the execution status of this line is deduced): QSpanCollection::Span span = d->span(r, c);
-
1502 r = span.top();
executed (the execution status of this line is deduced): r = span.top();
-
1503 c = span.left();
executed (the execution status of this line is deduced): c = span.left();
-
1504 }
executed: }
Execution Count:141
141
1505 return d->model->index(r, c, d->root);
executed: return d->model->index(r, c, d->root);
Execution Count:6253
6253
1506 } -
1507 return QModelIndex();
executed: return QModelIndex();
Execution Count:51
51
1508} -
1509 -
1510/*! -
1511 Returns the horizontal offset of the items in the table view. -
1512 -
1513 Note that the table view uses the horizontal header section -
1514 positions to determine the positions of columns in the view. -
1515 -
1516 \sa verticalOffset() -
1517*/ -
1518int QTableView::horizontalOffset() const -
1519{ -
1520 Q_D(const QTableView);
executed (the execution status of this line is deduced): const QTableViewPrivate * const d = d_func();
-
1521 return d->horizontalHeader->offset();
executed: return d->horizontalHeader->offset();
Execution Count:1470
1470
1522} -
1523 -
1524/*! -
1525 Returns the vertical offset of the items in the table view. -
1526 -
1527 Note that the table view uses the vertical header section -
1528 positions to determine the positions of rows in the view. -
1529 -
1530 \sa horizontalOffset() -
1531*/ -
1532int QTableView::verticalOffset() const -
1533{ -
1534 Q_D(const QTableView);
executed (the execution status of this line is deduced): const QTableViewPrivate * const d = d_func();
-
1535 return d->verticalHeader->offset();
executed: return d->verticalHeader->offset();
Execution Count:1470
1470
1536} -
1537 -
1538/*! -
1539 \fn QModelIndex QTableView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers) -
1540 -
1541 Moves the cursor in accordance with the given \a cursorAction, using the -
1542 information provided by the \a modifiers. -
1543 -
1544 \sa QAbstractItemView::CursorAction -
1545*/ -
1546QModelIndex QTableView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers) -
1547{ -
1548 Q_D(QTableView);
executed (the execution status of this line is deduced): QTableViewPrivate * const d = d_func();
-
1549 Q_UNUSED(modifiers);
executed (the execution status of this line is deduced): (void)modifiers;;
-
1550 -
1551 int bottom = d->model->rowCount(d->root) - 1;
executed (the execution status of this line is deduced): int bottom = d->model->rowCount(d->root) - 1;
-
1552 // make sure that bottom is the bottommost *visible* row -
1553 while (bottom >= 0 && isRowHidden(d->logicalRow(bottom)))
evaluated: bottom >= 0
TRUEFALSE
yes
Evaluation Count:334
yes
Evaluation Count:6
evaluated: isRowHidden(d->logicalRow(bottom))
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:331
3-334
1554 --bottom;
executed: --bottom;
Execution Count:3
3
1555 -
1556 int right = d->model->columnCount(d->root) - 1;
executed (the execution status of this line is deduced): int right = d->model->columnCount(d->root) - 1;
-
1557 -
1558 while (right >= 0 && isColumnHidden(d->logicalColumn(right)))
evaluated: right >= 0
TRUEFALSE
yes
Evaluation Count:340
yes
Evaluation Count:6
evaluated: isColumnHidden(d->logicalColumn(right))
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:331
6-340
1559 --right;
executed: --right;
Execution Count:9
9
1560 -
1561 if (bottom == -1 || right == -1)
evaluated: bottom == -1
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:331
partially evaluated: right == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:331
0-331
1562 return QModelIndex(); // model is empty
executed: return QModelIndex();
Execution Count:6
6
1563 -
1564 QModelIndex current = currentIndex();
executed (the execution status of this line is deduced): QModelIndex current = currentIndex();
-
1565 -
1566 if (!current.isValid()) {
evaluated: !current.isValid()
TRUEFALSE
yes
Evaluation Count:38
yes
Evaluation Count:293
38-293
1567 int row = 0;
executed (the execution status of this line is deduced): int row = 0;
-
1568 int column = 0;
executed (the execution status of this line is deduced): int column = 0;
-
1569 while (column < right && isColumnHidden(d->logicalColumn(column)))
evaluated: column < right
TRUEFALSE
yes
Evaluation Count:26
yes
Evaluation Count:13
evaluated: isColumnHidden(d->logicalColumn(column))
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:25
1-26
1570 ++column;
executed: ++column;
Execution Count:1
1
1571 while (isRowHidden(d->logicalRow(row)) && row < bottom)
partially evaluated: isRowHidden(d->logicalRow(row))
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:38
never evaluated: row < bottom
0-38
1572 ++row;
never executed: ++row;
0
1573 d->visualCursor = QPoint(column, row);
executed (the execution status of this line is deduced): d->visualCursor = QPoint(column, row);
-
1574 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
1575 } -
1576 -
1577 // Update visual cursor if current index has changed. -
1578 QPoint visualCurrent(d->visualColumn(current.column()), d->visualRow(current.row()));
executed (the execution status of this line is deduced): QPoint visualCurrent(d->visualColumn(current.column()), d->visualRow(current.row()));
-
1579 if (visualCurrent != d->visualCursor) {
evaluated: visualCurrent != d->visualCursor
TRUEFALSE
yes
Evaluation Count:110
yes
Evaluation Count:183
110-183
1580 if (d->hasSpans()) {
evaluated: d->hasSpans()
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:101
9-101
1581 QSpanCollection::Span span = d->span(current.row(), current.column());
executed (the execution status of this line is deduced): QSpanCollection::Span span = d->span(current.row(), current.column());
-
1582 if (span.top() > d->visualCursor.y() || d->visualCursor.y() > span.bottom()
evaluated: span.top() > d->visualCursor.y()
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:1
partially evaluated: d->visualCursor.y() > span.bottom()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-8
1583 || span.left() > d->visualCursor.x() || d->visualCursor.x() > span.right())
partially evaluated: span.left() > d->visualCursor.x()
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
never evaluated: d->visualCursor.x() > span.right()
0-1
1584 d->visualCursor = visualCurrent;
executed: d->visualCursor = visualCurrent;
Execution Count:9
9
1585 } else {
executed: }
Execution Count:9
9
1586 d->visualCursor = visualCurrent;
executed (the execution status of this line is deduced): d->visualCursor = visualCurrent;
-
1587 }
executed: }
Execution Count:101
101
1588 } -
1589 -
1590 int visualRow = d->visualCursor.y();
executed (the execution status of this line is deduced): int visualRow = d->visualCursor.y();
-
1591 if (visualRow > bottom)
partially evaluated: visualRow > bottom
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:293
0-293
1592 visualRow = bottom;
never executed: visualRow = bottom;
0
1593 Q_ASSERT(visualRow != -1);
executed (the execution status of this line is deduced): qt_noop();
-
1594 int visualColumn = d->visualCursor.x();
executed (the execution status of this line is deduced): int visualColumn = d->visualCursor.x();
-
1595 if (visualColumn > right)
evaluated: visualColumn > right
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:292
1-292
1596 visualColumn = right;
executed: visualColumn = right;
Execution Count:1
1
1597 Q_ASSERT(visualColumn != -1);
executed (the execution status of this line is deduced): qt_noop();
-
1598 -
1599 if (isRightToLeft()) {
partially evaluated: isRightToLeft()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:293
0-293
1600 if (cursorAction == MoveLeft)
never evaluated: cursorAction == MoveLeft
0
1601 cursorAction = MoveRight;
never executed: cursorAction = MoveRight;
0
1602 else if (cursorAction == MoveRight)
never evaluated: cursorAction == MoveRight
0
1603 cursorAction = MoveLeft;
never executed: cursorAction = MoveLeft;
0
1604 } -
1605 -
1606 switch (cursorAction) { -
1607 case MoveUp: { -
1608 int originalRow = visualRow;
executed (the execution status of this line is deduced): int originalRow = visualRow;
-
1609#ifdef QT_KEYPAD_NAVIGATION -
1610 if (QApplication::keypadNavigationEnabled() && visualRow == 0) -
1611 visualRow = d->visualRow(model()->rowCount() - 1) + 1; -
1612 // FIXME? visualRow = bottom + 1; -
1613#endif -
1614 int r = d->logicalRow(visualRow);
executed (the execution status of this line is deduced): int r = d->logicalRow(visualRow);
-
1615 int c = d->logicalColumn(visualColumn);
executed (the execution status of this line is deduced): int c = d->logicalColumn(visualColumn);
-
1616 if (r != -1 && d->hasSpans()) {
partially evaluated: r != -1
TRUEFALSE
yes
Evaluation Count:59
no
Evaluation Count:0
evaluated: d->hasSpans()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:57
0-59
1617 QSpanCollection::Span span = d->span(r, c);
executed (the execution status of this line is deduced): QSpanCollection::Span span = d->span(r, c);
-
1618 if (span.width() > 1 || span.height() > 1)
evaluated: span.width() > 1
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
partially evaluated: span.height() > 1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
1619 visualRow = d->visualRow(span.top());
executed: visualRow = d->visualRow(span.top());
Execution Count:1
1
1620 }
executed: }
Execution Count:2
2
1621 while (visualRow >= 0) {
partially evaluated: visualRow >= 0
TRUEFALSE
yes
Evaluation Count:79
no
Evaluation Count:0
0-79
1622 --visualRow;
executed (the execution status of this line is deduced): --visualRow;
-
1623 r = d->logicalRow(visualRow);
executed (the execution status of this line is deduced): r = d->logicalRow(visualRow);
-
1624 c = d->logicalColumn(visualColumn);
executed (the execution status of this line is deduced): c = d->logicalColumn(visualColumn);
-
1625 if (r == -1 || (!isRowHidden(r) && d->isCellEnabled(r, c)))
evaluated: r == -1
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:64
evaluated: !isRowHidden(r)
TRUEFALSE
yes
Evaluation Count:62
yes
Evaluation Count:2
evaluated: d->isCellEnabled(r, c)
TRUEFALSE
yes
Evaluation Count:44
yes
Evaluation Count:18
2-64
1626 break;
executed: break;
Execution Count:59
59
1627 }
executed: }
Execution Count:20
20
1628 if (visualRow < 0)
evaluated: visualRow < 0
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:44
15-44
1629 visualRow = originalRow;
executed: visualRow = originalRow;
Execution Count:15
15
1630 break;
executed: break;
Execution Count:59
59
1631 } -
1632 case MoveDown: { -
1633 int originalRow = visualRow;
executed (the execution status of this line is deduced): int originalRow = visualRow;
-
1634 if (d->hasSpans()) {
evaluated: d->hasSpans()
TRUEFALSE
yes
Evaluation Count:49
yes
Evaluation Count:76
49-76
1635 QSpanCollection::Span span = d->span(current.row(), current.column());
executed (the execution status of this line is deduced): QSpanCollection::Span span = d->span(current.row(), current.column());
-
1636 visualRow = d->visualRow(d->rowSpanEndLogical(span.top(), span.height()));
executed (the execution status of this line is deduced): visualRow = d->visualRow(d->rowSpanEndLogical(span.top(), span.height()));
-
1637 }
executed: }
Execution Count:49
49
1638#ifdef QT_KEYPAD_NAVIGATION -
1639 if (QApplication::keypadNavigationEnabled() && visualRow >= bottom) -
1640 visualRow = -1; -
1641#endif -
1642 int r = d->logicalRow(visualRow);
executed (the execution status of this line is deduced): int r = d->logicalRow(visualRow);
-
1643 int c = d->logicalColumn(visualColumn);
executed (the execution status of this line is deduced): int c = d->logicalColumn(visualColumn);
-
1644 if (r != -1 && d->hasSpans()) {
partially evaluated: r != -1
TRUEFALSE
yes
Evaluation Count:125
no
Evaluation Count:0
evaluated: d->hasSpans()
TRUEFALSE
yes
Evaluation Count:49
yes
Evaluation Count:76
0-125
1645 QSpanCollection::Span span = d->span(r, c);
executed (the execution status of this line is deduced): QSpanCollection::Span span = d->span(r, c);
-
1646 if (span.width() > 1 || span.height() > 1)
evaluated: span.width() > 1
TRUEFALSE
yes
Evaluation Count:44
yes
Evaluation Count:5
partially evaluated: span.height() > 1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-44
1647 visualRow = d->visualRow(d->rowSpanEndLogical(span.top(), span.height()));
executed: visualRow = d->visualRow(d->rowSpanEndLogical(span.top(), span.height()));
Execution Count:44
44
1648 }
executed: }
Execution Count:49
49
1649 while (visualRow <= bottom) {
evaluated: visualRow <= bottom
TRUEFALSE
yes
Evaluation Count:128
yes
Evaluation Count:1
1-128
1650 ++visualRow;
executed (the execution status of this line is deduced): ++visualRow;
-
1651 r = d->logicalRow(visualRow);
executed (the execution status of this line is deduced): r = d->logicalRow(visualRow);
-
1652 c = d->logicalColumn(visualColumn);
executed (the execution status of this line is deduced): c = d->logicalColumn(visualColumn);
-
1653 if (r == -1 || (!isRowHidden(r) && d->isCellEnabled(r, c)))
evaluated: r == -1
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:125
evaluated: !isRowHidden(r)
TRUEFALSE
yes
Evaluation Count:122
yes
Evaluation Count:3
evaluated: d->isCellEnabled(r, c)
TRUEFALSE
yes
Evaluation Count:121
yes
Evaluation Count:1
1-125
1654 break;
executed: break;
Execution Count:124
124
1655 }
executed: }
Execution Count:4
4
1656 if (visualRow > bottom)
evaluated: visualRow > bottom
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:121
4-121
1657 visualRow = originalRow;
executed: visualRow = originalRow;
Execution Count:4
4
1658 break;
executed: break;
Execution Count:125
125
1659 } -
1660 case MovePrevious: -
1661 case MoveLeft: { -
1662 int originalRow = visualRow;
executed (the execution status of this line is deduced): int originalRow = visualRow;
-
1663 int originalColumn = visualColumn;
executed (the execution status of this line is deduced): int originalColumn = visualColumn;
-
1664 bool firstTime = true;
executed (the execution status of this line is deduced): bool firstTime = true;
-
1665 bool looped = false;
executed (the execution status of this line is deduced): bool looped = false;
-
1666 bool wrapped = false;
executed (the execution status of this line is deduced): bool wrapped = false;
-
1667 do { -
1668 int r = d->logicalRow(visualRow);
executed (the execution status of this line is deduced): int r = d->logicalRow(visualRow);
-
1669 int c = d->logicalColumn(visualColumn);
executed (the execution status of this line is deduced): int c = d->logicalColumn(visualColumn);
-
1670 if (firstTime && c != -1 && d->hasSpans()) {
partially evaluated: firstTime
TRUEFALSE
yes
Evaluation Count:68
no
Evaluation Count:0
evaluated: c != -1
TRUEFALSE
yes
Evaluation Count:58
yes
Evaluation Count:10
evaluated: d->hasSpans()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:56
0-68
1671 firstTime = false;
executed (the execution status of this line is deduced): firstTime = false;
-
1672 QSpanCollection::Span span = d->span(r, c);
executed (the execution status of this line is deduced): QSpanCollection::Span span = d->span(r, c);
-
1673 if (span.width() > 1 || span.height() > 1)
evaluated: span.width() > 1
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
partially evaluated: span.height() > 1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
1674 visualColumn = d->visualColumn(span.left());
executed: visualColumn = d->visualColumn(span.left());
Execution Count:1
1
1675 }
executed: }
Execution Count:2
2
1676 while (visualColumn >= 0) {
partially evaluated: visualColumn >= 0
TRUEFALSE
yes
Evaluation Count:86
no
Evaluation Count:0
0-86
1677 --visualColumn;
executed (the execution status of this line is deduced): --visualColumn;
-
1678 r = d->logicalRow(visualRow);
executed (the execution status of this line is deduced): r = d->logicalRow(visualRow);
-
1679 c = d->logicalColumn(visualColumn);
executed (the execution status of this line is deduced): c = d->logicalColumn(visualColumn);
-
1680 if (r == -1 || c == -1 || (!isRowHidden(r) && !isColumnHidden(c) && d->isCellEnabled(r, c)))
partially evaluated: r == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:86
evaluated: c == -1
TRUEFALSE
yes
Evaluation Count:28
yes
Evaluation Count:58
evaluated: !isRowHidden(r)
TRUEFALSE
yes
Evaluation Count:54
yes
Evaluation Count:4
evaluated: !isColumnHidden(c)
TRUEFALSE
yes
Evaluation Count:48
yes
Evaluation Count:6
evaluated: d->isCellEnabled(r, c)
TRUEFALSE
yes
Evaluation Count:39
yes
Evaluation Count:9
0-86
1681 break;
executed: break;
Execution Count:67
67
1682 if (wrapped && (originalRow < visualRow || (originalRow == visualRow && originalColumn <= visualColumn))) {
evaluated: wrapped
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:18
partially evaluated: originalRow < visualRow
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
never evaluated: originalRow == visualRow
never evaluated: originalColumn <= visualColumn
0-18
1683 looped = true;
executed (the execution status of this line is deduced): looped = true;
-
1684 break;
executed: break;
Execution Count:1
1
1685 } -
1686 }
executed: }
Execution Count:18
18
1687 if (cursorAction == MoveLeft || visualColumn >= 0)
evaluated: cursorAction == MoveLeft
TRUEFALSE
yes
Evaluation Count:45
yes
Evaluation Count:23
evaluated: visualColumn >= 0
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:10
10-45
1688 break;
executed: break;
Execution Count:58
58
1689 visualColumn = right + 1;
executed (the execution status of this line is deduced): visualColumn = right + 1;
-
1690 if (visualRow == 0) {
evaluated: visualRow == 0
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:5
5
1691 wrapped = true;
executed (the execution status of this line is deduced): wrapped = true;
-
1692 visualRow = bottom;
executed (the execution status of this line is deduced): visualRow = bottom;
-
1693 } else {
executed: }
Execution Count:5
5
1694 --visualRow;
executed (the execution status of this line is deduced): --visualRow;
-
1695 }
executed: }
Execution Count:5
5
1696 } while (!looped);
partially evaluated: !looped
TRUEFALSE
yes
Evaluation Count:10
no
Evaluation Count:0
0-10
1697 if (visualColumn < 0)
evaluated: visualColumn < 0
TRUEFALSE
yes
Evaluation Count:18
yes
Evaluation Count:40
18-40
1698 visualColumn = originalColumn;
executed: visualColumn = originalColumn;
Execution Count:18
18
1699 break;
executed: break;
Execution Count:58
58
1700 } -
1701 case MoveNext: -
1702 case MoveRight: { -
1703 int originalRow = visualRow;
executed (the execution status of this line is deduced): int originalRow = visualRow;
-
1704 int originalColumn = visualColumn;
executed (the execution status of this line is deduced): int originalColumn = visualColumn;
-
1705 bool firstTime = true;
executed (the execution status of this line is deduced): bool firstTime = true;
-
1706 bool looped = false;
executed (the execution status of this line is deduced): bool looped = false;
-
1707 bool wrapped = false;
executed (the execution status of this line is deduced): bool wrapped = false;
-
1708 do { -
1709 int r = d->logicalRow(visualRow);
executed (the execution status of this line is deduced): int r = d->logicalRow(visualRow);
-
1710 int c = d->logicalColumn(visualColumn);
executed (the execution status of this line is deduced): int c = d->logicalColumn(visualColumn);
-
1711 if (firstTime && c != -1 && d->hasSpans()) {
partially evaluated: firstTime
TRUEFALSE
yes
Evaluation Count:44
no
Evaluation Count:0
evaluated: c != -1
TRUEFALSE
yes
Evaluation Count:31
yes
Evaluation Count:13
evaluated: d->hasSpans()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:27
0-44
1712 firstTime = false;
executed (the execution status of this line is deduced): firstTime = false;
-
1713 QSpanCollection::Span span = d->span(r, c);
executed (the execution status of this line is deduced): QSpanCollection::Span span = d->span(r, c);
-
1714 if (span.width() > 1 || span.height() > 1)
evaluated: span.width() > 1
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:3
partially evaluated: span.height() > 1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
1715 visualColumn = d->visualColumn(d->columnSpanEndLogical(span.left(), span.width()));
executed: visualColumn = d->visualColumn(d->columnSpanEndLogical(span.left(), span.width()));
Execution Count:1
1
1716 }
executed: }
Execution Count:4
4
1717 while (visualColumn <= right) {
evaluated: visualColumn <= right
TRUEFALSE
yes
Evaluation Count:90
yes
Evaluation Count:5
5-90
1718 ++visualColumn;
executed (the execution status of this line is deduced): ++visualColumn;
-
1719 r = d->logicalRow(visualRow);
executed (the execution status of this line is deduced): r = d->logicalRow(visualRow);
-
1720 c = d->logicalColumn(visualColumn);
executed (the execution status of this line is deduced): c = d->logicalColumn(visualColumn);
-
1721 if (r == -1 || c == -1 || (!isRowHidden(r) && !isColumnHidden(c) && d->isCellEnabled(r, c)))
partially evaluated: r == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:90
evaluated: c == -1
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:76
partially evaluated: !isRowHidden(r)
TRUEFALSE
yes
Evaluation Count:76
no
Evaluation Count:0
evaluated: !isColumnHidden(c)
TRUEFALSE
yes
Evaluation Count:68
yes
Evaluation Count:8
evaluated: d->isCellEnabled(r, c)
TRUEFALSE
yes
Evaluation Count:24
yes
Evaluation Count:44
0-90
1722 break;
executed: break;
Execution Count:38
38
1723 if (wrapped && (originalRow > visualRow || (originalRow == visualRow && originalColumn >= visualColumn))) {
evaluated: wrapped
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:51
partially evaluated: originalRow > visualRow
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
never evaluated: originalRow == visualRow
never evaluated: originalColumn >= visualColumn
0-51
1724 looped = true;
executed (the execution status of this line is deduced): looped = true;
-
1725 break;
executed: break;
Execution Count:1
1
1726 } -
1727 }
executed: }
Execution Count:51
51
1728 if (cursorAction == MoveRight || visualColumn <= right)
evaluated: cursorAction == MoveRight
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:33
evaluated: visualColumn <= right
TRUEFALSE
yes
Evaluation Count:20
yes
Evaluation Count:13
11-33
1729 break;
executed: break;
Execution Count:31
31
1730 visualColumn = -1;
executed (the execution status of this line is deduced): visualColumn = -1;
-
1731 if (visualRow == bottom) {
evaluated: visualRow == bottom
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:9
4-9
1732 wrapped = true;
executed (the execution status of this line is deduced): wrapped = true;
-
1733 visualRow = 0;
executed (the execution status of this line is deduced): visualRow = 0;
-
1734 } else {
executed: }
Execution Count:4
4
1735 ++visualRow;
executed (the execution status of this line is deduced): ++visualRow;
-
1736 }
executed: }
Execution Count:9
9
1737 } while (!looped);
partially evaluated: !looped
TRUEFALSE
yes
Evaluation Count:13
no
Evaluation Count:0
0-13
1738 if (visualColumn > right)
evaluated: visualColumn > right
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:25
6-25
1739 visualColumn = originalColumn;
executed: visualColumn = originalColumn;
Execution Count:6
6
1740 break;
executed: break;
Execution Count:31
31
1741 } -
1742 case MoveHome: -
1743 visualColumn = 0;
executed (the execution status of this line is deduced): visualColumn = 0;
-
1744 while (visualColumn < right && d->isVisualColumnHiddenOrDisabled(visualRow, visualColumn))
partially evaluated: visualColumn < right
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
evaluated: d->isVisualColumnHiddenOrDisabled(visualRow, visualColumn)
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:6
0-8
1745 ++visualColumn;
executed: ++visualColumn;
Execution Count:2
2
1746 if (modifiers & Qt::ControlModifier) {
evaluated: modifiers & Qt::ControlModifier
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:3
3
1747 visualRow = 0;
executed (the execution status of this line is deduced): visualRow = 0;
-
1748 while (visualRow < bottom && d->isVisualRowHiddenOrDisabled(visualRow, visualColumn))
partially evaluated: visualRow < bottom
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
evaluated: d->isVisualRowHiddenOrDisabled(visualRow, visualColumn)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:3
0-4
1749 ++visualRow;
executed: ++visualRow;
Execution Count:1
1
1750 }
executed: }
Execution Count:3
3
1751 break;
executed: break;
Execution Count:6
6
1752 case MoveEnd: -
1753 visualColumn = right;
executed (the execution status of this line is deduced): visualColumn = right;
-
1754 if (modifiers & Qt::ControlModifier)
evaluated: modifiers & Qt::ControlModifier
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:3
3-4
1755 visualRow = bottom;
executed: visualRow = bottom;
Execution Count:4
4
1756 break;
executed: break;
Execution Count:7
7
1757 case MovePageUp: { -
1758 int newRow = rowAt(visualRect(current).top() - d->viewport->height());
executed (the execution status of this line is deduced): int newRow = rowAt(visualRect(current).top() - d->viewport->height());
-
1759 if (newRow == -1)
partially evaluated: newRow == -1
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
1760 newRow = d->logicalRow(0);
executed: newRow = d->logicalRow(0);
Execution Count:3
3
1761 return d->model->index(newRow, current.column(), d->root);
executed: return d->model->index(newRow, current.column(), d->root);
Execution Count:3
3
1762 } -
1763 case MovePageDown: { -
1764 int newRow = rowAt(visualRect(current).bottom() + d->viewport->height());
executed (the execution status of this line is deduced): int newRow = rowAt(visualRect(current).bottom() + d->viewport->height());
-
1765 if (newRow == -1)
evaluated: newRow == -1
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:1
1-3
1766 newRow = d->logicalRow(bottom);
executed: newRow = d->logicalRow(bottom);
Execution Count:3
3
1767 return d->model->index(newRow, current.column(), d->root);
executed: return d->model->index(newRow, current.column(), d->root);
Execution Count:4
4
1768 }} -
1769 -
1770 d->visualCursor = QPoint(visualColumn, visualRow);
executed (the execution status of this line is deduced): d->visualCursor = QPoint(visualColumn, visualRow);
-
1771 int logicalRow = d->logicalRow(visualRow);
executed (the execution status of this line is deduced): int logicalRow = d->logicalRow(visualRow);
-
1772 int logicalColumn = d->logicalColumn(visualColumn);
executed (the execution status of this line is deduced): int logicalColumn = d->logicalColumn(visualColumn);
-
1773 if (!d->model->hasIndex(logicalRow, logicalColumn, d->root))
partially evaluated: !d->model->hasIndex(logicalRow, logicalColumn, d->root)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:286
0-286
1774 return QModelIndex();
never executed: return QModelIndex();
0
1775 -
1776 QModelIndex result = d->model->index(logicalRow, logicalColumn, d->root);
executed (the execution status of this line is deduced): QModelIndex result = d->model->index(logicalRow, logicalColumn, d->root);
-
1777 if (!d->isRowHidden(logicalRow) && !d->isColumnHidden(logicalColumn) && d->isIndexEnabled(result))
partially evaluated: !d->isRowHidden(logicalRow)
TRUEFALSE
yes
Evaluation Count:286
no
Evaluation Count:0
evaluated: !d->isColumnHidden(logicalColumn)
TRUEFALSE
yes
Evaluation Count:285
yes
Evaluation Count:1
evaluated: d->isIndexEnabled(result)
TRUEFALSE
yes
Evaluation Count:283
yes
Evaluation Count:2
0-286
1778 return result;
executed: return result;
Execution Count:283
283
1779 -
1780 return QModelIndex();
executed: return QModelIndex();
Execution Count:3
3
1781} -
1782 -
1783/*! -
1784 \fn void QTableView::setSelection(const QRect &rect, -
1785 QItemSelectionModel::SelectionFlags flags) -
1786 -
1787 Selects the items within the given \a rect and in accordance with -
1788 the specified selection \a flags. -
1789*/ -
1790void QTableView::setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags command) -
1791{ -
1792 Q_D(QTableView);
executed (the execution status of this line is deduced): QTableViewPrivate * const d = d_func();
-
1793 QModelIndex tl = indexAt(QPoint(isRightToLeft() ? qMax(rect.left(), rect.right())
executed (the execution status of this line is deduced): QModelIndex tl = indexAt(QPoint(isRightToLeft() ? qMax(rect.left(), rect.right())
-
1794 : qMin(rect.left(), rect.right()), qMin(rect.top(), rect.bottom())));
executed (the execution status of this line is deduced): : qMin(rect.left(), rect.right()), qMin(rect.top(), rect.bottom())));
-
1795 QModelIndex br = indexAt(QPoint(isRightToLeft() ? qMin(rect.left(), rect.right()) :
executed (the execution status of this line is deduced): QModelIndex br = indexAt(QPoint(isRightToLeft() ? qMin(rect.left(), rect.right()) :
-
1796 qMax(rect.left(), rect.right()), qMax(rect.top(), rect.bottom())));
executed (the execution status of this line is deduced): qMax(rect.left(), rect.right()), qMax(rect.top(), rect.bottom())));
-
1797 if (!d->selectionModel || !tl.isValid() || !br.isValid() || !d->isIndexEnabled(tl) || !d->isIndexEnabled(br))
evaluated: !d->selectionModel
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:468
evaluated: !tl.isValid()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:467
partially evaluated: !br.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:467
partially evaluated: !d->isIndexEnabled(tl)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:467
partially evaluated: !d->isIndexEnabled(br)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:467
0-468
1798 return;
executed: return;
Execution Count:3
3
1799 -
1800 bool verticalMoved = verticalHeader()->sectionsMoved();
executed (the execution status of this line is deduced): bool verticalMoved = verticalHeader()->sectionsMoved();
-
1801 bool horizontalMoved = horizontalHeader()->sectionsMoved();
executed (the execution status of this line is deduced): bool horizontalMoved = horizontalHeader()->sectionsMoved();
-
1802 -
1803 QItemSelection selection;
executed (the execution status of this line is deduced): QItemSelection selection;
-
1804 -
1805 if (d->hasSpans()) {
evaluated: d->hasSpans()
TRUEFALSE
yes
Evaluation Count:47
yes
Evaluation Count:420
47-420
1806 bool expanded;
executed (the execution status of this line is deduced): bool expanded;
-
1807 int top = qMin(d->visualRow(tl.row()), d->visualRow(br.row()));
executed (the execution status of this line is deduced): int top = qMin(d->visualRow(tl.row()), d->visualRow(br.row()));
-
1808 int left = qMin(d->visualColumn(tl.column()), d->visualColumn(br.column()));
executed (the execution status of this line is deduced): int left = qMin(d->visualColumn(tl.column()), d->visualColumn(br.column()));
-
1809 int bottom = qMax(d->visualRow(tl.row()), d->visualRow(br.row()));
executed (the execution status of this line is deduced): int bottom = qMax(d->visualRow(tl.row()), d->visualRow(br.row()));
-
1810 int right = qMax(d->visualColumn(tl.column()), d->visualColumn(br.column()));
executed (the execution status of this line is deduced): int right = qMax(d->visualColumn(tl.column()), d->visualColumn(br.column()));
-
1811 do { -
1812 expanded = false;
executed (the execution status of this line is deduced): expanded = false;
-
1813 foreach (QSpanCollection::Span *it, d->spans.spans) {
executed (the execution status of this line is deduced): 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;})) {
-
1814 const QSpanCollection::Span &span = *it;
executed (the execution status of this line is deduced): const QSpanCollection::Span &span = *it;
-
1815 int t = d->visualRow(span.top());
executed (the execution status of this line is deduced): int t = d->visualRow(span.top());
-
1816 int l = d->visualColumn(span.left());
executed (the execution status of this line is deduced): int l = d->visualColumn(span.left());
-
1817 int b = d->visualRow(d->rowSpanEndLogical(span.top(), span.height()));
executed (the execution status of this line is deduced): int b = d->visualRow(d->rowSpanEndLogical(span.top(), span.height()));
-
1818 int r = d->visualColumn(d->columnSpanEndLogical(span.left(), span.width()));
executed (the execution status of this line is deduced): int r = d->visualColumn(d->columnSpanEndLogical(span.left(), span.width()));
-
1819 if ((t > bottom) || (l > right) || (top > b) || (left > r))
evaluated: (t > bottom)
TRUEFALSE
yes
Evaluation Count:1260
yes
Evaluation Count:1982
partially evaluated: (l > right)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1982
evaluated: (top > b)
TRUEFALSE
yes
Evaluation Count:1892
yes
Evaluation Count:90
partially evaluated: (left > r)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:90
0-1982
1820 continue; // no intersect
executed: continue;
Execution Count:3152
3152
1821 if (t < top) {
partially evaluated: t < top
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:90
0-90
1822 top = t;
never executed (the execution status of this line is deduced): top = t;
-
1823 expanded = true;
never executed (the execution status of this line is deduced): expanded = true;
-
1824 }
never executed: }
0
1825 if (l < left) {
partially evaluated: l < left
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:90
0-90
1826 left = l;
never executed (the execution status of this line is deduced): left = l;
-
1827 expanded = true;
never executed (the execution status of this line is deduced): expanded = true;
-
1828 }
never executed: }
0
1829 if (b > bottom) {
partially evaluated: b > bottom
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:90
0-90
1830 bottom = b;
never executed (the execution status of this line is deduced): bottom = b;
-
1831 expanded = true;
never executed (the execution status of this line is deduced): expanded = true;
-
1832 }
never executed: }
0
1833 if (r > right) {
evaluated: r > right
TRUEFALSE
yes
Evaluation Count:44
yes
Evaluation Count:46
44-46
1834 right = r;
executed (the execution status of this line is deduced): right = r;
-
1835 expanded = true;
executed (the execution status of this line is deduced): expanded = true;
-
1836 }
executed: }
Execution Count:44
44
1837 if (expanded)
evaluated: expanded
TRUEFALSE
yes
Evaluation Count:44
yes
Evaluation Count:46
44-46
1838 break;
executed: break;
Execution Count:44
44
1839 }
executed: }
Execution Count:46
46
1840 } while (expanded);
executed: }
Execution Count:91
evaluated: expanded
TRUEFALSE
yes
Evaluation Count:44
yes
Evaluation Count:47
44-91
1841 for (int horizontal = left; horizontal <= right; ++horizontal) {
evaluated: horizontal <= right
TRUEFALSE
yes
Evaluation Count:227
yes
Evaluation Count:47
47-227
1842 int column = d->logicalColumn(horizontal);
executed (the execution status of this line is deduced): int column = d->logicalColumn(horizontal);
-
1843 for (int vertical = top; vertical <= bottom; ++vertical) {
evaluated: vertical <= bottom
TRUEFALSE
yes
Evaluation Count:239
yes
Evaluation Count:227
227-239
1844 int row = d->logicalRow(vertical);
executed (the execution status of this line is deduced): int row = d->logicalRow(vertical);
-
1845 QModelIndex index = d->model->index(row, column, d->root);
executed (the execution status of this line is deduced): QModelIndex index = d->model->index(row, column, d->root);
-
1846 selection.append(QItemSelectionRange(index));
executed (the execution status of this line is deduced): selection.append(QItemSelectionRange(index));
-
1847 }
executed: }
Execution Count:239
239
1848 }
executed: }
Execution Count:227
227
1849 } else if (verticalMoved && horizontalMoved) {
executed: }
Execution Count:47
evaluated: verticalMoved
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:418
partially evaluated: horizontalMoved
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-418
1850 int top = d->visualRow(tl.row());
never executed (the execution status of this line is deduced): int top = d->visualRow(tl.row());
-
1851 int left = d->visualColumn(tl.column());
never executed (the execution status of this line is deduced): int left = d->visualColumn(tl.column());
-
1852 int bottom = d->visualRow(br.row());
never executed (the execution status of this line is deduced): int bottom = d->visualRow(br.row());
-
1853 int right = d->visualColumn(br.column());
never executed (the execution status of this line is deduced): int right = d->visualColumn(br.column());
-
1854 for (int horizontal = left; horizontal <= right; ++horizontal) {
never evaluated: horizontal <= right
0
1855 int column = d->logicalColumn(horizontal);
never executed (the execution status of this line is deduced): int column = d->logicalColumn(horizontal);
-
1856 for (int vertical = top; vertical <= bottom; ++vertical) {
never evaluated: vertical <= bottom
0
1857 int row = d->logicalRow(vertical);
never executed (the execution status of this line is deduced): int row = d->logicalRow(vertical);
-
1858 QModelIndex index = d->model->index(row, column, d->root);
never executed (the execution status of this line is deduced): QModelIndex index = d->model->index(row, column, d->root);
-
1859 selection.append(QItemSelectionRange(index));
never executed (the execution status of this line is deduced): selection.append(QItemSelectionRange(index));
-
1860 }
never executed: }
0
1861 }
never executed: }
0
1862 } else if (horizontalMoved) {
never executed: }
evaluated: horizontalMoved
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:419
0-419
1863 int left = d->visualColumn(tl.column());
executed (the execution status of this line is deduced): int left = d->visualColumn(tl.column());
-
1864 int right = d->visualColumn(br.column());
executed (the execution status of this line is deduced): int right = d->visualColumn(br.column());
-
1865 for (int visual = left; visual <= right; ++visual) {
evaluated: visual <= right
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:1
1-3
1866 int column = d->logicalColumn(visual);
executed (the execution status of this line is deduced): int column = d->logicalColumn(visual);
-
1867 QModelIndex topLeft = d->model->index(tl.row(), column, d->root);
executed (the execution status of this line is deduced): QModelIndex topLeft = d->model->index(tl.row(), column, d->root);
-
1868 QModelIndex bottomRight = d->model->index(br.row(), column, d->root);
executed (the execution status of this line is deduced): QModelIndex bottomRight = d->model->index(br.row(), column, d->root);
-
1869 selection.append(QItemSelectionRange(topLeft, bottomRight));
executed (the execution status of this line is deduced): selection.append(QItemSelectionRange(topLeft, bottomRight));
-
1870 }
executed: }
Execution Count:3
3
1871 } else if (verticalMoved) {
executed: }
Execution Count:1
evaluated: verticalMoved
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:417
1-417
1872 int top = d->visualRow(tl.row());
executed (the execution status of this line is deduced): int top = d->visualRow(tl.row());
-
1873 int bottom = d->visualRow(br.row());
executed (the execution status of this line is deduced): int bottom = d->visualRow(br.row());
-
1874 for (int visual = top; visual <= bottom; ++visual) {
evaluated: visual <= bottom
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:2
2-4
1875 int row = d->logicalRow(visual);
executed (the execution status of this line is deduced): int row = d->logicalRow(visual);
-
1876 QModelIndex topLeft = d->model->index(row, tl.column(), d->root);
executed (the execution status of this line is deduced): QModelIndex topLeft = d->model->index(row, tl.column(), d->root);
-
1877 QModelIndex bottomRight = d->model->index(row, br.column(), d->root);
executed (the execution status of this line is deduced): QModelIndex bottomRight = d->model->index(row, br.column(), d->root);
-
1878 selection.append(QItemSelectionRange(topLeft, bottomRight));
executed (the execution status of this line is deduced): selection.append(QItemSelectionRange(topLeft, bottomRight));
-
1879 }
executed: }
Execution Count:4
4
1880 } else { // nothing moved
executed: }
Execution Count:2
2
1881 QItemSelectionRange range(tl, br);
executed (the execution status of this line is deduced): QItemSelectionRange range(tl, br);
-
1882 if (!range.isEmpty())
partially evaluated: !range.isEmpty()
TRUEFALSE
yes
Evaluation Count:417
no
Evaluation Count:0
0-417
1883 selection.append(range);
executed: selection.append(range);
Execution Count:417
417
1884 }
executed: }
Execution Count:417
417
1885 -
1886 d->selectionModel->select(selection, command);
executed (the execution status of this line is deduced): d->selectionModel->select(selection, command);
-
1887}
executed: }
Execution Count:467
467
1888 -
1889/*! -
1890 \internal -
1891 -
1892 Returns the rectangle from the viewport of the items in the given -
1893 \a selection. -
1894 -
1895 Since 4.7, the returned region only contains rectangles intersecting -
1896 (or included in) the viewport. -
1897*/ -
1898QRegion QTableView::visualRegionForSelection(const QItemSelection &selection) const -
1899{ -
1900 Q_D(const QTableView);
executed (the execution status of this line is deduced): const QTableViewPrivate * const d = d_func();
-
1901 -
1902 if (selection.isEmpty())
evaluated: selection.isEmpty()
TRUEFALSE
yes
Evaluation Count:335
yes
Evaluation Count:1394
335-1394
1903 return QRegion();
executed: return QRegion();
Execution Count:335
335
1904 -
1905 QRegion selectionRegion;
executed (the execution status of this line is deduced): QRegion selectionRegion;
-
1906 const QRect &viewportRect = d->viewport->rect();
executed (the execution status of this line is deduced): const QRect &viewportRect = d->viewport->rect();
-
1907 bool verticalMoved = verticalHeader()->sectionsMoved();
executed (the execution status of this line is deduced): bool verticalMoved = verticalHeader()->sectionsMoved();
-
1908 bool horizontalMoved = horizontalHeader()->sectionsMoved();
executed (the execution status of this line is deduced): bool horizontalMoved = horizontalHeader()->sectionsMoved();
-
1909 -
1910 if ((verticalMoved && horizontalMoved) || (d->hasSpans() && (verticalMoved || horizontalMoved))) {
evaluated: verticalMoved
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:1388
partially evaluated: horizontalMoved
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6
evaluated: d->hasSpans()
TRUEFALSE
yes
Evaluation Count:168
yes
Evaluation Count:1226
partially evaluated: verticalMoved
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:168
partially evaluated: horizontalMoved
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:168
0-1388
1911 for (int i = 0; i < selection.count(); ++i) {
never evaluated: i < selection.count()
0
1912 QItemSelectionRange range = selection.at(i);
never executed (the execution status of this line is deduced): QItemSelectionRange range = selection.at(i);
-
1913 if (range.parent() != d->root || !range.isValid())
never evaluated: range.parent() != d->root
never evaluated: !range.isValid()
0
1914 continue;
never executed: continue;
0
1915 for (int r = range.top(); r <= range.bottom(); ++r)
never evaluated: r <= range.bottom()
0
1916 for (int c = range.left(); c <= range.right(); ++c) {
never evaluated: c <= range.right()
0
1917 const QRect &rangeRect = visualRect(d->model->index(r, c, d->root));
never executed (the execution status of this line is deduced): const QRect &rangeRect = visualRect(d->model->index(r, c, d->root));
-
1918 if (viewportRect.intersects(rangeRect))
never evaluated: viewportRect.intersects(rangeRect)
0
1919 selectionRegion += rangeRect;
never executed: selectionRegion += rangeRect;
0
1920 }
never executed: }
0
1921 }
never executed: }
0
1922 } else if (horizontalMoved) {
never executed: }
evaluated: horizontalMoved
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:1391
0-1391
1923 for (int i = 0; i < selection.count(); ++i) {
evaluated: i < selection.count()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:3
3-5
1924 QItemSelectionRange range = selection.at(i);
executed (the execution status of this line is deduced): QItemSelectionRange range = selection.at(i);
-
1925 if (range.parent() != d->root || !range.isValid())
partially evaluated: range.parent() != d->root
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
partially evaluated: !range.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
1926 continue;
never executed: continue;
0
1927 int top = rowViewportPosition(range.top());
executed (the execution status of this line is deduced): int top = rowViewportPosition(range.top());
-
1928 int bottom = rowViewportPosition(range.bottom()) + rowHeight(range.bottom());
executed (the execution status of this line is deduced): int bottom = rowViewportPosition(range.bottom()) + rowHeight(range.bottom());
-
1929 if (top > bottom)
partially evaluated: top > bottom
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
1930 qSwap<int>(top, bottom);
never executed: qSwap<int>(top, bottom);
0
1931 int height = bottom - top;
executed (the execution status of this line is deduced): int height = bottom - top;
-
1932 for (int c = range.left(); c <= range.right(); ++c) {
evaluated: c <= range.right()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:5
5
1933 const QRect rangeRect(columnViewportPosition(c), top, columnWidth(c), height);
executed (the execution status of this line is deduced): const QRect rangeRect(columnViewportPosition(c), top, columnWidth(c), height);
-
1934 if (viewportRect.intersects(rangeRect))
evaluated: viewportRect.intersects(rangeRect)
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:1
1-4
1935 selectionRegion += rangeRect;
executed: selectionRegion += rangeRect;
Execution Count:4
4
1936 }
executed: }
Execution Count:5
5
1937 }
executed: }
Execution Count:5
5
1938 } else if (verticalMoved) {
executed: }
Execution Count:3
evaluated: verticalMoved
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:1385
3-1385
1939 for (int i = 0; i < selection.count(); ++i) {
evaluated: i < selection.count()
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:6
6-8
1940 QItemSelectionRange range = selection.at(i);
executed (the execution status of this line is deduced): QItemSelectionRange range = selection.at(i);
-
1941 if (range.parent() != d->root || !range.isValid())
partially evaluated: range.parent() != d->root
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
partially evaluated: !range.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
1942 continue;
never executed: continue;
0
1943 int left = columnViewportPosition(range.left());
executed (the execution status of this line is deduced): int left = columnViewportPosition(range.left());
-
1944 int right = columnViewportPosition(range.right()) + columnWidth(range.right());
executed (the execution status of this line is deduced): int right = columnViewportPosition(range.right()) + columnWidth(range.right());
-
1945 if (left > right)
partially evaluated: left > right
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
1946 qSwap<int>(left, right);
never executed: qSwap<int>(left, right);
0
1947 int width = right - left;
executed (the execution status of this line is deduced): int width = right - left;
-
1948 for (int r = range.top(); r <= range.bottom(); ++r) {
evaluated: r <= range.bottom()
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:8
8
1949 const QRect rangeRect(left, rowViewportPosition(r), width, rowHeight(r));
executed (the execution status of this line is deduced): const QRect rangeRect(left, rowViewportPosition(r), width, rowHeight(r));
-
1950 if (viewportRect.intersects(rangeRect))
evaluated: viewportRect.intersects(rangeRect)
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:2
2-6
1951 selectionRegion += rangeRect;
executed: selectionRegion += rangeRect;
Execution Count:6
6
1952 }
executed: }
Execution Count:8
8
1953 }
executed: }
Execution Count:8
8
1954 } else { // nothing moved
executed: }
Execution Count:6
6
1955 const int gridAdjust = showGrid() ? 1 : 0;
evaluated: showGrid()
TRUEFALSE
yes
Evaluation Count:1213
yes
Evaluation Count:172
172-1213
1956 for (int i = 0; i < selection.count(); ++i) {
evaluated: i < selection.count()
TRUEFALSE
yes
Evaluation Count:1744
yes
Evaluation Count:1385
1385-1744
1957 QItemSelectionRange range = selection.at(i);
executed (the execution status of this line is deduced): QItemSelectionRange range = selection.at(i);
-
1958 if (range.parent() != d->root || !range.isValid())
partially evaluated: range.parent() != d->root
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1744
partially evaluated: !range.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1744
0-1744
1959 continue;
never executed: continue;
0
1960 d->trimHiddenSelections(&range);
executed (the execution status of this line is deduced): d->trimHiddenSelections(&range);
-
1961 -
1962 const int rtop = rowViewportPosition(range.top());
executed (the execution status of this line is deduced): const int rtop = rowViewportPosition(range.top());
-
1963 const int rbottom = rowViewportPosition(range.bottom()) + rowHeight(range.bottom());
executed (the execution status of this line is deduced): const int rbottom = rowViewportPosition(range.bottom()) + rowHeight(range.bottom());
-
1964 int rleft;
executed (the execution status of this line is deduced): int rleft;
-
1965 int rright;
executed (the execution status of this line is deduced): int rright;
-
1966 if (isLeftToRight()) {
evaluated: isLeftToRight()
TRUEFALSE
yes
Evaluation Count:1743
yes
Evaluation Count:1
1-1743
1967 rleft = columnViewportPosition(range.left());
executed (the execution status of this line is deduced): rleft = columnViewportPosition(range.left());
-
1968 rright = columnViewportPosition(range.right()) + columnWidth(range.right());
executed (the execution status of this line is deduced): rright = columnViewportPosition(range.right()) + columnWidth(range.right());
-
1969 } else {
executed: }
Execution Count:1743
1743
1970 rleft = columnViewportPosition(range.right());
executed (the execution status of this line is deduced): rleft = columnViewportPosition(range.right());
-
1971 rright = columnViewportPosition(range.left()) + columnWidth(range.left());
executed (the execution status of this line is deduced): rright = columnViewportPosition(range.left()) + columnWidth(range.left());
-
1972 }
executed: }
Execution Count:1
1
1973 const QRect rangeRect(QPoint(rleft, rtop), QPoint(rright - 1 - gridAdjust, rbottom - 1 - gridAdjust));
executed (the execution status of this line is deduced): const QRect rangeRect(QPoint(rleft, rtop), QPoint(rright - 1 - gridAdjust, rbottom - 1 - gridAdjust));
-
1974 if (viewportRect.intersects(rangeRect))
evaluated: viewportRect.intersects(rangeRect)
TRUEFALSE
yes
Evaluation Count:1519
yes
Evaluation Count:225
225-1519
1975 selectionRegion += rangeRect;
executed: selectionRegion += rangeRect;
Execution Count:1519
1519
1976 if (d->hasSpans()) {
evaluated: d->hasSpans()
TRUEFALSE
yes
Evaluation Count:488
yes
Evaluation Count:1256
488-1256
1977 foreach (QSpanCollection::Span *s,
executed (the execution status of this line is deduced): 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;})) {
-
1978 d->spans.spansInRect(range.left(), range.top(), range.width(), range.height())) { -
1979 if (range.contains(s->top(), s->left(), range.parent())) {
evaluated: range.contains(s->top(), s->left(), range.parent())
TRUEFALSE
yes
Evaluation Count:89
yes
Evaluation Count:821
89-821
1980 const QRect &visualSpanRect = d->visualSpanRect(*s);
executed (the execution status of this line is deduced): const QRect &visualSpanRect = d->visualSpanRect(*s);
-
1981 if (viewportRect.intersects(visualSpanRect))
partially evaluated: viewportRect.intersects(visualSpanRect)
TRUEFALSE
yes
Evaluation Count:89
no
Evaluation Count:0
0-89
1982 selectionRegion += visualSpanRect;
executed: selectionRegion += visualSpanRect;
Execution Count:89
89
1983 }
executed: }
Execution Count:89
89
1984 }
executed: }
Execution Count:910
910
1985 }
executed: }
Execution Count:488
488
1986 }
executed: }
Execution Count:1744
1744
1987 }
executed: }
Execution Count:1385
1385
1988 -
1989 return selectionRegion;
executed: return selectionRegion;
Execution Count:1394
1394
1990} -
1991 -
1992 -
1993/*! -
1994 \reimp -
1995*/ -
1996QModelIndexList QTableView::selectedIndexes() const -
1997{ -
1998 Q_D(const QTableView);
executed (the execution status of this line is deduced): const QTableViewPrivate * const d = d_func();
-
1999 QModelIndexList viewSelected;
executed (the execution status of this line is deduced): QModelIndexList viewSelected;
-
2000 QModelIndexList modelSelected;
executed (the execution status of this line is deduced): QModelIndexList modelSelected;
-
2001 if (d->selectionModel)
evaluated: d->selectionModel
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:2
2-12
2002 modelSelected = d->selectionModel->selectedIndexes();
executed: modelSelected = d->selectionModel->selectedIndexes();
Execution Count:12
12
2003 for (int i = 0; i < modelSelected.count(); ++i) {
evaluated: i < modelSelected.count()
TRUEFALSE
yes
Evaluation Count:102
yes
Evaluation Count:14
14-102
2004 QModelIndex index = modelSelected.at(i);
executed (the execution status of this line is deduced): QModelIndex index = modelSelected.at(i);
-
2005 if (!isIndexHidden(index) && index.parent() == d->root)
evaluated: !isIndexHidden(index)
TRUEFALSE
yes
Evaluation Count:94
yes
Evaluation Count:8
partially evaluated: index.parent() == d->root
TRUEFALSE
yes
Evaluation Count:94
no
Evaluation Count:0
0-94
2006 viewSelected.append(index);
executed: viewSelected.append(index);
Execution Count:94
94
2007 }
executed: }
Execution Count:102
102
2008 return viewSelected;
executed: return viewSelected;
Execution Count:14
14
2009} -
2010 -
2011 -
2012/*! -
2013 This slot is called whenever rows are added or deleted. The -
2014 previous number of rows is specified by \a oldCount, and the new -
2015 number of rows is specified by \a newCount. -
2016*/ -
2017void QTableView::rowCountChanged(int oldCount, int newCount ) -
2018{ -
2019 Q_D(QTableView);
executed (the execution status of this line is deduced): QTableViewPrivate * const d = d_func();
-
2020 //when removing rows, we need to disable updates for the header until the geometries have been -
2021 //updated and the offset has been adjusted, or we risk calling paintSection for all the sections -
2022 if (newCount < oldCount)
evaluated: newCount < oldCount
TRUEFALSE
yes
Evaluation Count:156
yes
Evaluation Count:14130
156-14130
2023 d->verticalHeader->setUpdatesEnabled(false);
executed: d->verticalHeader->setUpdatesEnabled(false);
Execution Count:156
156
2024 d->doDelayedItemsLayout();
executed (the execution status of this line is deduced): d->doDelayedItemsLayout();
-
2025}
executed: }
Execution Count:14286
14286
2026 -
2027/*! -
2028 This slot is called whenever columns are added or deleted. The -
2029 previous number of columns is specified by \a oldCount, and the new -
2030 number of columns is specified by \a newCount. -
2031*/ -
2032void QTableView::columnCountChanged(int, int) -
2033{ -
2034 Q_D(QTableView);
executed (the execution status of this line is deduced): QTableViewPrivate * const d = d_func();
-
2035 updateGeometries();
executed (the execution status of this line is deduced): updateGeometries();
-
2036 if (horizontalScrollMode() == QAbstractItemView::ScrollPerItem)
evaluated: horizontalScrollMode() == QAbstractItemView::ScrollPerItem
TRUEFALSE
yes
Evaluation Count:1298
yes
Evaluation Count:26
26-1298
2037 d->horizontalHeader->setOffsetToSectionPosition(horizontalScrollBar()->value());
executed: d->horizontalHeader->setOffsetToSectionPosition(horizontalScrollBar()->value());
Execution Count:1298
1298
2038 else -
2039 d->horizontalHeader->setOffset(horizontalScrollBar()->value());
executed: d->horizontalHeader->setOffset(horizontalScrollBar()->value());
Execution Count:26
26
2040 d->viewport->update();
executed (the execution status of this line is deduced): d->viewport->update();
-
2041}
executed: }
Execution Count:1324
1324
2042 -
2043/*! -
2044 \reimp -
2045*/ -
2046void QTableView::updateGeometries() -
2047{ -
2048 Q_D(QTableView);
executed (the execution status of this line is deduced): QTableViewPrivate * const d = d_func();
-
2049 if (d->geometryRecursionBlock)
evaluated: d->geometryRecursionBlock
TRUEFALSE
yes
Evaluation Count:631
yes
Evaluation Count:3033
631-3033
2050 return;
executed: return;
Execution Count:631
631
2051 d->geometryRecursionBlock = true;
executed (the execution status of this line is deduced): d->geometryRecursionBlock = true;
-
2052 -
2053 int width = 0;
executed (the execution status of this line is deduced): int width = 0;
-
2054 if (!d->verticalHeader->isHidden()) {
evaluated: !d->verticalHeader->isHidden()
TRUEFALSE
yes
Evaluation Count:2306
yes
Evaluation Count:727
727-2306
2055 width = qMax(d->verticalHeader->minimumWidth(), d->verticalHeader->sizeHint().width());
executed (the execution status of this line is deduced): width = qMax(d->verticalHeader->minimumWidth(), d->verticalHeader->sizeHint().width());
-
2056 width = qMin(width, d->verticalHeader->maximumWidth());
executed (the execution status of this line is deduced): width = qMin(width, d->verticalHeader->maximumWidth());
-
2057 }
executed: }
Execution Count:2306
2306
2058 int height = 0;
executed (the execution status of this line is deduced): int height = 0;
-
2059 if (!d->horizontalHeader->isHidden()) {
evaluated: !d->horizontalHeader->isHidden()
TRUEFALSE
yes
Evaluation Count:2306
yes
Evaluation Count:727
727-2306
2060 height = qMax(d->horizontalHeader->minimumHeight(), d->horizontalHeader->sizeHint().height());
executed (the execution status of this line is deduced): height = qMax(d->horizontalHeader->minimumHeight(), d->horizontalHeader->sizeHint().height());
-
2061 height = qMin(height, d->horizontalHeader->maximumHeight());
executed (the execution status of this line is deduced): height = qMin(height, d->horizontalHeader->maximumHeight());
-
2062 }
executed: }
Execution Count:2306
2306
2063 bool reverse = isRightToLeft();
executed (the execution status of this line is deduced): bool reverse = isRightToLeft();
-
2064 if (reverse)
evaluated: reverse
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:3026
7-3026
2065 setViewportMargins(0, height, width, 0);
executed: setViewportMargins(0, height, width, 0);
Execution Count:7
7
2066 else -
2067 setViewportMargins(width, height, 0, 0);
executed: setViewportMargins(width, height, 0, 0);
Execution Count:3026
3026
2068 -
2069 // update headers -
2070 -
2071 QRect vg = d->viewport->geometry();
executed (the execution status of this line is deduced): QRect vg = d->viewport->geometry();
-
2072 -
2073 int verticalLeft = reverse ? vg.right() + 1 : (vg.left() - width);
evaluated: reverse
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:3026
7-3026
2074 d->verticalHeader->setGeometry(verticalLeft, vg.top(), width, vg.height());
executed (the execution status of this line is deduced): d->verticalHeader->setGeometry(verticalLeft, vg.top(), width, vg.height());
-
2075 if (d->verticalHeader->isHidden())
evaluated: d->verticalHeader->isHidden()
TRUEFALSE
yes
Evaluation Count:727
yes
Evaluation Count:2306
727-2306
2076 QMetaObject::invokeMethod(d->verticalHeader, "updateGeometries");
executed: QMetaObject::invokeMethod(d->verticalHeader, "updateGeometries");
Execution Count:727
727
2077 -
2078 int horizontalTop = vg.top() - height;
executed (the execution status of this line is deduced): int horizontalTop = vg.top() - height;
-
2079 d->horizontalHeader->setGeometry(vg.left(), horizontalTop, vg.width(), height);
executed (the execution status of this line is deduced): d->horizontalHeader->setGeometry(vg.left(), horizontalTop, vg.width(), height);
-
2080 if (d->horizontalHeader->isHidden())
evaluated: d->horizontalHeader->isHidden()
TRUEFALSE
yes
Evaluation Count:727
yes
Evaluation Count:2306
727-2306
2081 QMetaObject::invokeMethod(d->horizontalHeader, "updateGeometries");
executed: QMetaObject::invokeMethod(d->horizontalHeader, "updateGeometries");
Execution Count:727
727
2082 -
2083 // update cornerWidget -
2084 if (d->horizontalHeader->isHidden() || d->verticalHeader->isHidden()) {
evaluated: d->horizontalHeader->isHidden()
TRUEFALSE
yes
Evaluation Count:727
yes
Evaluation Count:2306
partially evaluated: d->verticalHeader->isHidden()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2306
0-2306
2085 d->cornerWidget->setHidden(true);
executed (the execution status of this line is deduced): d->cornerWidget->setHidden(true);
-
2086 } else {
executed: }
Execution Count:727
727
2087 d->cornerWidget->setHidden(false);
executed (the execution status of this line is deduced): d->cornerWidget->setHidden(false);
-
2088 d->cornerWidget->setGeometry(verticalLeft, horizontalTop, width, height);
executed (the execution status of this line is deduced): d->cornerWidget->setGeometry(verticalLeft, horizontalTop, width, height);
-
2089 }
executed: }
Execution Count:2306
2306
2090 -
2091 // update scroll bars -
2092 -
2093 // ### move this block into the if -
2094 QSize vsize = d->viewport->size();
executed (the execution status of this line is deduced): QSize vsize = d->viewport->size();
-
2095 QSize max = maximumViewportSize();
executed (the execution status of this line is deduced): QSize max = maximumViewportSize();
-
2096 uint horizontalLength = d->horizontalHeader->length();
executed (the execution status of this line is deduced): uint horizontalLength = d->horizontalHeader->length();
-
2097 uint verticalLength = d->verticalHeader->length();
executed (the execution status of this line is deduced): uint verticalLength = d->verticalHeader->length();
-
2098 if ((uint)max.width() >= horizontalLength && (uint)max.height() >= verticalLength)
evaluated: (uint)max.width() >= horizontalLength
TRUEFALSE
yes
Evaluation Count:1764
yes
Evaluation Count:1269
evaluated: (uint)max.height() >= verticalLength
TRUEFALSE
yes
Evaluation Count:1729
yes
Evaluation Count:35
35-1764
2099 vsize = max;
executed: vsize = max;
Execution Count:1729
1729
2100 -
2101 // horizontal scroll bar -
2102 const int columnCount = d->horizontalHeader->count();
executed (the execution status of this line is deduced): const int columnCount = d->horizontalHeader->count();
-
2103 const int viewportWidth = vsize.width();
executed (the execution status of this line is deduced): const int viewportWidth = vsize.width();
-
2104 int columnsInViewport = 0;
executed (the execution status of this line is deduced): int columnsInViewport = 0;
-
2105 for (int width = 0, column = columnCount - 1; column >= 0; --column) {
evaluated: column >= 0
TRUEFALSE
yes
Evaluation Count:11217
yes
Evaluation Count:1764
1764-11217
2106 int logical = d->horizontalHeader->logicalIndex(column);
executed (the execution status of this line is deduced): int logical = d->horizontalHeader->logicalIndex(column);
-
2107 if (!d->horizontalHeader->isSectionHidden(logical)) {
evaluated: !d->horizontalHeader->isSectionHidden(logical)
TRUEFALSE
yes
Evaluation Count:11154
yes
Evaluation Count:63
63-11154
2108 width += d->horizontalHeader->sectionSize(logical);
executed (the execution status of this line is deduced): width += d->horizontalHeader->sectionSize(logical);
-
2109 if (width > viewportWidth)
evaluated: width > viewportWidth
TRUEFALSE
yes
Evaluation Count:1269
yes
Evaluation Count:9885
1269-9885
2110 break;
executed: break;
Execution Count:1269
1269
2111 ++columnsInViewport;
executed (the execution status of this line is deduced): ++columnsInViewport;
-
2112 }
executed: }
Execution Count:9885
9885
2113 }
executed: }
Execution Count:9948
9948
2114 columnsInViewport = qMax(columnsInViewport, 1); //there must be always at least 1 column
executed (the execution status of this line is deduced): columnsInViewport = qMax(columnsInViewport, 1);
-
2115 -
2116 if (horizontalScrollMode() == QAbstractItemView::ScrollPerItem) {
evaluated: horizontalScrollMode() == QAbstractItemView::ScrollPerItem
TRUEFALSE
yes
Evaluation Count:2896
yes
Evaluation Count:137
137-2896
2117 const int visibleColumns = columnCount - d->horizontalHeader->hiddenSectionCount();
executed (the execution status of this line is deduced): const int visibleColumns = columnCount - d->horizontalHeader->hiddenSectionCount();
-
2118 horizontalScrollBar()->setRange(0, visibleColumns - columnsInViewport);
executed (the execution status of this line is deduced): horizontalScrollBar()->setRange(0, visibleColumns - columnsInViewport);
-
2119 horizontalScrollBar()->setPageStep(columnsInViewport);
executed (the execution status of this line is deduced): horizontalScrollBar()->setPageStep(columnsInViewport);
-
2120 if (columnsInViewport >= visibleColumns)
evaluated: columnsInViewport >= visibleColumns
TRUEFALSE
yes
Evaluation Count:1723
yes
Evaluation Count:1173
1173-1723
2121 d->horizontalHeader->setOffset(0);
executed: d->horizontalHeader->setOffset(0);
Execution Count:1723
1723
2122 horizontalScrollBar()->setSingleStep(1);
executed (the execution status of this line is deduced): horizontalScrollBar()->setSingleStep(1);
-
2123 } else { // ScrollPerPixel
executed: }
Execution Count:2896
2896
2124 horizontalScrollBar()->setPageStep(vsize.width());
executed (the execution status of this line is deduced): horizontalScrollBar()->setPageStep(vsize.width());
-
2125 horizontalScrollBar()->setRange(0, horizontalLength - vsize.width());
executed (the execution status of this line is deduced): horizontalScrollBar()->setRange(0, horizontalLength - vsize.width());
-
2126 horizontalScrollBar()->setSingleStep(qMax(vsize.width() / (columnsInViewport + 1), 2));
executed (the execution status of this line is deduced): horizontalScrollBar()->setSingleStep(qMax(vsize.width() / (columnsInViewport + 1), 2));
-
2127 }
executed: }
Execution Count:137
137
2128 -
2129 // vertical scroll bar -
2130 const int rowCount = d->verticalHeader->count();
executed (the execution status of this line is deduced): const int rowCount = d->verticalHeader->count();
-
2131 const int viewportHeight = vsize.height();
executed (the execution status of this line is deduced): const int viewportHeight = vsize.height();
-
2132 int rowsInViewport = 0;
executed (the execution status of this line is deduced): int rowsInViewport = 0;
-
2133 for (int height = 0, row = rowCount - 1; row >= 0; --row) {
evaluated: row >= 0
TRUEFALSE
yes
Evaluation Count:13722
yes
Evaluation Count:2323
2323-13722
2134 int logical = d->verticalHeader->logicalIndex(row);
executed (the execution status of this line is deduced): int logical = d->verticalHeader->logicalIndex(row);
-
2135 if (!d->verticalHeader->isSectionHidden(logical)) {
evaluated: !d->verticalHeader->isSectionHidden(logical)
TRUEFALSE
yes
Evaluation Count:13675
yes
Evaluation Count:47
47-13675
2136 height += d->verticalHeader->sectionSize(logical);
executed (the execution status of this line is deduced): height += d->verticalHeader->sectionSize(logical);
-
2137 if (height > viewportHeight)
evaluated: height > viewportHeight
TRUEFALSE
yes
Evaluation Count:710
yes
Evaluation Count:12965
710-12965
2138 break;
executed: break;
Execution Count:710
710
2139 ++rowsInViewport;
executed (the execution status of this line is deduced): ++rowsInViewport;
-
2140 }
executed: }
Execution Count:12965
12965
2141 }
executed: }
Execution Count:13012
13012
2142 rowsInViewport = qMax(rowsInViewport, 1); //there must be always at least 1 row
executed (the execution status of this line is deduced): rowsInViewport = qMax(rowsInViewport, 1);
-
2143 -
2144 if (verticalScrollMode() == QAbstractItemView::ScrollPerItem) {
evaluated: verticalScrollMode() == QAbstractItemView::ScrollPerItem
TRUEFALSE
yes
Evaluation Count:2919
yes
Evaluation Count:114
114-2919
2145 const int visibleRows = rowCount - d->verticalHeader->hiddenSectionCount();
executed (the execution status of this line is deduced): const int visibleRows = rowCount - d->verticalHeader->hiddenSectionCount();
-
2146 verticalScrollBar()->setRange(0, visibleRows - rowsInViewport);
executed (the execution status of this line is deduced): verticalScrollBar()->setRange(0, visibleRows - rowsInViewport);
-
2147 verticalScrollBar()->setPageStep(rowsInViewport);
executed (the execution status of this line is deduced): verticalScrollBar()->setPageStep(rowsInViewport);
-
2148 if (rowsInViewport >= visibleRows)
evaluated: rowsInViewport >= visibleRows
TRUEFALSE
yes
Evaluation Count:2270
yes
Evaluation Count:649
649-2270
2149 d->verticalHeader->setOffset(0);
executed: d->verticalHeader->setOffset(0);
Execution Count:2270
2270
2150 verticalScrollBar()->setSingleStep(1);
executed (the execution status of this line is deduced): verticalScrollBar()->setSingleStep(1);
-
2151 } else { // ScrollPerPixel
executed: }
Execution Count:2919
2919
2152 verticalScrollBar()->setPageStep(vsize.height());
executed (the execution status of this line is deduced): verticalScrollBar()->setPageStep(vsize.height());
-
2153 verticalScrollBar()->setRange(0, verticalLength - vsize.height());
executed (the execution status of this line is deduced): verticalScrollBar()->setRange(0, verticalLength - vsize.height());
-
2154 verticalScrollBar()->setSingleStep(qMax(vsize.height() / (rowsInViewport + 1), 2));
executed (the execution status of this line is deduced): verticalScrollBar()->setSingleStep(qMax(vsize.height() / (rowsInViewport + 1), 2));
-
2155 }
executed: }
Execution Count:114
114
2156 -
2157 d->geometryRecursionBlock = false;
executed (the execution status of this line is deduced): d->geometryRecursionBlock = false;
-
2158 QAbstractItemView::updateGeometries();
executed (the execution status of this line is deduced): QAbstractItemView::updateGeometries();
-
2159}
executed: }
Execution Count:3033
3033
2160 -
2161/*! -
2162 Returns the size hint for the given \a row's height or -1 if there -
2163 is no model. -
2164 -
2165 If you need to set the height of a given row to a fixed value, call -
2166 QHeaderView::resizeSection() on the table's vertical header. -
2167 -
2168 If you reimplement this function in a subclass, note that the value you -
2169 return is only used when resizeRowToContents() is called. In that case, -
2170 if a larger row height is required by either the vertical header or -
2171 the item delegate, that width will be used instead. -
2172 -
2173 \sa QWidget::sizeHint, verticalHeader() -
2174*/ -
2175int QTableView::sizeHintForRow(int row) const -
2176{ -
2177 Q_D(const QTableView);
executed (the execution status of this line is deduced): const QTableViewPrivate * const d = d_func();
-
2178 -
2179 if (!model())
evaluated: !model()
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:2045
7-2045
2180 return -1;
executed: return -1;
Execution Count:7
7
2181 -
2182 ensurePolished();
executed (the execution status of this line is deduced): ensurePolished();
-
2183 -
2184 int left = qMax(0, d->horizontalHeader->visualIndexAt(0));
executed (the execution status of this line is deduced): int left = qMax(0, d->horizontalHeader->visualIndexAt(0));
-
2185 int right = d->horizontalHeader->visualIndexAt(d->viewport->width());
executed (the execution status of this line is deduced): int right = d->horizontalHeader->visualIndexAt(d->viewport->width());
-
2186 if (right == -1) // the table don't have enough columns to fill the viewport
evaluated: right == -1
TRUEFALSE
yes
Evaluation Count:2009
yes
Evaluation Count:36
36-2009
2187 right = d->model->columnCount(d->root) - 1;
executed: right = d->model->columnCount(d->root) - 1;
Execution Count:2009
2009
2188 -
2189 QStyleOptionViewItem option = d->viewOptions();
executed (the execution status of this line is deduced): QStyleOptionViewItem option = d->viewOptions();
-
2190 -
2191 int hint = 0;
executed (the execution status of this line is deduced): int hint = 0;
-
2192 QModelIndex index;
executed (the execution status of this line is deduced): QModelIndex index;
-
2193 for (int column = left; column <= right; ++column) {
evaluated: column <= right
TRUEFALSE
yes
Evaluation Count:20215
yes
Evaluation Count:2045
2045-20215
2194 int logicalColumn = d->horizontalHeader->logicalIndex(column);
executed (the execution status of this line is deduced): int logicalColumn = d->horizontalHeader->logicalIndex(column);
-
2195 if (d->horizontalHeader->isSectionHidden(logicalColumn))
partially evaluated: d->horizontalHeader->isSectionHidden(logicalColumn)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:20215
0-20215
2196 continue;
never executed: continue;
0
2197 index = d->model->index(row, logicalColumn, d->root);
executed (the execution status of this line is deduced): index = d->model->index(row, logicalColumn, d->root);
-
2198 if (d->wrapItemText) {// for wrapping boundaries
partially evaluated: d->wrapItemText
TRUEFALSE
yes
Evaluation Count:20215
no
Evaluation Count:0
0-20215
2199 option.rect.setY(rowViewportPosition(index.row()));
executed (the execution status of this line is deduced): option.rect.setY(rowViewportPosition(index.row()));
-
2200 option.rect.setHeight(rowHeight(index.row()));
executed (the execution status of this line is deduced): option.rect.setHeight(rowHeight(index.row()));
-
2201 option.rect.setX(columnViewportPosition(index.column()));
executed (the execution status of this line is deduced): option.rect.setX(columnViewportPosition(index.column()));
-
2202 option.rect.setWidth(columnWidth(index.column()));
executed (the execution status of this line is deduced): option.rect.setWidth(columnWidth(index.column()));
-
2203 }
executed: }
Execution Count:20215
20215
2204 -
2205 QWidget *editor = d->editorForIndex(index).widget.data();
executed (the execution status of this line is deduced): QWidget *editor = d->editorForIndex(index).widget.data();
-
2206 if (editor && d->persistent.contains(editor)) {
partially evaluated: editor
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:20215
never evaluated: d->persistent.contains(editor)
0-20215
2207 hint = qMax(hint, editor->sizeHint().height());
never executed (the execution status of this line is deduced): hint = qMax(hint, editor->sizeHint().height());
-
2208 int min = editor->minimumSize().height();
never executed (the execution status of this line is deduced): int min = editor->minimumSize().height();
-
2209 int max = editor->maximumSize().height();
never executed (the execution status of this line is deduced): int max = editor->maximumSize().height();
-
2210 hint = qBound(min, hint, max);
never executed (the execution status of this line is deduced): hint = qBound(min, hint, max);
-
2211 }
never executed: }
0
2212 -
2213 hint = qMax(hint, itemDelegate(index)->sizeHint(option, index).height());
executed (the execution status of this line is deduced): hint = qMax(hint, itemDelegate(index)->sizeHint(option, index).height());
-
2214 }
executed: }
Execution Count:20215
20215
2215 -
2216 return d->showGrid ? hint + 1 : hint;
executed: return d->showGrid ? hint + 1 : hint;
Execution Count:2045
2045
2217} -
2218 -
2219/*! -
2220 Returns the size hint for the given \a column's width or -1 if -
2221 there is no model. -
2222 -
2223 If you need to set the width of a given column to a fixed value, call -
2224 QHeaderView::resizeSection() on the table's horizontal header. -
2225 -
2226 If you reimplement this function in a subclass, note that the value you -
2227 return will be used when resizeColumnToContents() or -
2228 QHeaderView::resizeSections() is called. If a larger column width is -
2229 required by either the horizontal header or the item delegate, the larger -
2230 width will be used instead. -
2231 -
2232 \sa QWidget::sizeHint, horizontalHeader() -
2233*/ -
2234int QTableView::sizeHintForColumn(int column) const -
2235{ -
2236 Q_D(const QTableView);
executed (the execution status of this line is deduced): const QTableViewPrivate * const d = d_func();
-
2237 -
2238 if (!model())
evaluated: !model()
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:70
7-70
2239 return -1;
executed: return -1;
Execution Count:7
7
2240 -
2241 ensurePolished();
executed (the execution status of this line is deduced): ensurePolished();
-
2242 -
2243 int top = qMax(0, d->verticalHeader->visualIndexAt(0));
executed (the execution status of this line is deduced): int top = qMax(0, d->verticalHeader->visualIndexAt(0));
-
2244 int bottom = d->verticalHeader->visualIndexAt(d->viewport->height());
executed (the execution status of this line is deduced): int bottom = d->verticalHeader->visualIndexAt(d->viewport->height());
-
2245 if (!isVisible() || bottom == -1) // the table don't have enough rows to fill the viewport
evaluated: !isVisible()
TRUEFALSE
yes
Evaluation Count:69
yes
Evaluation Count:1
partially evaluated: bottom == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-69
2246 bottom = d->model->rowCount(d->root) - 1;
executed: bottom = d->model->rowCount(d->root) - 1;
Execution Count:69
69
2247 -
2248 QStyleOptionViewItem option = d->viewOptions();
executed (the execution status of this line is deduced): QStyleOptionViewItem option = d->viewOptions();
-
2249 -
2250 int hint = 0;
executed (the execution status of this line is deduced): int hint = 0;
-
2251 QModelIndex index;
executed (the execution status of this line is deduced): QModelIndex index;
-
2252 for (int row = top; row <= bottom; ++row) {
evaluated: row <= bottom
TRUEFALSE
yes
Evaluation Count:20223
yes
Evaluation Count:70
70-20223
2253 int logicalRow = d->verticalHeader->logicalIndex(row);
executed (the execution status of this line is deduced): int logicalRow = d->verticalHeader->logicalIndex(row);
-
2254 if (d->verticalHeader->isSectionHidden(logicalRow))
partially evaluated: d->verticalHeader->isSectionHidden(logicalRow)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:20223
0-20223
2255 continue;
never executed: continue;
0
2256 index = d->model->index(logicalRow, column, d->root);
executed (the execution status of this line is deduced): index = d->model->index(logicalRow, column, d->root);
-
2257 -
2258 QWidget *editor = d->editorForIndex(index).widget.data();
executed (the execution status of this line is deduced): QWidget *editor = d->editorForIndex(index).widget.data();
-
2259 if (editor && d->persistent.contains(editor)) {
partially evaluated: editor
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:20223
never evaluated: d->persistent.contains(editor)
0-20223
2260 hint = qMax(hint, editor->sizeHint().width());
never executed (the execution status of this line is deduced): hint = qMax(hint, editor->sizeHint().width());
-
2261 int min = editor->minimumSize().width();
never executed (the execution status of this line is deduced): int min = editor->minimumSize().width();
-
2262 int max = editor->maximumSize().width();
never executed (the execution status of this line is deduced): int max = editor->maximumSize().width();
-
2263 hint = qBound(min, hint, max);
never executed (the execution status of this line is deduced): hint = qBound(min, hint, max);
-
2264 }
never executed: }
0
2265 -
2266 hint = qMax(hint, itemDelegate(index)->sizeHint(option, index).width());
executed (the execution status of this line is deduced): hint = qMax(hint, itemDelegate(index)->sizeHint(option, index).width());
-
2267 }
executed: }
Execution Count:20223
20223
2268 -
2269 return d->showGrid ? hint + 1 : hint;
executed: return d->showGrid ? hint + 1 : hint;
Execution Count:70
70
2270} -
2271 -
2272/*! -
2273 Returns the y-coordinate in contents coordinates of the given \a -
2274 row. -
2275*/ -
2276int QTableView::rowViewportPosition(int row) const -
2277{ -
2278 Q_D(const QTableView);
executed (the execution status of this line is deduced): const QTableViewPrivate * const d = d_func();
-
2279 return d->verticalHeader->sectionViewportPosition(row);
executed: return d->verticalHeader->sectionViewportPosition(row);
Execution Count:55553
55553
2280} -
2281 -
2282/*! -
2283 Returns the row in which the given y-coordinate, \a y, in contents -
2284 coordinates is located. -
2285 -
2286 \note This function returns -1 if the given coordinate is not valid -
2287 (has no row). -
2288 -
2289 \sa columnAt() -
2290*/ -
2291int QTableView::rowAt(int y) const -
2292{ -
2293 Q_D(const QTableView);
executed (the execution status of this line is deduced): const QTableViewPrivate * const d = d_func();
-
2294 return d->verticalHeader->logicalIndexAt(y);
executed: return d->verticalHeader->logicalIndexAt(y);
Execution Count:6325
6325
2295} -
2296 -
2297/*! -
2298 \since 4.1 -
2299 -
2300 Sets the height of the given \a row to be \a height. -
2301*/ -
2302void QTableView::setRowHeight(int row, int height) -
2303{ -
2304 Q_D(const QTableView);
executed (the execution status of this line is deduced): const QTableViewPrivate * const d = d_func();
-
2305 d->verticalHeader->resizeSection(row, height);
executed (the execution status of this line is deduced): d->verticalHeader->resizeSection(row, height);
-
2306}
executed: }
Execution Count:681
681
2307 -
2308/*! -
2309 Returns the height of the given \a row. -
2310 -
2311 \sa resizeRowToContents(), columnWidth() -
2312*/ -
2313int QTableView::rowHeight(int row) const -
2314{ -
2315 Q_D(const QTableView);
executed (the execution status of this line is deduced): const QTableViewPrivate * const d = d_func();
-
2316 return d->verticalHeader->sectionSize(row);
executed: return d->verticalHeader->sectionSize(row);
Execution Count:53492
53492
2317} -
2318 -
2319/*! -
2320 Returns the x-coordinate in contents coordinates of the given \a -
2321 column. -
2322*/ -
2323int QTableView::columnViewportPosition(int column) const -
2324{ -
2325 Q_D(const QTableView);
executed (the execution status of this line is deduced): const QTableViewPrivate * const d = d_func();
-
2326 return d->horizontalHeader->sectionViewportPosition(column);
executed: return d->horizontalHeader->sectionViewportPosition(column);
Execution Count:58925
58925
2327} -
2328 -
2329/*! -
2330 Returns the column in which the given x-coordinate, \a x, in contents -
2331 coordinates is located. -
2332 -
2333 \note This function returns -1 if the given coordinate is not valid -
2334 (has no column). -
2335 -
2336 \sa rowAt() -
2337*/ -
2338int QTableView::columnAt(int x) const -
2339{ -
2340 Q_D(const QTableView);
executed (the execution status of this line is deduced): const QTableViewPrivate * const d = d_func();
-
2341 return d->horizontalHeader->logicalIndexAt(x);
executed: return d->horizontalHeader->logicalIndexAt(x);
Execution Count:6310
6310
2342} -
2343 -
2344/*! -
2345 \since 4.1 -
2346 -
2347 Sets the width of the given \a column to be \a width. -
2348*/ -
2349void QTableView::setColumnWidth(int column, int width) -
2350{ -
2351 Q_D(const QTableView);
executed (the execution status of this line is deduced): const QTableViewPrivate * const d = d_func();
-
2352 d->horizontalHeader->resizeSection(column, width);
executed (the execution status of this line is deduced): d->horizontalHeader->resizeSection(column, width);
-
2353}
executed: }
Execution Count:684
684
2354 -
2355/*! -
2356 Returns the width of the given \a column. -
2357 -
2358 \sa resizeColumnToContents(), rowHeight() -
2359*/ -
2360int QTableView::columnWidth(int column) const -
2361{ -
2362 Q_D(const QTableView);
executed (the execution status of this line is deduced): const QTableViewPrivate * const d = d_func();
-
2363 return d->horizontalHeader->sectionSize(column);
executed: return d->horizontalHeader->sectionSize(column);
Execution Count:61056
61056
2364} -
2365 -
2366/*! -
2367 Returns true if the given \a row is hidden; otherwise returns false. -
2368 -
2369 \sa isColumnHidden() -
2370*/ -
2371bool QTableView::isRowHidden(int row) const -
2372{ -
2373 Q_D(const QTableView);
executed (the execution status of this line is deduced): const QTableViewPrivate * const d = d_func();
-
2374 return d->verticalHeader->isSectionHidden(row);
executed: return d->verticalHeader->isSectionHidden(row);
Execution Count:38651
38651
2375} -
2376 -
2377/*! -
2378 If \a hide is true \a row will be hidden, otherwise it will be shown. -
2379 -
2380 \sa setColumnHidden() -
2381*/ -
2382void QTableView::setRowHidden(int row, bool hide) -
2383{ -
2384 Q_D(QTableView);
executed (the execution status of this line is deduced): QTableViewPrivate * const d = d_func();
-
2385 if (row < 0 || row >= d->verticalHeader->count())
partially evaluated: row < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:313
partially evaluated: row >= d->verticalHeader->count()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:313
0-313
2386 return;
never executed: return;
0
2387 d->verticalHeader->setSectionHidden(row, hide);
executed (the execution status of this line is deduced): d->verticalHeader->setSectionHidden(row, hide);
-
2388}
executed: }
Execution Count:313
313
2389 -
2390/*! -
2391 Returns true if the given \a column is hidden; otherwise returns false. -
2392 -
2393 \sa isRowHidden() -
2394*/ -
2395bool QTableView::isColumnHidden(int column) const -
2396{ -
2397 Q_D(const QTableView);
executed (the execution status of this line is deduced): const QTableViewPrivate * const d = d_func();
-
2398 return d->horizontalHeader->isSectionHidden(column);
executed: return d->horizontalHeader->isSectionHidden(column);
Execution Count:38597
38597
2399} -
2400 -
2401/*! -
2402 If \a hide is true the given \a column will be hidden; otherwise it -
2403 will be shown. -
2404 -
2405 \sa setRowHidden() -
2406*/ -
2407void QTableView::setColumnHidden(int column, bool hide) -
2408{ -
2409 Q_D(QTableView);
executed (the execution status of this line is deduced): QTableViewPrivate * const d = d_func();
-
2410 if (column < 0 || column >= d->horizontalHeader->count())
partially evaluated: column < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:73
partially evaluated: column >= d->horizontalHeader->count()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:73
0-73
2411 return;
never executed: return;
0
2412 d->horizontalHeader->setSectionHidden(column, hide);
executed (the execution status of this line is deduced): d->horizontalHeader->setSectionHidden(column, hide);
-
2413}
executed: }
Execution Count:73
73
2414 -
2415/*! -
2416 \since 4.2 -
2417 \property QTableView::sortingEnabled -
2418 \brief whether sorting is enabled -
2419 -
2420 If this property is true, sorting is enabled for the table. If -
2421 this property is false, sorting is not enabled. The default value -
2422 is false. -
2423 -
2424 \note. Setting the property to true with setSortingEnabled() -
2425 immediately triggers a call to sortByColumn() with the current -
2426 sort section and order. -
2427 -
2428 \sa sortByColumn() -
2429*/ -
2430 -
2431/*! -
2432 If \a enabled true enables sorting for the table and immediately -
2433 trigger a call to sortByColumn() with the current sort section and -
2434 order -
2435 */ -
2436void QTableView::setSortingEnabled(bool enable) -
2437{ -
2438 Q_D(QTableView);
executed (the execution status of this line is deduced): QTableViewPrivate * const d = d_func();
-
2439 d->sortingEnabled = enable;
executed (the execution status of this line is deduced): d->sortingEnabled = enable;
-
2440 horizontalHeader()->setSortIndicatorShown(enable);
executed (the execution status of this line is deduced): horizontalHeader()->setSortIndicatorShown(enable);
-
2441 if (enable) {
evaluated: enable
TRUEFALSE
yes
Evaluation Count:27
yes
Evaluation Count:486
27-486
2442 disconnect(d->horizontalHeader, SIGNAL(sectionEntered(int)),
executed (the execution status of this line is deduced): disconnect(d->horizontalHeader, "2""sectionEntered(int)",
-
2443 this, SLOT(_q_selectColumn(int)));
executed (the execution status of this line is deduced): this, "1""_q_selectColumn(int)");
-
2444 disconnect(horizontalHeader(), SIGNAL(sectionPressed(int)),
executed (the execution status of this line is deduced): disconnect(horizontalHeader(), "2""sectionPressed(int)",
-
2445 this, SLOT(selectColumn(int)));
executed (the execution status of this line is deduced): this, "1""selectColumn(int)");
-
2446 connect(horizontalHeader(), SIGNAL(sortIndicatorChanged(int,Qt::SortOrder)),
executed (the execution status of this line is deduced): connect(horizontalHeader(), "2""sortIndicatorChanged(int,Qt::SortOrder)",
-
2447 this, SLOT(sortByColumn(int)), Qt::UniqueConnection);
executed (the execution status of this line is deduced): this, "1""sortByColumn(int)", Qt::UniqueConnection);
-
2448 sortByColumn(horizontalHeader()->sortIndicatorSection(),
executed (the execution status of this line is deduced): sortByColumn(horizontalHeader()->sortIndicatorSection(),
-
2449 horizontalHeader()->sortIndicatorOrder());
executed (the execution status of this line is deduced): horizontalHeader()->sortIndicatorOrder());
-
2450 } else {
executed: }
Execution Count:27
27
2451 connect(d->horizontalHeader, SIGNAL(sectionEntered(int)),
executed (the execution status of this line is deduced): connect(d->horizontalHeader, "2""sectionEntered(int)",
-
2452 this, SLOT(_q_selectColumn(int)), Qt::UniqueConnection);
executed (the execution status of this line is deduced): this, "1""_q_selectColumn(int)", Qt::UniqueConnection);
-
2453 connect(horizontalHeader(), SIGNAL(sectionPressed(int)),
executed (the execution status of this line is deduced): connect(horizontalHeader(), "2""sectionPressed(int)",
-
2454 this, SLOT(selectColumn(int)), Qt::UniqueConnection);
executed (the execution status of this line is deduced): this, "1""selectColumn(int)", Qt::UniqueConnection);
-
2455 disconnect(horizontalHeader(), SIGNAL(sortIndicatorChanged(int,Qt::SortOrder)),
executed (the execution status of this line is deduced): disconnect(horizontalHeader(), "2""sortIndicatorChanged(int,Qt::SortOrder)",
-
2456 this, SLOT(sortByColumn(int)));
executed (the execution status of this line is deduced): this, "1""sortByColumn(int)");
-
2457 }
executed: }
Execution Count:486
486
2458} -
2459 -
2460bool QTableView::isSortingEnabled() const -
2461{ -
2462 Q_D(const QTableView);
executed (the execution status of this line is deduced): const QTableViewPrivate * const d = d_func();
-
2463 return d->sortingEnabled;
executed: return d->sortingEnabled;
Execution Count:986
986
2464} -
2465 -
2466/*! -
2467 \property QTableView::showGrid -
2468 \brief whether the grid is shown -
2469 -
2470 If this property is true a grid is drawn for the table; if the -
2471 property is false, no grid is drawn. The default value is true. -
2472*/ -
2473bool QTableView::showGrid() const -
2474{ -
2475 Q_D(const QTableView);
executed (the execution status of this line is deduced): const QTableViewPrivate * const d = d_func();
-
2476 return d->showGrid;
executed: return d->showGrid;
Execution Count:30361
30361
2477} -
2478 -
2479void QTableView::setShowGrid(bool show) -
2480{ -
2481 Q_D(QTableView);
executed (the execution status of this line is deduced): QTableViewPrivate * const d = d_func();
-
2482 if (d->showGrid != show) {
evaluated: d->showGrid != show
TRUEFALSE
yes
Evaluation Count:45
yes
Evaluation Count:2
2-45
2483 d->showGrid = show;
executed (the execution status of this line is deduced): d->showGrid = show;
-
2484 d->viewport->update();
executed (the execution status of this line is deduced): d->viewport->update();
-
2485 }
executed: }
Execution Count:45
45
2486}
executed: }
Execution Count:47
47
2487 -
2488/*! -
2489 \property QTableView::gridStyle -
2490 \brief the pen style used to draw the grid. -
2491 -
2492 This property holds the style used when drawing the grid (see \l{showGrid}). -
2493*/ -
2494Qt::PenStyle QTableView::gridStyle() const -
2495{ -
2496 Q_D(const QTableView);
executed (the execution status of this line is deduced): const QTableViewPrivate * const d = d_func();
-
2497 return d->gridStyle;
executed: return d->gridStyle;
Execution Count:2
2
2498} -
2499 -
2500void QTableView::setGridStyle(Qt::PenStyle style) -
2501{ -
2502 Q_D(QTableView);
executed (the execution status of this line is deduced): QTableViewPrivate * const d = d_func();
-
2503 if (d->gridStyle != style) {
evaluated: d->gridStyle != style
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:7
2-7
2504 d->gridStyle = style;
executed (the execution status of this line is deduced): d->gridStyle = style;
-
2505 d->viewport->update();
executed (the execution status of this line is deduced): d->viewport->update();
-
2506 }
executed: }
Execution Count:2
2
2507}
executed: }
Execution Count:9
9
2508 -
2509/*! -
2510 \property QTableView::wordWrap -
2511 \brief the item text word-wrapping policy -
2512 \since 4.3 -
2513 -
2514 If this property is true then the item text is wrapped where -
2515 necessary at word-breaks; otherwise it is not wrapped at all. -
2516 This property is true by default. -
2517 -
2518 Note that even of wrapping is enabled, the cell will not be -
2519 expanded to fit all text. Ellipsis will be inserted according to -
2520 the current \l{QAbstractItemView::}{textElideMode}. -
2521 -
2522*/ -
2523void QTableView::setWordWrap(bool on) -
2524{ -
2525 Q_D(QTableView);
never executed (the execution status of this line is deduced): QTableViewPrivate * const d = d_func();
-
2526 if (d->wrapItemText == on)
never evaluated: d->wrapItemText == on
0
2527 return;
never executed: return;
0
2528 d->wrapItemText = on;
never executed (the execution status of this line is deduced): d->wrapItemText = on;
-
2529 QMetaObject::invokeMethod(d->verticalHeader, "resizeSections");
never executed (the execution status of this line is deduced): QMetaObject::invokeMethod(d->verticalHeader, "resizeSections");
-
2530 QMetaObject::invokeMethod(d->horizontalHeader, "resizeSections");
never executed (the execution status of this line is deduced): QMetaObject::invokeMethod(d->horizontalHeader, "resizeSections");
-
2531}
never executed: }
0
2532 -
2533bool QTableView::wordWrap() const -
2534{ -
2535 Q_D(const QTableView);
never executed (the execution status of this line is deduced): const QTableViewPrivate * const d = d_func();
-
2536 return d->wrapItemText;
never executed: return d->wrapItemText;
0
2537} -
2538 -
2539/*! -
2540 \property QTableView::cornerButtonEnabled -
2541 \brief whether the button in the top-left corner is enabled -
2542 \since 4.3 -
2543 -
2544 If this property is true then button in the top-left corner -
2545 of the table view is enabled. Clicking on this button will -
2546 select all the cells in the table view. -
2547 -
2548 This property is true by default. -
2549*/ -
2550void QTableView::setCornerButtonEnabled(bool enable) -
2551{ -
2552 Q_D(QTableView);
executed (the execution status of this line is deduced): QTableViewPrivate * const d = d_func();
-
2553 d->cornerWidget->setEnabled(enable);
executed (the execution status of this line is deduced): d->cornerWidget->setEnabled(enable);
-
2554}
executed: }
Execution Count:1
1
2555 -
2556bool QTableView::isCornerButtonEnabled() const -
2557{ -
2558 Q_D(const QTableView);
executed (the execution status of this line is deduced): const QTableViewPrivate * const d = d_func();
-
2559 return d->cornerWidget->isEnabled();
executed: return d->cornerWidget->isEnabled();
Execution Count:2
2
2560} -
2561 -
2562/*! -
2563 \internal -
2564 -
2565 Returns the rectangle on the viewport occupied by the given \a -
2566 index. -
2567 If the index is hidden in the view it will return a null QRect. -
2568*/ -
2569QRect QTableView::visualRect(const QModelIndex &index) const -
2570{ -
2571 Q_D(const QTableView);
executed (the execution status of this line is deduced): const QTableViewPrivate * const d = d_func();
-
2572 if (!d->isIndexValid(index) || index.parent() != d->root
evaluated: !d->isIndexValid(index)
TRUEFALSE
yes
Evaluation Count:34
yes
Evaluation Count:29362
partially evaluated: index.parent() != d->root
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:29362
0-29362
2573 || (!d->hasSpans() && isIndexHidden(index)))
evaluated: !d->hasSpans()
TRUEFALSE
yes
Evaluation Count:29022
yes
Evaluation Count:340
evaluated: isIndexHidden(index)
TRUEFALSE
yes
Evaluation Count:66
yes
Evaluation Count:28956
66-29022
2574 return QRect();
executed: return QRect();
Execution Count:100
100
2575 -
2576 d->executePostedLayout();
executed (the execution status of this line is deduced): d->executePostedLayout();
-
2577 -
2578 if (d->hasSpans()) {
evaluated: d->hasSpans()
TRUEFALSE
yes
Evaluation Count:340
yes
Evaluation Count:28956
340-28956
2579 QSpanCollection::Span span = d->span(index.row(), index.column());
executed (the execution status of this line is deduced): QSpanCollection::Span span = d->span(index.row(), index.column());
-
2580 return d->visualSpanRect(span);
executed: return d->visualSpanRect(span);
Execution Count:340
340
2581 } -
2582 -
2583 int rowp = rowViewportPosition(index.row());
executed (the execution status of this line is deduced): int rowp = rowViewportPosition(index.row());
-
2584 int rowh = rowHeight(index.row());
executed (the execution status of this line is deduced): int rowh = rowHeight(index.row());
-
2585 int colp = columnViewportPosition(index.column());
executed (the execution status of this line is deduced): int colp = columnViewportPosition(index.column());
-
2586 int colw = columnWidth(index.column());
executed (the execution status of this line is deduced): int colw = columnWidth(index.column());
-
2587 -
2588 const int i = showGrid() ? 1 : 0;
evaluated: showGrid()
TRUEFALSE
yes
Evaluation Count:20180
yes
Evaluation Count:8776
8776-20180
2589 return QRect(colp, rowp, colw - i, rowh - i);
executed: return QRect(colp, rowp, colw - i, rowh - i);
Execution Count:28956
28956
2590} -
2591 -
2592/*! -
2593 \internal -
2594 -
2595 Makes sure that the given \a item is visible in the table view, -
2596 scrolling if necessary. -
2597*/ -
2598void QTableView::scrollTo(const QModelIndex &index, ScrollHint hint) -
2599{ -
2600 Q_D(QTableView);
executed (the execution status of this line is deduced): QTableViewPrivate * const d = d_func();
-
2601 -
2602 // check if we really need to do anything -
2603 if (!d->isIndexValid(index)
evaluated: !d->isIndexValid(index)
TRUEFALSE
yes
Evaluation Count:35
yes
Evaluation Count:8649
35-8649
2604 || (d->model->parent(index) != d->root)
partially evaluated: (d->model->parent(index) != d->root)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8649
0-8649
2605 || isRowHidden(index.row()) || isColumnHidden(index.column()))
partially evaluated: isRowHidden(index.row())
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8649
partially evaluated: isColumnHidden(index.column())
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8649
0-8649
2606 return;
executed: return;
Execution Count:35
35
2607 -
2608 QSpanCollection::Span span;
executed (the execution status of this line is deduced): QSpanCollection::Span span;
-
2609 if (d->hasSpans())
evaluated: d->hasSpans()
TRUEFALSE
yes
Evaluation Count:47
yes
Evaluation Count:8602
47-8602
2610 span = d->span(index.row(), index.column());
executed: span = d->span(index.row(), index.column());
Execution Count:47
47
2611 -
2612 // Adjust horizontal position -
2613 -
2614 int viewportWidth = d->viewport->width();
executed (the execution status of this line is deduced): int viewportWidth = d->viewport->width();
-
2615 int horizontalOffset = d->horizontalHeader->offset();
executed (the execution status of this line is deduced): int horizontalOffset = d->horizontalHeader->offset();
-
2616 int horizontalPosition = d->horizontalHeader->sectionPosition(index.column());
executed (the execution status of this line is deduced): int horizontalPosition = d->horizontalHeader->sectionPosition(index.column());
-
2617 int horizontalIndex = d->horizontalHeader->visualIndex(index.column());
executed (the execution status of this line is deduced): int horizontalIndex = d->horizontalHeader->visualIndex(index.column());
-
2618 int cellWidth = d->hasSpans()
evaluated: d->hasSpans()
TRUEFALSE
yes
Evaluation Count:47
yes
Evaluation Count:8602
47-8602
2619 ? d->columnSpanWidth(index.column(), span.width())
executed (the execution status of this line is deduced): ? d->columnSpanWidth(index.column(), span.width())
-
2620 : d->horizontalHeader->sectionSize(index.column());
executed (the execution status of this line is deduced): : d->horizontalHeader->sectionSize(index.column());
-
2621 -
2622 if (horizontalScrollMode() == QAbstractItemView::ScrollPerItem) {
evaluated: horizontalScrollMode() == QAbstractItemView::ScrollPerItem
TRUEFALSE
yes
Evaluation Count:4569
yes
Evaluation Count:4080
4080-4569
2623 -
2624 bool positionAtLeft = (horizontalPosition - horizontalOffset < 0);
executed (the execution status of this line is deduced): bool positionAtLeft = (horizontalPosition - horizontalOffset < 0);
-
2625 bool positionAtRight = (horizontalPosition - horizontalOffset + cellWidth > viewportWidth);
executed (the execution status of this line is deduced): bool positionAtRight = (horizontalPosition - horizontalOffset + cellWidth > viewportWidth);
-
2626 -
2627 if (hint == PositionAtCenter || positionAtRight) {
partially evaluated: hint == PositionAtCenter
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4569
evaluated: positionAtRight
TRUEFALSE
yes
Evaluation Count:2126
yes
Evaluation Count:2443
0-4569
2628 int w = (hint == PositionAtCenter ? viewportWidth / 2 : viewportWidth);
partially evaluated: hint == PositionAtCenter
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2126
0-2126
2629 int x = cellWidth;
executed (the execution status of this line is deduced): int x = cellWidth;
-
2630 while (horizontalIndex > 0) {
evaluated: horizontalIndex > 0
TRUEFALSE
yes
Evaluation Count:4237
yes
Evaluation Count:7
7-4237
2631 x += columnWidth(d->horizontalHeader->logicalIndex(horizontalIndex-1));
executed (the execution status of this line is deduced): x += columnWidth(d->horizontalHeader->logicalIndex(horizontalIndex-1));
-
2632 if (x > w)
evaluated: x > w
TRUEFALSE
yes
Evaluation Count:2119
yes
Evaluation Count:2118
2118-2119
2633 break;
executed: break;
Execution Count:2119
2119
2634 --horizontalIndex;
executed (the execution status of this line is deduced): --horizontalIndex;
-
2635 }
executed: }
Execution Count:2118
2118
2636 }
executed: }
Execution Count:2126
2126
2637 -
2638 if (positionAtRight || hint == PositionAtCenter || positionAtLeft) {
evaluated: positionAtRight
TRUEFALSE
yes
Evaluation Count:2126
yes
Evaluation Count:2443
partially evaluated: hint == PositionAtCenter
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2443
evaluated: positionAtLeft
TRUEFALSE
yes
Evaluation Count:98
yes
Evaluation Count:2345
0-2443
2639 int hiddenSections = 0;
executed (the execution status of this line is deduced): int hiddenSections = 0;
-
2640 if (d->horizontalHeader->sectionsHidden()) {
evaluated: d->horizontalHeader->sectionsHidden()
TRUEFALSE
yes
Evaluation Count:210
yes
Evaluation Count:2014
210-2014
2641 for (int s = horizontalIndex - 1; s >= 0; --s) {
evaluated: s >= 0
TRUEFALSE
yes
Evaluation Count:1445
yes
Evaluation Count:210
210-1445
2642 int column = d->horizontalHeader->logicalIndex(s);
executed (the execution status of this line is deduced): int column = d->horizontalHeader->logicalIndex(s);
-
2643 if (d->horizontalHeader->isSectionHidden(column))
evaluated: d->horizontalHeader->isSectionHidden(column)
TRUEFALSE
yes
Evaluation Count:76
yes
Evaluation Count:1369
76-1369
2644 ++hiddenSections;
executed: ++hiddenSections;
Execution Count:76
76
2645 }
executed: }
Execution Count:1445
1445
2646 }
executed: }
Execution Count:210
210
2647 horizontalScrollBar()->setValue(horizontalIndex - hiddenSections);
executed (the execution status of this line is deduced): horizontalScrollBar()->setValue(horizontalIndex - hiddenSections);
-
2648 }
executed: }
Execution Count:2224
2224
2649 -
2650 } else { // ScrollPerPixel
executed: }
Execution Count:4569
4569
2651 if (hint == PositionAtCenter) {
partially evaluated: hint == PositionAtCenter
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4080
0-4080
2652 horizontalScrollBar()->setValue(horizontalPosition - ((viewportWidth - cellWidth) / 2));
never executed (the execution status of this line is deduced): horizontalScrollBar()->setValue(horizontalPosition - ((viewportWidth - cellWidth) / 2));
-
2653 } else {
never executed: }
0
2654 if (horizontalPosition - horizontalOffset < 0 || cellWidth > viewportWidth)
evaluated: horizontalPosition - horizontalOffset < 0
TRUEFALSE
yes
Evaluation Count:78
yes
Evaluation Count:4002
partially evaluated: cellWidth > viewportWidth
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4002
0-4002
2655 horizontalScrollBar()->setValue(horizontalPosition);
executed: horizontalScrollBar()->setValue(horizontalPosition);
Execution Count:78
78
2656 else if (horizontalPosition - horizontalOffset + cellWidth > viewportWidth)
evaluated: horizontalPosition - horizontalOffset + cellWidth > viewportWidth
TRUEFALSE
yes
Evaluation Count:1872
yes
Evaluation Count:2130
1872-2130
2657 horizontalScrollBar()->setValue(horizontalPosition - viewportWidth + cellWidth);
executed: horizontalScrollBar()->setValue(horizontalPosition - viewportWidth + cellWidth);
Execution Count:1872
1872
2658 } -
2659 } -
2660 -
2661 // Adjust vertical position -
2662 -
2663 int viewportHeight = d->viewport->height();
executed (the execution status of this line is deduced): int viewportHeight = d->viewport->height();
-
2664 int verticalOffset = d->verticalHeader->offset();
executed (the execution status of this line is deduced): int verticalOffset = d->verticalHeader->offset();
-
2665 int verticalPosition = d->verticalHeader->sectionPosition(index.row());
executed (the execution status of this line is deduced): int verticalPosition = d->verticalHeader->sectionPosition(index.row());
-
2666 int verticalIndex = d->verticalHeader->visualIndex(index.row());
executed (the execution status of this line is deduced): int verticalIndex = d->verticalHeader->visualIndex(index.row());
-
2667 int cellHeight = d->hasSpans()
evaluated: d->hasSpans()
TRUEFALSE
yes
Evaluation Count:47
yes
Evaluation Count:8602
47-8602
2668 ? d->rowSpanHeight(index.row(), span.height())
executed (the execution status of this line is deduced): ? d->rowSpanHeight(index.row(), span.height())
-
2669 : d->verticalHeader->sectionSize(index.row());
executed (the execution status of this line is deduced): : d->verticalHeader->sectionSize(index.row());
-
2670 -
2671 if (verticalPosition - verticalOffset < 0 || cellHeight > viewportHeight) {
evaluated: verticalPosition - verticalOffset < 0
TRUEFALSE
yes
Evaluation Count:25
yes
Evaluation Count:8624
partially evaluated: cellHeight > viewportHeight
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8624
0-8624
2672 if (hint == EnsureVisible)
partially evaluated: hint == EnsureVisible
TRUEFALSE
yes
Evaluation Count:25
no
Evaluation Count:0
0-25
2673 hint = PositionAtTop;
executed: hint = PositionAtTop;
Execution Count:25
25
2674 } else if (verticalPosition - verticalOffset + cellHeight > viewportHeight) {
executed: }
Execution Count:25
evaluated: verticalPosition - verticalOffset + cellHeight > viewportHeight
TRUEFALSE
yes
Evaluation Count:252
yes
Evaluation Count:8372
25-8372
2675 if (hint == EnsureVisible)
evaluated: hint == EnsureVisible
TRUEFALSE
yes
Evaluation Count:251
yes
Evaluation Count:1
1-251
2676 hint = PositionAtBottom;
executed: hint = PositionAtBottom;
Execution Count:251
251
2677 }
executed: }
Execution Count:252
252
2678 -
2679 if (verticalScrollMode() == QAbstractItemView::ScrollPerItem) {
evaluated: verticalScrollMode() == QAbstractItemView::ScrollPerItem
TRUEFALSE
yes
Evaluation Count:4562
yes
Evaluation Count:4087
4087-4562
2680 -
2681 if (hint == PositionAtBottom || hint == PositionAtCenter) {
evaluated: hint == PositionAtBottom
TRUEFALSE
yes
Evaluation Count:184
yes
Evaluation Count:4378
partially evaluated: hint == PositionAtCenter
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4378
0-4378
2682 int h = (hint == PositionAtCenter ? viewportHeight / 2 : viewportHeight);
partially evaluated: hint == PositionAtCenter
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:184
0-184
2683 int y = cellHeight;
executed (the execution status of this line is deduced): int y = cellHeight;
-
2684 while (verticalIndex > 0) {
partially evaluated: verticalIndex > 0
TRUEFALSE
yes
Evaluation Count:769
no
Evaluation Count:0
0-769
2685 int row = d->verticalHeader->logicalIndex(verticalIndex - 1);
executed (the execution status of this line is deduced): int row = d->verticalHeader->logicalIndex(verticalIndex - 1);
-
2686 y += d->verticalHeader->sectionSize(row);
executed (the execution status of this line is deduced): y += d->verticalHeader->sectionSize(row);
-
2687 if (y > h)
evaluated: y > h
TRUEFALSE
yes
Evaluation Count:184
yes
Evaluation Count:585
184-585
2688 break;
executed: break;
Execution Count:184
184
2689 --verticalIndex;
executed (the execution status of this line is deduced): --verticalIndex;
-
2690 }
executed: }
Execution Count:585
585
2691 }
executed: }
Execution Count:184
184
2692 -
2693 if (hint == PositionAtBottom || hint == PositionAtCenter || hint == PositionAtTop) {
evaluated: hint == PositionAtBottom
TRUEFALSE
yes
Evaluation Count:184
yes
Evaluation Count:4378
partially evaluated: hint == PositionAtCenter
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4378
evaluated: hint == PositionAtTop
TRUEFALSE
yes
Evaluation Count:20
yes
Evaluation Count:4358
0-4378
2694 int hiddenSections = 0;
executed (the execution status of this line is deduced): int hiddenSections = 0;
-
2695 if (d->verticalHeader->sectionsHidden()) {
evaluated: d->verticalHeader->sectionsHidden()
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:192
12-192
2696 for (int s = verticalIndex - 1; s >= 0; --s) {
evaluated: s >= 0
TRUEFALSE
yes
Evaluation Count:74
yes
Evaluation Count:12
12-74
2697 int row = d->verticalHeader->logicalIndex(s);
executed (the execution status of this line is deduced): int row = d->verticalHeader->logicalIndex(s);
-
2698 if (d->verticalHeader->isSectionHidden(row))
evaluated: d->verticalHeader->isSectionHidden(row)
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:70
4-70
2699 ++hiddenSections;
executed: ++hiddenSections;
Execution Count:4
4
2700 }
executed: }
Execution Count:74
74
2701 }
executed: }
Execution Count:12
12
2702 verticalScrollBar()->setValue(verticalIndex - hiddenSections);
executed (the execution status of this line is deduced): verticalScrollBar()->setValue(verticalIndex - hiddenSections);
-
2703 }
executed: }
Execution Count:204
204
2704 -
2705 } else { // ScrollPerPixel
executed: }
Execution Count:4562
4562
2706 if (hint == PositionAtTop) {
evaluated: hint == PositionAtTop
TRUEFALSE
yes
Evaluation Count:17
yes
Evaluation Count:4070
17-4070
2707 verticalScrollBar()->setValue(verticalPosition);
executed (the execution status of this line is deduced): verticalScrollBar()->setValue(verticalPosition);
-
2708 } else if (hint == PositionAtBottom) {
executed: }
Execution Count:17
evaluated: hint == PositionAtBottom
TRUEFALSE
yes
Evaluation Count:67
yes
Evaluation Count:4003
17-4003
2709 verticalScrollBar()->setValue(verticalPosition - viewportHeight + cellHeight);
executed (the execution status of this line is deduced): verticalScrollBar()->setValue(verticalPosition - viewportHeight + cellHeight);
-
2710 } else if (hint == PositionAtCenter) {
executed: }
Execution Count:67
partially evaluated: hint == PositionAtCenter
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4003
0-4003
2711 verticalScrollBar()->setValue(verticalPosition - ((viewportHeight - cellHeight) / 2));
never executed (the execution status of this line is deduced): verticalScrollBar()->setValue(verticalPosition - ((viewportHeight - cellHeight) / 2));
-
2712 }
never executed: }
0
2713 } -
2714 -
2715 update(index);
executed (the execution status of this line is deduced): update(index);
-
2716}
executed: }
Execution Count:8649
8649
2717 -
2718/*! -
2719 This slot is called to change the height of the given \a row. The -
2720 old height is specified by \a oldHeight, and the new height by \a -
2721 newHeight. -
2722 -
2723 \sa columnResized() -
2724*/ -
2725void QTableView::rowResized(int row, int, int) -
2726{ -
2727 Q_D(QTableView);
executed (the execution status of this line is deduced): QTableViewPrivate * const d = d_func();
-
2728 d->rowsToUpdate.append(row);
executed (the execution status of this line is deduced): d->rowsToUpdate.append(row);
-
2729 if (d->rowResizeTimerID == 0)
evaluated: d->rowResizeTimerID == 0
TRUEFALSE
yes
Evaluation Count:126
yes
Evaluation Count:1059
126-1059
2730 d->rowResizeTimerID = startTimer(0);
executed: d->rowResizeTimerID = startTimer(0);
Execution Count:126
126
2731}
executed: }
Execution Count:1185
1185
2732 -
2733/*! -
2734 This slot is called to change the width of the given \a column. -
2735 The old width is specified by \a oldWidth, and the new width by \a -
2736 newWidth. -
2737 -
2738 \sa rowResized() -
2739*/ -
2740void QTableView::columnResized(int column, int, int) -
2741{ -
2742 Q_D(QTableView);
executed (the execution status of this line is deduced): QTableViewPrivate * const d = d_func();
-
2743 d->columnsToUpdate.append(column);
executed (the execution status of this line is deduced): d->columnsToUpdate.append(column);
-
2744 if (d->columnResizeTimerID == 0)
evaluated: d->columnResizeTimerID == 0
TRUEFALSE
yes
Evaluation Count:124
yes
Evaluation Count:831
124-831
2745 d->columnResizeTimerID = startTimer(0);
executed: d->columnResizeTimerID = startTimer(0);
Execution Count:124
124
2746}
executed: }
Execution Count:955
955
2747 -
2748/*! -
2749 \reimp -
2750 */ -
2751void QTableView::timerEvent(QTimerEvent *event) -
2752{ -
2753 Q_D(QTableView);
executed (the execution status of this line is deduced): QTableViewPrivate * const d = d_func();
-
2754 -
2755 if (event->timerId() == d->columnResizeTimerID) {
evaluated: event->timerId() == d->columnResizeTimerID
TRUEFALSE
yes
Evaluation Count:30
yes
Evaluation Count:153
30-153
2756 updateGeometries();
executed (the execution status of this line is deduced): updateGeometries();
-
2757 killTimer(d->columnResizeTimerID);
executed (the execution status of this line is deduced): killTimer(d->columnResizeTimerID);
-
2758 d->columnResizeTimerID = 0;
executed (the execution status of this line is deduced): d->columnResizeTimerID = 0;
-
2759 -
2760 QRect rect;
executed (the execution status of this line is deduced): QRect rect;
-
2761 int viewportHeight = d->viewport->height();
executed (the execution status of this line is deduced): int viewportHeight = d->viewport->height();
-
2762 int viewportWidth = d->viewport->width();
executed (the execution status of this line is deduced): int viewportWidth = d->viewport->width();
-
2763 if (d->hasSpans()) {
evaluated: d->hasSpans()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:28
2-28
2764 rect = QRect(0, 0, viewportWidth, viewportHeight);
executed (the execution status of this line is deduced): rect = QRect(0, 0, viewportWidth, viewportHeight);
-
2765 } else {
executed: }
Execution Count:2
2
2766 for (int i = d->columnsToUpdate.size()-1; i >= 0; --i) {
evaluated: i >= 0
TRUEFALSE
yes
Evaluation Count:384
yes
Evaluation Count:28
28-384
2767 int column = d->columnsToUpdate.at(i);
executed (the execution status of this line is deduced): int column = d->columnsToUpdate.at(i);
-
2768 int x = columnViewportPosition(column);
executed (the execution status of this line is deduced): int x = columnViewportPosition(column);
-
2769 if (isRightToLeft())
partially evaluated: isRightToLeft()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:384
0-384
2770 rect |= QRect(0, 0, x + columnWidth(column), viewportHeight);
never executed: rect |= QRect(0, 0, x + columnWidth(column), viewportHeight);
0
2771 else -
2772 rect |= QRect(x, 0, viewportWidth - x, viewportHeight);
executed: rect |= QRect(x, 0, viewportWidth - x, viewportHeight);
Execution Count:384
384
2773 } -
2774 }
executed: }
Execution Count:28
28
2775 -
2776 d->viewport->update(rect.normalized());
executed (the execution status of this line is deduced): d->viewport->update(rect.normalized());
-
2777 d->columnsToUpdate.clear();
executed (the execution status of this line is deduced): d->columnsToUpdate.clear();
-
2778 }
executed: }
Execution Count:30
30
2779 -
2780 if (event->timerId() == d->rowResizeTimerID) {
evaluated: event->timerId() == d->rowResizeTimerID
TRUEFALSE
yes
Evaluation Count:38
yes
Evaluation Count:145
38-145
2781 updateGeometries();
executed (the execution status of this line is deduced): updateGeometries();
-
2782 killTimer(d->rowResizeTimerID);
executed (the execution status of this line is deduced): killTimer(d->rowResizeTimerID);
-
2783 d->rowResizeTimerID = 0;
executed (the execution status of this line is deduced): d->rowResizeTimerID = 0;
-
2784 -
2785 int viewportHeight = d->viewport->height();
executed (the execution status of this line is deduced): int viewportHeight = d->viewport->height();
-
2786 int viewportWidth = d->viewport->width();
executed (the execution status of this line is deduced): int viewportWidth = d->viewport->width();
-
2787 int top;
executed (the execution status of this line is deduced): int top;
-
2788 if (d->hasSpans()) {
evaluated: d->hasSpans()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:36
2-36
2789 top = 0;
executed (the execution status of this line is deduced): top = 0;
-
2790 } else {
executed: }
Execution Count:2
2
2791 top = viewportHeight;
executed (the execution status of this line is deduced): top = viewportHeight;
-
2792 for (int i = d->rowsToUpdate.size()-1; i >= 0; --i) {
evaluated: i >= 0
TRUEFALSE
yes
Evaluation Count:344
yes
Evaluation Count:36
36-344
2793 int y = rowViewportPosition(d->rowsToUpdate.at(i));
executed (the execution status of this line is deduced): int y = rowViewportPosition(d->rowsToUpdate.at(i));
-
2794 top = qMin(top, y);
executed (the execution status of this line is deduced): top = qMin(top, y);
-
2795 }
executed: }
Execution Count:344
344
2796 }
executed: }
Execution Count:36
36
2797 -
2798 d->viewport->update(QRect(0, top, viewportWidth, viewportHeight - top));
executed (the execution status of this line is deduced): d->viewport->update(QRect(0, top, viewportWidth, viewportHeight - top));
-
2799 d->rowsToUpdate.clear();
executed (the execution status of this line is deduced): d->rowsToUpdate.clear();
-
2800 }
executed: }
Execution Count:38
38
2801 -
2802 QAbstractItemView::timerEvent(event);
executed (the execution status of this line is deduced): QAbstractItemView::timerEvent(event);
-
2803}
executed: }
Execution Count:183
183
2804 -
2805/*! -
2806 This slot is called to change the index of the given \a row in the -
2807 table view. The old index is specified by \a oldIndex, and the new -
2808 index by \a newIndex. -
2809 -
2810 \sa columnMoved() -
2811*/ -
2812void QTableView::rowMoved(int, int oldIndex, int newIndex) -
2813{ -
2814 Q_D(QTableView);
executed (the execution status of this line is deduced): QTableViewPrivate * const d = d_func();
-
2815 -
2816 updateGeometries();
executed (the execution status of this line is deduced): updateGeometries();
-
2817 int logicalOldIndex = d->verticalHeader->logicalIndex(oldIndex);
executed (the execution status of this line is deduced): int logicalOldIndex = d->verticalHeader->logicalIndex(oldIndex);
-
2818 int logicalNewIndex = d->verticalHeader->logicalIndex(newIndex);
executed (the execution status of this line is deduced): int logicalNewIndex = d->verticalHeader->logicalIndex(newIndex);
-
2819 if (d->hasSpans()) {
partially evaluated: d->hasSpans()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:111
0-111
2820 d->viewport->update();
never executed (the execution status of this line is deduced): d->viewport->update();
-
2821 } else {
never executed: }
0
2822 int oldTop = rowViewportPosition(logicalOldIndex);
executed (the execution status of this line is deduced): int oldTop = rowViewportPosition(logicalOldIndex);
-
2823 int newTop = rowViewportPosition(logicalNewIndex);
executed (the execution status of this line is deduced): int newTop = rowViewportPosition(logicalNewIndex);
-
2824 int oldBottom = oldTop + rowHeight(logicalOldIndex);
executed (the execution status of this line is deduced): int oldBottom = oldTop + rowHeight(logicalOldIndex);
-
2825 int newBottom = newTop + rowHeight(logicalNewIndex);
executed (the execution status of this line is deduced): int newBottom = newTop + rowHeight(logicalNewIndex);
-
2826 int top = qMin(oldTop, newTop);
executed (the execution status of this line is deduced): int top = qMin(oldTop, newTop);
-
2827 int bottom = qMax(oldBottom, newBottom);
executed (the execution status of this line is deduced): int bottom = qMax(oldBottom, newBottom);
-
2828 int height = bottom - top;
executed (the execution status of this line is deduced): int height = bottom - top;
-
2829 d->viewport->update(0, top, d->viewport->width(), height);
executed (the execution status of this line is deduced): d->viewport->update(0, top, d->viewport->width(), height);
-
2830 }
executed: }
Execution Count:111
111
2831} -
2832 -
2833/*! -
2834 This slot is called to change the index of the given \a column in -
2835 the table view. The old index is specified by \a oldIndex, and -
2836 the new index by \a newIndex. -
2837 -
2838 \sa rowMoved() -
2839*/ -
2840void QTableView::columnMoved(int, int oldIndex, int newIndex) -
2841{ -
2842 Q_D(QTableView);
executed (the execution status of this line is deduced): QTableViewPrivate * const d = d_func();
-
2843 -
2844 updateGeometries();
executed (the execution status of this line is deduced): updateGeometries();
-
2845 int logicalOldIndex = d->horizontalHeader->logicalIndex(oldIndex);
executed (the execution status of this line is deduced): int logicalOldIndex = d->horizontalHeader->logicalIndex(oldIndex);
-
2846 int logicalNewIndex = d->horizontalHeader->logicalIndex(newIndex);
executed (the execution status of this line is deduced): int logicalNewIndex = d->horizontalHeader->logicalIndex(newIndex);
-
2847 if (d->hasSpans()) {
partially evaluated: d->hasSpans()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7
0-7
2848 d->viewport->update();
never executed (the execution status of this line is deduced): d->viewport->update();
-
2849 } else {
never executed: }
0
2850 int oldLeft = columnViewportPosition(logicalOldIndex);
executed (the execution status of this line is deduced): int oldLeft = columnViewportPosition(logicalOldIndex);
-
2851 int newLeft = columnViewportPosition(logicalNewIndex);
executed (the execution status of this line is deduced): int newLeft = columnViewportPosition(logicalNewIndex);
-
2852 int oldRight = oldLeft + columnWidth(logicalOldIndex);
executed (the execution status of this line is deduced): int oldRight = oldLeft + columnWidth(logicalOldIndex);
-
2853 int newRight = newLeft + columnWidth(logicalNewIndex);
executed (the execution status of this line is deduced): int newRight = newLeft + columnWidth(logicalNewIndex);
-
2854 int left = qMin(oldLeft, newLeft);
executed (the execution status of this line is deduced): int left = qMin(oldLeft, newLeft);
-
2855 int right = qMax(oldRight, newRight);
executed (the execution status of this line is deduced): int right = qMax(oldRight, newRight);
-
2856 int width = right - left;
executed (the execution status of this line is deduced): int width = right - left;
-
2857 d->viewport->update(left, 0, width, d->viewport->height());
executed (the execution status of this line is deduced): d->viewport->update(left, 0, width, d->viewport->height());
-
2858 }
executed: }
Execution Count:7
7
2859} -
2860 -
2861/*! -
2862 Selects the given \a row in the table view if the current -
2863 SelectionMode and SelectionBehavior allows rows to be selected. -
2864 -
2865 \sa selectColumn() -
2866*/ -
2867void QTableView::selectRow(int row) -
2868{ -
2869 Q_D(QTableView);
executed (the execution status of this line is deduced): QTableViewPrivate * const d = d_func();
-
2870 d->selectRow(row, true);
executed (the execution status of this line is deduced): d->selectRow(row, true);
-
2871}
executed: }
Execution Count:13
13
2872 -
2873/*! -
2874 Selects the given \a column in the table view if the current -
2875 SelectionMode and SelectionBehavior allows columns to be selected. -
2876 -
2877 \sa selectRow() -
2878*/ -
2879void QTableView::selectColumn(int column) -
2880{ -
2881 Q_D(QTableView);
executed (the execution status of this line is deduced): QTableViewPrivate * const d = d_func();
-
2882 d->selectColumn(column, true);
executed (the execution status of this line is deduced): d->selectColumn(column, true);
-
2883}
executed: }
Execution Count:13
13
2884 -
2885/*! -
2886 Hide the given \a row. -
2887 -
2888 \sa showRow(), hideColumn() -
2889*/ -
2890void QTableView::hideRow(int row) -
2891{ -
2892 Q_D(QTableView);
executed (the execution status of this line is deduced): QTableViewPrivate * const d = d_func();
-
2893 d->verticalHeader->hideSection(row);
executed (the execution status of this line is deduced): d->verticalHeader->hideSection(row);
-
2894}
executed: }
Execution Count:111
111
2895 -
2896/*! -
2897 Hide the given \a column. -
2898 -
2899 \sa showColumn(), hideRow() -
2900*/ -
2901void QTableView::hideColumn(int column) -
2902{ -
2903 Q_D(QTableView);
executed (the execution status of this line is deduced): QTableViewPrivate * const d = d_func();
-
2904 d->horizontalHeader->hideSection(column);
executed (the execution status of this line is deduced): d->horizontalHeader->hideSection(column);
-
2905}
executed: }
Execution Count:108
108
2906 -
2907/*! -
2908 Show the given \a row. -
2909 -
2910 \sa hideRow(), showColumn() -
2911*/ -
2912void QTableView::showRow(int row) -
2913{ -
2914 Q_D(QTableView);
executed (the execution status of this line is deduced): QTableViewPrivate * const d = d_func();
-
2915 d->verticalHeader->showSection(row);
executed (the execution status of this line is deduced): d->verticalHeader->showSection(row);
-
2916}
executed: }
Execution Count:418
418
2917 -
2918/*! -
2919 Show the given \a column. -
2920 -
2921 \sa hideColumn(), showRow() -
2922*/ -
2923void QTableView::showColumn(int column) -
2924{ -
2925 Q_D(QTableView);
executed (the execution status of this line is deduced): QTableViewPrivate * const d = d_func();
-
2926 d->horizontalHeader->showSection(column);
executed (the execution status of this line is deduced): d->horizontalHeader->showSection(column);
-
2927}
executed: }
Execution Count:418
418
2928 -
2929/*! -
2930 Resizes the given \a row based on the size hints of the delegate -
2931 used to render each item in the row. -
2932*/ -
2933void QTableView::resizeRowToContents(int row) -
2934{ -
2935 Q_D(QTableView);
executed (the execution status of this line is deduced): QTableViewPrivate * const d = d_func();
-
2936 int content = sizeHintForRow(row);
executed (the execution status of this line is deduced): int content = sizeHintForRow(row);
-
2937 int header = d->verticalHeader->sectionSizeHint(row);
executed (the execution status of this line is deduced): int header = d->verticalHeader->sectionSizeHint(row);
-
2938 d->verticalHeader->resizeSection(row, qMax(content, header));
executed (the execution status of this line is deduced): d->verticalHeader->resizeSection(row, qMax(content, header));
-
2939}
executed: }
Execution Count:2
2
2940 -
2941/*! -
2942 Resizes all rows based on the size hints of the delegate -
2943 used to render each item in the rows. -
2944*/ -
2945void QTableView::resizeRowsToContents() -
2946{ -
2947 Q_D(QTableView);
executed (the execution status of this line is deduced): QTableViewPrivate * const d = d_func();
-
2948 d->verticalHeader->resizeSections(QHeaderView::ResizeToContents);
executed (the execution status of this line is deduced): d->verticalHeader->resizeSections(QHeaderView::ResizeToContents);
-
2949}
executed: }
Execution Count:4
4
2950 -
2951/*! -
2952 Resizes the given \a column based on the size hints of the delegate -
2953 used to render each item in the column. -
2954 -
2955 \note Only visible columns will be resized. Reimplement sizeHintForColumn() -
2956 to resize hidden columns as well. -
2957*/ -
2958void QTableView::resizeColumnToContents(int column) -
2959{ -
2960 Q_D(QTableView);
executed (the execution status of this line is deduced): QTableViewPrivate * const d = d_func();
-
2961 int content = sizeHintForColumn(column);
executed (the execution status of this line is deduced): int content = sizeHintForColumn(column);
-
2962 int header = d->horizontalHeader->sectionSizeHint(column);
executed (the execution status of this line is deduced): int header = d->horizontalHeader->sectionSizeHint(column);
-
2963 d->horizontalHeader->resizeSection(column, qMax(content, header));
executed (the execution status of this line is deduced): d->horizontalHeader->resizeSection(column, qMax(content, header));
-
2964}
executed: }
Execution Count:3
3
2965 -
2966/*! -
2967 Resizes all columns based on the size hints of the delegate -
2968 used to render each item in the columns. -
2969*/ -
2970void QTableView::resizeColumnsToContents() -
2971{ -
2972 Q_D(QTableView);
executed (the execution status of this line is deduced): QTableViewPrivate * const d = d_func();
-
2973 d->horizontalHeader->resizeSections(QHeaderView::ResizeToContents);
executed (the execution status of this line is deduced): d->horizontalHeader->resizeSections(QHeaderView::ResizeToContents);
-
2974}
executed: }
Execution Count:4
4
2975 -
2976/*! -
2977 \obsolete -
2978 \overload -
2979 -
2980 Sorts the model by the values in the given \a column. -
2981*/ -
2982void QTableView::sortByColumn(int column) -
2983{ -
2984 Q_D(QTableView);
executed (the execution status of this line is deduced): QTableViewPrivate * const d = d_func();
-
2985 if (column == -1)
partially evaluated: column == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:50
0-50
2986 return;
never executed: return;
0
2987 d->model->sort(column, d->horizontalHeader->sortIndicatorOrder());
executed (the execution status of this line is deduced): d->model->sort(column, d->horizontalHeader->sortIndicatorOrder());
-
2988}
executed: }
Execution Count:50
50
2989 -
2990/*! -
2991 \since 4.2 -
2992 -
2993 Sorts the model by the values in the given \a column in the given \a order. -
2994 -
2995 \sa sortingEnabled -
2996 */ -
2997void QTableView::sortByColumn(int column, Qt::SortOrder order) -
2998{ -
2999 Q_D(QTableView);
executed (the execution status of this line is deduced): QTableViewPrivate * const d = d_func();
-
3000 d->horizontalHeader->setSortIndicator(column, order);
executed (the execution status of this line is deduced): d->horizontalHeader->setSortIndicator(column, order);
-
3001 sortByColumn(column);
executed (the execution status of this line is deduced): sortByColumn(column);
-
3002}
executed: }
Execution Count:33
33
3003 -
3004/*! -
3005 \internal -
3006*/ -
3007void QTableView::verticalScrollbarAction(int action) -
3008{ -
3009 QAbstractItemView::verticalScrollbarAction(action);
executed (the execution status of this line is deduced): QAbstractItemView::verticalScrollbarAction(action);
-
3010}
executed: }
Execution Count:6
6
3011 -
3012/*! -
3013 \internal -
3014*/ -
3015void QTableView::horizontalScrollbarAction(int action) -
3016{ -
3017 QAbstractItemView::horizontalScrollbarAction(action);
executed (the execution status of this line is deduced): QAbstractItemView::horizontalScrollbarAction(action);
-
3018}
executed: }
Execution Count:5
5
3019 -
3020/*! -
3021 \reimp -
3022*/ -
3023bool QTableView::isIndexHidden(const QModelIndex &index) const -
3024{ -
3025 Q_D(const QTableView);
executed (the execution status of this line is deduced): const QTableViewPrivate * const d = d_func();
-
3026 Q_ASSERT(d->isIndexValid(index));
executed (the execution status of this line is deduced): qt_noop();
-
3027 if (isRowHidden(index.row()) || isColumnHidden(index.column()))
evaluated: isRowHidden(index.row())
TRUEFALSE
yes
Evaluation Count:77
yes
Evaluation Count:29142
evaluated: isColumnHidden(index.column())
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:29127
15-29142
3028 return true;
executed: return true;
Execution Count:92
92
3029 if (d->hasSpans()) {
evaluated: d->hasSpans()
TRUEFALSE
yes
Evaluation Count:18
yes
Evaluation Count:29109
18-29109
3030 QSpanCollection::Span span = d->span(index.row(), index.column());
executed (the execution status of this line is deduced): QSpanCollection::Span span = d->span(index.row(), index.column());
-
3031 return !((span.top() == index.row()) && (span.left() == index.column()));
executed: return !((span.top() == index.row()) && (span.left() == index.column()));
Execution Count:18
18
3032 } -
3033 return false;
executed: return false;
Execution Count:29109
29109
3034} -
3035 -
3036/*! -
3037 \fn void QTableView::setSpan(int row, int column, int rowSpanCount, int columnSpanCount) -
3038 \since 4.2 -
3039 -
3040 Sets the span of the table element at (\a row, \a column) to the number of -
3041 rows and columns specified by (\a rowSpanCount, \a columnSpanCount). -
3042 -
3043 \sa rowSpan(), columnSpan() -
3044*/ -
3045void QTableView::setSpan(int row, int column, int rowSpan, int columnSpan) -
3046{ -
3047 Q_D(QTableView);
executed (the execution status of this line is deduced): QTableViewPrivate * const d = d_func();
-
3048 if (row < 0 || column < 0 || rowSpan < 0 || columnSpan < 0)
evaluated: row < 0
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:126
partially evaluated: column < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:126
partially evaluated: rowSpan < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:126
partially evaluated: columnSpan < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:126
0-126
3049 return;
executed: return;
Execution Count:14
14
3050 d->setSpan(row, column, rowSpan, columnSpan);
executed (the execution status of this line is deduced): d->setSpan(row, column, rowSpan, columnSpan);
-
3051 d->viewport->update();
executed (the execution status of this line is deduced): d->viewport->update();
-
3052}
executed: }
Execution Count:126
126
3053 -
3054/*! -
3055 \since 4.2 -
3056 -
3057 Returns the row span of the table element at (\a row, \a column). -
3058 The default is 1. -
3059 -
3060 \sa setSpan(), columnSpan() -
3061*/ -
3062int QTableView::rowSpan(int row, int column) const -
3063{ -
3064 Q_D(const QTableView);
executed (the execution status of this line is deduced): const QTableViewPrivate * const d = d_func();
-
3065 return d->rowSpan(row, column);
executed: return d->rowSpan(row, column);
Execution Count:58
58
3066} -
3067 -
3068/*! -
3069 \since 4.2 -
3070 -
3071 Returns the column span of the table element at (\a row, \a -
3072 column). The default is 1. -
3073 -
3074 \sa setSpan(), rowSpan() -
3075*/ -
3076int QTableView::columnSpan(int row, int column) const -
3077{ -
3078 Q_D(const QTableView);
executed (the execution status of this line is deduced): const QTableViewPrivate * const d = d_func();
-
3079 return d->columnSpan(row, column);
executed: return d->columnSpan(row, column);
Execution Count:58
58
3080} -
3081 -
3082/*! -
3083 \since 4.4 -
3084 -
3085 Removes all row and column spans in the table view. -
3086 -
3087 \sa setSpan() -
3088*/ -
3089 -
3090void QTableView::clearSpans() -
3091{ -
3092 Q_D(QTableView);
executed (the execution status of this line is deduced): QTableViewPrivate * const d = d_func();
-
3093 d->spans.clear();
executed (the execution status of this line is deduced): d->spans.clear();
-
3094 d->viewport->update();
executed (the execution status of this line is deduced): d->viewport->update();
-
3095}
executed: }
Execution Count:8
8
3096 -
3097void QTableViewPrivate::_q_selectRow(int row) -
3098{ -
3099 selectRow(row, false);
executed (the execution status of this line is deduced): selectRow(row, false);
-
3100}
executed: }
Execution Count:4
4
3101 -
3102void QTableViewPrivate::_q_selectColumn(int column) -
3103{ -
3104 selectColumn(column, false);
executed (the execution status of this line is deduced): selectColumn(column, false);
-
3105}
executed: }
Execution Count:4
4
3106 -
3107void QTableViewPrivate::selectRow(int row, bool anchor) -
3108{ -
3109 Q_Q(QTableView);
executed (the execution status of this line is deduced): QTableView * const q = q_func();
-
3110 -
3111 if (q->selectionBehavior() == QTableView::SelectColumns
evaluated: q->selectionBehavior() == QTableView::SelectColumns
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:13
4-13
3112 || (q->selectionMode() == QTableView::SingleSelection
evaluated: q->selectionMode() == QTableView::SingleSelection
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:11
2-11
3113 && q->selectionBehavior() == QTableView::SelectItems))
evaluated: q->selectionBehavior() == QTableView::SelectItems
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1
3114 return;
executed: return;
Execution Count:5
5
3115 -
3116 if (row >= 0 && row < model->rowCount(root)) {
partially evaluated: row >= 0
TRUEFALSE
yes
Evaluation Count:12
no
Evaluation Count:0
partially evaluated: row < model->rowCount(root)
TRUEFALSE
yes
Evaluation Count:12
no
Evaluation Count:0
0-12
3117 int column = horizontalHeader->logicalIndexAt(q->isRightToLeft() ? viewport->width() : 0);
executed (the execution status of this line is deduced): int column = horizontalHeader->logicalIndexAt(q->isRightToLeft() ? viewport->width() : 0);
-
3118 QModelIndex index = model->index(row, column, root);
executed (the execution status of this line is deduced): QModelIndex index = model->index(row, column, root);
-
3119 QItemSelectionModel::SelectionFlags command = q->selectionCommand(index);
executed (the execution status of this line is deduced): QItemSelectionModel::SelectionFlags command = q->selectionCommand(index);
-
3120 selectionModel->setCurrentIndex(index, QItemSelectionModel::NoUpdate);
executed (the execution status of this line is deduced): selectionModel->setCurrentIndex(index, QItemSelectionModel::NoUpdate);
-
3121 if ((anchor && !(command & QItemSelectionModel::Current))
evaluated: anchor
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:4
partially evaluated: !(command & QItemSelectionModel::Current)
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
0-8
3122 || (q->selectionMode() == QTableView::SingleSelection))
partially evaluated: (q->selectionMode() == QTableView::SingleSelection)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
3123 rowSectionAnchor = row;
executed: rowSectionAnchor = row;
Execution Count:8
8
3124 -
3125 if (q->selectionMode() != QTableView::SingleSelection
evaluated: q->selectionMode() != QTableView::SingleSelection
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:1
1-11
3126 && command.testFlag(QItemSelectionModel::Toggle)) {
evaluated: command.testFlag(QItemSelectionModel::Toggle)
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:4
4-7
3127 if (anchor)
evaluated: anchor
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:4
3-4
3128 ctrlDragSelectionFlag = verticalHeader->selectionModel()->selectedRows().contains(index)
executed: ctrlDragSelectionFlag = verticalHeader->selectionModel()->selectedRows().contains(index) ? QItemSelectionModel::Deselect : QItemSelectionModel::Select;
Execution Count:3
partially evaluated: verticalHeader->selectionModel()->selectedRows().contains(index)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
3129 ? QItemSelectionModel::Deselect : QItemSelectionModel::Select;
executed: ctrlDragSelectionFlag = verticalHeader->selectionModel()->selectedRows().contains(index) ? QItemSelectionModel::Deselect : QItemSelectionModel::Select;
Execution Count:3
3
3130 command &= ~QItemSelectionModel::Toggle;
executed (the execution status of this line is deduced): command &= ~QItemSelectionModel::Toggle;
-
3131 command |= ctrlDragSelectionFlag;
executed (the execution status of this line is deduced): command |= ctrlDragSelectionFlag;
-
3132 if (!anchor)
evaluated: !anchor
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:3
3-4
3133 command |= QItemSelectionModel::Current;
executed: command |= QItemSelectionModel::Current;
Execution Count:4
4
3134 }
executed: }
Execution Count:7
7
3135 -
3136 QModelIndex tl = model->index(qMin(rowSectionAnchor, row), logicalColumn(0), root);
executed (the execution status of this line is deduced): QModelIndex tl = model->index(qMin(rowSectionAnchor, row), logicalColumn(0), root);
-
3137 QModelIndex br = model->index(qMax(rowSectionAnchor, row), logicalColumn(model->columnCount(root) - 1), root);
executed (the execution status of this line is deduced): QModelIndex br = model->index(qMax(rowSectionAnchor, row), logicalColumn(model->columnCount(root) - 1), root);
-
3138 if ((verticalHeader->sectionsMoved() && tl.row() != br.row())
partially evaluated: verticalHeader->sectionsMoved()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12
never evaluated: tl.row() != br.row()
0-12
3139 || horizontalHeader->sectionsMoved()) {
partially evaluated: horizontalHeader->sectionsMoved()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12
0-12
3140 q->setSelection(q->visualRect(tl)|q->visualRect(br), command);
never executed (the execution status of this line is deduced): q->setSelection(q->visualRect(tl)|q->visualRect(br), command);
-
3141 } else {
never executed: }
0
3142 selectionModel->select(QItemSelection(tl, br), command);
executed (the execution status of this line is deduced): selectionModel->select(QItemSelection(tl, br), command);
-
3143 }
executed: }
Execution Count:12
12
3144 } -
3145}
executed: }
Execution Count:12
12
3146 -
3147void QTableViewPrivate::selectColumn(int column, bool anchor) -
3148{ -
3149 Q_Q(QTableView);
executed (the execution status of this line is deduced): QTableView * const q = q_func();
-
3150 -
3151 if (q->selectionBehavior() == QTableView::SelectRows
evaluated: q->selectionBehavior() == QTableView::SelectRows
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:13
4-13
3152 || (q->selectionMode() == QTableView::SingleSelection
evaluated: q->selectionMode() == QTableView::SingleSelection
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:11
2-11
3153 && q->selectionBehavior() == QTableView::SelectItems))
evaluated: q->selectionBehavior() == QTableView::SelectItems
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1
3154 return;
executed: return;
Execution Count:5
5
3155 -
3156 if (column >= 0 && column < model->columnCount(root)) {
partially evaluated: column >= 0
TRUEFALSE
yes
Evaluation Count:12
no
Evaluation Count:0
partially evaluated: column < model->columnCount(root)
TRUEFALSE
yes
Evaluation Count:12
no
Evaluation Count:0
0-12
3157 int row = verticalHeader->logicalIndexAt(0);
executed (the execution status of this line is deduced): int row = verticalHeader->logicalIndexAt(0);
-
3158 QModelIndex index = model->index(row, column, root);
executed (the execution status of this line is deduced): QModelIndex index = model->index(row, column, root);
-
3159 QItemSelectionModel::SelectionFlags command = q->selectionCommand(index);
executed (the execution status of this line is deduced): QItemSelectionModel::SelectionFlags command = q->selectionCommand(index);
-
3160 selectionModel->setCurrentIndex(index, QItemSelectionModel::NoUpdate);
executed (the execution status of this line is deduced): selectionModel->setCurrentIndex(index, QItemSelectionModel::NoUpdate);
-
3161 if ((anchor && !(command & QItemSelectionModel::Current))
evaluated: anchor
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:4
partially evaluated: !(command & QItemSelectionModel::Current)
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
0-8
3162 || (q->selectionMode() == QTableView::SingleSelection))
partially evaluated: (q->selectionMode() == QTableView::SingleSelection)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
3163 columnSectionAnchor = column;
executed: columnSectionAnchor = column;
Execution Count:8
8
3164 -
3165 if (q->selectionMode() != QTableView::SingleSelection
evaluated: q->selectionMode() != QTableView::SingleSelection
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:1
1-11
3166 && command.testFlag(QItemSelectionModel::Toggle)) {
evaluated: command.testFlag(QItemSelectionModel::Toggle)
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:4
4-7
3167 if (anchor)
evaluated: anchor
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:4
3-4
3168 ctrlDragSelectionFlag = horizontalHeader->selectionModel()->selectedColumns().contains(index)
executed: ctrlDragSelectionFlag = horizontalHeader->selectionModel()->selectedColumns().contains(index) ? QItemSelectionModel::Deselect : QItemSelectionModel::Select;
Execution Count:3
partially evaluated: horizontalHeader->selectionModel()->selectedColumns().contains(index)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
3169 ? QItemSelectionModel::Deselect : QItemSelectionModel::Select;
executed: ctrlDragSelectionFlag = horizontalHeader->selectionModel()->selectedColumns().contains(index) ? QItemSelectionModel::Deselect : QItemSelectionModel::Select;
Execution Count:3
3
3170 command &= ~QItemSelectionModel::Toggle;
executed (the execution status of this line is deduced): command &= ~QItemSelectionModel::Toggle;
-
3171 command |= ctrlDragSelectionFlag;
executed (the execution status of this line is deduced): command |= ctrlDragSelectionFlag;
-
3172 if (!anchor)
evaluated: !anchor
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:3
3-4
3173 command |= QItemSelectionModel::Current;
executed: command |= QItemSelectionModel::Current;
Execution Count:4
4
3174 }
executed: }
Execution Count:7
7
3175 -
3176 QModelIndex tl = model->index(logicalRow(0), qMin(columnSectionAnchor, column), root);
executed (the execution status of this line is deduced): QModelIndex tl = model->index(logicalRow(0), qMin(columnSectionAnchor, column), root);
-
3177 QModelIndex br = model->index(logicalRow(model->rowCount(root) - 1),
executed (the execution status of this line is deduced): QModelIndex br = model->index(logicalRow(model->rowCount(root) - 1),
-
3178 qMax(columnSectionAnchor, column), root);
executed (the execution status of this line is deduced): qMax(columnSectionAnchor, column), root);
-
3179 if ((horizontalHeader->sectionsMoved() && tl.column() != br.column())
partially evaluated: horizontalHeader->sectionsMoved()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12
never evaluated: tl.column() != br.column()
0-12
3180 || verticalHeader->sectionsMoved()) {
partially evaluated: verticalHeader->sectionsMoved()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12
0-12
3181 q->setSelection(q->visualRect(tl)|q->visualRect(br), command);
never executed (the execution status of this line is deduced): q->setSelection(q->visualRect(tl)|q->visualRect(br), command);
-
3182 } else {
never executed: }
0
3183 selectionModel->select(QItemSelection(tl, br), command);
executed (the execution status of this line is deduced): selectionModel->select(QItemSelection(tl, br), command);
-
3184 }
executed: }
Execution Count:12
12
3185 } -
3186}
executed: }
Execution Count:12
12
3187 -
3188/*! -
3189 \reimp -
3190 */ -
3191void QTableView::currentChanged(const QModelIndex &current, const QModelIndex &previous) -
3192{ -
3193#ifndef QT_NO_ACCESSIBILITY -
3194 if (QAccessible::isActive()) {
evaluated: QAccessible::isActive()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:1939
3-1939
3195 if (current.isValid()) {
partially evaluated: current.isValid()
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
3196 Q_D(QTableView);
executed (the execution status of this line is deduced): QTableViewPrivate * const d = d_func();
-
3197 int entry = d->accessibleTable2Index(current);
executed (the execution status of this line is deduced): int entry = d->accessibleTable2Index(current);
-
3198 QAccessibleEvent event(this, QAccessible::Focus);
executed (the execution status of this line is deduced): QAccessibleEvent event(this, QAccessible::Focus);
-
3199 event.setChild(entry);
executed (the execution status of this line is deduced): event.setChild(entry);
-
3200 QAccessible::updateAccessibility(&event);
executed (the execution status of this line is deduced): QAccessible::updateAccessibility(&event);
-
3201 }
executed: }
Execution Count:3
3
3202 }
executed: }
Execution Count:3
3
3203#endif -
3204 QAbstractItemView::currentChanged(current, previous);
executed (the execution status of this line is deduced): QAbstractItemView::currentChanged(current, previous);
-
3205}
executed: }
Execution Count:1942
1942
3206 -
3207/*! -
3208 \reimp -
3209 */ -
3210void QTableView::selectionChanged(const QItemSelection &selected, -
3211 const QItemSelection &deselected) -
3212{ -
3213 Q_D(QTableView);
executed (the execution status of this line is deduced): QTableViewPrivate * const d = d_func();
-
3214 Q_UNUSED(d)
executed (the execution status of this line is deduced): (void)d;
-
3215#ifndef QT_NO_ACCESSIBILITY -
3216 if (QAccessible::isActive()) {
evaluated: QAccessible::isActive()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2027
2-2027
3217 // ### does not work properly for selection ranges. -
3218 QModelIndex sel = selected.indexes().value(0);
executed (the execution status of this line is deduced): QModelIndex sel = selected.indexes().value(0);
-
3219 if (sel.isValid()) {
partially evaluated: sel.isValid()
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
3220 int entry = d->accessibleTable2Index(sel);
executed (the execution status of this line is deduced): int entry = d->accessibleTable2Index(sel);
-
3221 QAccessibleEvent event(this, QAccessible::Selection);
executed (the execution status of this line is deduced): QAccessibleEvent event(this, QAccessible::Selection);
-
3222 event.setChild(entry);
executed (the execution status of this line is deduced): event.setChild(entry);
-
3223 QAccessible::updateAccessibility(&event);
executed (the execution status of this line is deduced): QAccessible::updateAccessibility(&event);
-
3224 }
executed: }
Execution Count:2
2
3225 QModelIndex desel = deselected.indexes().value(0);
executed (the execution status of this line is deduced): QModelIndex desel = deselected.indexes().value(0);
-
3226 if (desel.isValid()) {
partially evaluated: desel.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
3227 int entry = d->accessibleTable2Index(desel);
never executed (the execution status of this line is deduced): int entry = d->accessibleTable2Index(desel);
-
3228 QAccessibleEvent event(this, QAccessible::SelectionRemove);
never executed (the execution status of this line is deduced): QAccessibleEvent event(this, QAccessible::SelectionRemove);
-
3229 event.setChild(entry);
never executed (the execution status of this line is deduced): event.setChild(entry);
-
3230 QAccessible::updateAccessibility(&event);
never executed (the execution status of this line is deduced): QAccessible::updateAccessibility(&event);
-
3231 }
never executed: }
0
3232 }
executed: }
Execution Count:2
2
3233#endif -
3234 QAbstractItemView::selectionChanged(selected, deselected);
executed (the execution status of this line is deduced): QAbstractItemView::selectionChanged(selected, deselected);
-
3235}
executed: }
Execution Count:2029
2029
3236 -
3237int QTableView::visualIndex(const QModelIndex &index) const -
3238{ -
3239 return index.row();
never executed: return index.row();
0
3240} -
3241 -
3242QT_END_NAMESPACE -
3243 -
3244#include "qtableview.moc" -
3245 -
3246#include "moc_qtableview.cpp" -
3247 -
3248#endif // QT_NO_TABLEVIEW -
3249 -
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial