itemviews/qheaderview.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4 -
5 -
6 -
7 -
8 -
9 -
10QDataStream &operator<<(QDataStream &out, const QHeaderViewPrivate::SectionItem &section) -
11{ -
12 section.write(out); -
13 return out;
executed: return out;
Execution Count:774
774
14} -
15 -
16QDataStream &operator>>(QDataStream &in, QHeaderViewPrivate::SectionItem &section) -
17{ -
18 section.read(in); -
19 return in;
executed: return in;
Execution Count:435
435
20} -
21QHeaderView::QHeaderView(Qt::Orientation orientation, QWidget *parent) -
22 : QAbstractItemView(*new QHeaderViewPrivate, parent) -
23{ -
24 QHeaderViewPrivate * const d = d_func(); -
25 d->setDefaultValues(orientation); -
26 initialize(); -
27}
executed: }
Execution Count:1855
1855
28 -
29 -
30 -
31 -
32QHeaderView::QHeaderView(QHeaderViewPrivate &dd, -
33 Qt::Orientation orientation, QWidget *parent) -
34 : QAbstractItemView(dd, parent) -
35{ -
36 QHeaderViewPrivate * const d = d_func(); -
37 d->setDefaultValues(orientation); -
38 initialize(); -
39}
never executed: }
0
40 -
41 -
42 -
43 -
44 -
45QHeaderView::~QHeaderView() -
46{ -
47} -
48 -
49 -
50 -
51 -
52void QHeaderView::initialize() -
53{ -
54 QHeaderViewPrivate * const d = d_func(); -
55 setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); -
56 setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); -
57 setFrameStyle(NoFrame); -
58 setFocusPolicy(Qt::NoFocus); -
59 d->viewport->setMouseTracking(true); -
60 d->viewport->setBackgroundRole(QPalette::Button); -
61 d->textElideMode = Qt::ElideNone; -
62 delete d->itemDelegate; -
63}
executed: }
Execution Count:1855
1855
64 -
65 -
66 -
67 -
68void QHeaderView::setModel(QAbstractItemModel *model) -
69{ -
70 if (model == this->model())
evaluated: model == this->model()
TRUEFALSE
yes
Evaluation Count:45
yes
Evaluation Count:3473
45-3473
71 return;
executed: return;
Execution Count:45
45
72 QHeaderViewPrivate * const d = d_func(); -
73 d->persistentHiddenSections.clear(); -
74 if (d->model && d->model != QAbstractItemModelPrivate::staticEmptyModel()) {
partially evaluated: d->model
TRUEFALSE
yes
Evaluation Count:3473
no
Evaluation Count:0
evaluated: d->model != QAbstractItemModelPrivate::staticEmptyModel()
TRUEFALSE
yes
Evaluation Count:22
yes
Evaluation Count:3451
0-3473
75 if (d->orientation == Qt::Horizontal) {
evaluated: d->orientation == Qt::Horizontal
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:16
6-16
76 QObject::disconnect(d->model, "2""columnsInserted(QModelIndex,int,int)", -
77 this, "1""sectionsInserted(QModelIndex,int,int)"); -
78 QObject::disconnect(d->model, "2""columnsAboutToBeRemoved(QModelIndex,int,int)", -
79 this, "1""sectionsAboutToBeRemoved(QModelIndex,int,int)"); -
80 QObject::disconnect(d->model, "2""columnsRemoved(QModelIndex,int,int)", -
81 this, "1""_q_sectionsRemoved(QModelIndex,int,int)"); -
82 QObject::disconnect(d->model, "2""columnsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)", -
83 this, "1""_q_layoutAboutToBeChanged()"); -
84 } else {
executed: }
Execution Count:6
6
85 QObject::disconnect(d->model, "2""rowsInserted(QModelIndex,int,int)", -
86 this, "1""sectionsInserted(QModelIndex,int,int)"); -
87 QObject::disconnect(d->model, "2""rowsAboutToBeRemoved(QModelIndex,int,int)", -
88 this, "1""sectionsAboutToBeRemoved(QModelIndex,int,int)"); -
89 QObject::disconnect(d->model, "2""rowsRemoved(QModelIndex,int,int)", -
90 this, "1""_q_sectionsRemoved(QModelIndex,int,int)"); -
91 QObject::disconnect(d->model, "2""rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)", -
92 this, "1""_q_layoutAboutToBeChanged()"); -
93 }
executed: }
Execution Count:16
16
94 QObject::disconnect(d->model, "2""headerDataChanged(Qt::Orientation,int,int)", -
95 this, "1""headerDataChanged(Qt::Orientation,int,int)"); -
96 QObject::disconnect(d->model, "2""layoutAboutToBeChanged()", -
97 this, "1""_q_layoutAboutToBeChanged()"); -
98 }
executed: }
Execution Count:22
22
99 -
100 if (model && model != QAbstractItemModelPrivate::staticEmptyModel()) {
evaluated: model
TRUEFALSE
yes
Evaluation Count:3470
yes
Evaluation Count:3
evaluated: model != QAbstractItemModelPrivate::staticEmptyModel()
TRUEFALSE
yes
Evaluation Count:1830
yes
Evaluation Count:1640
3-3470
101 if (d->orientation == Qt::Horizontal) {
evaluated: d->orientation == Qt::Horizontal
TRUEFALSE
yes
Evaluation Count:1179
yes
Evaluation Count:651
651-1179
102 QObject::connect(model, "2""columnsInserted(QModelIndex,int,int)", -
103 this, "1""sectionsInserted(QModelIndex,int,int)"); -
104 QObject::connect(model, "2""columnsAboutToBeRemoved(QModelIndex,int,int)", -
105 this, "1""sectionsAboutToBeRemoved(QModelIndex,int,int)"); -
106 QObject::connect(model, "2""columnsRemoved(QModelIndex,int,int)", -
107 this, "1""_q_sectionsRemoved(QModelIndex,int,int)"); -
108 QObject::connect(model, "2""columnsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)", -
109 this, "1""_q_layoutAboutToBeChanged()"); -
110 } else {
executed: }
Execution Count:1179
1179
111 QObject::connect(model, "2""rowsInserted(QModelIndex,int,int)", -
112 this, "1""sectionsInserted(QModelIndex,int,int)"); -
113 QObject::connect(model, "2""rowsAboutToBeRemoved(QModelIndex,int,int)", -
114 this, "1""sectionsAboutToBeRemoved(QModelIndex,int,int)"); -
115 QObject::connect(model, "2""rowsRemoved(QModelIndex,int,int)", -
116 this, "1""_q_sectionsRemoved(QModelIndex,int,int)"); -
117 QObject::connect(model, "2""rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)", -
118 this, "1""_q_layoutAboutToBeChanged()"); -
119 }
executed: }
Execution Count:651
651
120 QObject::connect(model, "2""headerDataChanged(Qt::Orientation,int,int)", -
121 this, "1""headerDataChanged(Qt::Orientation,int,int)"); -
122 QObject::connect(model, "2""layoutAboutToBeChanged()", -
123 this, "1""_q_layoutAboutToBeChanged()"); -
124 }
executed: }
Execution Count:1830
1830
125 -
126 d->state = QHeaderViewPrivate::NoClear; -
127 QAbstractItemView::setModel(model); -
128 d->state = QHeaderViewPrivate::NoState; -
129 -
130 -
131 -
132 -
133 initializeSections(); -
134}
executed: }
Execution Count:3473
3473
135 -
136 -
137 -
138 -
139 -
140 -
141 -
142Qt::Orientation QHeaderView::orientation() const -
143{ -
144 const QHeaderViewPrivate * const d = d_func(); -
145 return d->orientation;
executed: return d->orientation;
Execution Count:15444
15444
146} -
147int QHeaderView::offset() const -
148{ -
149 const QHeaderViewPrivate * const d = d_func(); -
150 return d->offset;
executed: return d->offset;
Execution Count:32578
32578
151} -
152void QHeaderView::setOffset(int newOffset) -
153{ -
154 QHeaderViewPrivate * const d = d_func(); -
155 if (d->offset == (int)newOffset)
evaluated: d->offset == (int)newOffset
TRUEFALSE
yes
Evaluation Count:4994
yes
Evaluation Count:5896
4994-5896
156 return;
executed: return;
Execution Count:4994
4994
157 int ndelta = d->offset - newOffset; -
158 d->offset = newOffset; -
159 if (d->orientation == Qt::Horizontal)
evaluated: d->orientation == Qt::Horizontal
TRUEFALSE
yes
Evaluation Count:5582
yes
Evaluation Count:314
314-5582
160 d->viewport->scroll(isRightToLeft() ? -ndelta : ndelta, 0);
executed: d->viewport->scroll(isRightToLeft() ? -ndelta : ndelta, 0);
Execution Count:5582
5582
161 else -
162 d->viewport->scroll(0, ndelta);
executed: d->viewport->scroll(0, ndelta);
Execution Count:314
314
163 if (d->state == QHeaderViewPrivate::ResizeSection && !d->preventCursorChangeInSetOffset) {
partially evaluated: d->state == QHeaderViewPrivate::ResizeSection
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5896
never evaluated: !d->preventCursorChangeInSetOffset
0-5896
164 QPoint cursorPos = QCursor::pos(); -
165 if (d->orientation == Qt::Horizontal)
never evaluated: d->orientation == Qt::Horizontal
0
166 QCursor::setPos(cursorPos.x() + ndelta, cursorPos.y());
never executed: QCursor::setPos(cursorPos.x() + ndelta, cursorPos.y());
0
167 else -
168 QCursor::setPos(cursorPos.x(), cursorPos.y() + ndelta);
never executed: QCursor::setPos(cursorPos.x(), cursorPos.y() + ndelta);
0
169 d->firstPos += ndelta; -
170 d->lastPos += ndelta; -
171 }
never executed: }
0
172}
executed: }
Execution Count:5896
5896
173void QHeaderView::setOffsetToSectionPosition(int visualSectionNumber) -
174{ -
175 QHeaderViewPrivate * const d = d_func(); -
176 if (visualSectionNumber > -1 && visualSectionNumber < d->sectionCount()) {
partially evaluated: visualSectionNumber > -1
TRUEFALSE
yes
Evaluation Count:4002
no
Evaluation Count:0
evaluated: visualSectionNumber < d->sectionCount()
TRUEFALSE
yes
Evaluation Count:3309
yes
Evaluation Count:693
0-4002
177 int position = d->headerSectionPosition(d->adjustedVisualIndex(visualSectionNumber)); -
178 setOffset(position); -
179 }
executed: }
Execution Count:3309
3309
180}
executed: }
Execution Count:4002
4002
181 -
182 -
183 -
184 -
185 -
186 -
187 -
188void QHeaderView::setOffsetToLastSection() -
189{ -
190 const QHeaderViewPrivate * const d = d_func(); -
191 int size = (d->orientation == Qt::Horizontal ? viewport()->width() : viewport()->height());
evaluated: d->orientation == Qt::Horizontal
TRUEFALSE
yes
Evaluation Count:151
yes
Evaluation Count:16
16-151
192 int position = length() - size; -
193 setOffset(position); -
194}
executed: }
Execution Count:167
167
195 -
196 -
197 -
198 -
199 -
200 -
201 -
202int QHeaderView::length() const -
203{ -
204 const QHeaderViewPrivate * const d = d_func(); -
205 d->executePostedLayout(); -
206 d->executePostedResize(); -
207 -
208 return d->length;
executed: return d->length;
Execution Count:11163
11163
209} -
210 -
211 -
212 -
213 -
214 -
215 -
216 -
217QSize QHeaderView::sizeHint() const -
218{ -
219 const QHeaderViewPrivate * const d = d_func(); -
220 if (d->cachedSizeHint.isValid())
evaluated: d->cachedSizeHint.isValid()
TRUEFALSE
yes
Evaluation Count:2254
yes
Evaluation Count:3769
2254-3769
221 return d->cachedSizeHint;
executed: return d->cachedSizeHint;
Execution Count:2254
2254
222 d->cachedSizeHint = QSize(0, 0); -
223 const int sectionCount = count(); -
224 -
225 -
226 int i = 0; -
227 for (int checked = 0; checked < 100 && i < sectionCount; ++i) {
evaluated: checked < 100
TRUEFALSE
yes
Evaluation Count:23166
yes
Evaluation Count:46
evaluated: i < sectionCount
TRUEFALSE
yes
Evaluation Count:19443
yes
Evaluation Count:3723
46-23166
228 if (isSectionHidden(i))
evaluated: isSectionHidden(i)
TRUEFALSE
yes
Evaluation Count:143
yes
Evaluation Count:19300
143-19300
229 continue;
executed: continue;
Execution Count:143
143
230 checked++; -
231 QSize hint = sectionSizeFromContents(i); -
232 d->cachedSizeHint = d->cachedSizeHint.expandedTo(hint); -
233 }
executed: }
Execution Count:19300
19300
234 -
235 i = qMax(i, sectionCount - 100 ); -
236 for (int j = sectionCount - 1, checked = 0; j >= i && checked < 100; --j) {
evaluated: j >= i
TRUEFALSE
yes
Evaluation Count:3400
yes
Evaluation Count:3769
partially evaluated: checked < 100
TRUEFALSE
yes
Evaluation Count:3400
no
Evaluation Count:0
0-3769
237 if (isSectionHidden(j))
partially evaluated: isSectionHidden(j)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3400
0-3400
238 continue;
never executed: continue;
0
239 checked++; -
240 QSize hint = sectionSizeFromContents(j); -
241 d->cachedSizeHint = d->cachedSizeHint.expandedTo(hint); -
242 }
executed: }
Execution Count:3400
3400
243 return d->cachedSizeHint;
executed: return d->cachedSizeHint;
Execution Count:3769
3769
244} -
245int QHeaderView::sectionSizeHint(int logicalIndex) const -
246{ -
247 const QHeaderViewPrivate * const d = d_func(); -
248 if (isSectionHidden(logicalIndex))
partially evaluated: isSectionHidden(logicalIndex)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2290
0-2290
249 return 0;
never executed: return 0;
0
250 if (logicalIndex < 0 || logicalIndex >= count())
evaluated: logicalIndex < 0
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:2289
evaluated: logicalIndex >= count()
TRUEFALSE
yes
Evaluation Count:141
yes
Evaluation Count:2148
1-2289
251 return -1;
executed: return -1;
Execution Count:142
142
252 QSize size; -
253 QVariant value = d->model->headerData(logicalIndex, d->orientation, Qt::SizeHintRole); -
254 if (value.isValid())
partially evaluated: value.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2148
0-2148
255 size = qvariant_cast<QSize>(value);
never executed: size = qvariant_cast<QSize>(value);
0
256 else -
257 size = sectionSizeFromContents(logicalIndex);
executed: size = sectionSizeFromContents(logicalIndex);
Execution Count:2148
2148
258 int hint = d->orientation == Qt::Horizontal ? size.width() : size.height();
evaluated: d->orientation == Qt::Horizontal
TRUEFALSE
yes
Evaluation Count:106
yes
Evaluation Count:2042
106-2042
259 return qMax(minimumSectionSize(), hint);
executed: return qMax(minimumSectionSize(), hint);
Execution Count:2148
2148
260} -
261int QHeaderView::visualIndexAt(int position) const -
262{ -
263 const QHeaderViewPrivate * const d = d_func(); -
264 int vposition = position; -
265 d->executePostedLayout(); -
266 d->executePostedResize(); -
267 const int count = d->sectionCount(); -
268 if (count < 1)
evaluated: count < 1
TRUEFALSE
yes
Evaluation Count:108
yes
Evaluation Count:98118
108-98118
269 return -1;
executed: return -1;
Execution Count:108
108
270 -
271 if (d->reverse())
evaluated: d->reverse()
TRUEFALSE
yes
Evaluation Count:47
yes
Evaluation Count:98071
47-98071
272 vposition = d->viewport->width() - vposition;
executed: vposition = d->viewport->width() - vposition;
Execution Count:47
47
273 vposition += d->offset; -
274 -
275 if (vposition > d->length)
evaluated: vposition > d->length
TRUEFALSE
yes
Evaluation Count:4545
yes
Evaluation Count:93573
4545-93573
276 return -1;
executed: return -1;
Execution Count:4545
4545
277 int visual = d->headerVisualIndexAt(vposition); -
278 if (visual < 0)
evaluated: visual < 0
TRUEFALSE
yes
Evaluation Count:377
yes
Evaluation Count:93196
377-93196
279 return -1;
executed: return -1;
Execution Count:377
377
280 -
281 while (d->isVisualIndexHidden(visual)){
partially evaluated: d->isVisualIndexHidden(visual)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:93196
0-93196
282 ++visual; -
283 if (visual >= count)
never evaluated: visual >= count
0
284 return -1;
never executed: return -1;
0
285 }
never executed: }
0
286 return visual;
executed: return visual;
Execution Count:93196
93196
287} -
288 -
289 -
290 -
291 -
292 -
293 -
294 -
295int QHeaderView::logicalIndexAt(int position) const -
296{ -
297 const int visual = visualIndexAt(position); -
298 if (visual > -1)
evaluated: visual > -1
TRUEFALSE
yes
Evaluation Count:51446
yes
Evaluation Count:677
677-51446
299 return logicalIndex(visual);
executed: return logicalIndex(visual);
Execution Count:51446
51446
300 return -1;
executed: return -1;
Execution Count:677
677
301} -
302int QHeaderView::sectionSize(int logicalIndex) const -
303{ -
304 const QHeaderViewPrivate * const d = d_func(); -
305 if (isSectionHidden(logicalIndex))
evaluated: isSectionHidden(logicalIndex)
TRUEFALSE
yes
Evaluation Count:1793
yes
Evaluation Count:245808
1793-245808
306 return 0;
executed: return 0;
Execution Count:1793
1793
307 if (logicalIndex < 0 || logicalIndex >= count())
evaluated: logicalIndex < 0
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:245802
evaluated: logicalIndex >= count()
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:245793
6-245802
308 return 0;
executed: return 0;
Execution Count:15
15
309 int visual = visualIndex(logicalIndex); -
310 if (visual == -1)
partially evaluated: visual == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:245793
0-245793
311 return 0;
never executed: return 0;
0
312 d->executePostedResize(); -
313 return d->headerSectionSize(visual);
executed: return d->headerSectionSize(visual);
Execution Count:245793
245793
314} -
315int QHeaderView::sectionPosition(int logicalIndex) const -
316{ -
317 const QHeaderViewPrivate * const d = d_func(); -
318 int visual = visualIndex(logicalIndex); -
319 -
320 -
321 if (visual == -1)
evaluated: visual == -1
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:181151
5-181151
322 return -1;
executed: return -1;
Execution Count:5
5
323 d->executePostedResize(); -
324 return d->headerSectionPosition(visual);
executed: return d->headerSectionPosition(visual);
Execution Count:181151
181151
325} -
326int QHeaderView::sectionViewportPosition(int logicalIndex) const -
327{ -
328 const QHeaderViewPrivate * const d = d_func(); -
329 if (logicalIndex >= count())
evaluated: logicalIndex >= count()
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:156223
11-156223
330 return -1;
executed: return -1;
Execution Count:11
11
331 int position = sectionPosition(logicalIndex); -
332 if (position < 0)
evaluated: position < 0
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:156218
5-156218
333 return position;
executed: return position;
Execution Count:5
5
334 int offsetPosition = position - d->offset; -
335 if (d->reverse())
evaluated: d->reverse()
TRUEFALSE
yes
Evaluation Count:76
yes
Evaluation Count:156142
76-156142
336 return d->viewport->width() - (offsetPosition + sectionSize(logicalIndex));
executed: return d->viewport->width() - (offsetPosition + sectionSize(logicalIndex));
Execution Count:76
76
337 return offsetPosition;
executed: return offsetPosition;
Execution Count:156142
156142
338} -
339void QHeaderView::moveSection(int from, int to) -
340{ -
341 QHeaderViewPrivate * const d = d_func(); -
342 -
343 d->executePostedLayout(); -
344 if (from < 0 || from >= d->sectionCount() || to < 0 || to >= d->sectionCount())
evaluated: from < 0
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:78
evaluated: from >= d->sectionCount()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:77
evaluated: to < 0
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:76
evaluated: to >= d->sectionCount()
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:69
1-78
345 return;
executed: return;
Execution Count:22
22
346 -
347 if (from == to) {
evaluated: from == to
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:67
2-67
348 int logical = logicalIndex(from); -
349 qt_noop(); -
350 updateSection(logical); -
351 return;
executed: return;
Execution Count:2
2
352 } -
353 -
354 if (stretchLastSection() && to == d->lastVisibleVisualIndex())
evaluated: stretchLastSection()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:63
partially evaluated: to == d->lastVisibleVisualIndex()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-63
355 d->lastSectionSize = sectionSize(from);
never executed: d->lastSectionSize = sectionSize(from);
0
356 -
357 -
358 d->initializeIndexMapping(); -
359 -
360 QBitArray sectionHidden = d->sectionHidden; -
361 int *visualIndices = d->visualIndices.data(); -
362 int *logicalIndices = d->logicalIndices.data(); -
363 int logical = logicalIndices[from]; -
364 int visual = from; -
365 -
366 int affected_count = qAbs(to - from) + 1; -
367 QVarLengthArray<int> sizes(affected_count); -
368 QVarLengthArray<ResizeMode> modes(affected_count); -
369 -
370 -
371 if (to > from) {
evaluated: to > from
TRUEFALSE
yes
Evaluation Count:54
yes
Evaluation Count:13
13-54
372 sizes[to - from] = d->headerSectionSize(from); -
373 modes[to - from] = d->headerSectionResizeMode(from); -
374 while (visual < to) {
evaluated: visual < to
TRUEFALSE
yes
Evaluation Count:10979
yes
Evaluation Count:54
54-10979
375 sizes[visual - from] = d->headerSectionSize(visual + 1); -
376 modes[visual - from] = d->headerSectionResizeMode(visual + 1); -
377 if (!sectionHidden.isEmpty())
evaluated: !sectionHidden.isEmpty()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:10974
5-10974
378 sectionHidden.setBit(visual, sectionHidden.testBit(visual + 1));
executed: sectionHidden.setBit(visual, sectionHidden.testBit(visual + 1));
Execution Count:5
5
379 visualIndices[logicalIndices[visual + 1]] = visual; -
380 logicalIndices[visual] = logicalIndices[visual + 1]; -
381 ++visual; -
382 }
executed: }
Execution Count:10979
10979
383 } else {
executed: }
Execution Count:54
54
384 sizes[0] = d->headerSectionSize(from); -
385 modes[0] = d->headerSectionResizeMode(from); -
386 while (visual > to) {
evaluated: visual > to
TRUEFALSE
yes
Evaluation Count:20
yes
Evaluation Count:13
13-20
387 sizes[visual - to] = d->headerSectionSize(visual - 1); -
388 modes[visual - to] = d->headerSectionResizeMode(visual - 1); -
389 if (!sectionHidden.isEmpty())
evaluated: !sectionHidden.isEmpty()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:16
4-16
390 sectionHidden.setBit(visual, sectionHidden.testBit(visual - 1));
executed: sectionHidden.setBit(visual, sectionHidden.testBit(visual - 1));
Execution Count:4
4
391 visualIndices[logicalIndices[visual - 1]] = visual; -
392 logicalIndices[visual] = logicalIndices[visual - 1]; -
393 --visual; -
394 }
executed: }
Execution Count:20
20
395 }
executed: }
Execution Count:13
13
396 if (!sectionHidden.isEmpty()) {
evaluated: !sectionHidden.isEmpty()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:62
5-62
397 sectionHidden.setBit(to, d->sectionHidden.testBit(from)); -
398 d->sectionHidden = sectionHidden; -
399 }
executed: }
Execution Count:5
5
400 visualIndices[logical] = to; -
401 logicalIndices[to] = logical; -
402 -
403 -
404 -
405 -
406 if (to > from) {
evaluated: to > from
TRUEFALSE
yes
Evaluation Count:54
yes
Evaluation Count:13
13-54
407 for (visual = from; visual <= to; ++visual) {
evaluated: visual <= to
TRUEFALSE
yes
Evaluation Count:11033
yes
Evaluation Count:54
54-11033
408 int size = sizes[visual - from]; -
409 ResizeMode mode = modes[visual - from]; -
410 d->createSectionItems(visual, visual, size, mode); -
411 }
executed: }
Execution Count:11033
11033
412 } else {
executed: }
Execution Count:54
54
413 for (visual = to; visual <= from; ++visual) {
evaluated: visual <= from
TRUEFALSE
yes
Evaluation Count:33
yes
Evaluation Count:13
13-33
414 int size = sizes[visual - to]; -
415 ResizeMode mode = modes[visual - to]; -
416 d->createSectionItems(visual, visual, size, mode); -
417 }
executed: }
Execution Count:33
33
418 }
executed: }
Execution Count:13
13
419 -
420 -
421 -
422 -
423 if (d->hasAutoResizeSections())
evaluated: d->hasAutoResizeSections()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:62
5-62
424 d->doDelayedResizeSections();
executed: d->doDelayedResizeSections();
Execution Count:5
5
425 d->viewport->update(); -
426 -
427 sectionMoved(logical, from, to); -
428}
executed: }
Execution Count:67
67
429void QHeaderView::swapSections(int first, int second) -
430{ -
431 QHeaderViewPrivate * const d = d_func(); -
432 -
433 if (first == second)
evaluated: first == second
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:4135
1-4135
434 return;
executed: return;
Execution Count:1
1
435 d->executePostedLayout(); -
436 if (first < 0 || first >= d->sectionCount() || second < 0 || second >= d->sectionCount())
evaluated: first < 0
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:4134
evaluated: first >= d->sectionCount()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:4133
evaluated: second < 0
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:4132
evaluated: second >= d->sectionCount()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:4127
1-4134
437 return;
executed: return;
Execution Count:8
8
438 -
439 int firstSize = d->headerSectionSize(first); -
440 ResizeMode firstMode = d->headerSectionResizeMode(first); -
441 int firstLogical = d->logicalIndex(first); -
442 -
443 int secondSize = d->headerSectionSize(second); -
444 ResizeMode secondMode = d->headerSectionResizeMode(second); -
445 int secondLogical = d->logicalIndex(second); -
446 -
447 if (d->state == QHeaderViewPrivate::ResizeSection)
partially evaluated: d->state == QHeaderViewPrivate::ResizeSection
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4127
0-4127
448 d->preventCursorChangeInSetOffset = true;
never executed: d->preventCursorChangeInSetOffset = true;
0
449 -
450 d->createSectionItems(second, second, firstSize, firstMode); -
451 d->createSectionItems(first, first, secondSize, secondMode); -
452 -
453 d->initializeIndexMapping(); -
454 -
455 d->visualIndices[firstLogical] = second; -
456 d->logicalIndices[second] = firstLogical; -
457 -
458 d->visualIndices[secondLogical] = first; -
459 d->logicalIndices[first] = secondLogical; -
460 -
461 if (!d->sectionHidden.isEmpty()) {
evaluated: !d->sectionHidden.isEmpty()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:4123
4-4123
462 bool firstHidden = d->sectionHidden.testBit(first); -
463 bool secondHidden = d->sectionHidden.testBit(second); -
464 d->sectionHidden.setBit(first, secondHidden); -
465 d->sectionHidden.setBit(second, firstHidden); -
466 }
executed: }
Execution Count:4
4
467 -
468 d->viewport->update(); -
469 sectionMoved(firstLogical, first, second); -
470 sectionMoved(secondLogical, second, first); -
471}
executed: }
Execution Count:4127
4127
472void QHeaderView::resizeSection(int logical, int size) -
473{ -
474 QHeaderViewPrivate * const d = d_func(); -
475 if (logical < 0 || logical >= count() || size < 0)
evaluated: logical < 0
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:17951
evaluated: logical >= count()
TRUEFALSE
yes
Evaluation Count:606
yes
Evaluation Count:17345
evaluated: size < 0
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:17344
1-17951
476 return;
executed: return;
Execution Count:611
611
477 -
478 if (isSectionHidden(logical)) {
evaluated: isSectionHidden(logical)
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:17331
13-17331
479 d->hiddenSectionSize.insert(logical, size); -
480 return;
executed: return;
Execution Count:13
13
481 } -
482 -
483 int visual = visualIndex(logical); -
484 if (visual == -1)
partially evaluated: visual == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:17331
0-17331
485 return;
never executed: return;
0
486 -
487 if (d->state == QHeaderViewPrivate::ResizeSection && !d->cascadingResizing && logical != d->section)
partially evaluated: d->state == QHeaderViewPrivate::ResizeSection
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:17331
never evaluated: !d->cascadingResizing
never evaluated: logical != d->section
0-17331
488 d->preventCursorChangeInSetOffset = true;
never executed: d->preventCursorChangeInSetOffset = true;
0
489 -
490 int oldSize = d->headerSectionSize(visual); -
491 if (oldSize == size)
evaluated: oldSize == size
TRUEFALSE
yes
Evaluation Count:89
yes
Evaluation Count:17242
89-17242
492 return;
executed: return;
Execution Count:89
89
493 -
494 d->executePostedLayout(); -
495 d->invalidateCachedSizeHint(); -
496 -
497 if (stretchLastSection() && visual == d->lastVisibleVisualIndex())
evaluated: stretchLastSection()
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:17228
evaluated: visual == d->lastVisibleVisualIndex()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:12
2-17228
498 d->lastSectionSize = size;
executed: d->lastSectionSize = size;
Execution Count:2
2
499 -
500 d->createSectionItems(visual, visual, size, d->headerSectionResizeMode(visual)); -
501 -
502 if (!updatesEnabled()) {
evaluated: !updatesEnabled()
TRUEFALSE
yes
Evaluation Count:15242
yes
Evaluation Count:2000
2000-15242
503 if (d->hasAutoResizeSections())
partially evaluated: d->hasAutoResizeSections()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15242
0-15242
504 d->doDelayedResizeSections();
never executed: d->doDelayedResizeSections();
0
505 sectionResized(logical, oldSize, size); -
506 return;
executed: return;
Execution Count:15242
15242
507 } -
508 -
509 int w = d->viewport->width(); -
510 int h = d->viewport->height(); -
511 int pos = sectionViewportPosition(logical); -
512 QRect r; -
513 if (d->orientation == Qt::Horizontal)
evaluated: d->orientation == Qt::Horizontal
TRUEFALSE
yes
Evaluation Count:1294
yes
Evaluation Count:706
706-1294
514 if (isRightToLeft())
partially evaluated: isRightToLeft()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1294
0-1294
515 r.setRect(0, 0, pos + size, h);
never executed: r.setRect(0, 0, pos + size, h);
0
516 else -
517 r.setRect(pos, 0, w - pos, h);
executed: r.setRect(pos, 0, w - pos, h);
Execution Count:1294
1294
518 else -
519 r.setRect(0, pos, w, h - pos);
executed: r.setRect(0, pos, w, h - pos);
Execution Count:706
706
520 -
521 if (d->hasAutoResizeSections()) {
evaluated: d->hasAutoResizeSections()
TRUEFALSE
yes
Evaluation Count:18
yes
Evaluation Count:1982
18-1982
522 d->doDelayedResizeSections(); -
523 r = d->viewport->rect(); -
524 }
executed: }
Execution Count:18
18
525 d->viewport->update(r.normalized()); -
526 sectionResized(logical, oldSize, size); -
527}
executed: }
Execution Count:2000
2000
528void QHeaderView::resizeSections(QHeaderView::ResizeMode mode) -
529{ -
530 QHeaderViewPrivate * const d = d_func(); -
531 d->resizeSections(mode, true); -
532}
executed: }
Execution Count:16
16
533bool QHeaderView::isSectionHidden(int logicalIndex) const -
534{ -
535 const QHeaderViewPrivate * const d = d_func(); -
536 d->executePostedLayout(); -
537 if (logicalIndex >= d->sectionHidden.count() || logicalIndex < 0 || logicalIndex >= d->sectionCount())
evaluated: logicalIndex >= d->sectionHidden.count()
TRUEFALSE
yes
Evaluation Count:3738175
yes
Evaluation Count:57579
evaluated: logicalIndex < 0
TRUEFALSE
yes
Evaluation Count:24
yes
Evaluation Count:57555
partially evaluated: logicalIndex >= d->sectionCount()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:57555
0-3738175
538 return false;
executed: return false;
Execution Count:3738199
3738199
539 int visual = visualIndex(logicalIndex); -
540 qt_noop(); -
541 return d->sectionHidden.testBit(visual);
executed: return d->sectionHidden.testBit(visual);
Execution Count:57555
57555
542} -
543int QHeaderView::hiddenSectionCount() const -
544{ -
545 const QHeaderViewPrivate * const d = d_func(); -
546 return d->hiddenSectionSize.count();
executed: return d->hiddenSectionSize.count();
Execution Count:5845
5845
547} -
548void QHeaderView::setSectionHidden(int logicalIndex, bool hide) -
549{ -
550 QHeaderViewPrivate * const d = d_func(); -
551 if (logicalIndex < 0 || logicalIndex >= count())
evaluated: logicalIndex < 0
TRUEFALSE
yes
Evaluation Count:164
yes
Evaluation Count:13306
evaluated: logicalIndex >= count()
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:13294
12-13306
552 return;
executed: return;
Execution Count:176
176
553 -
554 d->executePostedLayout(); -
555 int visual = visualIndex(logicalIndex); -
556 qt_noop(); -
557 if (hide == d->isVisualIndexHidden(visual))
evaluated: hide == d->isVisualIndexHidden(visual)
TRUEFALSE
yes
Evaluation Count:1747
yes
Evaluation Count:11547
1747-11547
558 return;
executed: return;
Execution Count:1747
1747
559 if (hide) {
evaluated: hide
TRUEFALSE
yes
Evaluation Count:6995
yes
Evaluation Count:4552
4552-6995
560 int size = d->headerSectionSize(visual); -
561 if (!d->hasAutoResizeSections())
evaluated: !d->hasAutoResizeSections()
TRUEFALSE
yes
Evaluation Count:6951
yes
Evaluation Count:44
44-6951
562 resizeSection(logicalIndex, 0);
executed: resizeSection(logicalIndex, 0);
Execution Count:6951
6951
563 d->hiddenSectionSize.insert(logicalIndex, size); -
564 if (d->sectionHidden.count() < count())
evaluated: d->sectionHidden.count() < count()
TRUEFALSE
yes
Evaluation Count:228
yes
Evaluation Count:6767
228-6767
565 d->sectionHidden.resize(count());
executed: d->sectionHidden.resize(count());
Execution Count:228
228
566 d->sectionHidden.setBit(visual, true); -
567 if (d->hasAutoResizeSections())
evaluated: d->hasAutoResizeSections()
TRUEFALSE
yes
Evaluation Count:44
yes
Evaluation Count:6951
44-6951
568 d->doDelayedResizeSections();
executed: d->doDelayedResizeSections();
Execution Count:44
44
569 } else {
executed: }
Execution Count:6995
6995
570 int size = d->hiddenSectionSize.value(logicalIndex, d->defaultSectionSize); -
571 d->hiddenSectionSize.remove(logicalIndex); -
572 if (d->hiddenSectionSize.isEmpty()) {
evaluated: d->hiddenSectionSize.isEmpty()
TRUEFALSE
yes
Evaluation Count:94
yes
Evaluation Count:4458
94-4458
573 d->sectionHidden.clear(); -
574 } else {
executed: }
Execution Count:94
94
575 qt_noop(); -
576 d->sectionHidden.setBit(visual, false); -
577 }
executed: }
Execution Count:4458
4458
578 resizeSection(logicalIndex, size); -
579 }
executed: }
Execution Count:4552
4552
580} -
581 -
582 -
583 -
584 -
585 -
586 -
587 -
588int QHeaderView::count() const -
589{ -
590 const QHeaderViewPrivate * const d = d_func(); -
591 -
592 -
593 d->executePostedLayout(); -
594 return d->sectionCount();
executed: return d->sectionCount();
Execution Count:511298
511298
595} -
596int QHeaderView::visualIndex(int logicalIndex) const -
597{ -
598 const QHeaderViewPrivate * const d = d_func(); -
599 if (logicalIndex < 0)
evaluated: logicalIndex < 0
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:617525
7-617525
600 return -1;
executed: return -1;
Execution Count:7
7
601 d->executePostedLayout(); -
602 if (d->visualIndices.isEmpty()) {
evaluated: d->visualIndices.isEmpty()
TRUEFALSE
yes
Evaluation Count:488398
yes
Evaluation Count:129127
129127-488398
603 if (logicalIndex < d->sectionCount())
evaluated: logicalIndex < d->sectionCount()
TRUEFALSE
yes
Evaluation Count:488007
yes
Evaluation Count:391
391-488007
604 return logicalIndex;
executed: return logicalIndex;
Execution Count:488007
488007
605 } else if (logicalIndex < d->visualIndices.count()) {
executed: }
Execution Count:391
evaluated: logicalIndex < d->visualIndices.count()
TRUEFALSE
yes
Evaluation Count:129080
yes
Evaluation Count:47
47-129080
606 int visual = d->visualIndices.at(logicalIndex); -
607 qt_noop(); -
608 return visual;
executed: return visual;
Execution Count:129080
129080
609 } -
610 return -1;
executed: return -1;
Execution Count:438
438
611} -
612int QHeaderView::logicalIndex(int visualIndex) const -
613{ -
614 const QHeaderViewPrivate * const d = d_func(); -
615 if (visualIndex < 0 || visualIndex >= d->sectionCount())
evaluated: visualIndex < 0
TRUEFALSE
yes
Evaluation Count:765
yes
Evaluation Count:239472
evaluated: visualIndex >= d->sectionCount()
TRUEFALSE
yes
Evaluation Count:1300
yes
Evaluation Count:238172
765-239472
616 return -1;
executed: return -1;
Execution Count:2065
2065
617 return d->logicalIndex(visualIndex);
executed: return d->logicalIndex(visualIndex);
Execution Count:238172
238172
618} -
619void QHeaderView::setSectionsMovable(bool movable) -
620{ -
621 QHeaderViewPrivate * const d = d_func(); -
622 d->movableSections = movable; -
623}
executed: }
Execution Count:674
674
624bool QHeaderView::sectionsMovable() const -
625{ -
626 const QHeaderViewPrivate * const d = d_func(); -
627 return d->movableSections;
executed: return d->movableSections;
Execution Count:3
3
628} -
629void QHeaderView::setSectionsClickable(bool clickable) -
630{ -
631 QHeaderViewPrivate * const d = d_func(); -
632 d->clickableSections = clickable; -
633}
executed: }
Execution Count:2261
2261
634bool QHeaderView::sectionsClickable() const -
635{ -
636 const QHeaderViewPrivate * const d = d_func(); -
637 return d->clickableSections;
executed: return d->clickableSections;
Execution Count:3
3
638} -
639void QHeaderView::setHighlightSections(bool highlight) -
640{ -
641 QHeaderViewPrivate * const d = d_func(); -
642 d->highlightSelected = highlight; -
643}
executed: }
Execution Count:968
968
644 -
645bool QHeaderView::highlightSections() const -
646{ -
647 const QHeaderViewPrivate * const d = d_func(); -
648 return d->highlightSelected;
executed: return d->highlightSelected;
Execution Count:4
4
649} -
650void QHeaderView::setSectionResizeMode(ResizeMode mode) -
651{ -
652 QHeaderViewPrivate * const d = d_func(); -
653 initializeSections(); -
654 d->stretchSections = (mode == Stretch ? count() : 0);
evaluated: mode == Stretch
TRUEFALSE
yes
Evaluation Count:57
yes
Evaluation Count:9
9-57
655 d->contentsSections = (mode == ResizeToContents ? count() : 0);
evaluated: mode == ResizeToContents
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:62
4-62
656 d->setGlobalHeaderResizeMode(mode); -
657 if (d->hasAutoResizeSections())
evaluated: d->hasAutoResizeSections()
TRUEFALSE
yes
Evaluation Count:62
yes
Evaluation Count:4
4-62
658 d->doDelayedResizeSections();
executed: d->doDelayedResizeSections();
Execution Count:62
62
659}
executed: }
Execution Count:66
66
660void QHeaderView::setSectionResizeMode(int logicalIndex, ResizeMode mode) -
661{ -
662 QHeaderViewPrivate * const d = d_func(); -
663 int visual = visualIndex(logicalIndex); -
664 qt_noop(); -
665 -
666 ResizeMode old = d->headerSectionResizeMode(visual); -
667 d->setHeaderSectionResizeMode(visual, mode); -
668 -
669 if (mode == Stretch && old != Stretch)
evaluated: mode == Stretch
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:8
partially evaluated: old != Stretch
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
0-8
670 ++d->stretchSections;
executed: ++d->stretchSections;
Execution Count:4
4
671 else if (mode == ResizeToContents && old != ResizeToContents)
evaluated: mode == ResizeToContents
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:6
partially evaluated: old != ResizeToContents
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-6
672 ++d->contentsSections;
executed: ++d->contentsSections;
Execution Count:2
2
673 else if (mode != Stretch && old == Stretch)
partially evaluated: mode != Stretch
TRUEFALSE
yes
Evaluation Count:6
no
Evaluation Count:0
partially evaluated: old == Stretch
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6
0-6
674 --d->stretchSections;
never executed: --d->stretchSections;
0
675 else if (mode != ResizeToContents && old == ResizeToContents)
partially evaluated: mode != ResizeToContents
TRUEFALSE
yes
Evaluation Count:6
no
Evaluation Count:0
partially evaluated: old == ResizeToContents
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6
0-6
676 --d->contentsSections;
never executed: --d->contentsSections;
0
677 -
678 if (d->hasAutoResizeSections() && d->state == QHeaderViewPrivate::NoState)
evaluated: d->hasAutoResizeSections()
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:3
partially evaluated: d->state == QHeaderViewPrivate::NoState
TRUEFALSE
yes
Evaluation Count:9
no
Evaluation Count:0
0-9
679 d->doDelayedResizeSections();
executed: d->doDelayedResizeSections();
Execution Count:9
9
680}
executed: }
Execution Count:12
12
681QHeaderView::ResizeMode QHeaderView::sectionResizeMode(int logicalIndex) const -
682{ -
683 const QHeaderViewPrivate * const d = d_func(); -
684 int visual = visualIndex(logicalIndex); -
685 if (visual == -1)
evaluated: visual == -1
TRUEFALSE
yes
Evaluation Count:385
yes
Evaluation Count:14982
385-14982
686 return Fixed;
executed: return Fixed;
Execution Count:385
385
687 return d->headerSectionResizeMode(visual);
executed: return d->headerSectionResizeMode(visual);
Execution Count:14982
14982
688} -
689int QHeaderView::stretchSectionCount() const -
690{ -
691 const QHeaderViewPrivate * const d = d_func(); -
692 return d->stretchSections;
executed: return d->stretchSections;
Execution Count:3
3
693} -
694void QHeaderView::setSortIndicatorShown(bool show) -
695{ -
696 QHeaderViewPrivate * const d = d_func(); -
697 if (d->sortIndicatorShown == show)
evaluated: d->sortIndicatorShown == show
TRUEFALSE
yes
Evaluation Count:1169
yes
Evaluation Count:326
326-1169
698 return;
executed: return;
Execution Count:1169
1169
699 -
700 d->sortIndicatorShown = show; -
701 -
702 if (sortIndicatorSection() < 0 || sortIndicatorSection() > count())
partially evaluated: sortIndicatorSection() < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:326
evaluated: sortIndicatorSection() > count()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:324
0-326
703 return;
executed: return;
Execution Count:2
2
704 -
705 if (d->headerSectionResizeMode(sortIndicatorSection()) == ResizeToContents)
partially evaluated: d->headerSectionResizeMode(sortIndicatorSection()) == ResizeToContents
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:324
0-324
706 resizeSections();
never executed: resizeSections();
0
707 -
708 d->viewport->update(); -
709}
executed: }
Execution Count:324
324
710 -
711bool QHeaderView::isSortIndicatorShown() const -
712{ -
713 const QHeaderViewPrivate * const d = d_func(); -
714 return d->sortIndicatorShown;
executed: return d->sortIndicatorShown;
Execution Count:26862
26862
715} -
716void QHeaderView::setSortIndicator(int logicalIndex, Qt::SortOrder order) -
717{ -
718 QHeaderViewPrivate * const d = d_func(); -
719 -
720 -
721 int old = d->sortIndicatorSection; -
722 if (old == logicalIndex && order == d->sortIndicatorOrder)
evaluated: old == logicalIndex
TRUEFALSE
yes
Evaluation Count:624
yes
Evaluation Count:35
evaluated: order == d->sortIndicatorOrder
TRUEFALSE
yes
Evaluation Count:356
yes
Evaluation Count:268
35-624
723 return;
executed: return;
Execution Count:356
356
724 d->sortIndicatorSection = logicalIndex; -
725 d->sortIndicatorOrder = order; -
726 -
727 if (logicalIndex >= d->sectionCount()) {
evaluated: logicalIndex >= d->sectionCount()
TRUEFALSE
yes
Evaluation Count:191
yes
Evaluation Count:112
112-191
728 sortIndicatorChanged(logicalIndex, order); -
729 return;
executed: return;
Execution Count:191
191
730 } -
731 -
732 if (old != logicalIndex
evaluated: old != logicalIndex
TRUEFALSE
yes
Evaluation Count:33
yes
Evaluation Count:79
33-79
733 && ((logicalIndex >= 0 && sectionResizeMode(logicalIndex) == ResizeToContents)
partially evaluated: logicalIndex >= 0
TRUEFALSE
yes
Evaluation Count:33
no
Evaluation Count:0
partially evaluated: sectionResizeMode(logicalIndex) == ResizeToContents
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:33
0-33
734 || old >= d->sectionCount() || (old >= 0 && sectionResizeMode(old) == ResizeToContents))) {
evaluated: old >= d->sectionCount()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:31
partially evaluated: old >= 0
TRUEFALSE
yes
Evaluation Count:31
no
Evaluation Count:0
partially evaluated: sectionResizeMode(old) == ResizeToContents
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:31
0-31
735 resizeSections(); -
736 d->viewport->update(); -
737 } else {
executed: }
Execution Count:2
2
738 if (old >= 0 && old != logicalIndex)
partially evaluated: old >= 0
TRUEFALSE
yes
Evaluation Count:110
no
Evaluation Count:0
evaluated: old != logicalIndex
TRUEFALSE
yes
Evaluation Count:31
yes
Evaluation Count:79
0-110
739 updateSection(old);
executed: updateSection(old);
Execution Count:31
31
740 if (logicalIndex >= 0)
partially evaluated: logicalIndex >= 0
TRUEFALSE
yes
Evaluation Count:110
no
Evaluation Count:0
0-110
741 updateSection(logicalIndex);
executed: updateSection(logicalIndex);
Execution Count:110
110
742 }
executed: }
Execution Count:110
110
743 -
744 sortIndicatorChanged(logicalIndex, order); -
745}
executed: }
Execution Count:112
112
746int QHeaderView::sortIndicatorSection() const -
747{ -
748 const QHeaderViewPrivate * const d = d_func(); -
749 return d->sortIndicatorSection;
executed: return d->sortIndicatorSection;
Execution Count:2003
2003
750} -
751Qt::SortOrder QHeaderView::sortIndicatorOrder() const -
752{ -
753 const QHeaderViewPrivate * const d = d_func(); -
754 return d->sortIndicatorOrder;
executed: return d->sortIndicatorOrder;
Execution Count:887
887
755} -
756bool QHeaderView::stretchLastSection() const -
757{ -
758 const QHeaderViewPrivate * const d = d_func(); -
759 return d->stretchLastSection;
executed: return d->stretchLastSection;
Execution Count:18931
18931
760} -
761 -
762void QHeaderView::setStretchLastSection(bool stretch) -
763{ -
764 QHeaderViewPrivate * const d = d_func(); -
765 d->stretchLastSection = stretch; -
766 if (d->state != QHeaderViewPrivate::NoState)
partially evaluated: d->state != QHeaderViewPrivate::NoState
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:884
0-884
767 return;
never executed: return;
0
768 if (stretch)
evaluated: stretch
TRUEFALSE
yes
Evaluation Count:681
yes
Evaluation Count:203
203-681
769 resizeSections();
executed: resizeSections();
Execution Count:681
681
770 else if (count())
evaluated: count()
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:191
12-191
771 resizeSection(count() - 1, d->defaultSectionSize);
executed: resizeSection(count() - 1, d->defaultSectionSize);
Execution Count:12
12
772} -
773bool QHeaderView::cascadingSectionResizes() const -
774{ -
775 const QHeaderViewPrivate * const d = d_func(); -
776 return d->cascadingResizing;
never executed: return d->cascadingResizing;
0
777} -
778 -
779void QHeaderView::setCascadingSectionResizes(bool enable) -
780{ -
781 QHeaderViewPrivate * const d = d_func(); -
782 d->cascadingResizing = enable; -
783}
never executed: }
0
784int QHeaderView::defaultSectionSize() const -
785{ -
786 const QHeaderViewPrivate * const d = d_func(); -
787 return d->defaultSectionSize;
executed: return d->defaultSectionSize;
Execution Count:39
39
788} -
789 -
790void QHeaderView::setDefaultSectionSize(int size) -
791{ -
792 QHeaderViewPrivate * const d = d_func(); -
793 if (size < 0)
evaluated: size < 0
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:85
1-85
794 return;
executed: return;
Execution Count:1
1
795 d->setDefaultSectionSize(size); -
796}
executed: }
Execution Count:85
85
797int QHeaderView::minimumSectionSize() const -
798{ -
799 const QHeaderViewPrivate * const d = d_func(); -
800 if (d->minimumSectionSize == -1) {
evaluated: d->minimumSectionSize == -1
TRUEFALSE
yes
Evaluation Count:5777
yes
Evaluation Count:2
2-5777
801 QSize strut = QApplication::globalStrut(); -
802 int margin = style()->pixelMetric(QStyle::PM_HeaderMargin, 0, this); -
803 if (d->orientation == Qt::Horizontal)
evaluated: d->orientation == Qt::Horizontal
TRUEFALSE
yes
Evaluation Count:2266
yes
Evaluation Count:3511
2266-3511
804 return qMax(strut.width(), (fontMetrics().maxWidth() + margin));
executed: return qMax(strut.width(), (fontMetrics().maxWidth() + margin));
Execution Count:2266
2266
805 return qMax(strut.height(), (fontMetrics().height() + margin));
executed: return qMax(strut.height(), (fontMetrics().height() + margin));
Execution Count:3511
3511
806 } -
807 return d->minimumSectionSize;
executed: return d->minimumSectionSize;
Execution Count:2
2
808} -
809 -
810void QHeaderView::setMinimumSectionSize(int size) -
811{ -
812 QHeaderViewPrivate * const d = d_func(); -
813 if (size < 0)
evaluated: size < 0
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:2
1-2
814 return;
executed: return;
Execution Count:1
1
815 d->minimumSectionSize = size; -
816}
executed: }
Execution Count:2
2
817 -
818 -
819 -
820 -
821 -
822 -
823 -
824Qt::Alignment QHeaderView::defaultAlignment() const -
825{ -
826 const QHeaderViewPrivate * const d = d_func(); -
827 return d->defaultAlignment;
executed: return d->defaultAlignment;
Execution Count:8
8
828} -
829 -
830void QHeaderView::setDefaultAlignment(Qt::Alignment alignment) -
831{ -
832 QHeaderViewPrivate * const d = d_func(); -
833 if (d->defaultAlignment == alignment)
partially evaluated: d->defaultAlignment == alignment
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:674
0-674
834 return;
never executed: return;
0
835 -
836 d->defaultAlignment = alignment; -
837 d->viewport->update(); -
838}
executed: }
Execution Count:674
674
839 -
840 -
841 -
842 -
843void QHeaderView::doItemsLayout() -
844{ -
845 initializeSections(); -
846 QAbstractItemView::doItemsLayout(); -
847}
executed: }
Execution Count:6312
6312
848 -
849 -
850 -
851 -
852 -
853 -
854 -
855bool QHeaderView::sectionsMoved() const -
856{ -
857 const QHeaderViewPrivate * const d = d_func(); -
858 return !d->visualIndices.isEmpty();
executed: return !d->visualIndices.isEmpty();
Execution Count:4583
4583
859} -
860bool QHeaderView::sectionsHidden() const -
861{ -
862 const QHeaderViewPrivate * const d = d_func(); -
863 return !d->hiddenSectionSize.isEmpty();
executed: return !d->hiddenSectionSize.isEmpty();
Execution Count:2430
2430
864} -
865QByteArray QHeaderView::saveState() const -
866{ -
867 const QHeaderViewPrivate * const d = d_func(); -
868 QByteArray data; -
869 QDataStream stream(&data, QIODevice::WriteOnly); -
870 stream << QHeaderViewPrivate::VersionMarker; -
871 stream << 0; -
872 d->write(stream); -
873 return data;
executed: return data;
Execution Count:194
194
874} -
875bool QHeaderView::restoreState(const QByteArray &state) -
876{ -
877 QHeaderViewPrivate * const d = d_func(); -
878 if (state.isEmpty())
partially evaluated: state.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:109
0-109
879 return false;
never executed: return false;
0
880 QByteArray data = state; -
881 QDataStream stream(&data, QIODevice::ReadOnly); -
882 int marker; -
883 int ver; -
884 stream >> marker; -
885 stream >> ver; -
886 if (stream.status() != QDataStream::Ok
partially evaluated: stream.status() != QDataStream::Ok
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:109
0-109
887 || marker != QHeaderViewPrivate::VersionMarker
partially evaluated: marker != QHeaderViewPrivate::VersionMarker
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:109
0-109
888 || ver != 0)
partially evaluated: ver != 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:109
0-109
889 return false;
never executed: return false;
0
890 -
891 if (d->read(stream)) {
partially evaluated: d->read(stream)
TRUEFALSE
yes
Evaluation Count:109
no
Evaluation Count:0
0-109
892 sortIndicatorChanged(d->sortIndicatorSection, d->sortIndicatorOrder ); -
893 d->viewport->update(); -
894 return true;
executed: return true;
Execution Count:109
109
895 } -
896 return false;
never executed: return false;
0
897} -
898 -
899 -
900 -
901 -
902 -
903void QHeaderView::reset() -
904{ -
905 QAbstractItemView::reset(); -
906 -
907 -
908 -
909 initializeSections(); -
910}
executed: }
Execution Count:2661
2661
911 -
912 -
913 -
914 -
915 -
916void QHeaderView::headerDataChanged(Qt::Orientation orientation, int logicalFirst, int logicalLast) -
917{ -
918 QHeaderViewPrivate * const d = d_func(); -
919 if (d->orientation != orientation)
evaluated: d->orientation != orientation
TRUEFALSE
yes
Evaluation Count:1289
yes
Evaluation Count:1334
1289-1334
920 return;
executed: return;
Execution Count:1289
1289
921 -
922 if (logicalFirst < 0 || logicalLast < 0 || logicalFirst >= count() || logicalLast >= count())
partially evaluated: logicalFirst < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1334
partially evaluated: logicalLast < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1334
partially evaluated: logicalFirst >= count()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1334
evaluated: logicalLast >= count()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:1330
0-1334
923 return;
executed: return;
Execution Count:4
4
924 -
925 d->invalidateCachedSizeHint(); -
926 -
927 int firstVisualIndex = 2147483647, lastVisualIndex = -1; -
928 -
929 for (int section = logicalFirst; section <= logicalLast; ++section) {
evaluated: section <= logicalLast
TRUEFALSE
yes
Evaluation Count:8946
yes
Evaluation Count:1330
1330-8946
930 const int visual = visualIndex(section); -
931 firstVisualIndex = qMin(firstVisualIndex, visual); -
932 lastVisualIndex = qMax(lastVisualIndex, visual); -
933 }
executed: }
Execution Count:8946
8946
934 -
935 d->executePostedResize(); -
936 const int first = d->headerSectionPosition(firstVisualIndex), -
937 last = d->headerSectionPosition(lastVisualIndex) -
938 + d->headerSectionSize(lastVisualIndex); -
939 -
940 if (orientation == Qt::Horizontal) {
evaluated: orientation == Qt::Horizontal
TRUEFALSE
yes
Evaluation Count:687
yes
Evaluation Count:643
643-687
941 d->viewport->update(first, 0, last - first, d->viewport->height()); -
942 } else {
executed: }
Execution Count:687
687
943 d->viewport->update(0, first, d->viewport->width(), last - first); -
944 }
executed: }
Execution Count:643
643
945} -
946void QHeaderView::updateSection(int logicalIndex) -
947{ -
948 QHeaderViewPrivate * const d = d_func(); -
949 if (d->orientation == Qt::Horizontal)
evaluated: d->orientation == Qt::Horizontal
TRUEFALSE
yes
Evaluation Count:164
yes
Evaluation Count:17
17-164
950 d->viewport->update(QRect(sectionViewportPosition(logicalIndex), 164
951 0, sectionSize(logicalIndex), d->viewport->height()));
executed: d->viewport->update(QRect(sectionViewportPosition(logicalIndex), 0, sectionSize(logicalIndex), d->viewport->height()));
Execution Count:164
164
952 else -
953 d->viewport->update(QRect(0, sectionViewportPosition(logicalIndex), 17
954 d->viewport->width(), sectionSize(logicalIndex)));
executed: d->viewport->update(QRect(0, sectionViewportPosition(logicalIndex), d->viewport->width(), sectionSize(logicalIndex)));
Execution Count:17
17
955} -
956 -
957 -
958 -
959 -
960 -
961 -
962void QHeaderView::resizeSections() -
963{ -
964 QHeaderViewPrivate * const d = d_func(); -
965 if (d->hasAutoResizeSections())
evaluated: d->hasAutoResizeSections()
TRUEFALSE
yes
Evaluation Count:4332
yes
Evaluation Count:88825
4332-88825
966 d->resizeSections(Interactive, false);
executed: d->resizeSections(Interactive, false);
Execution Count:4332
4332
967}
executed: }
Execution Count:93157
93157
968void QHeaderView::sectionsInserted(const QModelIndex &parent, -
969 int logicalFirst, int logicalLast) -
970{ -
971 QHeaderViewPrivate * const d = d_func(); -
972 if (parent != d->root)
evaluated: parent != d->root
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:13555
13-13555
973 return;
executed: return;
Execution Count:13
13
974 int oldCount = d->sectionCount(); -
975 -
976 d->invalidateCachedSizeHint(); -
977 -
978 if (d->state == QHeaderViewPrivate::ResizeSection)
partially evaluated: d->state == QHeaderViewPrivate::ResizeSection
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13555
0-13555
979 d->preventCursorChangeInSetOffset = true;
never executed: d->preventCursorChangeInSetOffset = true;
0
980 -
981 -
982 int insertAt = logicalFirst; -
983 int insertCount = logicalLast - logicalFirst + 1; -
984 -
985 QHeaderViewPrivate::SectionItem section(d->defaultSectionSize, d->globalResizeMode); -
986 d->sectionStartposRecalc = true; -
987 -
988 if (d->sectionItems.isEmpty() || insertAt >= d->sectionItems.count()) {
evaluated: d->sectionItems.isEmpty()
TRUEFALSE
yes
Evaluation Count:327
yes
Evaluation Count:13228
evaluated: insertAt >= d->sectionItems.count()
TRUEFALSE
yes
Evaluation Count:13142
yes
Evaluation Count:86
86-13228
989 int insertLength = d->defaultSectionSize * insertCount; -
990 d->length += insertLength; -
991 d->sectionItems.insert(d->sectionItems.count(), insertCount, section); -
992 } else {
executed: }
Execution Count:13469
13469
993 -
994 int insertLength = d->defaultSectionSize * insertCount; -
995 d->length += insertLength; -
996 d->sectionItems.insert(insertAt, insertCount, section); -
997 }
executed: }
Execution Count:86
86
998 -
999 -
1000 if (d->sortIndicatorSection >= logicalFirst)
evaluated: d->sortIndicatorSection >= logicalFirst
TRUEFALSE
yes
Evaluation Count:13471
yes
Evaluation Count:84
84-13471
1001 d->sortIndicatorSection += insertCount;
executed: d->sortIndicatorSection += insertCount;
Execution Count:13471
13471
1002 -
1003 -
1004 if (d->globalResizeMode == Stretch)
evaluated: d->globalResizeMode == Stretch
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:13554
1-13554
1005 d->stretchSections = d->sectionCount();
executed: d->stretchSections = d->sectionCount();
Execution Count:1
1
1006 else if (d->globalResizeMode == ResizeToContents)
partially evaluated: d->globalResizeMode == ResizeToContents
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13554
0-13554
1007 d->contentsSections = d->sectionCount();
never executed: d->contentsSections = d->sectionCount();
0
1008 -
1009 -
1010 d->sectionSelected.clear(); -
1011 -
1012 -
1013 if (!d->visualIndices.isEmpty() && !d->logicalIndices.isEmpty()) {
evaluated: !d->visualIndices.isEmpty()
TRUEFALSE
yes
Evaluation Count:26
yes
Evaluation Count:13529
partially evaluated: !d->logicalIndices.isEmpty()
TRUEFALSE
yes
Evaluation Count:26
no
Evaluation Count:0
0-13529
1014 qt_noop(); -
1015 int mappingCount = d->visualIndices.count(); -
1016 for (int i = 0; i < mappingCount; ++i) {
evaluated: i < mappingCount
TRUEFALSE
yes
Evaluation Count:12138
yes
Evaluation Count:26
26-12138
1017 if (d->visualIndices.at(i) >= logicalFirst)
evaluated: d->visualIndices.at(i) >= logicalFirst
TRUEFALSE
yes
Evaluation Count:6022
yes
Evaluation Count:6116
6022-6116
1018 d->visualIndices[i] += insertCount;
executed: d->visualIndices[i] += insertCount;
Execution Count:6022
6022
1019 if (d->logicalIndices.at(i) >= logicalFirst)
evaluated: d->logicalIndices.at(i) >= logicalFirst
TRUEFALSE
yes
Evaluation Count:6022
yes
Evaluation Count:6116
6022-6116
1020 d->logicalIndices[i] += insertCount;
executed: d->logicalIndices[i] += insertCount;
Execution Count:6022
6022
1021 }
executed: }
Execution Count:12138
12138
1022 for (int j = logicalFirst; j <= logicalLast; ++j) {
evaluated: j <= logicalLast
TRUEFALSE
yes
Evaluation Count:4194
yes
Evaluation Count:26
26-4194
1023 d->visualIndices.insert(j, j); -
1024 d->logicalIndices.insert(j, j); -
1025 }
executed: }
Execution Count:4194
4194
1026 }
executed: }
Execution Count:26
26
1027 -
1028 -
1029 if (!d->sectionHidden.isEmpty()) {
evaluated: !d->sectionHidden.isEmpty()
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:13540
15-13540
1030 QBitArray sectionHidden(d->sectionHidden); -
1031 sectionHidden.resize(sectionHidden.count() + insertCount); -
1032 sectionHidden.fill(false, logicalFirst, logicalLast + 1); -
1033 for (int j = logicalLast + 1; j < sectionHidden.count(); ++j)
evaluated: j < sectionHidden.count()
TRUEFALSE
yes
Evaluation Count:2036
yes
Evaluation Count:15
15-2036
1034 -
1035 sectionHidden.setBit(j, d->sectionHidden.testBit(j - insertCount));
executed: sectionHidden.setBit(j, d->sectionHidden.testBit(j - insertCount));
Execution Count:2036
2036
1036 d->sectionHidden = sectionHidden; -
1037 }
executed: }
Execution Count:15
15
1038 -
1039 -
1040 QHash<int, int> newHiddenSectionSize; -
1041 for (int i = 0; i < logicalFirst; ++i)
evaluated: i < logicalFirst
TRUEFALSE
yes
Evaluation Count:3252532
yes
Evaluation Count:13555
13555-3252532
1042 if (isSectionHidden(i))
evaluated: isSectionHidden(i)
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:3252522
10-3252522
1043 newHiddenSectionSize[i] = d->hiddenSectionSize[i];
executed: newHiddenSectionSize[i] = d->hiddenSectionSize[i];
Execution Count:10
10
1044 for (int j = logicalLast + 1; j < d->sectionCount(); ++j)
evaluated: j < d->sectionCount()
TRUEFALSE
yes
Evaluation Count:6569
yes
Evaluation Count:13555
6569-13555
1045 if (isSectionHidden(j))
evaluated: isSectionHidden(j)
TRUEFALSE
yes
Evaluation Count:547
yes
Evaluation Count:6022
547-6022
1046 newHiddenSectionSize[j] = d->hiddenSectionSize[j - insertCount];
executed: newHiddenSectionSize[j] = d->hiddenSectionSize[j - insertCount];
Execution Count:547
547
1047 d->hiddenSectionSize = newHiddenSectionSize; -
1048 -
1049 d->doDelayedResizeSections(); -
1050 sectionCountChanged(oldCount, count()); -
1051 -
1052 -
1053 if (!d->hasAutoResizeSections())
evaluated: !d->hasAutoResizeSections()
TRUEFALSE
yes
Evaluation Count:13489
yes
Evaluation Count:66
66-13489
1054 d->viewport->update();
executed: d->viewport->update();
Execution Count:13489
13489
1055}
executed: }
Execution Count:13555
13555
1056void QHeaderView::sectionsAboutToBeRemoved(const QModelIndex &parent, -
1057 int logicalFirst, int logicalLast) -
1058{ -
1059 (void)parent;; -
1060 (void)logicalFirst;; -
1061 (void)logicalLast;; -
1062}
executed: }
Execution Count:234
234
1063 -
1064void QHeaderViewPrivate::updateHiddenSections(int logicalFirst, int logicalLast) -
1065{ -
1066 QHeaderView * const q = q_func(); -
1067 const int changeCount = logicalLast - logicalFirst + 1; -
1068 -
1069 -
1070 QHash<int, int> newHiddenSectionSize; -
1071 for (int i = 0; i < logicalFirst; ++i)
evaluated: i < logicalFirst
TRUEFALSE
yes
Evaluation Count:6645
yes
Evaluation Count:297
297-6645
1072 if (q->isSectionHidden(i))
evaluated: q->isSectionHidden(i)
TRUEFALSE
yes
Evaluation Count:544
yes
Evaluation Count:6101
544-6101
1073 newHiddenSectionSize[i] = hiddenSectionSize[i];
executed: newHiddenSectionSize[i] = hiddenSectionSize[i];
Execution Count:544
544
1074 for (int j = logicalLast + 1; j < sectionCount(); ++j)
evaluated: j < sectionCount()
TRUEFALSE
yes
Evaluation Count:6256
yes
Evaluation Count:297
297-6256
1075 if (q->isSectionHidden(j))
evaluated: q->isSectionHidden(j)
TRUEFALSE
yes
Evaluation Count:542
yes
Evaluation Count:5714
542-5714
1076 newHiddenSectionSize[j - changeCount] = hiddenSectionSize[j];
executed: newHiddenSectionSize[j - changeCount] = hiddenSectionSize[j];
Execution Count:542
542
1077 hiddenSectionSize = newHiddenSectionSize; -
1078 -
1079 -
1080 if (!sectionHidden.isEmpty()) {
evaluated: !sectionHidden.isEmpty()
TRUEFALSE
yes
Evaluation Count:21
yes
Evaluation Count:276
21-276
1081 const int newsize = qMin(sectionCount() - changeCount, sectionHidden.size()); -
1082 QBitArray newSectionHidden(newsize); -
1083 for (int j = 0, k = 0; j < sectionHidden.size(); ++j) {
evaluated: j < sectionHidden.size()
TRUEFALSE
yes
Evaluation Count:6242
yes
Evaluation Count:21
21-6242
1084 const int logical = logicalIndex(j); -
1085 if (logical < logicalFirst || logical > logicalLast) {
evaluated: logical < logicalFirst
TRUEFALSE
yes
Evaluation Count:2080
yes
Evaluation Count:4162
evaluated: logical > logicalLast
TRUEFALSE
yes
Evaluation Count:2032
yes
Evaluation Count:2130
2032-4162
1086 newSectionHidden[k++] = sectionHidden[j]; -
1087 }
executed: }
Execution Count:4112
4112
1088 }
executed: }
Execution Count:6242
6242
1089 sectionHidden = newSectionHidden; -
1090 }
executed: }
Execution Count:21
21
1091}
executed: }
Execution Count:297
297
1092 -
1093void QHeaderViewPrivate::_q_sectionsRemoved(const QModelIndex &parent, -
1094 int logicalFirst, int logicalLast) -
1095{ -
1096 QHeaderView * const q = q_func(); -
1097 if (parent != root)
partially evaluated: parent != root
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:234
0-234
1098 return;
never executed: return;
0
1099 if (qMin(logicalFirst, logicalLast) < 0
partially evaluated: qMin(logicalFirst, logicalLast) < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:234
0-234
1100 || qMax(logicalLast, logicalFirst) >= sectionCount())
evaluated: qMax(logicalLast, logicalFirst) >= sectionCount()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:230
4-230
1101 return;
executed: return;
Execution Count:4
4
1102 int oldCount = q->count(); -
1103 int changeCount = logicalLast - logicalFirst + 1; -
1104 -
1105 if (state == QHeaderViewPrivate::ResizeSection)
partially evaluated: state == QHeaderViewPrivate::ResizeSection
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:230
0-230
1106 preventCursorChangeInSetOffset = true;
never executed: preventCursorChangeInSetOffset = true;
0
1107 -
1108 updateHiddenSections(logicalFirst, logicalLast); -
1109 -
1110 if (visualIndices.isEmpty() && logicalIndices.isEmpty()) {
evaluated: visualIndices.isEmpty()
TRUEFALSE
yes
Evaluation Count:201
yes
Evaluation Count:29
partially evaluated: logicalIndices.isEmpty()
TRUEFALSE
yes
Evaluation Count:201
no
Evaluation Count:0
0-201
1111 -
1112 removeSectionsFromSectionItems(logicalFirst, logicalLast); -
1113 } else {
executed: }
Execution Count:201
201
1114 if (logicalFirst == logicalLast) {
evaluated: logicalFirst == logicalLast
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:25
4-25
1115 int l = logicalFirst; -
1116 int visual = visualIndices.at(l); -
1117 qt_noop(); -
1118 for (int v = 0; v < sectionCount(); ++v) {
evaluated: v < sectionCount()
TRUEFALSE
yes
Evaluation Count:2000
yes
Evaluation Count:4
4-2000
1119 if (v > visual) {
evaluated: v > visual
TRUEFALSE
yes
Evaluation Count:1976
yes
Evaluation Count:24
24-1976
1120 int logical = logicalIndices.at(v); -
1121 --(visualIndices[logical]); -
1122 }
executed: }
Execution Count:1976
1976
1123 if (logicalIndex(v) > l)
evaluated: logicalIndex(v) > l
TRUEFALSE
yes
Evaluation Count:1996
yes
Evaluation Count:4
4-1996
1124 --(logicalIndices[v]);
executed: --(logicalIndices[v]);
Execution Count:1996
1996
1125 }
executed: }
Execution Count:2000
2000
1126 logicalIndices.remove(visual); -
1127 visualIndices.remove(l); -
1128 -
1129 removeSectionsFromSectionItems(visual, visual); -
1130 } else {
executed: }
Execution Count:4
4
1131 sectionStartposRecalc = true; -
1132 for (int u = 0; u < sectionItems.count(); ++u)
evaluated: u < sectionItems.count()
TRUEFALSE
yes
Evaluation Count:12091
yes
Evaluation Count:25
25-12091
1133 sectionItems.at(u).tmpLogIdx = logicalIndices.at(u);
executed: sectionItems.at(u).tmpLogIdx = logicalIndices.at(u);
Execution Count:12091
12091
1134 for (int v = sectionItems.count() - 1; v >= 0; --v) {
evaluated: v >= 0
TRUEFALSE
yes
Evaluation Count:12091
yes
Evaluation Count:25
25-12091
1135 if (logicalFirst <= sectionItems.at(v).tmpLogIdx && sectionItems.at(v).tmpLogIdx <= logicalLast)
evaluated: logicalFirst <= sectionItems.at(v).tmpLogIdx
TRUEFALSE
yes
Evaluation Count:6067
yes
Evaluation Count:6024
evaluated: sectionItems.at(v).tmpLogIdx <= logicalLast
TRUEFALSE
yes
Evaluation Count:2103
yes
Evaluation Count:3964
2103-6067
1136 removeSectionsFromSectionItems(v, v);
executed: removeSectionsFromSectionItems(v, v);
Execution Count:2103
2103
1137 }
executed: }
Execution Count:12091
12091
1138 visualIndices.resize(sectionItems.count()); -
1139 logicalIndices.resize(sectionItems.count()); -
1140 int* visual_data = visualIndices.data(); -
1141 int* logical_data = logicalIndices.data(); -
1142 for (int w = 0; w < sectionItems.count(); ++w) {
evaluated: w < sectionItems.count()
TRUEFALSE
yes
Evaluation Count:9988
yes
Evaluation Count:25
25-9988
1143 int logindex = sectionItems.at(w).tmpLogIdx; -
1144 if (logindex > logicalFirst)
evaluated: logindex > logicalFirst
TRUEFALSE
yes
Evaluation Count:3964
yes
Evaluation Count:6024
3964-6024
1145 logindex -= changeCount;
executed: logindex -= changeCount;
Execution Count:3964
3964
1146 visual_data[logindex] = w; -
1147 logical_data[w] = logindex; -
1148 }
executed: }
Execution Count:9988
9988
1149 }
executed: }
Execution Count:25
25
1150 -
1151 } -
1152 -
1153 -
1154 if (sortIndicatorSection >= logicalFirst) {
evaluated: sortIndicatorSection >= logicalFirst
TRUEFALSE
yes
Evaluation Count:203
yes
Evaluation Count:27
27-203
1155 if (sortIndicatorSection <= logicalLast)
evaluated: sortIndicatorSection <= logicalLast
TRUEFALSE
yes
Evaluation Count:22
yes
Evaluation Count:181
22-181
1156 sortIndicatorSection = -1;
executed: sortIndicatorSection = -1;
Execution Count:22
22
1157 else -
1158 sortIndicatorSection -= changeCount;
executed: sortIndicatorSection -= changeCount;
Execution Count:181
181
1159 } -
1160 -
1161 -
1162 if (sectionCount() <= 0)
evaluated: sectionCount() <= 0
TRUEFALSE
yes
Evaluation Count:35
yes
Evaluation Count:195
35-195
1163 clear();
executed: clear();
Execution Count:35
35
1164 invalidateCachedSizeHint(); -
1165 q->sectionCountChanged(oldCount, q->count()); -
1166 viewport->update(); -
1167}
executed: }
Execution Count:230
230
1168 -
1169void QHeaderViewPrivate::_q_layoutAboutToBeChanged() -
1170{ -
1171 -
1172 -
1173 -
1174 -
1175 if ((orientation == Qt::Horizontal && model->rowCount(root) == 0)
evaluated: orientation == Qt::Horizontal
TRUEFALSE
yes
Evaluation Count:948
yes
Evaluation Count:107
evaluated: model->rowCount(root) == 0
TRUEFALSE
yes
Evaluation Count:326
yes
Evaluation Count:622
107-948
1176 || model->columnCount(root) == 0)
evaluated: model->columnCount(root) == 0
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:728
1-728
1177 return;
executed: return;
Execution Count:327
327
1178 -
1179 for (int i = 0; i < sectionHidden.count(); ++i)
evaluated: i < sectionHidden.count()
TRUEFALSE
yes
Evaluation Count:64
yes
Evaluation Count:728
64-728
1180 if (sectionHidden.testBit(i))
evaluated: sectionHidden.testBit(i)
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:50
14-50
1181 persistentHiddenSections.append(orientation == Qt::Horizontal 14
1182 ? model->index(0, logicalIndex(i), root) 14
1183 : model->index(logicalIndex(i), 0, root));
executed: persistentHiddenSections.append(orientation == Qt::Horizontal ? model->index(0, logicalIndex(i), root) : model->index(logicalIndex(i), 0, root));
Execution Count:14
14
1184}
executed: }
Execution Count:728
728
1185 -
1186void QHeaderViewPrivate::_q_layoutChanged() -
1187{ -
1188 QHeaderView * const q = q_func(); -
1189 viewport->update(); -
1190 if (persistentHiddenSections.isEmpty() || modelIsEmpty()) {
evaluated: persistentHiddenSections.isEmpty()
TRUEFALSE
yes
Evaluation Count:207
yes
Evaluation Count:8
partially evaluated: modelIsEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-207
1191 if (modelSectionCount() != sectionCount())
evaluated: modelSectionCount() != sectionCount()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:205
2-205
1192 q->initializeSections();
executed: q->initializeSections();
Execution Count:2
2
1193 persistentHiddenSections.clear(); -
1194 return;
executed: return;
Execution Count:207
207
1195 } -
1196 -
1197 QBitArray oldSectionHidden = sectionHidden; -
1198 bool sectionCountChanged = false; -
1199 -
1200 for (int i = 0; i < persistentHiddenSections.count(); ++i) {
evaluated: i < persistentHiddenSections.count()
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:8
8-14
1201 QModelIndex index = persistentHiddenSections.at(i); -
1202 if (index.isValid()) {
partially evaluated: index.isValid()
TRUEFALSE
yes
Evaluation Count:14
no
Evaluation Count:0
0-14
1203 const int logical = (orientation == Qt::Horizontal
evaluated: orientation == Qt::Horizontal
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:4
4-10
1204 ? index.column() -
1205 : index.row()); -
1206 q->setSectionHidden(logical, true); -
1207 oldSectionHidden.setBit(logical, false); -
1208 } else if (!sectionCountChanged && (modelSectionCount() != sectionCount())) {
executed: }
Execution Count:14
never evaluated: !sectionCountChanged
never evaluated: (modelSectionCount() != sectionCount())
0-14
1209 sectionCountChanged = true; -
1210 break;
never executed: break;
0
1211 } -
1212 } -
1213 persistentHiddenSections.clear(); -
1214 -
1215 for (int i = 0; i < oldSectionHidden.count(); ++i) {
evaluated: i < oldSectionHidden.count()
TRUEFALSE
yes
Evaluation Count:64
yes
Evaluation Count:8
8-64
1216 if (oldSectionHidden.testBit(i))
evaluated: oldSectionHidden.testBit(i)
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:61
3-61
1217 q->setSectionHidden(i, false);
executed: q->setSectionHidden(i, false);
Execution Count:3
3
1218 }
executed: }
Execution Count:64
64
1219 -
1220 -
1221 if (sectionCountChanged)
partially evaluated: sectionCountChanged
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
1222 q->initializeSections();
never executed: q->initializeSections();
0
1223}
executed: }
Execution Count:8
8
1224 -
1225 -
1226 -
1227 -
1228 -
1229void QHeaderView::initializeSections() -
1230{ -
1231 QHeaderViewPrivate * const d = d_func(); -
1232 const int oldCount = d->sectionCount(); -
1233 const int newCount = d->modelSectionCount(); -
1234 if (newCount <= 0) {
evaluated: newCount <= 0
TRUEFALSE
yes
Evaluation Count:3927
yes
Evaluation Count:8587
3927-8587
1235 d->clear(); -
1236 sectionCountChanged(oldCount, 0); -
1237 } else if (newCount != oldCount) {
executed: }
Execution Count:3927
evaluated: newCount != oldCount
TRUEFALSE
yes
Evaluation Count:1618
yes
Evaluation Count:6969
1618-6969
1238 const int min = qBound(0, oldCount, newCount - 1); -
1239 initializeSections(min, newCount - 1); -
1240 if (stretchLastSection())
evaluated: stretchLastSection()
TRUEFALSE
yes
Evaluation Count:440
yes
Evaluation Count:1178
440-1178
1241 d->lastSectionSize = sectionSize(logicalIndex(d->sectionCount() - 1));
executed: d->lastSectionSize = sectionSize(logicalIndex(d->sectionCount() - 1));
Execution Count:440
440
1242 -
1243 -
1244 if (newCount < oldCount)
evaluated: newCount < oldCount
TRUEFALSE
yes
Evaluation Count:67
yes
Evaluation Count:1551
67-1551
1245 d->updateHiddenSections(0, newCount-1);
executed: d->updateHiddenSections(0, newCount-1);
Execution Count:67
67
1246 }
executed: }
Execution Count:1618
1618
1247} -
1248 -
1249 -
1250 -
1251 -
1252 -
1253void QHeaderView::initializeSections(int start, int end) -
1254{ -
1255 QHeaderViewPrivate * const d = d_func(); -
1256 -
1257 qt_noop(); -
1258 qt_noop(); -
1259 -
1260 d->invalidateCachedSizeHint(); -
1261 int oldCount = d->sectionCount(); -
1262 -
1263 if (end + 1 < d->sectionCount()) {
evaluated: end + 1 < d->sectionCount()
TRUEFALSE
yes
Evaluation Count:67
yes
Evaluation Count:1551
67-1551
1264 int newCount = end + 1; -
1265 d->removeSectionsFromSectionItems(newCount, d->sectionCount() - 1); -
1266 if (!d->hiddenSectionSize.isEmpty()) {
evaluated: !d->hiddenSectionSize.isEmpty()
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:61
6-61
1267 if (oldCount - newCount > d->hiddenSectionSize.count()) {
evaluated: oldCount - newCount > d->hiddenSectionSize.count()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:5
1-5
1268 for (int i = end + 1; i < d->sectionCount(); ++i)
partially evaluated: i < d->sectionCount()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
1269 d->hiddenSectionSize.remove(i);
never executed: d->hiddenSectionSize.remove(i);
0
1270 } else {
executed: }
Execution Count:1
1
1271 QHash<int, int>::iterator it = d->hiddenSectionSize.begin(); -
1272 while (it != d->hiddenSectionSize.end()) {
evaluated: it != d->hiddenSectionSize.end()
TRUEFALSE
yes
Evaluation Count:574
yes
Evaluation Count:5
5-574
1273 if (it.key() > end)
evaluated: it.key() > end
TRUEFALSE
yes
Evaluation Count:30
yes
Evaluation Count:544
30-544
1274 it = d->hiddenSectionSize.erase(it);
executed: it = d->hiddenSectionSize.erase(it);
Execution Count:30
30
1275 else -
1276 ++it;
executed: ++it;
Execution Count:544
544
1277 } -
1278 }
executed: }
Execution Count:5
5
1279 } -
1280 }
executed: }
Execution Count:67
67
1281 -
1282 int newSectionCount = end + 1; -
1283 -
1284 if (!d->logicalIndices.isEmpty()) {
evaluated: !d->logicalIndices.isEmpty()
TRUEFALSE
yes
Evaluation Count:29
yes
Evaluation Count:1589
29-1589
1285 if (oldCount <= newSectionCount) {
evaluated: oldCount <= newSectionCount
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:15
14-15
1286 d->logicalIndices.resize(newSectionCount); -
1287 d->visualIndices.resize(newSectionCount); -
1288 for (int i = oldCount; i < newSectionCount; ++i) {
evaluated: i < newSectionCount
TRUEFALSE
yes
Evaluation Count:76
yes
Evaluation Count:14
14-76
1289 d->logicalIndices[i] = i; -
1290 d->visualIndices[i] = i; -
1291 }
executed: }
Execution Count:76
76
1292 } else {
executed: }
Execution Count:14
14
1293 int j = 0; -
1294 for (int i = 0; i < oldCount; ++i) {
evaluated: i < oldCount
TRUEFALSE
yes
Evaluation Count:6077
yes
Evaluation Count:15
15-6077
1295 int v = d->logicalIndices.at(i); -
1296 if (v < newSectionCount) {
evaluated: v < newSectionCount
TRUEFALSE
yes
Evaluation Count:6013
yes
Evaluation Count:64
64-6013
1297 d->logicalIndices[j] = v; -
1298 d->visualIndices[v] = j; -
1299 j++; -
1300 }
executed: }
Execution Count:6013
6013
1301 }
executed: }
Execution Count:6077
6077
1302 d->logicalIndices.resize(newSectionCount); -
1303 d->visualIndices.resize(newSectionCount); -
1304 }
executed: }
Execution Count:15
15
1305 } -
1306 -
1307 if (d->globalResizeMode == Stretch)
partially evaluated: d->globalResizeMode == Stretch
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1618
0-1618
1308 d->stretchSections = newSectionCount;
never executed: d->stretchSections = newSectionCount;
0
1309 else if (d->globalResizeMode == ResizeToContents)
evaluated: d->globalResizeMode == ResizeToContents
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1617
1-1617
1310 d->contentsSections = newSectionCount;
executed: d->contentsSections = newSectionCount;
Execution Count:1
1
1311 if (!d->sectionHidden.isEmpty())
evaluated: !d->sectionHidden.isEmpty()
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:1608
10-1608
1312 d->sectionHidden.resize(newSectionCount);
executed: d->sectionHidden.resize(newSectionCount);
Execution Count:10
10
1313 -
1314 if (newSectionCount > oldCount)
evaluated: newSectionCount > oldCount
TRUEFALSE
yes
Evaluation Count:1551
yes
Evaluation Count:67
67-1551
1315 d->createSectionItems(start, end, (end - start + 1) * d->defaultSectionSize, d->globalResizeMode);
executed: d->createSectionItems(start, end, (end - start + 1) * d->defaultSectionSize, d->globalResizeMode);
Execution Count:1551
1551
1316 -
1317 -
1318 if (d->sectionCount() != oldCount)
partially evaluated: d->sectionCount() != oldCount
TRUEFALSE
yes
Evaluation Count:1618
no
Evaluation Count:0
0-1618
1319 sectionCountChanged(oldCount, d->sectionCount());
executed: sectionCountChanged(oldCount, d->sectionCount());
Execution Count:1618
1618
1320 d->viewport->update(); -
1321}
executed: }
Execution Count:1618
1618
1322 -
1323 -
1324 -
1325 -
1326 -
1327void QHeaderView::currentChanged(const QModelIndex &current, const QModelIndex &old) -
1328{ -
1329 QHeaderViewPrivate * const d = d_func(); -
1330 -
1331 if (d->orientation == Qt::Horizontal && current.column() != old.column()) {
evaluated: d->orientation == Qt::Horizontal
TRUEFALSE
yes
Evaluation Count:2503
yes
Evaluation Count:2045
evaluated: current.column() != old.column()
TRUEFALSE
yes
Evaluation Count:2059
yes
Evaluation Count:444
444-2503
1332 if (old.isValid() && old.parent() == d->root)
evaluated: old.isValid()
TRUEFALSE
yes
Evaluation Count:1171
yes
Evaluation Count:888
evaluated: old.parent() == d->root
TRUEFALSE
yes
Evaluation Count:1134
yes
Evaluation Count:37
37-1171
1333 d->viewport->update(QRect(sectionViewportPosition(old.column()), 0, 1134
1334 sectionSize(old.column()), d->viewport->height()));
executed: d->viewport->update(QRect(sectionViewportPosition(old.column()), 0, sectionSize(old.column()), d->viewport->height()));
Execution Count:1134
1134
1335 if (current.isValid() && current.parent() == d->root)
evaluated: current.isValid()
TRUEFALSE
yes
Evaluation Count:1441
yes
Evaluation Count:618
evaluated: current.parent() == d->root
TRUEFALSE
yes
Evaluation Count:1400
yes
Evaluation Count:41
41-1441
1336 d->viewport->update(QRect(sectionViewportPosition(current.column()), 0, 1400
1337 sectionSize(current.column()), d->viewport->height()));
executed: d->viewport->update(QRect(sectionViewportPosition(current.column()), 0, sectionSize(current.column()), d->viewport->height()));
Execution Count:1400
1400
1338 } else if (d->orientation == Qt::Vertical && current.row() != old.row()) {
executed: }
Execution Count:2059
evaluated: d->orientation == Qt::Vertical
TRUEFALSE
yes
Evaluation Count:2045
yes
Evaluation Count:444
evaluated: current.row() != old.row()
TRUEFALSE
yes
Evaluation Count:1755
yes
Evaluation Count:290
290-2059
1339 if (old.isValid() && old.parent() == d->root)
evaluated: old.isValid()
TRUEFALSE
yes
Evaluation Count:983
yes
Evaluation Count:772
partially evaluated: old.parent() == d->root
TRUEFALSE
yes
Evaluation Count:983
no
Evaluation Count:0
0-983
1340 d->viewport->update(QRect(0, sectionViewportPosition(old.row()), 983
1341 d->viewport->width(), sectionSize(old.row())));
executed: d->viewport->update(QRect(0, sectionViewportPosition(old.row()), d->viewport->width(), sectionSize(old.row())));
Execution Count:983
983
1342 if (current.isValid() && current.parent() == d->root)
evaluated: current.isValid()
TRUEFALSE
yes
Evaluation Count:1152
yes
Evaluation Count:603
partially evaluated: current.parent() == d->root
TRUEFALSE
yes
Evaluation Count:1152
no
Evaluation Count:0
0-1152
1343 d->viewport->update(QRect(0, sectionViewportPosition(current.row()), 1152
1344 d->viewport->width(), sectionSize(current.row())));
executed: d->viewport->update(QRect(0, sectionViewportPosition(current.row()), d->viewport->width(), sectionSize(current.row())));
Execution Count:1152
1152
1345 }
executed: }
Execution Count:1755
1755
1346} -
1347 -
1348 -
1349 -
1350 -
1351 -
1352 -
1353bool QHeaderView::event(QEvent *e) -
1354{ -
1355 QHeaderViewPrivate * const d = d_func(); -
1356 switch (e->type()) { -
1357 case QEvent::HoverEnter: { -
1358 QHoverEvent *he = static_cast<QHoverEvent*>(e); -
1359 d->hover = logicalIndexAt(he->pos()); -
1360 if (d->hover != -1)
partially evaluated: d->hover != -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
1361 updateSection(d->hover);
never executed: updateSection(d->hover);
0
1362 break; }
executed: break;
Execution Count:2
2
1363 case QEvent::Leave: -
1364 case QEvent::HoverLeave: { -
1365 if (d->hover != -1)
partially evaluated: d->hover != -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
1366 updateSection(d->hover);
never executed: updateSection(d->hover);
0
1367 d->hover = -1; -
1368 break; }
executed: break;
Execution Count:5
5
1369 case QEvent::HoverMove: { -
1370 QHoverEvent *he = static_cast<QHoverEvent*>(e); -
1371 int oldHover = d->hover; -
1372 d->hover = logicalIndexAt(he->pos()); -
1373 if (d->hover != oldHover) {
partially evaluated: d->hover != oldHover
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
1374 if (oldHover != -1)
never evaluated: oldHover != -1
0
1375 updateSection(oldHover);
never executed: updateSection(oldHover);
0
1376 if (d->hover != -1)
never evaluated: d->hover != -1
0
1377 updateSection(d->hover);
never executed: updateSection(d->hover);
0
1378 }
never executed: }
0
1379 break; }
executed: break;
Execution Count:2
2
1380 case QEvent::Timer: { -
1381 QTimerEvent *te = static_cast<QTimerEvent*>(e); -
1382 if (te->timerId() == d->delayedResize.timerId()) {
evaluated: te->timerId() == d->delayedResize.timerId()
TRUEFALSE
yes
Evaluation Count:103
yes
Evaluation Count:17
17-103
1383 d->delayedResize.stop(); -
1384 resizeSections(); -
1385 }
executed: }
Execution Count:103
103
1386 break; }
executed: break;
Execution Count:120
120
1387 default: -
1388 break;
executed: break;
Execution Count:17408
17408
1389 } -
1390 return QAbstractItemView::event(e);
executed: return QAbstractItemView::event(e);
Execution Count:17537
17537
1391} -
1392 -
1393 -
1394 -
1395 -
1396 -
1397void QHeaderView::paintEvent(QPaintEvent *e) -
1398{ -
1399 QHeaderViewPrivate * const d = d_func(); -
1400 -
1401 if (count() == 0)
evaluated: count() == 0
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:813
4-813
1402 return;
executed: return;
Execution Count:4
4
1403 -
1404 QPainter painter(d->viewport); -
1405 const QPoint offset = d->scrollDelayOffset; -
1406 QRect translatedEventRect = e->rect(); -
1407 translatedEventRect.translate(offset); -
1408 -
1409 int start = -1; -
1410 int end = -1; -
1411 if (d->orientation == Qt::Horizontal) {
evaluated: d->orientation == Qt::Horizontal
TRUEFALSE
yes
Evaluation Count:535
yes
Evaluation Count:278
278-535
1412 start = visualIndexAt(translatedEventRect.left()); -
1413 end = visualIndexAt(translatedEventRect.right()); -
1414 } else {
executed: }
Execution Count:535
535
1415 start = visualIndexAt(translatedEventRect.top()); -
1416 end = visualIndexAt(translatedEventRect.bottom()); -
1417 }
executed: }
Execution Count:278
278
1418 -
1419 if (d->reverse()) {
evaluated: d->reverse()
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:806
7-806
1420 start = (start == -1 ? count() - 1 : start);
evaluated: start == -1
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:4
3-4
1421 end = (end == -1 ? 0 : end);
partially evaluated: end == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7
0-7
1422 } else {
executed: }
Execution Count:7
7
1423 start = (start == -1 ? 0 : start);
partially evaluated: start == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:806
0-806
1424 end = (end == -1 ? count() - 1 : end);
evaluated: end == -1
TRUEFALSE
yes
Evaluation Count:75
yes
Evaluation Count:731
75-731
1425 }
executed: }
Execution Count:806
806
1426 -
1427 int tmp = start; -
1428 start = qMin(start, end); -
1429 end = qMax(tmp, end); -
1430 -
1431 d->prepareSectionSelected(); -
1432 -
1433 QRect currentSectionRect; -
1434 int logical; -
1435 const int width = d->viewport->width(); -
1436 const int height = d->viewport->height(); -
1437 for (int i = start; i <= end; ++i) {
evaluated: i <= end
TRUEFALSE
yes
Evaluation Count:2007
yes
Evaluation Count:813
813-2007
1438 if (d->isVisualIndexHidden(i))
evaluated: d->isVisualIndexHidden(i)
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:2004
3-2004
1439 continue;
executed: continue;
Execution Count:3
3
1440 painter.save(); -
1441 logical = logicalIndex(i); -
1442 if (d->orientation == Qt::Horizontal) {
evaluated: d->orientation == Qt::Horizontal
TRUEFALSE
yes
Evaluation Count:991
yes
Evaluation Count:1013
991-1013
1443 currentSectionRect.setRect(sectionViewportPosition(logical), 0, sectionSize(logical), height); -
1444 } else {
executed: }
Execution Count:991
991
1445 currentSectionRect.setRect(0, sectionViewportPosition(logical), width, sectionSize(logical)); -
1446 }
executed: }
Execution Count:1013
1013
1447 currentSectionRect.translate(offset); -
1448 -
1449 QVariant variant = d->model->headerData(logical, d->orientation, -
1450 Qt::FontRole); -
1451 if (variant.isValid() && variant.canConvert<QFont>()) {
partially evaluated: variant.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2004
never evaluated: variant.canConvert<QFont>()
0-2004
1452 QFont sectionFont = qvariant_cast<QFont>(variant); -
1453 painter.setFont(sectionFont); -
1454 }
never executed: }
0
1455 paintSection(&painter, currentSectionRect, logical); -
1456 painter.restore(); -
1457 }
executed: }
Execution Count:2004
2004
1458 -
1459 QStyleOption opt; -
1460 opt.init(this); -
1461 -
1462 if (d->reverse()) {
evaluated: d->reverse()
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:806
7-806
1463 opt.state |= QStyle::State_Horizontal; -
1464 if (currentSectionRect.left() > translatedEventRect.left()) {
partially evaluated: currentSectionRect.left() > translatedEventRect.left()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7
0-7
1465 opt.rect = QRect(translatedEventRect.left(), 0, -
1466 currentSectionRect.left() - translatedEventRect.left(), height); -
1467 style()->drawControl(QStyle::CE_HeaderEmptyArea, &opt, &painter, this); -
1468 }
never executed: }
0
1469 } else if (currentSectionRect.right() < translatedEventRect.right()) {
executed: }
Execution Count:7
evaluated: currentSectionRect.right() < translatedEventRect.right()
TRUEFALSE
yes
Evaluation Count:38
yes
Evaluation Count:768
7-768
1470 -
1471 opt.state |= QStyle::State_Horizontal; -
1472 opt.rect = QRect(currentSectionRect.right() + 1, 0, -
1473 translatedEventRect.right() - currentSectionRect.right(), height); -
1474 style()->drawControl(QStyle::CE_HeaderEmptyArea, &opt, &painter, this); -
1475 } else if (currentSectionRect.bottom() < translatedEventRect.bottom()) {
executed: }
Execution Count:38
evaluated: currentSectionRect.bottom() < translatedEventRect.bottom()
TRUEFALSE
yes
Evaluation Count:37
yes
Evaluation Count:731
37-731
1476 -
1477 opt.state &= ~QStyle::State_Horizontal; -
1478 opt.rect = QRect(0, currentSectionRect.bottom() + 1, -
1479 width, height - currentSectionRect.bottom() - 1); -
1480 style()->drawControl(QStyle::CE_HeaderEmptyArea, &opt, &painter, this); -
1481 }
executed: }
Execution Count:37
37
1482} -
1483 -
1484 -
1485 -
1486 -
1487 -
1488void QHeaderView::mousePressEvent(QMouseEvent *e) -
1489{ -
1490 QHeaderViewPrivate * const d = d_func(); -
1491 if (d->state != QHeaderViewPrivate::NoState || e->button() != Qt::LeftButton)
partially evaluated: d->state != QHeaderViewPrivate::NoState
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:175
partially evaluated: e->button() != Qt::LeftButton
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:175
0-175
1492 return;
never executed: return;
0
1493 int pos = d->orientation == Qt::Horizontal ? e->x() : e->y();
evaluated: d->orientation == Qt::Horizontal
TRUEFALSE
yes
Evaluation Count:94
yes
Evaluation Count:81
81-94
1494 int handle = d->sectionHandleAt(pos); -
1495 d->originalSize = -1; -
1496 if (handle == -1) {
evaluated: handle == -1
TRUEFALSE
yes
Evaluation Count:156
yes
Evaluation Count:19
19-156
1497 d->pressed = logicalIndexAt(pos); -
1498 if (d->clickableSections)
evaluated: d->clickableSections
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:144
12-144
1499 sectionPressed(d->pressed);
executed: sectionPressed(d->pressed);
Execution Count:12
12
1500 -
1501 bool acceptMoveSection = d->movableSections; -
1502 if (acceptMoveSection && d->pressed == 0 && !d->allowUserMoveOfSection0)
evaluated: acceptMoveSection
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:155
partially evaluated: d->pressed == 0
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
partially evaluated: !d->allowUserMoveOfSection0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-155
1503 acceptMoveSection = false;
never executed: acceptMoveSection = false;
0
1504 -
1505 if (acceptMoveSection) {
evaluated: acceptMoveSection
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:155
1-155
1506 d->section = d->target = d->pressed; -
1507 if (d->section == -1)
partially evaluated: d->section == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
1508 return;
never executed: return;
0
1509 d->state = QHeaderViewPrivate::MoveSection; -
1510 d->setupSectionIndicator(d->section, pos); -
1511 } else if (d->clickableSections && d->pressed != -1) {
executed: }
Execution Count:1
evaluated: d->clickableSections
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:144
partially evaluated: d->pressed != -1
TRUEFALSE
yes
Evaluation Count:11
no
Evaluation Count:0
0-144
1512 updateSection(d->pressed); -
1513 d->state = QHeaderViewPrivate::SelectSections; -
1514 }
executed: }
Execution Count:11
11
1515 } else if (sectionResizeMode(handle) == Interactive) {
partially evaluated: sectionResizeMode(handle) == Interactive
TRUEFALSE
yes
Evaluation Count:19
no
Evaluation Count:0
0-19
1516 d->originalSize = sectionSize(handle); -
1517 d->state = QHeaderViewPrivate::ResizeSection; -
1518 d->section = handle; -
1519 d->preventCursorChangeInSetOffset = false; -
1520 }
executed: }
Execution Count:19
19
1521 -
1522 d->firstPos = pos; -
1523 d->lastPos = pos; -
1524 -
1525 d->clearCascadingSections(); -
1526}
executed: }
Execution Count:175
175
1527 -
1528 -
1529 -
1530 -
1531 -
1532void QHeaderView::mouseMoveEvent(QMouseEvent *e) -
1533{ -
1534 QHeaderViewPrivate * const d = d_func(); -
1535 int pos = d->orientation == Qt::Horizontal ? e->x() : e->y();
evaluated: d->orientation == Qt::Horizontal
TRUEFALSE
yes
Evaluation Count:43
yes
Evaluation Count:42
42-43
1536 if (pos < 0)
partially evaluated: pos < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:85
0-85
1537 return;
never executed: return;
0
1538 if (e->buttons() == Qt::NoButton) {
evaluated: e->buttons() == Qt::NoButton
TRUEFALSE
yes
Evaluation Count:77
yes
Evaluation Count:8
8-77
1539 -
1540 -
1541 -
1542 -
1543 -
1544 -
1545 d->state = QHeaderViewPrivate::NoState; -
1546 d->pressed = -1; -
1547 -
1548 }
executed: }
Execution Count:77
77
1549 switch (d->state) { -
1550 case QHeaderViewPrivate::ResizeSection: { -
1551 qt_noop(); -
1552 if (d->cascadingResizing) {
never evaluated: d->cascadingResizing
0
1553 int delta = d->reverse() ? d->lastPos - pos : pos - d->lastPos;
never evaluated: d->reverse()
0
1554 int visual = visualIndex(d->section); -
1555 d->cascadingResize(visual, d->headerSectionSize(visual) + delta); -
1556 } else {
never executed: }
0
1557 int delta = d->reverse() ? d->firstPos - pos : pos - d->firstPos;
never evaluated: d->reverse()
0
1558 resizeSection(d->section, qMax(d->originalSize + delta, minimumSectionSize())); -
1559 }
never executed: }
0
1560 d->lastPos = pos; -
1561 return;
never executed: return;
0
1562 } -
1563 case QHeaderViewPrivate::MoveSection: { -
1564 if (d->shouldAutoScroll(e->pos()))
never evaluated: d->shouldAutoScroll(e->pos())
0
1565 d->startAutoScroll();
never executed: d->startAutoScroll();
0
1566 if (qAbs(pos - d->firstPos) >= QApplication::startDragDistance()
never evaluated: qAbs(pos - d->firstPos) >= QApplication::startDragDistance()
0
1567 || !d->sectionIndicator->isHidden()) {
never evaluated: !d->sectionIndicator->isHidden()
0
1568 int visual = visualIndexAt(pos); -
1569 if (visual == -1)
never evaluated: visual == -1
0
1570 return;
never executed: return;
0
1571 if (visual == 0 && logicalIndex(0) == 0 && !d->allowUserMoveOfSection0)
never evaluated: visual == 0
never evaluated: logicalIndex(0) == 0
never evaluated: !d->allowUserMoveOfSection0
0
1572 return;
never executed: return;
0
1573 -
1574 int posThreshold = d->headerSectionPosition(visual) - d->offset + d->headerSectionSize(visual) / 2; -
1575 int moving = visualIndex(d->section); -
1576 if (visual < moving) {
never evaluated: visual < moving
0
1577 if (pos < posThreshold)
never evaluated: pos < posThreshold
0
1578 d->target = d->logicalIndex(visual);
never executed: d->target = d->logicalIndex(visual);
0
1579 else -
1580 d->target = d->logicalIndex(visual + 1);
never executed: d->target = d->logicalIndex(visual + 1);
0
1581 } else if (visual > moving) {
never evaluated: visual > moving
0
1582 if (pos > posThreshold)
never evaluated: pos > posThreshold
0
1583 d->target = d->logicalIndex(visual);
never executed: d->target = d->logicalIndex(visual);
0
1584 else -
1585 d->target = d->logicalIndex(visual - 1);
never executed: d->target = d->logicalIndex(visual - 1);
0
1586 } else { -
1587 d->target = d->section; -
1588 }
never executed: }
0
1589 d->updateSectionIndicator(d->section, pos); -
1590 }
never executed: }
0
1591 return;
never executed: return;
0
1592 } -
1593 case QHeaderViewPrivate::SelectSections: { -
1594 int logical = logicalIndexAt(pos); -
1595 if (logical == d->pressed)
partially evaluated: logical == d->pressed
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
1596 return;
never executed: return;
0
1597 else if (d->pressed != -1)
partially evaluated: d->pressed != -1
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
0-8
1598 updateSection(d->pressed);
executed: updateSection(d->pressed);
Execution Count:8
8
1599 d->pressed = logical; -
1600 if (d->clickableSections && logical != -1) {
partially evaluated: d->clickableSections
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
partially evaluated: logical != -1
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
0-8
1601 sectionEntered(d->pressed); -
1602 updateSection(d->pressed); -
1603 }
executed: }
Execution Count:8
8
1604 return;
executed: return;
Execution Count:8
8
1605 } -
1606 case QHeaderViewPrivate::NoState: { -
1607 -
1608 int handle = d->sectionHandleAt(pos); -
1609 bool hasCursor = testAttribute(Qt::WA_SetCursor); -
1610 if (handle != -1 && (sectionResizeMode(handle) == Interactive)) {
evaluated: handle != -1
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:67
partially evaluated: (sectionResizeMode(handle) == Interactive)
TRUEFALSE
yes
Evaluation Count:10
no
Evaluation Count:0
0-67
1611 if (!hasCursor)
evaluated: !hasCursor
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:7
3-7
1612 setCursor(d->orientation == Qt::Horizontal ? Qt::SplitHCursor : Qt::SplitVCursor);
executed: setCursor(d->orientation == Qt::Horizontal ? Qt::SplitHCursor : Qt::SplitVCursor);
Execution Count:3
3
1613 } else if (hasCursor) {
executed: }
Execution Count:10
evaluated: hasCursor
TRUEFALSE
yes
Evaluation Count:40
yes
Evaluation Count:27
10-40
1614 unsetCursor(); -
1615 }
executed: }
Execution Count:40
40
1616 -
1617 return;
executed: return;
Execution Count:77
77
1618 } -
1619 default: -
1620 break;
never executed: break;
0
1621 } -
1622}
never executed: }
0
1623 -
1624 -
1625 -
1626 -
1627 -
1628void QHeaderView::mouseReleaseEvent(QMouseEvent *e) -
1629{ -
1630 QHeaderViewPrivate * const d = d_func(); -
1631 int pos = d->orientation == Qt::Horizontal ? e->x() : e->y();
evaluated: d->orientation == Qt::Horizontal
TRUEFALSE
yes
Evaluation Count:92
yes
Evaluation Count:81
81-92
1632 switch (d->state) { -
1633 case QHeaderViewPrivate::MoveSection: -
1634 if (!d->sectionIndicator->isHidden()) {
partially evaluated: !d->sectionIndicator->isHidden()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
1635 int from = visualIndex(d->section); -
1636 qt_noop(); -
1637 int to = visualIndex(d->target); -
1638 qt_noop(); -
1639 moveSection(from, to); -
1640 d->section = d->target = -1; -
1641 d->updateSectionIndicator(d->section, pos); -
1642 break;
never executed: break;
0
1643 } -
1644 case QHeaderViewPrivate::SelectSections:
code before this statement executed: case QHeaderViewPrivate::SelectSections:
Execution Count:1
1
1645 if (!d->clickableSections) {
partially evaluated: !d->clickableSections
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:11
0-11
1646 int section = logicalIndexAt(pos); -
1647 updateSection(section); -
1648 }
never executed: }
0
1649 -
1650 case QHeaderViewPrivate::NoState:
code before this statement executed: case QHeaderViewPrivate::NoState:
Execution Count:11
11
1651 if (d->clickableSections) {
evaluated: d->clickableSections
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:146
11-146
1652 int section = logicalIndexAt(pos); -
1653 if (section != -1 && section == d->pressed) {
partially evaluated: section != -1
TRUEFALSE
yes
Evaluation Count:11
no
Evaluation Count:0
partially evaluated: section == d->pressed
TRUEFALSE
yes
Evaluation Count:11
no
Evaluation Count:0
0-11
1654 d->flipSortIndicator(section); -
1655 sectionClicked(section); -
1656 }
executed: }
Execution Count:11
11
1657 if (d->pressed != -1)
partially evaluated: d->pressed != -1
TRUEFALSE
yes
Evaluation Count:11
no
Evaluation Count:0
0-11
1658 updateSection(d->pressed);
executed: updateSection(d->pressed);
Execution Count:11
11
1659 }
executed: }
Execution Count:11
11
1660 break;
executed: break;
Execution Count:157
157
1661 case QHeaderViewPrivate::ResizeSection: -
1662 d->originalSize = -1; -
1663 d->clearCascadingSections(); -
1664 break;
executed: break;
Execution Count:16
16
1665 default: -
1666 break;
never executed: break;
0
1667 } -
1668 d->state = QHeaderViewPrivate::NoState; -
1669 d->pressed = -1; -
1670}
executed: }
Execution Count:173
173
1671 -
1672 -
1673 -
1674 -
1675 -
1676void QHeaderView::mouseDoubleClickEvent(QMouseEvent *e) -
1677{ -
1678 QHeaderViewPrivate * const d = d_func(); -
1679 int pos = d->orientation == Qt::Horizontal ? e->x() : e->y();
evaluated: d->orientation == Qt::Horizontal
TRUEFALSE
yes
Evaluation Count:40
yes
Evaluation Count:40
40
1680 int handle = d->sectionHandleAt(pos); -
1681 if (handle > -1 && sectionResizeMode(handle) == Interactive) {
evaluated: handle > -1
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:71
partially evaluated: sectionResizeMode(handle) == Interactive
TRUEFALSE
yes
Evaluation Count:9
no
Evaluation Count:0
0-71
1682 sectionHandleDoubleClicked(handle); -
1683 -
1684 Qt::CursorShape splitCursor = (d->orientation == Qt::Horizontal)
evaluated: (d->orientation == Qt::Horizontal)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:8
1-8
1685 ? Qt::SplitHCursor : Qt::SplitVCursor; -
1686 if (cursor().shape() == splitCursor) {
evaluated: cursor().shape() == splitCursor
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:7
2-7
1687 -
1688 handle = d->sectionHandleAt(pos); -
1689 if (!(handle > -1 && sectionResizeMode(handle) == Interactive))
partially evaluated: handle > -1
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
partially evaluated: sectionResizeMode(handle) == Interactive
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
1690 setCursor(Qt::ArrowCursor);
never executed: setCursor(Qt::ArrowCursor);
0
1691 }
executed: }
Execution Count:2
2
1692 -
1693 } else {
executed: }
Execution Count:9
9
1694 sectionDoubleClicked(logicalIndexAt(e->pos())); -
1695 }
executed: }
Execution Count:71
71
1696} -
1697 -
1698 -
1699 -
1700 -
1701 -
1702bool QHeaderView::viewportEvent(QEvent *e) -
1703{ -
1704 QHeaderViewPrivate * const d = d_func(); -
1705 switch (e->type()) { -
1706 -
1707 case QEvent::ToolTip: { -
1708 QHelpEvent *he = static_cast<QHelpEvent*>(e); -
1709 int logical = logicalIndexAt(he->pos()); -
1710 if (logical != -1) {
never evaluated: logical != -1
0
1711 QVariant variant = d->model->headerData(logical, d->orientation, Qt::ToolTipRole); -
1712 if (variant.isValid()) {
never evaluated: variant.isValid()
0
1713 QToolTip::showText(he->globalPos(), variant.toString(), this); -
1714 return true;
never executed: return true;
0
1715 } -
1716 }
never executed: }
0
1717 break; }
never executed: break;
0
1718 -
1719 -
1720 case QEvent::QueryWhatsThis: { -
1721 QHelpEvent *he = static_cast<QHelpEvent*>(e); -
1722 int logical = logicalIndexAt(he->pos()); -
1723 if (logical != -1
never evaluated: logical != -1
0
1724 && d->model->headerData(logical, d->orientation, Qt::WhatsThisRole).isValid())
never evaluated: d->model->headerData(logical, d->orientation, Qt::WhatsThisRole).isValid()
0
1725 return true;
never executed: return true;
0
1726 break; }
never executed: break;
0
1727 case QEvent::WhatsThis: { -
1728 QHelpEvent *he = static_cast<QHelpEvent*>(e); -
1729 int logical = logicalIndexAt(he->pos()); -
1730 if (logical != -1) {
never evaluated: logical != -1
0
1731 QVariant whatsthis = d->model->headerData(logical, d->orientation, -
1732 Qt::WhatsThisRole); -
1733 if (whatsthis.isValid()) {
never evaluated: whatsthis.isValid()
0
1734 QWhatsThis::showText(he->globalPos(), whatsthis.toString(), this); -
1735 return true;
never executed: return true;
0
1736 } -
1737 }
never executed: }
0
1738 break; }
never executed: break;
0
1739 -
1740 -
1741 case QEvent::StatusTip: { -
1742 QHelpEvent *he = static_cast<QHelpEvent*>(e); -
1743 int logical = logicalIndexAt(he->pos()); -
1744 if (logical != -1) {
never evaluated: logical != -1
0
1745 QString statustip = d->model->headerData(logical, d->orientation, -
1746 Qt::StatusTipRole).toString(); -
1747 if (!statustip.isEmpty())
never evaluated: !statustip.isEmpty()
0
1748 setStatusTip(statustip);
never executed: setStatusTip(statustip);
0
1749 }
never executed: }
0
1750 return true; }
never executed: return true;
0
1751 -
1752 case QEvent::Hide: -
1753 case QEvent::Show: -
1754 case QEvent::FontChange: -
1755 case QEvent::StyleChange:{ -
1756 QAbstractScrollArea *parent = qobject_cast<QAbstractScrollArea *>(parentWidget()); -
1757 if (parent && parent->isVisible())
evaluated: parent
TRUEFALSE
yes
Evaluation Count:666
yes
Evaluation Count:609
evaluated: parent->isVisible()
TRUEFALSE
yes
Evaluation Count:629
yes
Evaluation Count:37
37-666
1758 resizeSections();
executed: resizeSections();
Execution Count:629
629
1759 geometriesChanged(); -
1760 break;}
executed: break;
Execution Count:1275
1275
1761 case QEvent::ContextMenu: { -
1762 d->state = QHeaderViewPrivate::NoState; -
1763 d->pressed = d->section = d->target = -1; -
1764 d->updateSectionIndicator(d->section, -1); -
1765 break; }
never executed: break;
0
1766 case QEvent::Wheel: { -
1767 QAbstractScrollArea *asa = qobject_cast<QAbstractScrollArea *>(parentWidget()); -
1768 if (asa)
partially evaluated: asa
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
1769 return QApplication::sendEvent(asa->viewport(), e);
executed: return QApplication::sendEvent(asa->viewport(), e);
Execution Count:1
1
1770 break; }
never executed: break;
0
1771 default: -
1772 break;
executed: break;
Execution Count:10070
10070
1773 } -
1774 return QAbstractItemView::viewportEvent(e);
executed: return QAbstractItemView::viewportEvent(e);
Execution Count:11345
11345
1775} -
1776void QHeaderView::paintSection(QPainter *painter, const QRect &rect, int logicalIndex) const -
1777{ -
1778 const QHeaderViewPrivate * const d = d_func(); -
1779 if (!rect.isValid())
partially evaluated: !rect.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2005
0-2005
1780 return;
never executed: return;
0
1781 -
1782 QStyleOptionHeader opt; -
1783 initStyleOption(&opt); -
1784 QStyle::State state = QStyle::State_None; -
1785 if (isEnabled())
partially evaluated: isEnabled()
TRUEFALSE
yes
Evaluation Count:2005
no
Evaluation Count:0
0-2005
1786 state |= QStyle::State_Enabled;
executed: state |= QStyle::State_Enabled;
Execution Count:2005
2005
1787 if (window()->isActiveWindow())
evaluated: window()->isActiveWindow()
TRUEFALSE
yes
Evaluation Count:1624
yes
Evaluation Count:381
381-1624
1788 state |= QStyle::State_Active;
executed: state |= QStyle::State_Active;
Execution Count:1624
1624
1789 if (d->clickableSections) {
evaluated: d->clickableSections
TRUEFALSE
yes
Evaluation Count:1514
yes
Evaluation Count:491
491-1514
1790 if (logicalIndex == d->hover)
partially evaluated: logicalIndex == d->hover
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1514
0-1514
1791 state |= QStyle::State_MouseOver;
never executed: state |= QStyle::State_MouseOver;
0
1792 if (logicalIndex == d->pressed)
evaluated: logicalIndex == d->pressed
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1513
1-1513
1793 state |= QStyle::State_Sunken;
executed: state |= QStyle::State_Sunken;
Execution Count:1
1
1794 else if (d->highlightSelected) {
evaluated: d->highlightSelected
TRUEFALSE
yes
Evaluation Count:1388
yes
Evaluation Count:125
125-1388
1795 if (d->sectionIntersectsSelection(logicalIndex))
evaluated: d->sectionIntersectsSelection(logicalIndex)
TRUEFALSE
yes
Evaluation Count:475
yes
Evaluation Count:913
475-913
1796 state |= QStyle::State_On;
executed: state |= QStyle::State_On;
Execution Count:475
475
1797 if (d->isSectionSelected(logicalIndex))
evaluated: d->isSectionSelected(logicalIndex)
TRUEFALSE
yes
Evaluation Count:32
yes
Evaluation Count:1356
32-1356
1798 state |= QStyle::State_Sunken;
executed: state |= QStyle::State_Sunken;
Execution Count:32
32
1799 }
executed: }
Execution Count:1388
1388
1800 -
1801 } -
1802 if (isSortIndicatorShown() && sortIndicatorSection() == logicalIndex)
evaluated: isSortIndicatorShown()
TRUEFALSE
yes
Evaluation Count:140
yes
Evaluation Count:1865
evaluated: sortIndicatorSection() == logicalIndex
TRUEFALSE
yes
Evaluation Count:40
yes
Evaluation Count:100
40-1865
1803 opt.sortIndicator = (sortIndicatorOrder() == Qt::AscendingOrder)
evaluated: (sortIndicatorOrder() == Qt::AscendingOrder)
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:35
5-40
1804 ? QStyleOptionHeader::SortDown : QStyleOptionHeader::SortUp;
executed: opt.sortIndicator = (sortIndicatorOrder() == Qt::AscendingOrder) ? QStyleOptionHeader::SortDown : QStyleOptionHeader::SortUp;
Execution Count:40
40
1805 -
1806 -
1807 QVariant textAlignment = d->model->headerData(logicalIndex, d->orientation, -
1808 Qt::TextAlignmentRole); -
1809 opt.rect = rect; -
1810 opt.section = logicalIndex; -
1811 opt.state |= state; -
1812 opt.textAlignment = Qt::Alignment(textAlignment.isValid() -
1813 ? Qt::Alignment(textAlignment.toInt()) -
1814 : d->defaultAlignment); -
1815 -
1816 opt.iconAlignment = Qt::AlignVCenter; -
1817 opt.text = d->model->headerData(logicalIndex, d->orientation, -
1818 Qt::DisplayRole).toString(); -
1819 if (d->textElideMode != Qt::ElideNone)
partially evaluated: d->textElideMode != Qt::ElideNone
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2005
0-2005
1820 opt.text = opt.fontMetrics.elidedText(opt.text, d->textElideMode , rect.width() - 4);
never executed: opt.text = opt.fontMetrics.elidedText(opt.text, d->textElideMode , rect.width() - 4);
0
1821 -
1822 QVariant variant = d->model->headerData(logicalIndex, d->orientation, -
1823 Qt::DecorationRole); -
1824 opt.icon = qvariant_cast<QIcon>(variant); -
1825 if (opt.icon.isNull())
partially evaluated: opt.icon.isNull()
TRUEFALSE
yes
Evaluation Count:2005
no
Evaluation Count:0
0-2005
1826 opt.icon = qvariant_cast<QPixmap>(variant);
executed: opt.icon = qvariant_cast<QPixmap>(variant);
Execution Count:2005
2005
1827 QVariant foregroundBrush = d->model->headerData(logicalIndex, d->orientation, -
1828 Qt::ForegroundRole); -
1829 if (foregroundBrush.canConvert<QBrush>())
partially evaluated: foregroundBrush.canConvert<QBrush>()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2005
0-2005
1830 opt.palette.setBrush(QPalette::ButtonText, qvariant_cast<QBrush>(foregroundBrush));
never executed: opt.palette.setBrush(QPalette::ButtonText, qvariant_cast<QBrush>(foregroundBrush));
0
1831 -
1832 QPointF oldBO = painter->brushOrigin(); -
1833 QVariant backgroundBrush = d->model->headerData(logicalIndex, d->orientation, -
1834 Qt::BackgroundRole); -
1835 if (backgroundBrush.canConvert<QBrush>()) {
partially evaluated: backgroundBrush.canConvert<QBrush>()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2005
0-2005
1836 opt.palette.setBrush(QPalette::Button, qvariant_cast<QBrush>(backgroundBrush)); -
1837 opt.palette.setBrush(QPalette::Window, qvariant_cast<QBrush>(backgroundBrush)); -
1838 painter->setBrushOrigin(opt.rect.topLeft()); -
1839 }
never executed: }
0
1840 -
1841 -
1842 int visual = visualIndex(logicalIndex); -
1843 qt_noop(); -
1844 if (count() == 1)
evaluated: count() == 1
TRUEFALSE
yes
Evaluation Count:139
yes
Evaluation Count:1866
139-1866
1845 opt.position = QStyleOptionHeader::OnlyOneSection;
executed: opt.position = QStyleOptionHeader::OnlyOneSection;
Execution Count:139
139
1846 else if (visual == 0)
evaluated: visual == 0
TRUEFALSE
yes
Evaluation Count:542
yes
Evaluation Count:1324
542-1324
1847 opt.position = QStyleOptionHeader::Beginning;
executed: opt.position = QStyleOptionHeader::Beginning;
Execution Count:542
542
1848 else if (visual == count() - 1)
evaluated: visual == count() - 1
TRUEFALSE
yes
Evaluation Count:143
yes
Evaluation Count:1181
143-1181
1849 opt.position = QStyleOptionHeader::End;
executed: opt.position = QStyleOptionHeader::End;
Execution Count:143
143
1850 else -
1851 opt.position = QStyleOptionHeader::Middle;
executed: opt.position = QStyleOptionHeader::Middle;
Execution Count:1181
1181
1852 opt.orientation = d->orientation; -
1853 -
1854 bool previousSelected = d->isSectionSelected(this->logicalIndex(visual - 1)); -
1855 bool nextSelected = d->isSectionSelected(this->logicalIndex(visual + 1)); -
1856 if (previousSelected && nextSelected)
evaluated: previousSelected
TRUEFALSE
yes
Evaluation Count:17
yes
Evaluation Count:1988
evaluated: nextSelected
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:5
5-1988
1857 opt.selectedPosition = QStyleOptionHeader::NextAndPreviousAreSelected;
executed: opt.selectedPosition = QStyleOptionHeader::NextAndPreviousAreSelected;
Execution Count:12
12
1858 else if (previousSelected)
evaluated: previousSelected
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:1988
5-1988
1859 opt.selectedPosition = QStyleOptionHeader::PreviousIsSelected;
executed: opt.selectedPosition = QStyleOptionHeader::PreviousIsSelected;
Execution Count:5
5
1860 else if (nextSelected)
evaluated: nextSelected
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:1981
7-1981
1861 opt.selectedPosition = QStyleOptionHeader::NextIsSelected;
executed: opt.selectedPosition = QStyleOptionHeader::NextIsSelected;
Execution Count:7
7
1862 else -
1863 opt.selectedPosition = QStyleOptionHeader::NotAdjacent;
executed: opt.selectedPosition = QStyleOptionHeader::NotAdjacent;
Execution Count:1981
1981
1864 -
1865 style()->drawControl(QStyle::CE_Header, &opt, painter, this); -
1866 -
1867 painter->setBrushOrigin(oldBO); -
1868}
executed: }
Execution Count:2005
2005
1869QSize QHeaderView::sectionSizeFromContents(int logicalIndex) const -
1870{ -
1871 const QHeaderViewPrivate * const d = d_func(); -
1872 qt_noop(); -
1873 -
1874 ensurePolished(); -
1875 -
1876 -
1877 QVariant variant = d->model->headerData(logicalIndex, d->orientation, Qt::SizeHintRole); -
1878 if (variant.isValid())
partially evaluated: variant.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:24848
0-24848
1879 return qvariant_cast<QSize>(variant);
never executed: return qvariant_cast<QSize>(variant);
0
1880 -
1881 -
1882 QStyleOptionHeader opt; -
1883 initStyleOption(&opt); -
1884 opt.section = logicalIndex; -
1885 QVariant var = d->model->headerData(logicalIndex, d->orientation, -
1886 Qt::FontRole); -
1887 QFont fnt; -
1888 if (var.isValid() && var.canConvert<QFont>())
partially evaluated: var.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:24848
never evaluated: var.canConvert<QFont>()
0-24848
1889 fnt = qvariant_cast<QFont>(var);
never executed: fnt = qvariant_cast<QFont>(var);
0
1890 else -
1891 fnt = font();
executed: fnt = font();
Execution Count:24848
24848
1892 fnt.setBold(true); -
1893 opt.fontMetrics = QFontMetrics(fnt); -
1894 opt.text = d->model->headerData(logicalIndex, d->orientation, -
1895 Qt::DisplayRole).toString(); -
1896 variant = d->model->headerData(logicalIndex, d->orientation, Qt::DecorationRole); -
1897 opt.icon = qvariant_cast<QIcon>(variant); -
1898 if (opt.icon.isNull())
partially evaluated: opt.icon.isNull()
TRUEFALSE
yes
Evaluation Count:24848
no
Evaluation Count:0
0-24848
1899 opt.icon = qvariant_cast<QPixmap>(variant);
executed: opt.icon = qvariant_cast<QPixmap>(variant);
Execution Count:24848
24848
1900 QSize size = style()->sizeFromContents(QStyle::CT_HeaderSection, &opt, QSize(), this); -
1901 if (isSortIndicatorShown()) {
evaluated: isSortIndicatorShown()
TRUEFALSE
yes
Evaluation Count:506
yes
Evaluation Count:24342
506-24342
1902 int margin = style()->pixelMetric(QStyle::PM_HeaderMargin, &opt, this); -
1903 if (d->orientation == Qt::Horizontal)
partially evaluated: d->orientation == Qt::Horizontal
TRUEFALSE
yes
Evaluation Count:506
no
Evaluation Count:0
0-506
1904 size.rwidth() += size.height() + margin;
executed: size.rwidth() += size.height() + margin;
Execution Count:506
506
1905 else -
1906 size.rheight() += size.width() + margin;
never executed: size.rheight() += size.width() + margin;
0
1907 } -
1908 return size;
executed: return size;
Execution Count:24848
24848
1909} -
1910int QHeaderView::horizontalOffset() const -
1911{ -
1912 const QHeaderViewPrivate * const d = d_func(); -
1913 if (d->orientation == Qt::Horizontal)
evaluated: d->orientation == Qt::Horizontal
TRUEFALSE
yes
Evaluation Count:537
yes
Evaluation Count:294
294-537
1914 return d->offset;
executed: return d->offset;
Execution Count:537
537
1915 return 0;
executed: return 0;
Execution Count:294
294
1916} -
1917int QHeaderView::verticalOffset() const -
1918{ -
1919 const QHeaderViewPrivate * const d = d_func(); -
1920 if (d->orientation == Qt::Vertical)
evaluated: d->orientation == Qt::Vertical
TRUEFALSE
yes
Evaluation Count:295
yes
Evaluation Count:536
295-536
1921 return d->offset;
executed: return d->offset;
Execution Count:295
295
1922 return 0;
executed: return 0;
Execution Count:536
536
1923} -
1924 -
1925 -
1926 -
1927 -
1928 -
1929 -
1930void QHeaderView::updateGeometries() -
1931{ -
1932 QHeaderViewPrivate * const d = d_func(); -
1933 d->layoutChildren(); -
1934 if (d->hasAutoResizeSections())
evaluated: d->hasAutoResizeSections()
TRUEFALSE
yes
Evaluation Count:6762
yes
Evaluation Count:3301
3301-6762
1935 d->doDelayedResizeSections();
executed: d->doDelayedResizeSections();
Execution Count:6762
6762
1936}
executed: }
Execution Count:10063
10063
1937 -
1938 -
1939 -
1940 -
1941 -
1942 -
1943void QHeaderView::scrollContentsBy(int dx, int dy) -
1944{ -
1945 QHeaderViewPrivate * const d = d_func(); -
1946 d->scrollDirtyRegion(dx, dy); -
1947}
never executed: }
0
1948 -
1949 -
1950 -
1951 -
1952 -
1953void QHeaderView::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &) -
1954{ -
1955 QHeaderViewPrivate * const d = d_func(); -
1956 d->invalidateCachedSizeHint(); -
1957 if (d->hasAutoResizeSections()) {
evaluated: d->hasAutoResizeSections()
TRUEFALSE
yes
Evaluation Count:7682
yes
Evaluation Count:106086
7682-106086
1958 bool resizeRequired = d->globalResizeMode == ResizeToContents; -
1959 int first = orientation() == Qt::Horizontal ? topLeft.column() : topLeft.row();
evaluated: orientation() == Qt::Horizontal
TRUEFALSE
yes
Evaluation Count:7052
yes
Evaluation Count:630
630-7052
1960 int last = orientation() == Qt::Horizontal ? bottomRight.column() : bottomRight.row();
evaluated: orientation() == Qt::Horizontal
TRUEFALSE
yes
Evaluation Count:7052
yes
Evaluation Count:630
630-7052
1961 for (int i = first; i <= last && !resizeRequired; ++i)
evaluated: i <= last
TRUEFALSE
yes
Evaluation Count:15250
yes
Evaluation Count:7682
partially evaluated: !resizeRequired
TRUEFALSE
yes
Evaluation Count:15250
no
Evaluation Count:0
0-15250
1962 resizeRequired = (sectionResizeMode(i) == ResizeToContents);
executed: resizeRequired = (sectionResizeMode(i) == ResizeToContents);
Execution Count:15250
15250
1963 if (resizeRequired)
partially evaluated: resizeRequired
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7682
0-7682
1964 d->doDelayedResizeSections();
never executed: d->doDelayedResizeSections();
0
1965 }
executed: }
Execution Count:7682
7682
1966}
executed: }
Execution Count:113768
113768
1967 -
1968 -
1969 -
1970 -
1971 -
1972 -
1973 -
1974void QHeaderView::rowsInserted(const QModelIndex &, int, int) -
1975{ -
1976 -
1977} -
1978QRect QHeaderView::visualRect(const QModelIndex &) const -
1979{ -
1980 return QRect();
executed: return QRect();
Execution Count:5449
5449
1981} -
1982void QHeaderView::scrollTo(const QModelIndex &, ScrollHint) -
1983{ -
1984 -
1985} -
1986QModelIndex QHeaderView::indexAt(const QPoint &) const -
1987{ -
1988 return QModelIndex();
executed: return QModelIndex();
Execution Count:25
25
1989} -
1990bool QHeaderView::isIndexHidden(const QModelIndex &) const -
1991{ -
1992 return true;
executed: return true;
Execution Count:1
1
1993} -
1994QModelIndex QHeaderView::moveCursor(CursorAction, Qt::KeyboardModifiers) -
1995{ -
1996 return QModelIndex();
executed: return QModelIndex();
Execution Count:42
42
1997} -
1998void QHeaderView::setSelection(const QRect&, QItemSelectionModel::SelectionFlags) -
1999{ -
2000 -
2001} -
2002 -
2003 -
2004 -
2005 -
2006 -
2007QRegion QHeaderView::visualRegionForSelection(const QItemSelection &selection) const -
2008{ -
2009 const QHeaderViewPrivate * const d = d_func(); -
2010 const int max = d->modelSectionCount(); -
2011 if (d->orientation == Qt::Horizontal) {
evaluated: d->orientation == Qt::Horizontal
TRUEFALSE
yes
Evaluation Count:2538
yes
Evaluation Count:1606
1606-2538
2012 int left = max; -
2013 int right = 0; -
2014 int rangeLeft, rangeRight; -
2015 -
2016 for (int i = 0; i < selection.count(); ++i) {
evaluated: i < selection.count()
TRUEFALSE
yes
Evaluation Count:2473
yes
Evaluation Count:2538
2473-2538
2017 QItemSelectionRange r = selection.at(i); -
2018 if (r.parent().isValid() || !r.isValid())
evaluated: r.parent().isValid()
TRUEFALSE
yes
Evaluation Count:177
yes
Evaluation Count:2296
partially evaluated: !r.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2296
0-2296
2019 continue;
executed: continue;
Execution Count:177
177
2020 -
2021 rangeLeft = visualIndex(r.left()); -
2022 if (rangeLeft == -1)
partially evaluated: rangeLeft == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2296
0-2296
2023 continue;
never executed: continue;
0
2024 rangeRight = visualIndex(r.right()); -
2025 if (rangeRight == -1)
partially evaluated: rangeRight == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2296
0-2296
2026 continue;
never executed: continue;
0
2027 if (rangeLeft < left)
evaluated: rangeLeft < left
TRUEFALSE
yes
Evaluation Count:1931
yes
Evaluation Count:365
365-1931
2028 left = rangeLeft;
executed: left = rangeLeft;
Execution Count:1931
1931
2029 if (rangeRight > right)
evaluated: rangeRight > right
TRUEFALSE
yes
Evaluation Count:1485
yes
Evaluation Count:811
811-1485
2030 right = rangeRight;
executed: right = rangeRight;
Execution Count:1485
1485
2031 }
executed: }
Execution Count:2296
2296
2032 -
2033 int logicalLeft = logicalIndex(left); -
2034 int logicalRight = logicalIndex(right); -
2035 -
2036 if (logicalLeft < 0 || logicalLeft >= count() ||
evaluated: logicalLeft < 0
TRUEFALSE
yes
Evaluation Count:609
yes
Evaluation Count:1929
partially evaluated: logicalLeft >= count()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1929
0-1929
2037 logicalRight < 0 || logicalRight >= count())
partially evaluated: logicalRight < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1929
partially evaluated: logicalRight >= count()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1929
0-1929
2038 return QRegion();
executed: return QRegion();
Execution Count:609
609
2039 -
2040 int leftPos = sectionViewportPosition(logicalLeft); -
2041 int rightPos = sectionViewportPosition(logicalRight); -
2042 rightPos += sectionSize(logicalRight); -
2043 return QRect(leftPos, 0, rightPos - leftPos, height());
executed: return QRect(leftPos, 0, rightPos - leftPos, height());
Execution Count:1929
1929
2044 } -
2045 -
2046 int top = max; -
2047 int bottom = 0; -
2048 int rangeTop, rangeBottom; -
2049 -
2050 for (int i = 0; i < selection.count(); ++i) {
evaluated: i < selection.count()
TRUEFALSE
yes
Evaluation Count:1697
yes
Evaluation Count:1606
1606-1697
2051 QItemSelectionRange r = selection.at(i); -
2052 if (r.parent().isValid() || !r.isValid())
partially evaluated: r.parent().isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1697
partially evaluated: !r.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1697
0-1697
2053 continue;
never executed: continue;
0
2054 -
2055 rangeTop = visualIndex(r.top()); -
2056 if (rangeTop == -1)
partially evaluated: rangeTop == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1697
0-1697
2057 continue;
never executed: continue;
0
2058 rangeBottom = visualIndex(r.bottom()); -
2059 if (rangeBottom == -1)
partially evaluated: rangeBottom == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1697
0-1697
2060 continue;
never executed: continue;
0
2061 if (rangeTop < top)
evaluated: rangeTop < top
TRUEFALSE
yes
Evaluation Count:1350
yes
Evaluation Count:347
347-1350
2062 top = rangeTop;
executed: top = rangeTop;
Execution Count:1350
1350
2063 if (rangeBottom > bottom)
evaluated: rangeBottom > bottom
TRUEFALSE
yes
Evaluation Count:1131
yes
Evaluation Count:566
566-1131
2064 bottom = rangeBottom;
executed: bottom = rangeBottom;
Execution Count:1131
1131
2065 }
executed: }
Execution Count:1697
1697
2066 -
2067 int logicalTop = logicalIndex(top); -
2068 int logicalBottom = logicalIndex(bottom); -
2069 -
2070 if (logicalTop == -1 || logicalBottom == -1)
partially evaluated: logicalBottom == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1334
evaluated: logicalTop == -1
TRUEFALSE
yes
Evaluation Count:272
yes
Evaluation Count:1334
0-1334
2071 return QRect();
executed: return QRect();
Execution Count:272
272
2072 -
2073 int topPos = sectionViewportPosition(logicalTop); -
2074 int bottomPos = sectionViewportPosition(logicalBottom) + sectionSize(logicalBottom); -
2075 -
2076 return QRect(0, topPos, width(), bottomPos - topPos);
executed: return QRect(0, topPos, width(), bottomPos - topPos);
Execution Count:1334
1334
2077} -
2078 -
2079 -
2080 -
2081 -
2082int QHeaderViewPrivate::sectionHandleAt(int position) -
2083{ -
2084 QHeaderView * const q = q_func(); -
2085 int visual = q->visualIndexAt(position); -
2086 if (visual == -1)
partially evaluated: visual == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:334
0-334
2087 return -1;
never executed: return -1;
0
2088 int log = logicalIndex(visual); -
2089 int pos = q->sectionViewportPosition(log); -
2090 int grip = q->style()->pixelMetric(QStyle::PM_HeaderGripMargin, 0, q); -
2091 -
2092 bool atLeft = position < pos + grip; -
2093 bool atRight = (position > pos + q->sectionSize(log) - grip); -
2094 if (reverse())
partially evaluated: reverse()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:334
0-334
2095 qSwap(atLeft, atRight);
never executed: qSwap(atLeft, atRight);
0
2096 -
2097 if (atLeft) {
evaluated: atLeft
TRUEFALSE
yes
Evaluation Count:38
yes
Evaluation Count:296
38-296
2098 -
2099 while(visual > -1) {
partially evaluated: visual > -1
TRUEFALSE
yes
Evaluation Count:38
no
Evaluation Count:0
0-38
2100 int logical = q->logicalIndex(--visual); -
2101 if (!q->isSectionHidden(logical))
partially evaluated: !q->isSectionHidden(logical)
TRUEFALSE
yes
Evaluation Count:38
no
Evaluation Count:0
0-38
2102 return logical;
executed: return logical;
Execution Count:38
38
2103 }
never executed: }
0
2104 } else if (atRight) {
never executed: }
evaluated: atRight
TRUEFALSE
yes
Evaluation Count:17
yes
Evaluation Count:279
0-279
2105 -
2106 return log;
executed: return log;
Execution Count:17
17
2107 } -
2108 return -1;
executed: return -1;
Execution Count:279
279
2109} -
2110 -
2111void QHeaderViewPrivate::setupSectionIndicator(int section, int position) -
2112{ -
2113 QHeaderView * const q = q_func(); -
2114 if (!sectionIndicator) {
partially evaluated: !sectionIndicator
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
2115 sectionIndicator = new QLabel(viewport); -
2116 }
executed: }
Execution Count:1
1
2117 -
2118 int w, h; -
2119 int p = q->sectionViewportPosition(section); -
2120 if (orientation == Qt::Horizontal) {
partially evaluated: orientation == Qt::Horizontal
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
2121 w = q->sectionSize(section); -
2122 h = viewport->height(); -
2123 } else {
executed: }
Execution Count:1
1
2124 w = viewport->width(); -
2125 h = q->sectionSize(section); -
2126 }
never executed: }
0
2127 sectionIndicator->resize(w, h); -
2128 -
2129 QPixmap pm(w, h); -
2130 pm.fill(QColor(0, 0, 0, 45)); -
2131 QRect rect(0, 0, w, h); -
2132 -
2133 QPainter painter(&pm); -
2134 painter.setOpacity(0.75); -
2135 q->paintSection(&painter, rect, section); -
2136 painter.end(); -
2137 -
2138 sectionIndicator->setPixmap(pm); -
2139 sectionIndicatorOffset = position - qMax(p, 0); -
2140}
executed: }
Execution Count:1
1
2141 -
2142void QHeaderViewPrivate::updateSectionIndicator(int section, int position) -
2143{ -
2144 if (!sectionIndicator)
never evaluated: !sectionIndicator
0
2145 return;
never executed: return;
0
2146 -
2147 if (section == -1 || target == -1) {
never evaluated: section == -1
never evaluated: target == -1
0
2148 sectionIndicator->hide(); -
2149 return;
never executed: return;
0
2150 } -
2151 -
2152 if (orientation == Qt::Horizontal)
never evaluated: orientation == Qt::Horizontal
0
2153 sectionIndicator->move(position - sectionIndicatorOffset, 0);
never executed: sectionIndicator->move(position - sectionIndicatorOffset, 0);
0
2154 else -
2155 sectionIndicator->move(0, position - sectionIndicatorOffset);
never executed: sectionIndicator->move(0, position - sectionIndicatorOffset);
0
2156 -
2157 sectionIndicator->show(); -
2158}
never executed: }
0
2159void QHeaderView::initStyleOption(QStyleOptionHeader *option) const -
2160{ -
2161 const QHeaderViewPrivate * const d = d_func(); -
2162 option->initFrom(this); -
2163 option->state = QStyle::State_None | QStyle::State_Raised; -
2164 option->orientation = d->orientation; -
2165 if (d->orientation == Qt::Horizontal)
evaluated: d->orientation == Qt::Horizontal
TRUEFALSE
yes
Evaluation Count:12519
yes
Evaluation Count:14334
12519-14334
2166 option->state |= QStyle::State_Horizontal;
executed: option->state |= QStyle::State_Horizontal;
Execution Count:12519
12519
2167 if (isEnabled())
partially evaluated: isEnabled()
TRUEFALSE
yes
Evaluation Count:26853
no
Evaluation Count:0
0-26853
2168 option->state |= QStyle::State_Enabled;
executed: option->state |= QStyle::State_Enabled;
Execution Count:26853
26853
2169 option->section = 0; -
2170}
executed: }
Execution Count:26853
26853
2171 -
2172bool QHeaderViewPrivate::isSectionSelected(int section) const -
2173{ -
2174 int i = section * 2; -
2175 if (i < 0 || i >= sectionSelected.count())
evaluated: i < 0
TRUEFALSE
yes
Evaluation Count:963
yes
Evaluation Count:4435
evaluated: i >= sectionSelected.count()
TRUEFALSE
yes
Evaluation Count:1886
yes
Evaluation Count:2549
963-4435
2176 return false;
executed: return false;
Execution Count:2849
2849
2177 if (sectionSelected.testBit(i))
evaluated: sectionSelected.testBit(i)
TRUEFALSE
yes
Evaluation Count:1059
yes
Evaluation Count:1490
1059-1490
2178 return sectionSelected.testBit(i + 1);
executed: return sectionSelected.testBit(i + 1);
Execution Count:1059
1059
2179 bool s = false; -
2180 if (orientation == Qt::Horizontal)
evaluated: orientation == Qt::Horizontal
TRUEFALSE
yes
Evaluation Count:737
yes
Evaluation Count:753
737-753
2181 s = isColumnSelected(section);
executed: s = isColumnSelected(section);
Execution Count:737
737
2182 else -
2183 s = isRowSelected(section);
executed: s = isRowSelected(section);
Execution Count:753
753
2184 sectionSelected.setBit(i + 1, s); -
2185 sectionSelected.setBit(i, true); -
2186 return s;
executed: return s;
Execution Count:1490
1490
2187} -
2188 -
2189 -
2190 -
2191 -
2192 -
2193int QHeaderViewPrivate::lastVisibleVisualIndex() const -
2194{ -
2195 const QHeaderView * const q = q_func(); -
2196 for (int visual = q->count()-1; visual >= 0; --visual) {
partially evaluated: visual >= 0
TRUEFALSE
yes
Evaluation Count:4928
no
Evaluation Count:0
0-4928
2197 if (!q->isSectionHidden(q->logicalIndex(visual)))
evaluated: !q->isSectionHidden(q->logicalIndex(visual))
TRUEFALSE
yes
Evaluation Count:4903
yes
Evaluation Count:25
25-4903
2198 return visual;
executed: return visual;
Execution Count:4903
4903
2199 }
executed: }
Execution Count:25
25
2200 -
2201 -
2202 return -1;
never executed: return -1;
0
2203} -
2204void QHeaderViewPrivate::resizeSections(QHeaderView::ResizeMode globalMode, bool useGlobalMode) -
2205{ -
2206 QHeaderView * const q = q_func(); -
2207 -
2208 delayedResize.stop(); -
2209 -
2210 executePostedLayout(); -
2211 if (sectionCount() == 0)
evaluated: sectionCount() == 0
TRUEFALSE
yes
Evaluation Count:818
yes
Evaluation Count:3530
818-3530
2212 return;
executed: return;
Execution Count:818
818
2213 -
2214 if (resizeRecursionBlock)
evaluated: resizeRecursionBlock
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:3528
2-3528
2215 return;
executed: return;
Execution Count:2
2
2216 resizeRecursionBlock = true; -
2217 -
2218 invalidateCachedSizeHint(); -
2219 -
2220 const int lastVisibleSection = lastVisibleVisualIndex(); -
2221 -
2222 -
2223 int stretchSection = -1; -
2224 if (stretchLastSection && !useGlobalMode)
evaluated: stretchLastSection
TRUEFALSE
yes
Evaluation Count:1357
yes
Evaluation Count:2171
partially evaluated: !useGlobalMode
TRUEFALSE
yes
Evaluation Count:1357
no
Evaluation Count:0
0-2171
2225 stretchSection = lastVisibleVisualIndex();
executed: stretchSection = lastVisibleVisualIndex();
Execution Count:1357
1357
2226 -
2227 -
2228 int lengthToStretch = (orientation == Qt::Horizontal ? viewport->width() : viewport->height());
evaluated: orientation == Qt::Horizontal
TRUEFALSE
yes
Evaluation Count:2720
yes
Evaluation Count:808
808-2720
2229 int numberOfStretchedSections = 0; -
2230 QList<int> section_sizes; -
2231 for (int i = 0; i < sectionCount(); ++i) {
evaluated: i < sectionCount()
TRUEFALSE
yes
Evaluation Count:23080
yes
Evaluation Count:3528
3528-23080
2232 if (isVisualIndexHidden(i))
evaluated: isVisualIndexHidden(i)
TRUEFALSE
yes
Evaluation Count:55
yes
Evaluation Count:23025
55-23025
2233 continue;
executed: continue;
Execution Count:55
55
2234 -
2235 QHeaderView::ResizeMode resizeMode; -
2236 if (useGlobalMode && (i != stretchSection))
evaluated: useGlobalMode
TRUEFALSE
yes
Evaluation Count:2090
yes
Evaluation Count:20935
partially evaluated: (i != stretchSection)
TRUEFALSE
yes
Evaluation Count:2090
no
Evaluation Count:0
0-20935
2237 resizeMode = globalMode;
executed: resizeMode = globalMode;
Execution Count:2090
2090
2238 else -
2239 resizeMode = (i == stretchSection ? QHeaderView::Stretch : headerSectionResizeMode(i));
evaluated: i == stretchSection
TRUEFALSE
yes
Evaluation Count:1357
yes
Evaluation Count:19578
executed: resizeMode = (i == stretchSection ? QHeaderView::Stretch : headerSectionResizeMode(i));
Execution Count:20935
1357-20935
2240 -
2241 if (resizeMode == QHeaderView::Stretch) {
evaluated: resizeMode == QHeaderView::Stretch
TRUEFALSE
yes
Evaluation Count:16589
yes
Evaluation Count:6436
6436-16589
2242 ++numberOfStretchedSections; -
2243 section_sizes.append(headerSectionSize(i)); -
2244 continue;
executed: continue;
Execution Count:16589
16589
2245 } -
2246 -
2247 -
2248 int sectionSize = 0; -
2249 if (resizeMode == QHeaderView::Interactive || resizeMode == QHeaderView::Fixed) {
evaluated: resizeMode == QHeaderView::Interactive
TRUEFALSE
yes
Evaluation Count:4296
yes
Evaluation Count:2140
partially evaluated: resizeMode == QHeaderView::Fixed
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2140
0-4296
2250 sectionSize = headerSectionSize(i); -
2251 } else {
executed: }
Execution Count:4296
4296
2252 int logicalIndex = q->logicalIndex(i); -
2253 sectionSize = qMax(viewSectionSizeHint(logicalIndex), -
2254 q->sectionSizeHint(logicalIndex)); -
2255 }
executed: }
Execution Count:2140
2140
2256 section_sizes.append(sectionSize); -
2257 lengthToStretch -= sectionSize; -
2258 }
executed: }
Execution Count:6436
6436
2259 -
2260 -
2261 int stretchSectionLength = -1; -
2262 int pixelReminder = 0; -
2263 if (numberOfStretchedSections > 0 && lengthToStretch > 0) {
evaluated: numberOfStretchedSections > 0
TRUEFALSE
yes
Evaluation Count:3507
yes
Evaluation Count:21
evaluated: lengthToStretch > 0
TRUEFALSE
yes
Evaluation Count:2933
yes
Evaluation Count:574
21-3507
2264 int hintLengthForEveryStretchedSection = lengthToStretch / numberOfStretchedSections; -
2265 stretchSectionLength = qMax(hintLengthForEveryStretchedSection, q->minimumSectionSize()); -
2266 pixelReminder = lengthToStretch % numberOfStretchedSections; -
2267 }
executed: }
Execution Count:2933
2933
2268 -
2269 -
2270 int spanStartSection = 0; -
2271 int previousSectionLength = 0; -
2272 -
2273 QHeaderView::ResizeMode previousSectionResizeMode = QHeaderView::Interactive; -
2274 -
2275 -
2276 for (int i = 0; i < sectionCount(); ++i) {
evaluated: i < sectionCount()
TRUEFALSE
yes
Evaluation Count:23080
yes
Evaluation Count:3528
3528-23080
2277 int oldSectionLength = headerSectionSize(i); -
2278 int newSectionLength = -1; -
2279 QHeaderView::ResizeMode newSectionResizeMode = headerSectionResizeMode(i); -
2280 -
2281 if (isVisualIndexHidden(i)) {
evaluated: isVisualIndexHidden(i)
TRUEFALSE
yes
Evaluation Count:55
yes
Evaluation Count:23025
55-23025
2282 newSectionLength = 0; -
2283 } else {
executed: }
Execution Count:55
55
2284 QHeaderView::ResizeMode resizeMode; -
2285 if (useGlobalMode)
evaluated: useGlobalMode
TRUEFALSE
yes
Evaluation Count:2090
yes
Evaluation Count:20935
2090-20935
2286 resizeMode = globalMode;
executed: resizeMode = globalMode;
Execution Count:2090
2090
2287 else -
2288 resizeMode = (i == stretchSection
evaluated: i == stretchSection
TRUEFALSE
yes
Evaluation Count:1357
yes
Evaluation Count:19578
1357-20935
2289 ? QHeaderView::Stretch 20935
2290 : newSectionResizeMode);
executed: resizeMode = (i == stretchSection ? QHeaderView::Stretch : newSectionResizeMode);
Execution Count:20935
20935
2291 if (resizeMode == QHeaderView::Stretch && stretchSectionLength != -1) {
evaluated: resizeMode == QHeaderView::Stretch
TRUEFALSE
yes
Evaluation Count:16589
yes
Evaluation Count:6436
evaluated: stretchSectionLength != -1
TRUEFALSE
yes
Evaluation Count:16015
yes
Evaluation Count:574
574-16589
2292 if (i == lastVisibleSection)
evaluated: i == lastVisibleSection
TRUEFALSE
yes
Evaluation Count:2931
yes
Evaluation Count:13084
2931-13084
2293 newSectionLength = qMax(stretchSectionLength, lastSectionSize);
executed: newSectionLength = qMax(stretchSectionLength, lastSectionSize);
Execution Count:2931
2931
2294 else -
2295 newSectionLength = stretchSectionLength;
executed: newSectionLength = stretchSectionLength;
Execution Count:13084
13084
2296 if (pixelReminder > 0) {
evaluated: pixelReminder > 0
TRUEFALSE
yes
Evaluation Count:379
yes
Evaluation Count:15636
379-15636
2297 newSectionLength += 1; -
2298 --pixelReminder; -
2299 }
executed: }
Execution Count:379
379
2300 section_sizes.removeFirst(); -
2301 } else {
executed: }
Execution Count:16015
16015
2302 newSectionLength = section_sizes.front(); -
2303 section_sizes.removeFirst(); -
2304 }
executed: }
Execution Count:7010
7010
2305 } -
2306 -
2307 -
2308 if ((previousSectionResizeMode != newSectionResizeMode
evaluated: previousSectionResizeMode != newSectionResizeMode
TRUEFALSE
yes
Evaluation Count:2224
yes
Evaluation Count:20856
2224-20856
2309 || previousSectionLength != newSectionLength) && i > 0) {
evaluated: previousSectionLength != newSectionLength
TRUEFALSE
yes
Evaluation Count:1907
yes
Evaluation Count:18949
evaluated: i > 0
TRUEFALSE
yes
Evaluation Count:633
yes
Evaluation Count:3498
633-18949
2310 int spanLength = (i - spanStartSection) * previousSectionLength; -
2311 createSectionItems(spanStartSection, i - 1, spanLength, previousSectionResizeMode); -
2312 -
2313 spanStartSection = i; -
2314 }
executed: }
Execution Count:633
633
2315 -
2316 if (newSectionLength != oldSectionLength)
evaluated: newSectionLength != oldSectionLength
TRUEFALSE
yes
Evaluation Count:1020
yes
Evaluation Count:22060
1020-22060
2317 q->sectionResized(logicalIndex(i), oldSectionLength, newSectionLength);
executed: q->sectionResized(logicalIndex(i), oldSectionLength, newSectionLength);
Execution Count:1020
1020
2318 -
2319 previousSectionLength = newSectionLength; -
2320 previousSectionResizeMode = newSectionResizeMode; -
2321 }
executed: }
Execution Count:23080
23080
2322 -
2323 createSectionItems(spanStartSection, sectionCount() - 1, -
2324 (sectionCount() - spanStartSection) * previousSectionLength, -
2325 previousSectionResizeMode); -
2326 -
2327 resizeRecursionBlock = false; -
2328 viewport->update(); -
2329}
executed: }
Execution Count:3528
3528
2330 -
2331void QHeaderViewPrivate::createSectionItems(int start, int end, int size, QHeaderView::ResizeMode mode) -
2332{ -
2333 int sizePerSection = size / (end - start + 1); -
2334 if (end >= sectionItems.count()) {
evaluated: end >= sectionItems.count()
TRUEFALSE
yes
Evaluation Count:1551
yes
Evaluation Count:40735
1551-40735
2335 sectionItems.resize(end + 1); -
2336 sectionStartposRecalc = true; -
2337 }
executed: }
Execution Count:1551
1551
2338 SectionItem *sectiondata = sectionItems.data(); -
2339 for (int i = start; i <= end; ++i) {
evaluated: i <= end
TRUEFALSE
yes
Evaluation Count:30071161
yes
Evaluation Count:42286
42286-30071161
2340 length += (sizePerSection - sectiondata[i].size); -
2341 sectionStartposRecalc |= (sectiondata[i].size != sizePerSection); -
2342 sectiondata[i].size = sizePerSection; -
2343 sectiondata[i].resizeMode = mode; -
2344 }
executed: }
Execution Count:30071161
30071161
2345}
executed: }
Execution Count:42286
42286
2346 -
2347void QHeaderViewPrivate::removeSectionsFromSectionItems(int start, int end) -
2348{ -
2349 -
2350 sectionStartposRecalc |= (end != sectionItems.count() - 1); -
2351 int removedlength = 0; -
2352 for (int u = start; u <= end; ++u)
evaluated: u <= end
TRUEFALSE
yes
Evaluation Count:3093
yes
Evaluation Count:2375
2375-3093
2353 removedlength += sectionItems.at(u).size;
executed: removedlength += sectionItems.at(u).size;
Execution Count:3093
3093
2354 length -= removedlength; -
2355 sectionItems.remove(start, end - start + 1); -
2356}
executed: }
Execution Count:2375
2375
2357 -
2358void QHeaderViewPrivate::clear() -
2359{ -
2360 if (state != NoClear) {
evaluated: state != NoClear
TRUEFALSE
yes
Evaluation Count:3579
yes
Evaluation Count:383
383-3579
2361 length = 0; -
2362 visualIndices.clear(); -
2363 logicalIndices.clear(); -
2364 sectionSelected.clear(); -
2365 sectionHidden.clear(); -
2366 hiddenSectionSize.clear(); -
2367 sectionItems.clear(); -
2368 invalidateCachedSizeHint(); -
2369 }
executed: }
Execution Count:3579
3579
2370}
executed: }
Execution Count:3962
3962
2371 -
2372void QHeaderViewPrivate::flipSortIndicator(int section) -
2373{ -
2374 QHeaderView * const q = q_func(); -
2375 Qt::SortOrder sortOrder; -
2376 if (sortIndicatorSection == section) {
evaluated: sortIndicatorSection == section
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:9
2-9
2377 sortOrder = (sortIndicatorOrder == Qt::DescendingOrder) ? Qt::AscendingOrder : Qt::DescendingOrder;
evaluated: (sortIndicatorOrder == Qt::DescendingOrder)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1
2378 } else {
executed: }
Execution Count:2
2
2379 const QVariant value = model->headerData(section, orientation, Qt::InitialSortOrderRole); -
2380 if (value.canConvert(QVariant::Int))
evaluated: value.canConvert(QVariant::Int)
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:7
2-7
2381 sortOrder = static_cast<Qt::SortOrder>(value.toInt());
executed: sortOrder = static_cast<Qt::SortOrder>(value.toInt());
Execution Count:2
2
2382 else -
2383 sortOrder = Qt::AscendingOrder;
executed: sortOrder = Qt::AscendingOrder;
Execution Count:7
7
2384 } -
2385 q->setSortIndicator(section, sortOrder); -
2386}
executed: }
Execution Count:11
11
2387 -
2388void QHeaderViewPrivate::cascadingResize(int visual, int newSize) -
2389{ -
2390 QHeaderView * const q = q_func(); -
2391 const int minimumSize = q->minimumSectionSize(); -
2392 const int oldSize = headerSectionSize(visual); -
2393 int delta = newSize - oldSize; -
2394 -
2395 if (delta > 0) {
never evaluated: delta > 0
0
2396 bool sectionResized = false; -
2397 -
2398 -
2399 for (int i = firstCascadingSection; i < visual; ++i) {
never evaluated: i < visual
0
2400 if (cascadingSectionSize.contains(i)) {
never evaluated: cascadingSectionSize.contains(i)
0
2401 int currentSectionSize = headerSectionSize(i); -
2402 int originalSectionSize = cascadingSectionSize.value(i); -
2403 if (currentSectionSize < originalSectionSize) {
never evaluated: currentSectionSize < originalSectionSize
0
2404 int newSectionSize = currentSectionSize + delta; -
2405 resizeSectionItem(i, currentSectionSize, newSectionSize); -
2406 if (newSectionSize >= originalSectionSize && false)
never evaluated: newSectionSize >= originalSectionSize
never evaluated: false
0
2407 cascadingSectionSize.remove(i);
never executed: cascadingSectionSize.remove(i);
0
2408 sectionResized = true; -
2409 break;
never executed: break;
0
2410 } -
2411 }
never executed: }
0
2412 -
2413 }
never executed: }
0
2414 -
2415 -
2416 if (!sectionResized) {
never evaluated: !sectionResized
0
2417 newSize = qMax(newSize, minimumSize); -
2418 if (oldSize != newSize)
never evaluated: oldSize != newSize
0
2419 resizeSectionItem(visual, oldSize, newSize);
never executed: resizeSectionItem(visual, oldSize, newSize);
0
2420 }
never executed: }
0
2421 -
2422 -
2423 for (int i = visual + 1; i < sectionCount(); ++i) {
never evaluated: i < sectionCount()
0
2424 if (!sectionIsCascadable(i))
never evaluated: !sectionIsCascadable(i)
0
2425 continue;
never executed: continue;
0
2426 int currentSectionSize = headerSectionSize(i); -
2427 if (currentSectionSize <= minimumSize)
never evaluated: currentSectionSize <= minimumSize
0
2428 continue;
never executed: continue;
0
2429 int newSectionSize = qMax(currentSectionSize - delta, minimumSize); -
2430 -
2431 resizeSectionItem(i, currentSectionSize, newSectionSize); -
2432 saveCascadingSectionSize(i, currentSectionSize); -
2433 delta = delta - (currentSectionSize - newSectionSize); -
2434 -
2435 -
2436 if (delta <= 0)
never evaluated: delta <= 0
0
2437 break;
never executed: break;
0
2438 }
never executed: }
0
2439 } else {
never executed: }
0
2440 bool sectionResized = false; -
2441 -
2442 -
2443 for (int i = lastCascadingSection; i > visual; --i) {
never evaluated: i > visual
0
2444 if (!cascadingSectionSize.contains(i))
never evaluated: !cascadingSectionSize.contains(i)
0
2445 continue;
never executed: continue;
0
2446 int currentSectionSize = headerSectionSize(i); -
2447 int originalSectionSize = cascadingSectionSize.value(i); -
2448 if (currentSectionSize >= originalSectionSize)
never evaluated: currentSectionSize >= originalSectionSize
0
2449 continue;
never executed: continue;
0
2450 int newSectionSize = currentSectionSize - delta; -
2451 resizeSectionItem(i, currentSectionSize, newSectionSize); -
2452 if (newSectionSize >= originalSectionSize && false) {
never evaluated: newSectionSize >= originalSectionSize
never evaluated: false
0
2453 -
2454 cascadingSectionSize.remove(i); -
2455 }
never executed: }
0
2456 sectionResized = true; -
2457 break;
never executed: break;
0
2458 } -
2459 -
2460 -
2461 resizeSectionItem(visual, oldSize, qMax(newSize, minimumSize)); -
2462 -
2463 -
2464 if (delta < 0 && newSize < minimumSize) {
never evaluated: delta < 0
never evaluated: newSize < minimumSize
0
2465 for (int i = visual - 1; i >= 0; --i) {
never evaluated: i >= 0
0
2466 if (!sectionIsCascadable(i))
never evaluated: !sectionIsCascadable(i)
0
2467 continue;
never executed: continue;
0
2468 int sectionSize = headerSectionSize(i); -
2469 if (sectionSize <= minimumSize)
never evaluated: sectionSize <= minimumSize
0
2470 continue;
never executed: continue;
0
2471 resizeSectionItem(i, sectionSize, qMax(sectionSize + delta, minimumSize)); -
2472 saveCascadingSectionSize(i, sectionSize); -
2473 break;
never executed: break;
0
2474 } -
2475 }
never executed: }
0
2476 -
2477 -
2478 if (!sectionResized) {
never evaluated: !sectionResized
0
2479 for (int i = visual + 1; i < sectionCount(); ++i) {
never evaluated: i < sectionCount()
0
2480 if (!sectionIsCascadable(i))
never evaluated: !sectionIsCascadable(i)
0
2481 continue;
never executed: continue;
0
2482 int currentSectionSize = headerSectionSize(i); -
2483 int newSectionSize = qMax(currentSectionSize - delta, minimumSize); -
2484 resizeSectionItem(i, currentSectionSize, newSectionSize); -
2485 break;
never executed: break;
0
2486 } -
2487 }
never executed: }
0
2488 }
never executed: }
0
2489 -
2490 if (hasAutoResizeSections())
never evaluated: hasAutoResizeSections()
0
2491 doDelayedResizeSections();
never executed: doDelayedResizeSections();
0
2492 -
2493 viewport->update(); -
2494}
never executed: }
0
2495 -
2496void QHeaderViewPrivate::setDefaultSectionSize(int size) -
2497{ -
2498 QHeaderView * const q = q_func(); -
2499 executePostedLayout(); -
2500 invalidateCachedSizeHint(); -
2501 defaultSectionSize = size; -
2502 if (state == QHeaderViewPrivate::ResizeSection)
partially evaluated: state == QHeaderViewPrivate::ResizeSection
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:85
0-85
2503 preventCursorChangeInSetOffset = true;
never executed: preventCursorChangeInSetOffset = true;
0
2504 for (int i = 0; i < sectionItems.count(); ++i) {
evaluated: i < sectionItems.count()
TRUEFALSE
yes
Evaluation Count:6234
yes
Evaluation Count:85
85-6234
2505 QHeaderViewPrivate::SectionItem &section = sectionItems[i]; -
2506 if (sectionHidden.isEmpty() || !sectionHidden.testBit(i)) {
evaluated: sectionHidden.isEmpty()
TRUEFALSE
yes
Evaluation Count:2208
yes
Evaluation Count:4026
evaluated: !sectionHidden.testBit(i)
TRUEFALSE
yes
Evaluation Count:4009
yes
Evaluation Count:17
17-4026
2507 const int newSize = size; -
2508 if (newSize != section.size) {
evaluated: newSize != section.size
TRUEFALSE
yes
Evaluation Count:4207
yes
Evaluation Count:2010
2010-4207
2509 length += newSize - section.size; -
2510 const int oldSectionSize = section.sectionSize(); -
2511 section.size = size; -
2512 q->sectionResized(logicalIndex(i), oldSectionSize, size); -
2513 }
executed: }
Execution Count:4207
4207
2514 }
executed: }
Execution Count:6217
6217
2515 }
executed: }
Execution Count:6234
6234
2516 sectionStartposRecalc = true; -
2517 if (hasAutoResizeSections())
evaluated: hasAutoResizeSections()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:83
2-83
2518 doDelayedResizeSections();
executed: doDelayedResizeSections();
Execution Count:2
2
2519 viewport->update(); -
2520}
executed: }
Execution Count:85
85
2521 -
2522void QHeaderViewPrivate::recalcSectionStartPos() const -
2523{ -
2524 int pixelpos = 0; -
2525 for (QVector<SectionItem>::const_iterator i = sectionItems.constBegin(); i != sectionItems.constEnd(); ++i) {
evaluated: i != sectionItems.constEnd()
TRUEFALSE
yes
Evaluation Count:31526740
yes
Evaluation Count:6208
6208-31526740
2526 i->calculated_startpos = pixelpos; -
2527 pixelpos += i->size; -
2528 }
executed: }
Execution Count:31526740
31526740
2529 sectionStartposRecalc = false; -
2530}
executed: }
Execution Count:6208
6208
2531 -
2532void QHeaderViewPrivate::resizeSectionItem(int visualIndex, int oldSize, int newSize) -
2533{ -
2534 QHeaderView * const q = q_func(); -
2535 QHeaderView::ResizeMode mode = headerSectionResizeMode(visualIndex); -
2536 createSectionItems(visualIndex, visualIndex, newSize, mode); -
2537 q->sectionResized(logicalIndex(visualIndex), oldSize, newSize); -
2538}
never executed: }
0
2539 -
2540int QHeaderViewPrivate::headerSectionSize(int visual) const -
2541{ -
2542 if (visual < sectionCount() && visual >= 0)
partially evaluated: visual < sectionCount()
TRUEFALSE
yes
Evaluation Count:334746
no
Evaluation Count:0
partially evaluated: visual >= 0
TRUEFALSE
yes
Evaluation Count:334746
no
Evaluation Count:0
0-334746
2543 return sectionItems.at(visual).sectionSize();
executed: return sectionItems.at(visual).sectionSize();
Execution Count:334746
334746
2544 return -1;
never executed: return -1;
0
2545} -
2546 -
2547int QHeaderViewPrivate::headerSectionPosition(int visual) const -
2548{ -
2549 if (visual < sectionCount() && visual >= 0) {
partially evaluated: visual < sectionCount()
TRUEFALSE
yes
Evaluation Count:187120
no
Evaluation Count:0
partially evaluated: visual >= 0
TRUEFALSE
yes
Evaluation Count:187120
no
Evaluation Count:0
0-187120
2550 if (sectionStartposRecalc)
evaluated: sectionStartposRecalc
TRUEFALSE
yes
Evaluation Count:3055
yes
Evaluation Count:184065
3055-184065
2551 recalcSectionStartPos();
executed: recalcSectionStartPos();
Execution Count:3055
3055
2552 return sectionItems.at(visual).calculated_startpos;
executed: return sectionItems.at(visual).calculated_startpos;
Execution Count:187120
187120
2553 } -
2554 return -1;
never executed: return -1;
0
2555} -
2556 -
2557int QHeaderViewPrivate::headerVisualIndexAt(int position) const -
2558{ -
2559 if (sectionStartposRecalc)
evaluated: sectionStartposRecalc
TRUEFALSE
yes
Evaluation Count:3044
yes
Evaluation Count:90529
3044-90529
2560 recalcSectionStartPos();
executed: recalcSectionStartPos();
Execution Count:3044
3044
2561 int startidx = 0; -
2562 int endidx = sectionItems.count() - 1; -
2563 while (startidx <= endidx) {
evaluated: startidx <= endidx
TRUEFALSE
yes
Evaluation Count:563187
yes
Evaluation Count:377
377-563187
2564 int middle = (endidx + startidx) / 2; -
2565 if (sectionItems.at(middle).calculated_startpos > position) {
evaluated: sectionItems.at(middle).calculated_startpos > position
TRUEFALSE
yes
Evaluation Count:361009
yes
Evaluation Count:202178
202178-361009
2566 endidx = middle - 1; -
2567 } else {
executed: }
Execution Count:361009
361009
2568 if (sectionItems.at(middle).calculatedEndPos() <= position)
evaluated: sectionItems.at(middle).calculatedEndPos() <= position
TRUEFALSE
yes
Evaluation Count:108982
yes
Evaluation Count:93196
93196-108982
2569 startidx = middle + 1;
executed: startidx = middle + 1;
Execution Count:108982
108982
2570 else -
2571 return middle;
executed: return middle;
Execution Count:93196
93196
2572 } -
2573 } -
2574 return -1;
executed: return -1;
Execution Count:377
377
2575} -
2576 -
2577void QHeaderViewPrivate::setHeaderSectionResizeMode(int visual, QHeaderView::ResizeMode mode) -
2578{ -
2579 int size = headerSectionSize(visual); -
2580 createSectionItems(visual, visual, size, mode); -
2581}
executed: }
Execution Count:12
12
2582 -
2583QHeaderView::ResizeMode QHeaderViewPrivate::headerSectionResizeMode(int visual) const -
2584{ -
2585 if (visual < 0 || visual >= sectionItems.count())
partially evaluated: visual < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:94538
evaluated: visual >= sectionItems.count()
TRUEFALSE
yes
Evaluation Count:195
yes
Evaluation Count:94343
0-94538
2586 return globalResizeMode;
executed: return globalResizeMode;
Execution Count:195
195
2587 return sectionItems.at(visual).resizeMode;
executed: return sectionItems.at(visual).resizeMode;
Execution Count:94343
94343
2588} -
2589 -
2590void QHeaderViewPrivate::setGlobalHeaderResizeMode(QHeaderView::ResizeMode mode) -
2591{ -
2592 globalResizeMode = mode; -
2593 for (int i = 0; i < sectionItems.count(); ++i)
evaluated: i < sectionItems.count()
TRUEFALSE
yes
Evaluation Count:444
yes
Evaluation Count:66
66-444
2594 sectionItems[i].resizeMode = mode;
executed: sectionItems[i].resizeMode = mode;
Execution Count:444
444
2595}
executed: }
Execution Count:66
66
2596 -
2597int QHeaderViewPrivate::viewSectionSizeHint(int logical) const -
2598{ -
2599 if (QAbstractItemView *view = qobject_cast<QAbstractItemView*>(parent)) {
partially evaluated: QAbstractItemView *view = qobject_cast<QAbstractItemView*>(parent)
TRUEFALSE
yes
Evaluation Count:2140
no
Evaluation Count:0
0-2140
2600 return (orientation == Qt::Horizontal 2140
2601 ? view->sizeHintForColumn(logical) 2140
2602 : view->sizeHintForRow(logical));
executed: return (orientation == Qt::Horizontal ? view->sizeHintForColumn(logical) : view->sizeHintForRow(logical));
Execution Count:2140
2140
2603 } -
2604 return 0;
never executed: return 0;
0
2605} -
2606 -
2607int QHeaderViewPrivate::adjustedVisualIndex(int visualIndex) const -
2608{ -
2609 if (!sectionHidden.isEmpty()) {
evaluated: !sectionHidden.isEmpty()
TRUEFALSE
yes
Evaluation Count:225
yes
Evaluation Count:3084
225-3084
2610 int adjustedVisualIndex = visualIndex; -
2611 int currentVisualIndex = 0; -
2612 for (int i = 0; i < sectionItems.count(); ++i) {
partially evaluated: i < sectionItems.count()
TRUEFALSE
yes
Evaluation Count:2279
no
Evaluation Count:0
0-2279
2613 if (sectionHidden.testBit(i))
evaluated: sectionHidden.testBit(i)
TRUEFALSE
yes
Evaluation Count:70
yes
Evaluation Count:2209
70-2209
2614 ++adjustedVisualIndex;
executed: ++adjustedVisualIndex;
Execution Count:70
70
2615 else -
2616 ++currentVisualIndex;
executed: ++currentVisualIndex;
Execution Count:2209
2209
2617 if (currentVisualIndex >= visualIndex)
evaluated: currentVisualIndex >= visualIndex
TRUEFALSE
yes
Evaluation Count:225
yes
Evaluation Count:2054
225-2054
2618 break;
executed: break;
Execution Count:225
225
2619 }
executed: }
Execution Count:2054
2054
2620 visualIndex = adjustedVisualIndex; -
2621 }
executed: }
Execution Count:225
225
2622 return visualIndex;
executed: return visualIndex;
Execution Count:3309
3309
2623} -
2624 -
2625 -
2626void QHeaderViewPrivate::write(QDataStream &out) const -
2627{ -
2628 out << int(orientation); -
2629 out << int(sortIndicatorOrder); -
2630 out << sortIndicatorSection; -
2631 out << sortIndicatorShown; -
2632 -
2633 out << visualIndices; -
2634 out << logicalIndices; -
2635 -
2636 out << sectionHidden; -
2637 out << hiddenSectionSize; -
2638 -
2639 out << length; -
2640 out << sectionCount(); -
2641 out << movableSections; -
2642 out << clickableSections; -
2643 out << highlightSelected; -
2644 out << stretchLastSection; -
2645 out << cascadingResizing; -
2646 out << stretchSections; -
2647 out << contentsSections; -
2648 out << defaultSectionSize; -
2649 out << minimumSectionSize; -
2650 -
2651 out << int(defaultAlignment); -
2652 out << int(globalResizeMode); -
2653 -
2654 out << sectionItems; -
2655}
executed: }
Execution Count:194
194
2656 -
2657bool QHeaderViewPrivate::read(QDataStream &in) -
2658{ -
2659 int orient, order, align, global; -
2660 in >> orient; -
2661 orientation = (Qt::Orientation)orient; -
2662 -
2663 in >> order; -
2664 sortIndicatorOrder = (Qt::SortOrder)order; -
2665 -
2666 in >> sortIndicatorSection; -
2667 in >> sortIndicatorShown; -
2668 -
2669 in >> visualIndices; -
2670 in >> logicalIndices; -
2671 -
2672 in >> sectionHidden; -
2673 in >> hiddenSectionSize; -
2674 -
2675 in >> length; -
2676 int unusedSectionCount; -
2677 in >> unusedSectionCount; -
2678 in >> movableSections; -
2679 in >> clickableSections; -
2680 in >> highlightSelected; -
2681 in >> stretchLastSection; -
2682 in >> cascadingResizing; -
2683 in >> stretchSections; -
2684 in >> contentsSections; -
2685 in >> defaultSectionSize; -
2686 in >> minimumSectionSize; -
2687 -
2688 in >> align; -
2689 defaultAlignment = Qt::Alignment(align); -
2690 -
2691 in >> global; -
2692 globalResizeMode = (QHeaderView::ResizeMode)global; -
2693 -
2694 in >> sectionItems; -
2695 -
2696 -
2697 -
2698 QVector<SectionItem> newSectionItems; -
2699 for (int u = 0; u < sectionItems.count(); ++u) {
evaluated: u < sectionItems.count()
TRUEFALSE
yes
Evaluation Count:435
yes
Evaluation Count:109
109-435
2700 int count = sectionItems.at(u).tmpDataStreamSectionCount; -
2701 for (int n = 0; n < count; ++n)
evaluated: n < count
TRUEFALSE
yes
Evaluation Count:435
yes
Evaluation Count:435
435
2702 newSectionItems.append(sectionItems[u]);
executed: newSectionItems.append(sectionItems[u]);
Execution Count:435
435
2703 }
executed: }
Execution Count:435
435
2704 sectionItems = newSectionItems; -
2705 recalcSectionStartPos(); -
2706 return true;
executed: return true;
Execution Count:109
109
2707} -
2708 -
2709 -
2710 -
2711 -
2712 -
2713 -
2714 -
2715 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial