itemviews/qheaderview.cpp

Source codeSwitch to Preprocessed file
LineSource CodeCoverage
1/**************************************************************************** -
2** -
3** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -
4** Contact: http://www.qt-project.org/legal -
5** -
6** This file is part of the QtGui module of the Qt Toolkit. -
7** -
8** $QT_BEGIN_LICENSE:LGPL$ -
9** Commercial License Usage -
10** Licensees holding valid commercial Qt licenses may use this file in -
11** accordance with the commercial license agreement provided with the -
12** Software or, alternatively, in accordance with the terms contained in -
13** a written agreement between you and Digia. For licensing terms and -
14** conditions see http://qt.digia.com/licensing. For further information -
15** use the contact form at http://qt.digia.com/contact-us. -
16** -
17** GNU Lesser General Public License Usage -
18** Alternatively, this file may be used under the terms of the GNU Lesser -
19** General Public License version 2.1 as published by the Free Software -
20** Foundation and appearing in the file LICENSE.LGPL included in the -
21** packaging of this file. Please review the following information to -
22** ensure the GNU Lesser General Public License version 2.1 requirements -
23** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -
24** -
25** In addition, as a special exception, Digia gives you certain additional -
26** rights. These rights are described in the Digia Qt LGPL Exception -
27** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -
28** -
29** GNU General Public License Usage -
30** Alternatively, this file may be used under the terms of the GNU -
31** General Public License version 3.0 as published by the Free Software -
32** Foundation and appearing in the file LICENSE.GPL included in the -
33** packaging of this file. Please review the following information to -
34** ensure the GNU General Public License version 3.0 requirements will be -
35** met: http://www.gnu.org/copyleft/gpl.html. -
36** -
37** -
38** $QT_END_LICENSE$ -
39** -
40****************************************************************************/ -
41 -
42#include "qheaderview.h" -
43 -
44#ifndef QT_NO_ITEMVIEWS -
45#include <qbitarray.h> -
46#include <qbrush.h> -
47#include <qdebug.h> -
48#include <qevent.h> -
49#include <qpainter.h> -
50#include <qscrollbar.h> -
51#include <qtooltip.h> -
52#include <qwhatsthis.h> -
53#include <qstyle.h> -
54#include <qstyleoption.h> -
55#include <qvector.h> -
56#include <qapplication.h> -
57#include <qvarlengtharray.h> -
58#include <qabstractitemdelegate.h> -
59#include <qvariant.h> -
60#include <private/qheaderview_p.h> -
61#include <private/qabstractitemmodel_p.h> -
62 -
63#ifndef QT_NO_DATASTREAM -
64#include <qdatastream.h> -
65#endif -
66 -
67QT_BEGIN_NAMESPACE -
68 -
69#ifndef QT_NO_DATASTREAM -
70QDataStream &operator<<(QDataStream &out, const QHeaderViewPrivate::SectionItem &section) -
71{ -
72 section.write(out);
executed (the execution status of this line is deduced): section.write(out);
-
73 return out;
executed: return out;
Execution Count:774
774
74} -
75 -
76QDataStream &operator>>(QDataStream &in, QHeaderViewPrivate::SectionItem &section) -
77{ -
78 section.read(in);
executed (the execution status of this line is deduced): section.read(in);
-
79 return in;
executed: return in;
Execution Count:435
435
80} -
81#endif // QT_NO_DATASTREAM -
82 -
83 -
84/*! -
85 \class QHeaderView -
86 -
87 \brief The QHeaderView class provides a header row or header column for -
88 item views. -
89 -
90 \ingroup model-view -
91 \inmodule QtWidgets -
92 -
93 A QHeaderView displays the headers used in item views such as the -
94 QTableView and QTreeView classes. It takes the place of Qt3's \c QHeader -
95 class previously used for the same purpose, but uses the Qt's model/view -
96 architecture for consistency with the item view classes. -
97 -
98 The QHeaderView class is one of the \l{Model/View Classes} and is part of -
99 Qt's \l{Model/View Programming}{model/view framework}. -
100 -
101 The header gets the data for each section from the model using the -
102 QAbstractItemModel::headerData() function. You can set the data by using -
103 QAbstractItemModel::setHeaderData(). -
104 -
105 Each header has an orientation() and a number of sections, given by the -
106 count() function. A section refers to a part of the header - either a row -
107 or a column, depending on the orientation. -
108 -
109 Sections can be moved and resized using moveSection() and resizeSection(); -
110 they can also be hidden and shown with hideSection() and showSection(). -
111 -
112 Each section of a header is described by a section ID, specified by its -
113 section(), and can be located at a particular visualIndex() in the header. -
114 A section can have a sort indicator set with setSortIndicator(); this -
115 indicates whether the items in the associated item view will be sorted in -
116 the order given by the section. -
117 -
118 For a horizontal header the section is equivalent to a column in the model, -
119 and for a vertical header the section is equivalent to a row in the model. -
120 -
121 \section1 Moving Header Sections -
122 -
123 A header can be fixed in place, or made movable with setSectionsMovable(). It can -
124 be made clickable with setSectionsClickable(), and has resizing behavior in -
125 accordance with setSectionResizeMode() -
126 -
127 \note Double-clicking on a header to resize a section only applies for -
128 visible rows. -
129 -
130 A header will emit sectionMoved() if the user moves a section, -
131 sectionResized() if the user resizes a section, and sectionClicked() as -
132 well as sectionHandleDoubleClicked() in response to mouse clicks. A header -
133 will also emit sectionCountChanged(). -
134 -
135 You can identify a section using the logicalIndex() and logicalIndexAt() -
136 functions, or by its index position, using the visualIndex() and -
137 visualIndexAt() functions. The visual index will change if a section is -
138 moved, but the logical index will not change. -
139 -
140 \section1 Appearance -
141 -
142 QTableWidget and QTableView create default headers. If you want -
143 the headers to be visible, you can use \l{QFrame::}{setVisible()}. -
144 -
145 Not all \l{Qt::}{ItemDataRole}s will have an effect on a -
146 QHeaderView. If you need to draw other roles, you can subclass -
147 QHeaderView and reimplement \l{QHeaderView::}{paintEvent()}. -
148 QHeaderView respects the following item data roles: -
149 \l{Qt::}{TextAlignmentRole}, \l{Qt::}{DisplayRole}, -
150 \l{Qt::}{FontRole}, \l{Qt::}{DecorationRole}, -
151 \l{Qt::}{ForegroundRole}, and \l{Qt::}{BackgroundRole}. -
152 -
153 \note Each header renders the data for each section itself, and does not -
154 rely on a delegate. As a result, calling a header's setItemDelegate() -
155 function will have no effect. -
156 -
157 \sa {Model/View Programming}, QListView, QTableView, QTreeView -
158*/ -
159 -
160/*! -
161 \enum QHeaderView::ResizeMode -
162 -
163 The resize mode specifies the behavior of the header sections. It can be -
164 set on the entire header view or on individual sections using -
165 setSectionResizeMode(). -
166 -
167 \value Interactive The user can resize the section. The section can also be -
168 resized programmatically using resizeSection(). The section size -
169 defaults to \l defaultSectionSize. (See also -
170 \l cascadingSectionResizes.) -
171 -
172 \value Fixed The user cannot resize the section. The section can only be -
173 resized programmatically using resizeSection(). The section size -
174 defaults to \l defaultSectionSize. -
175 -
176 \value Stretch QHeaderView will automatically resize the section to fill -
177 the available space. The size cannot be changed by the user or -
178 programmatically. -
179 -
180 \value ResizeToContents QHeaderView will automatically resize the section -
181 to its optimal size based on the contents of the entire column or -
182 row. The size cannot be changed by the user or programmatically. -
183 (This value was introduced in 4.2) -
184 -
185 The following values are obsolete: -
186 \value Custom Use Fixed instead. -
187 -
188 \sa setResizeMode(), setSectionResizeMode(), stretchLastSection, minimumSectionSize -
189*/ -
190 -
191/*! -
192 \fn void QHeaderView::sectionMoved(int logicalIndex, int oldVisualIndex, -
193 int newVisualIndex) -
194 -
195 This signal is emitted when a section is moved. The section's logical index -
196 is specified by \a logicalIndex, the old index by \a oldVisualIndex, and -
197 the new index position by \a newVisualIndex. -
198 -
199 \sa moveSection() -
200*/ -
201 -
202/*! -
203 \fn void QHeaderView::sectionResized(int logicalIndex, int oldSize, -
204 int newSize) -
205 -
206 This signal is emitted when a section is resized. The section's logical -
207 number is specified by \a logicalIndex, the old size by \a oldSize, and the -
208 new size by \a newSize. -
209 -
210 \sa resizeSection() -
211*/ -
212 -
213/*! -
214 \fn void QHeaderView::sectionPressed(int logicalIndex) -
215 -
216 This signal is emitted when a section is pressed. The section's logical -
217 index is specified by \a logicalIndex. -
218 -
219 \sa setSectionsClickable() -
220*/ -
221 -
222/*! -
223 \fn void QHeaderView::sectionClicked(int logicalIndex) -
224 -
225 This signal is emitted when a section is clicked. The section's logical -
226 index is specified by \a logicalIndex. -
227 -
228 Note that the sectionPressed signal will also be emitted. -
229 -
230 \sa setSectionsClickable(), sectionPressed() -
231*/ -
232 -
233/*! -
234 \fn void QHeaderView::sectionEntered(int logicalIndex) -
235 \since 4.3 -
236 -
237 This signal is emitted when the cursor moves over the section and the left -
238 mouse button is pressed. The section's logical index is specified by -
239 \a logicalIndex. -
240 -
241 \sa setSectionsClickable(), sectionPressed() -
242*/ -
243 -
244/*! -
245 \fn void QHeaderView::sectionDoubleClicked(int logicalIndex) -
246 -
247 This signal is emitted when a section is double-clicked. The section's -
248 logical index is specified by \a logicalIndex. -
249 -
250 \sa setSectionsClickable() -
251*/ -
252 -
253/*! -
254 \fn void QHeaderView::sectionCountChanged(int oldCount, int newCount) -
255 -
256 This signal is emitted when the number of sections changes, i.e., when -
257 sections are added or deleted. The original count is specified by -
258 \a oldCount, and the new count by \a newCount. -
259 -
260 \sa count(), length(), headerDataChanged() -
261*/ -
262 -
263/*! -
264 \fn void QHeaderView::sectionHandleDoubleClicked(int logicalIndex) -
265 -
266 This signal is emitted when a section is double-clicked. The section's -
267 logical index is specified by \a logicalIndex. -
268 -
269 \sa setSectionsClickable() -
270*/ -
271 -
272/*! -
273 \fn void QHeaderView::sortIndicatorChanged(int logicalIndex, -
274 Qt::SortOrder order) -
275 \since 4.3 -
276 -
277 This signal is emitted when the section containing the sort indicator or -
278 the order indicated is changed. The section's logical index is specified -
279 by \a logicalIndex and the sort order is specified by \a order. -
280 -
281 \sa setSortIndicator() -
282*/ -
283 -
284/*! -
285 \fn void QHeaderView::geometriesChanged() -
286 \since 4.2 -
287 -
288 This signal is emitted when the header's geometries have changed. -
289*/ -
290 -
291/*! -
292 \property QHeaderView::highlightSections -
293 \brief whether the sections containing selected items are highlighted -
294 -
295 By default, this property is false. -
296*/ -
297 -
298/*! -
299 Creates a new generic header with the given \a orientation and \a parent. -
300*/ -
301QHeaderView::QHeaderView(Qt::Orientation orientation, QWidget *parent) -
302 : QAbstractItemView(*new QHeaderViewPrivate, parent) -
303{ -
304 Q_D(QHeaderView);
executed (the execution status of this line is deduced): QHeaderViewPrivate * const d = d_func();
-
305 d->setDefaultValues(orientation);
executed (the execution status of this line is deduced): d->setDefaultValues(orientation);
-
306 initialize();
executed (the execution status of this line is deduced): initialize();
-
307}
executed: }
Execution Count:1855
1855
308 -
309/*! -
310 \internal -
311*/ -
312QHeaderView::QHeaderView(QHeaderViewPrivate &dd, -
313 Qt::Orientation orientation, QWidget *parent) -
314 : QAbstractItemView(dd, parent) -
315{ -
316 Q_D(QHeaderView);
never executed (the execution status of this line is deduced): QHeaderViewPrivate * const d = d_func();
-
317 d->setDefaultValues(orientation);
never executed (the execution status of this line is deduced): d->setDefaultValues(orientation);
-
318 initialize();
never executed (the execution status of this line is deduced): initialize();
-
319}
never executed: }
0
320 -
321/*! -
322 Destroys the header. -
323*/ -
324 -
325QHeaderView::~QHeaderView() -
326{ -
327} -
328 -
329/*! -
330 \internal -
331*/ -
332void QHeaderView::initialize() -
333{ -
334 Q_D(QHeaderView);
executed (the execution status of this line is deduced): QHeaderViewPrivate * const d = d_func();
-
335 setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
executed (the execution status of this line is deduced): setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
-
336 setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
executed (the execution status of this line is deduced): setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
-
337 setFrameStyle(NoFrame);
executed (the execution status of this line is deduced): setFrameStyle(NoFrame);
-
338 setFocusPolicy(Qt::NoFocus);
executed (the execution status of this line is deduced): setFocusPolicy(Qt::NoFocus);
-
339 d->viewport->setMouseTracking(true);
executed (the execution status of this line is deduced): d->viewport->setMouseTracking(true);
-
340 d->viewport->setBackgroundRole(QPalette::Button);
executed (the execution status of this line is deduced): d->viewport->setBackgroundRole(QPalette::Button);
-
341 d->textElideMode = Qt::ElideNone;
executed (the execution status of this line is deduced): d->textElideMode = Qt::ElideNone;
-
342 delete d->itemDelegate;
executed (the execution status of this line is deduced): delete d->itemDelegate;
-
343}
executed: }
Execution Count:1855
1855
344 -
345/*! -
346 \reimp -
347*/ -
348void QHeaderView::setModel(QAbstractItemModel *model) -
349{ -
350 if (model == this->model())
evaluated: model == this->model()
TRUEFALSE
yes
Evaluation Count:45
yes
Evaluation Count:3473
45-3473
351 return;
executed: return;
Execution Count:45
45
352 Q_D(QHeaderView);
executed (the execution status of this line is deduced): QHeaderViewPrivate * const d = d_func();
-
353 d->persistentHiddenSections.clear();
executed (the execution status of this line is deduced): d->persistentHiddenSections.clear();
-
354 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
355 if (d->orientation == Qt::Horizontal) {
evaluated: d->orientation == Qt::Horizontal
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:16
6-16
356 QObject::disconnect(d->model, SIGNAL(columnsInserted(QModelIndex,int,int)),
executed (the execution status of this line is deduced): QObject::disconnect(d->model, "2""columnsInserted(QModelIndex,int,int)",
-
357 this, SLOT(sectionsInserted(QModelIndex,int,int)));
executed (the execution status of this line is deduced): this, "1""sectionsInserted(QModelIndex,int,int)");
-
358 QObject::disconnect(d->model, SIGNAL(columnsAboutToBeRemoved(QModelIndex,int,int)),
executed (the execution status of this line is deduced): QObject::disconnect(d->model, "2""columnsAboutToBeRemoved(QModelIndex,int,int)",
-
359 this, SLOT(sectionsAboutToBeRemoved(QModelIndex,int,int)));
executed (the execution status of this line is deduced): this, "1""sectionsAboutToBeRemoved(QModelIndex,int,int)");
-
360 QObject::disconnect(d->model, SIGNAL(columnsRemoved(QModelIndex,int,int)),
executed (the execution status of this line is deduced): QObject::disconnect(d->model, "2""columnsRemoved(QModelIndex,int,int)",
-
361 this, SLOT(_q_sectionsRemoved(QModelIndex,int,int)));
executed (the execution status of this line is deduced): this, "1""_q_sectionsRemoved(QModelIndex,int,int)");
-
362 QObject::disconnect(d->model, SIGNAL(columnsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)),
executed (the execution status of this line is deduced): QObject::disconnect(d->model, "2""columnsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)",
-
363 this, SLOT(_q_layoutAboutToBeChanged()));
executed (the execution status of this line is deduced): this, "1""_q_layoutAboutToBeChanged()");
-
364 } else {
executed: }
Execution Count:6
6
365 QObject::disconnect(d->model, SIGNAL(rowsInserted(QModelIndex,int,int)),
executed (the execution status of this line is deduced): QObject::disconnect(d->model, "2""rowsInserted(QModelIndex,int,int)",
-
366 this, SLOT(sectionsInserted(QModelIndex,int,int)));
executed (the execution status of this line is deduced): this, "1""sectionsInserted(QModelIndex,int,int)");
-
367 QObject::disconnect(d->model, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)),
executed (the execution status of this line is deduced): QObject::disconnect(d->model, "2""rowsAboutToBeRemoved(QModelIndex,int,int)",
-
368 this, SLOT(sectionsAboutToBeRemoved(QModelIndex,int,int)));
executed (the execution status of this line is deduced): this, "1""sectionsAboutToBeRemoved(QModelIndex,int,int)");
-
369 QObject::disconnect(d->model, SIGNAL(rowsRemoved(QModelIndex,int,int)),
executed (the execution status of this line is deduced): QObject::disconnect(d->model, "2""rowsRemoved(QModelIndex,int,int)",
-
370 this, SLOT(_q_sectionsRemoved(QModelIndex,int,int)));
executed (the execution status of this line is deduced): this, "1""_q_sectionsRemoved(QModelIndex,int,int)");
-
371 QObject::disconnect(d->model, SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)),
executed (the execution status of this line is deduced): QObject::disconnect(d->model, "2""rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)",
-
372 this, SLOT(_q_layoutAboutToBeChanged()));
executed (the execution status of this line is deduced): this, "1""_q_layoutAboutToBeChanged()");
-
373 }
executed: }
Execution Count:16
16
374 QObject::disconnect(d->model, SIGNAL(headerDataChanged(Qt::Orientation,int,int)),
executed (the execution status of this line is deduced): QObject::disconnect(d->model, "2""headerDataChanged(Qt::Orientation,int,int)",
-
375 this, SLOT(headerDataChanged(Qt::Orientation,int,int)));
executed (the execution status of this line is deduced): this, "1""headerDataChanged(Qt::Orientation,int,int)");
-
376 QObject::disconnect(d->model, SIGNAL(layoutAboutToBeChanged()),
executed (the execution status of this line is deduced): QObject::disconnect(d->model, "2""layoutAboutToBeChanged()",
-
377 this, SLOT(_q_layoutAboutToBeChanged()));
executed (the execution status of this line is deduced): this, "1""_q_layoutAboutToBeChanged()");
-
378 }
executed: }
Execution Count:22
22
379 -
380 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
381 if (d->orientation == Qt::Horizontal) {
evaluated: d->orientation == Qt::Horizontal
TRUEFALSE
yes
Evaluation Count:1179
yes
Evaluation Count:651
651-1179
382 QObject::connect(model, SIGNAL(columnsInserted(QModelIndex,int,int)),
executed (the execution status of this line is deduced): QObject::connect(model, "2""columnsInserted(QModelIndex,int,int)",
-
383 this, SLOT(sectionsInserted(QModelIndex,int,int)));
executed (the execution status of this line is deduced): this, "1""sectionsInserted(QModelIndex,int,int)");
-
384 QObject::connect(model, SIGNAL(columnsAboutToBeRemoved(QModelIndex,int,int)),
executed (the execution status of this line is deduced): QObject::connect(model, "2""columnsAboutToBeRemoved(QModelIndex,int,int)",
-
385 this, SLOT(sectionsAboutToBeRemoved(QModelIndex,int,int)));
executed (the execution status of this line is deduced): this, "1""sectionsAboutToBeRemoved(QModelIndex,int,int)");
-
386 QObject::connect(model, SIGNAL(columnsRemoved(QModelIndex,int,int)),
executed (the execution status of this line is deduced): QObject::connect(model, "2""columnsRemoved(QModelIndex,int,int)",
-
387 this, SLOT(_q_sectionsRemoved(QModelIndex,int,int)));
executed (the execution status of this line is deduced): this, "1""_q_sectionsRemoved(QModelIndex,int,int)");
-
388 QObject::connect(model, SIGNAL(columnsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)),
executed (the execution status of this line is deduced): QObject::connect(model, "2""columnsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)",
-
389 this, SLOT(_q_layoutAboutToBeChanged()));
executed (the execution status of this line is deduced): this, "1""_q_layoutAboutToBeChanged()");
-
390 } else {
executed: }
Execution Count:1179
1179
391 QObject::connect(model, SIGNAL(rowsInserted(QModelIndex,int,int)),
executed (the execution status of this line is deduced): QObject::connect(model, "2""rowsInserted(QModelIndex,int,int)",
-
392 this, SLOT(sectionsInserted(QModelIndex,int,int)));
executed (the execution status of this line is deduced): this, "1""sectionsInserted(QModelIndex,int,int)");
-
393 QObject::connect(model, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)),
executed (the execution status of this line is deduced): QObject::connect(model, "2""rowsAboutToBeRemoved(QModelIndex,int,int)",
-
394 this, SLOT(sectionsAboutToBeRemoved(QModelIndex,int,int)));
executed (the execution status of this line is deduced): this, "1""sectionsAboutToBeRemoved(QModelIndex,int,int)");
-
395 QObject::connect(model, SIGNAL(rowsRemoved(QModelIndex,int,int)),
executed (the execution status of this line is deduced): QObject::connect(model, "2""rowsRemoved(QModelIndex,int,int)",
-
396 this, SLOT(_q_sectionsRemoved(QModelIndex,int,int)));
executed (the execution status of this line is deduced): this, "1""_q_sectionsRemoved(QModelIndex,int,int)");
-
397 QObject::connect(model, SIGNAL(rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)),
executed (the execution status of this line is deduced): QObject::connect(model, "2""rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)",
-
398 this, SLOT(_q_layoutAboutToBeChanged()));
executed (the execution status of this line is deduced): this, "1""_q_layoutAboutToBeChanged()");
-
399 }
executed: }
Execution Count:651
651
400 QObject::connect(model, SIGNAL(headerDataChanged(Qt::Orientation,int,int)),
executed (the execution status of this line is deduced): QObject::connect(model, "2""headerDataChanged(Qt::Orientation,int,int)",
-
401 this, SLOT(headerDataChanged(Qt::Orientation,int,int)));
executed (the execution status of this line is deduced): this, "1""headerDataChanged(Qt::Orientation,int,int)");
-
402 QObject::connect(model, SIGNAL(layoutAboutToBeChanged()),
executed (the execution status of this line is deduced): QObject::connect(model, "2""layoutAboutToBeChanged()",
-
403 this, SLOT(_q_layoutAboutToBeChanged()));
executed (the execution status of this line is deduced): this, "1""_q_layoutAboutToBeChanged()");
-
404 }
executed: }
Execution Count:1830
1830
405 -
406 d->state = QHeaderViewPrivate::NoClear;
executed (the execution status of this line is deduced): d->state = QHeaderViewPrivate::NoClear;
-
407 QAbstractItemView::setModel(model);
executed (the execution status of this line is deduced): QAbstractItemView::setModel(model);
-
408 d->state = QHeaderViewPrivate::NoState;
executed (the execution status of this line is deduced): d->state = QHeaderViewPrivate::NoState;
-
409 -
410 // Users want to set sizes and modes before the widget is shown. -
411 // Thus, we have to initialize when the model is set, -
412 // and not lazily like we do in the other views. -
413 initializeSections();
executed (the execution status of this line is deduced): initializeSections();
-
414}
executed: }
Execution Count:3473
3473
415 -
416/*! -
417 Returns the orientation of the header. -
418 -
419 \sa Qt::Orientation -
420*/ -
421 -
422Qt::Orientation QHeaderView::orientation() const -
423{ -
424 Q_D(const QHeaderView);
executed (the execution status of this line is deduced): const QHeaderViewPrivate * const d = d_func();
-
425 return d->orientation;
executed: return d->orientation;
Execution Count:15444
15444
426} -
427 -
428/*! -
429 Returns the offset of the header: this is the header's left-most (or -
430 top-most for vertical headers) visible pixel. -
431 -
432 \sa setOffset() -
433*/ -
434 -
435int QHeaderView::offset() const -
436{ -
437 Q_D(const QHeaderView);
executed (the execution status of this line is deduced): const QHeaderViewPrivate * const d = d_func();
-
438 return d->offset;
executed: return d->offset;
Execution Count:32578
32578
439} -
440 -
441/*! -
442 \fn void QHeaderView::setOffset(int offset) -
443 -
444 Sets the header's offset to \a offset. -
445 -
446 \sa offset(), length() -
447*/ -
448 -
449void QHeaderView::setOffset(int newOffset) -
450{ -
451 Q_D(QHeaderView);
executed (the execution status of this line is deduced): QHeaderViewPrivate * const d = d_func();
-
452 if (d->offset == (int)newOffset)
evaluated: d->offset == (int)newOffset
TRUEFALSE
yes
Evaluation Count:4994
yes
Evaluation Count:5896
4994-5896
453 return;
executed: return;
Execution Count:4994
4994
454 int ndelta = d->offset - newOffset;
executed (the execution status of this line is deduced): int ndelta = d->offset - newOffset;
-
455 d->offset = newOffset;
executed (the execution status of this line is deduced): d->offset = newOffset;
-
456 if (d->orientation == Qt::Horizontal)
evaluated: d->orientation == Qt::Horizontal
TRUEFALSE
yes
Evaluation Count:5582
yes
Evaluation Count:314
314-5582
457 d->viewport->scroll(isRightToLeft() ? -ndelta : ndelta, 0);
executed: d->viewport->scroll(isRightToLeft() ? -ndelta : ndelta, 0);
Execution Count:5582
5582
458 else -
459 d->viewport->scroll(0, ndelta);
executed: d->viewport->scroll(0, ndelta);
Execution Count:314
314
460 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
461 QPoint cursorPos = QCursor::pos();
never executed (the execution status of this line is deduced): QPoint cursorPos = QCursor::pos();
-
462 if (d->orientation == Qt::Horizontal)
never evaluated: d->orientation == Qt::Horizontal
0
463 QCursor::setPos(cursorPos.x() + ndelta, cursorPos.y());
never executed: QCursor::setPos(cursorPos.x() + ndelta, cursorPos.y());
0
464 else -
465 QCursor::setPos(cursorPos.x(), cursorPos.y() + ndelta);
never executed: QCursor::setPos(cursorPos.x(), cursorPos.y() + ndelta);
0
466 d->firstPos += ndelta;
never executed (the execution status of this line is deduced): d->firstPos += ndelta;
-
467 d->lastPos += ndelta;
never executed (the execution status of this line is deduced): d->lastPos += ndelta;
-
468 }
never executed: }
0
469}
executed: }
Execution Count:5896
5896
470 -
471/*! -
472 \since 4.2 -
473 Sets the offset to the start of the section at the given \a visualSectionNumber. -
474 \a visualSectionNumber is the actual visible section when hiddenSections are -
475 not considered. That is not always the same as visualIndex(). -
476 -
477 \sa setOffset(), sectionPosition() -
478*/ -
479void QHeaderView::setOffsetToSectionPosition(int visualSectionNumber) -
480{ -
481 Q_D(QHeaderView);
executed (the execution status of this line is deduced): QHeaderViewPrivate * const d = d_func();
-
482 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
483 int position = d->headerSectionPosition(d->adjustedVisualIndex(visualSectionNumber));
executed (the execution status of this line is deduced): int position = d->headerSectionPosition(d->adjustedVisualIndex(visualSectionNumber));
-
484 setOffset(position);
executed (the execution status of this line is deduced): setOffset(position);
-
485 }
executed: }
Execution Count:3309
3309
486}
executed: }
Execution Count:4002
4002
487 -
488/*! -
489 \since 4.2 -
490 Sets the offset to make the last section visible. -
491 -
492 \sa setOffset(), sectionPosition(), setOffsetToSectionPosition() -
493*/ -
494void QHeaderView::setOffsetToLastSection() -
495{ -
496 Q_D(const QHeaderView);
executed (the execution status of this line is deduced): const QHeaderViewPrivate * const d = d_func();
-
497 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
498 int position = length() - size;
executed (the execution status of this line is deduced): int position = length() - size;
-
499 setOffset(position);
executed (the execution status of this line is deduced): setOffset(position);
-
500}
executed: }
Execution Count:167
167
501 -
502/*! -
503 Returns the length along the orientation of the header. -
504 -
505 \sa sizeHint(), setSectionResizeMode(), offset() -
506*/ -
507 -
508int QHeaderView::length() const -
509{ -
510 Q_D(const QHeaderView);
executed (the execution status of this line is deduced): const QHeaderViewPrivate * const d = d_func();
-
511 d->executePostedLayout();
executed (the execution status of this line is deduced): d->executePostedLayout();
-
512 d->executePostedResize();
executed (the execution status of this line is deduced): d->executePostedResize();
-
513 //Q_ASSERT(d->headerLength() == d->length); -
514 return d->length;
executed: return d->length;
Execution Count:11163
11163
515} -
516 -
517/*! -
518 Returns a suitable size hint for this header. -
519 -
520 \sa sectionSizeHint() -
521*/ -
522 -
523QSize QHeaderView::sizeHint() const -
524{ -
525 Q_D(const QHeaderView);
executed (the execution status of this line is deduced): const QHeaderViewPrivate * const d = d_func();
-
526 if (d->cachedSizeHint.isValid())
evaluated: d->cachedSizeHint.isValid()
TRUEFALSE
yes
Evaluation Count:2254
yes
Evaluation Count:3769
2254-3769
527 return d->cachedSizeHint;
executed: return d->cachedSizeHint;
Execution Count:2254
2254
528 d->cachedSizeHint = QSize(0, 0); //reinitialize the cached size hint
executed (the execution status of this line is deduced): d->cachedSizeHint = QSize(0, 0);
-
529 const int sectionCount = count();
executed (the execution status of this line is deduced): const int sectionCount = count();
-
530 -
531 // get size hint for the first n sections -
532 int i = 0;
executed (the execution status of this line is deduced): int i = 0;
-
533 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
534 if (isSectionHidden(i))
evaluated: isSectionHidden(i)
TRUEFALSE
yes
Evaluation Count:143
yes
Evaluation Count:19300
143-19300
535 continue;
executed: continue;
Execution Count:143
143
536 checked++;
executed (the execution status of this line is deduced): checked++;
-
537 QSize hint = sectionSizeFromContents(i);
executed (the execution status of this line is deduced): QSize hint = sectionSizeFromContents(i);
-
538 d->cachedSizeHint = d->cachedSizeHint.expandedTo(hint);
executed (the execution status of this line is deduced): d->cachedSizeHint = d->cachedSizeHint.expandedTo(hint);
-
539 }
executed: }
Execution Count:19300
19300
540 // get size hint for the last n sections -
541 i = qMax(i, sectionCount - 100 );
executed (the execution status of this line is deduced): i = qMax(i, sectionCount - 100 );
-
542 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
543 if (isSectionHidden(j))
partially evaluated: isSectionHidden(j)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3400
0-3400
544 continue;
never executed: continue;
0
545 checked++;
executed (the execution status of this line is deduced): checked++;
-
546 QSize hint = sectionSizeFromContents(j);
executed (the execution status of this line is deduced): QSize hint = sectionSizeFromContents(j);
-
547 d->cachedSizeHint = d->cachedSizeHint.expandedTo(hint);
executed (the execution status of this line is deduced): d->cachedSizeHint = d->cachedSizeHint.expandedTo(hint);
-
548 }
executed: }
Execution Count:3400
3400
549 return d->cachedSizeHint;
executed: return d->cachedSizeHint;
Execution Count:3769
3769
550} -
551 -
552/*! -
553 Returns a suitable size hint for the section specified by \a logicalIndex. -
554 -
555 \sa sizeHint(), defaultSectionSize(), minimumSectionSize(), -
556 Qt::SizeHintRole -
557*/ -
558 -
559int QHeaderView::sectionSizeHint(int logicalIndex) const -
560{ -
561 Q_D(const QHeaderView);
executed (the execution status of this line is deduced): const QHeaderViewPrivate * const d = d_func();
-
562 if (isSectionHidden(logicalIndex))
partially evaluated: isSectionHidden(logicalIndex)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2290
0-2290
563 return 0;
never executed: return 0;
0
564 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
565 return -1;
executed: return -1;
Execution Count:142
142
566 QSize size;
executed (the execution status of this line is deduced): QSize size;
-
567 QVariant value = d->model->headerData(logicalIndex, d->orientation, Qt::SizeHintRole);
executed (the execution status of this line is deduced): QVariant value = d->model->headerData(logicalIndex, d->orientation, Qt::SizeHintRole);
-
568 if (value.isValid())
partially evaluated: value.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2148
0-2148
569 size = qvariant_cast<QSize>(value);
never executed: size = qvariant_cast<QSize>(value);
0
570 else -
571 size = sectionSizeFromContents(logicalIndex);
executed: size = sectionSizeFromContents(logicalIndex);
Execution Count:2148
2148
572 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
573 return qMax(minimumSectionSize(), hint);
executed: return qMax(minimumSectionSize(), hint);
Execution Count:2148
2148
574} -
575 -
576/*! -
577 Returns the visual index of the section that covers the given \a position -
578 in the viewport. -
579 -
580 \sa logicalIndexAt() -
581*/ -
582 -
583int QHeaderView::visualIndexAt(int position) const -
584{ -
585 Q_D(const QHeaderView);
executed (the execution status of this line is deduced): const QHeaderViewPrivate * const d = d_func();
-
586 int vposition = position;
executed (the execution status of this line is deduced): int vposition = position;
-
587 d->executePostedLayout();
executed (the execution status of this line is deduced): d->executePostedLayout();
-
588 d->executePostedResize();
executed (the execution status of this line is deduced): d->executePostedResize();
-
589 const int count = d->sectionCount();
executed (the execution status of this line is deduced): const int count = d->sectionCount();
-
590 if (count < 1)
evaluated: count < 1
TRUEFALSE
yes
Evaluation Count:108
yes
Evaluation Count:98118
108-98118
591 return -1;
executed: return -1;
Execution Count:108
108
592 -
593 if (d->reverse())
evaluated: d->reverse()
TRUEFALSE
yes
Evaluation Count:47
yes
Evaluation Count:98071
47-98071
594 vposition = d->viewport->width() - vposition;
executed: vposition = d->viewport->width() - vposition;
Execution Count:47
47
595 vposition += d->offset;
executed (the execution status of this line is deduced): vposition += d->offset;
-
596 -
597 if (vposition > d->length)
evaluated: vposition > d->length
TRUEFALSE
yes
Evaluation Count:4545
yes
Evaluation Count:93573
4545-93573
598 return -1;
executed: return -1;
Execution Count:4545
4545
599 int visual = d->headerVisualIndexAt(vposition);
executed (the execution status of this line is deduced): int visual = d->headerVisualIndexAt(vposition);
-
600 if (visual < 0)
evaluated: visual < 0
TRUEFALSE
yes
Evaluation Count:377
yes
Evaluation Count:93196
377-93196
601 return -1;
executed: return -1;
Execution Count:377
377
602 -
603 while (d->isVisualIndexHidden(visual)){
partially evaluated: d->isVisualIndexHidden(visual)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:93196
0-93196
604 ++visual;
never executed (the execution status of this line is deduced): ++visual;
-
605 if (visual >= count)
never evaluated: visual >= count
0
606 return -1;
never executed: return -1;
0
607 }
never executed: }
0
608 return visual;
executed: return visual;
Execution Count:93196
93196
609} -
610 -
611/*! -
612 Returns the section that covers the given \a position in the viewport. -
613 -
614 \sa visualIndexAt(), isSectionHidden() -
615*/ -
616 -
617int QHeaderView::logicalIndexAt(int position) const -
618{ -
619 const int visual = visualIndexAt(position);
executed (the execution status of this line is deduced): const int visual = visualIndexAt(position);
-
620 if (visual > -1)
evaluated: visual > -1
TRUEFALSE
yes
Evaluation Count:51446
yes
Evaluation Count:677
677-51446
621 return logicalIndex(visual);
executed: return logicalIndex(visual);
Execution Count:51446
51446
622 return -1;
executed: return -1;
Execution Count:677
677
623} -
624 -
625/*! -
626 Returns the width (or height for vertical headers) of the given -
627 \a logicalIndex. -
628 -
629 \sa length(), setSectionResizeMode(), defaultSectionSize() -
630*/ -
631 -
632int QHeaderView::sectionSize(int logicalIndex) const -
633{ -
634 Q_D(const QHeaderView);
executed (the execution status of this line is deduced): const QHeaderViewPrivate * const d = d_func();
-
635 if (isSectionHidden(logicalIndex))
evaluated: isSectionHidden(logicalIndex)
TRUEFALSE
yes
Evaluation Count:1793
yes
Evaluation Count:245808
1793-245808
636 return 0;
executed: return 0;
Execution Count:1793
1793
637 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
638 return 0;
executed: return 0;
Execution Count:15
15
639 int visual = visualIndex(logicalIndex);
executed (the execution status of this line is deduced): int visual = visualIndex(logicalIndex);
-
640 if (visual == -1)
partially evaluated: visual == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:245793
0-245793
641 return 0;
never executed: return 0;
0
642 d->executePostedResize();
executed (the execution status of this line is deduced): d->executePostedResize();
-
643 return d->headerSectionSize(visual);
executed: return d->headerSectionSize(visual);
Execution Count:245793
245793
644} -
645 -
646/*! -
647 -
648 Returns the section position of the given \a logicalIndex, or -1 -
649 if the section is hidden. The position is measured in pixels from -
650 the first visible item's top-left corner to the top-left corner of -
651 the item with \a logicalIndex. The measurement is along the x-axis -
652 for horizontal headers and along the y-axis for vertical headers. -
653 -
654 \sa sectionViewportPosition() -
655*/ -
656 -
657int QHeaderView::sectionPosition(int logicalIndex) const -
658{ -
659 Q_D(const QHeaderView);
executed (the execution status of this line is deduced): const QHeaderViewPrivate * const d = d_func();
-
660 int visual = visualIndex(logicalIndex);
executed (the execution status of this line is deduced): int visual = visualIndex(logicalIndex);
-
661 // in some cases users may change the selections -
662 // before we have a chance to do the layout -
663 if (visual == -1)
evaluated: visual == -1
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:181151
5-181151
664 return -1;
executed: return -1;
Execution Count:5
5
665 d->executePostedResize();
executed (the execution status of this line is deduced): d->executePostedResize();
-
666 return d->headerSectionPosition(visual);
executed: return d->headerSectionPosition(visual);
Execution Count:181151
181151
667} -
668 -
669/*! -
670 Returns the section viewport position of the given \a logicalIndex. -
671 -
672 If the section is hidden, the return value is undefined. -
673 -
674 \sa sectionPosition(), isSectionHidden() -
675*/ -
676 -
677int QHeaderView::sectionViewportPosition(int logicalIndex) const -
678{ -
679 Q_D(const QHeaderView);
executed (the execution status of this line is deduced): const QHeaderViewPrivate * const d = d_func();
-
680 if (logicalIndex >= count())
evaluated: logicalIndex >= count()
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:156223
11-156223
681 return -1;
executed: return -1;
Execution Count:11
11
682 int position = sectionPosition(logicalIndex);
executed (the execution status of this line is deduced): int position = sectionPosition(logicalIndex);
-
683 if (position < 0)
evaluated: position < 0
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:156218
5-156218
684 return position; // the section was hidden
executed: return position;
Execution Count:5
5
685 int offsetPosition = position - d->offset;
executed (the execution status of this line is deduced): int offsetPosition = position - d->offset;
-
686 if (d->reverse())
evaluated: d->reverse()
TRUEFALSE
yes
Evaluation Count:76
yes
Evaluation Count:156142
76-156142
687 return d->viewport->width() - (offsetPosition + sectionSize(logicalIndex));
executed: return d->viewport->width() - (offsetPosition + sectionSize(logicalIndex));
Execution Count:76
76
688 return offsetPosition;
executed: return offsetPosition;
Execution Count:156142
156142
689} -
690 -
691/*! -
692 \fn int QHeaderView::logicalIndexAt(int x, int y) const -
693 -
694 Returns the logical index of the section at the given coordinate. If the -
695 header is horizontal \a x will be used, otherwise \a y will be used to -
696 find the logical index. -
697*/ -
698 -
699/*! -
700 \fn int QHeaderView::logicalIndexAt(const QPoint &pos) const -
701 -
702 Returns the logical index of the section at the position given in \a pos. -
703 If the header is horizontal the x-coordinate will be used, otherwise the -
704 y-coordinate will be used to find the logical index. -
705 -
706 \sa sectionPosition() -
707*/ -
708 -
709/*! -
710 Moves the section at visual index \a from to occupy visual index \a to. -
711 -
712 \sa sectionsMoved() -
713*/ -
714 -
715void QHeaderView::moveSection(int from, int to) -
716{ -
717 Q_D(QHeaderView);
executed (the execution status of this line is deduced): QHeaderViewPrivate * const d = d_func();
-
718 -
719 d->executePostedLayout();
executed (the execution status of this line is deduced): d->executePostedLayout();
-
720 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
721 return;
executed: return;
Execution Count:22
22
722 -
723 if (from == to) {
evaluated: from == to
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:67
2-67
724 int logical = logicalIndex(from);
executed (the execution status of this line is deduced): int logical = logicalIndex(from);
-
725 Q_ASSERT(logical != -1);
executed (the execution status of this line is deduced): qt_noop();
-
726 updateSection(logical);
executed (the execution status of this line is deduced): updateSection(logical);
-
727 return;
executed: return;
Execution Count:2
2
728 } -
729 -
730 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
731 d->lastSectionSize = sectionSize(from);
never executed: d->lastSectionSize = sectionSize(from);
0
732 -
733 //int oldHeaderLength = length(); // ### for debugging; remove later -
734 d->initializeIndexMapping();
executed (the execution status of this line is deduced): d->initializeIndexMapping();
-
735 -
736 QBitArray sectionHidden = d->sectionHidden;
executed (the execution status of this line is deduced): QBitArray sectionHidden = d->sectionHidden;
-
737 int *visualIndices = d->visualIndices.data();
executed (the execution status of this line is deduced): int *visualIndices = d->visualIndices.data();
-
738 int *logicalIndices = d->logicalIndices.data();
executed (the execution status of this line is deduced): int *logicalIndices = d->logicalIndices.data();
-
739 int logical = logicalIndices[from];
executed (the execution status of this line is deduced): int logical = logicalIndices[from];
-
740 int visual = from;
executed (the execution status of this line is deduced): int visual = from;
-
741 -
742 int affected_count = qAbs(to - from) + 1;
executed (the execution status of this line is deduced): int affected_count = qAbs(to - from) + 1;
-
743 QVarLengthArray<int> sizes(affected_count);
executed (the execution status of this line is deduced): QVarLengthArray<int> sizes(affected_count);
-
744 QVarLengthArray<ResizeMode> modes(affected_count);
executed (the execution status of this line is deduced): QVarLengthArray<ResizeMode> modes(affected_count);
-
745 -
746 // move sections and indices -
747 if (to > from) {
evaluated: to > from
TRUEFALSE
yes
Evaluation Count:54
yes
Evaluation Count:13
13-54
748 sizes[to - from] = d->headerSectionSize(from);
executed (the execution status of this line is deduced): sizes[to - from] = d->headerSectionSize(from);
-
749 modes[to - from] = d->headerSectionResizeMode(from);
executed (the execution status of this line is deduced): modes[to - from] = d->headerSectionResizeMode(from);
-
750 while (visual < to) {
evaluated: visual < to
TRUEFALSE
yes
Evaluation Count:10979
yes
Evaluation Count:54
54-10979
751 sizes[visual - from] = d->headerSectionSize(visual + 1);
executed (the execution status of this line is deduced): sizes[visual - from] = d->headerSectionSize(visual + 1);
-
752 modes[visual - from] = d->headerSectionResizeMode(visual + 1);
executed (the execution status of this line is deduced): modes[visual - from] = d->headerSectionResizeMode(visual + 1);
-
753 if (!sectionHidden.isEmpty())
evaluated: !sectionHidden.isEmpty()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:10974
5-10974
754 sectionHidden.setBit(visual, sectionHidden.testBit(visual + 1));
executed: sectionHidden.setBit(visual, sectionHidden.testBit(visual + 1));
Execution Count:5
5
755 visualIndices[logicalIndices[visual + 1]] = visual;
executed (the execution status of this line is deduced): visualIndices[logicalIndices[visual + 1]] = visual;
-
756 logicalIndices[visual] = logicalIndices[visual + 1];
executed (the execution status of this line is deduced): logicalIndices[visual] = logicalIndices[visual + 1];
-
757 ++visual;
executed (the execution status of this line is deduced): ++visual;
-
758 }
executed: }
Execution Count:10979
10979
759 } else {
executed: }
Execution Count:54
54
760 sizes[0] = d->headerSectionSize(from);
executed (the execution status of this line is deduced): sizes[0] = d->headerSectionSize(from);
-
761 modes[0] = d->headerSectionResizeMode(from);
executed (the execution status of this line is deduced): modes[0] = d->headerSectionResizeMode(from);
-
762 while (visual > to) {
evaluated: visual > to
TRUEFALSE
yes
Evaluation Count:20
yes
Evaluation Count:13
13-20
763 sizes[visual - to] = d->headerSectionSize(visual - 1);
executed (the execution status of this line is deduced): sizes[visual - to] = d->headerSectionSize(visual - 1);
-
764 modes[visual - to] = d->headerSectionResizeMode(visual - 1);
executed (the execution status of this line is deduced): modes[visual - to] = d->headerSectionResizeMode(visual - 1);
-
765 if (!sectionHidden.isEmpty())
evaluated: !sectionHidden.isEmpty()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:16
4-16
766 sectionHidden.setBit(visual, sectionHidden.testBit(visual - 1));
executed: sectionHidden.setBit(visual, sectionHidden.testBit(visual - 1));
Execution Count:4
4
767 visualIndices[logicalIndices[visual - 1]] = visual;
executed (the execution status of this line is deduced): visualIndices[logicalIndices[visual - 1]] = visual;
-
768 logicalIndices[visual] = logicalIndices[visual - 1];
executed (the execution status of this line is deduced): logicalIndices[visual] = logicalIndices[visual - 1];
-
769 --visual;
executed (the execution status of this line is deduced): --visual;
-
770 }
executed: }
Execution Count:20
20
771 }
executed: }
Execution Count:13
13
772 if (!sectionHidden.isEmpty()) {
evaluated: !sectionHidden.isEmpty()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:62
5-62
773 sectionHidden.setBit(to, d->sectionHidden.testBit(from));
executed (the execution status of this line is deduced): sectionHidden.setBit(to, d->sectionHidden.testBit(from));
-
774 d->sectionHidden = sectionHidden;
executed (the execution status of this line is deduced): d->sectionHidden = sectionHidden;
-
775 }
executed: }
Execution Count:5
5
776 visualIndices[logical] = to;
executed (the execution status of this line is deduced): visualIndices[logical] = to;
-
777 logicalIndices[to] = logical;
executed (the execution status of this line is deduced): logicalIndices[to] = logical;
-
778 -
779 //Q_ASSERT(oldHeaderLength == length()); -
780 // move sizes -
781 // ### check for items of section sizes here -
782 if (to > from) {
evaluated: to > from
TRUEFALSE
yes
Evaluation Count:54
yes
Evaluation Count:13
13-54
783 for (visual = from; visual <= to; ++visual) {
evaluated: visual <= to
TRUEFALSE
yes
Evaluation Count:11033
yes
Evaluation Count:54
54-11033
784 int size = sizes[visual - from];
executed (the execution status of this line is deduced): int size = sizes[visual - from];
-
785 ResizeMode mode = modes[visual - from];
executed (the execution status of this line is deduced): ResizeMode mode = modes[visual - from];
-
786 d->createSectionItems(visual, visual, size, mode);
executed (the execution status of this line is deduced): d->createSectionItems(visual, visual, size, mode);
-
787 }
executed: }
Execution Count:11033
11033
788 } else {
executed: }
Execution Count:54
54
789 for (visual = to; visual <= from; ++visual) {
evaluated: visual <= from
TRUEFALSE
yes
Evaluation Count:33
yes
Evaluation Count:13
13-33
790 int size = sizes[visual - to];
executed (the execution status of this line is deduced): int size = sizes[visual - to];
-
791 ResizeMode mode = modes[visual - to];
executed (the execution status of this line is deduced): ResizeMode mode = modes[visual - to];
-
792 d->createSectionItems(visual, visual, size, mode);
executed (the execution status of this line is deduced): d->createSectionItems(visual, visual, size, mode);
-
793 }
executed: }
Execution Count:33
33
794 }
executed: }
Execution Count:13
13
795 //Q_ASSERT(d->headerLength() == length()); -
796 //Q_ASSERT(oldHeaderLength == length()); -
797 //Q_ASSERT(d->logicalIndices.count() == d->sectionCount); -
798 -
799 if (d->hasAutoResizeSections())
evaluated: d->hasAutoResizeSections()
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:62
5-62
800 d->doDelayedResizeSections();
executed: d->doDelayedResizeSections();
Execution Count:5
5
801 d->viewport->update();
executed (the execution status of this line is deduced): d->viewport->update();
-
802 -
803 emit sectionMoved(logical, from, to);
executed (the execution status of this line is deduced): sectionMoved(logical, from, to);
-
804}
executed: }
Execution Count:67
67
805 -
806/*! -
807 \since 4.2 -
808 Swaps the section at visual index \a first with the section at visual -
809 index \a second. -
810 -
811 \sa moveSection() -
812*/ -
813void QHeaderView::swapSections(int first, int second) -
814{ -
815 Q_D(QHeaderView);
executed (the execution status of this line is deduced): QHeaderViewPrivate * const d = d_func();
-
816 -
817 if (first == second)
evaluated: first == second
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:4135
1-4135
818 return;
executed: return;
Execution Count:1
1
819 d->executePostedLayout();
executed (the execution status of this line is deduced): d->executePostedLayout();
-
820 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
821 return;
executed: return;
Execution Count:8
8
822 -
823 int firstSize = d->headerSectionSize(first);
executed (the execution status of this line is deduced): int firstSize = d->headerSectionSize(first);
-
824 ResizeMode firstMode = d->headerSectionResizeMode(first);
executed (the execution status of this line is deduced): ResizeMode firstMode = d->headerSectionResizeMode(first);
-
825 int firstLogical = d->logicalIndex(first);
executed (the execution status of this line is deduced): int firstLogical = d->logicalIndex(first);
-
826 -
827 int secondSize = d->headerSectionSize(second);
executed (the execution status of this line is deduced): int secondSize = d->headerSectionSize(second);
-
828 ResizeMode secondMode = d->headerSectionResizeMode(second);
executed (the execution status of this line is deduced): ResizeMode secondMode = d->headerSectionResizeMode(second);
-
829 int secondLogical = d->logicalIndex(second);
executed (the execution status of this line is deduced): int secondLogical = d->logicalIndex(second);
-
830 -
831 if (d->state == QHeaderViewPrivate::ResizeSection)
partially evaluated: d->state == QHeaderViewPrivate::ResizeSection
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4127
0-4127
832 d->preventCursorChangeInSetOffset = true;
never executed: d->preventCursorChangeInSetOffset = true;
0
833 -
834 d->createSectionItems(second, second, firstSize, firstMode);
executed (the execution status of this line is deduced): d->createSectionItems(second, second, firstSize, firstMode);
-
835 d->createSectionItems(first, first, secondSize, secondMode);
executed (the execution status of this line is deduced): d->createSectionItems(first, first, secondSize, secondMode);
-
836 -
837 d->initializeIndexMapping();
executed (the execution status of this line is deduced): d->initializeIndexMapping();
-
838 -
839 d->visualIndices[firstLogical] = second;
executed (the execution status of this line is deduced): d->visualIndices[firstLogical] = second;
-
840 d->logicalIndices[second] = firstLogical;
executed (the execution status of this line is deduced): d->logicalIndices[second] = firstLogical;
-
841 -
842 d->visualIndices[secondLogical] = first;
executed (the execution status of this line is deduced): d->visualIndices[secondLogical] = first;
-
843 d->logicalIndices[first] = secondLogical;
executed (the execution status of this line is deduced): d->logicalIndices[first] = secondLogical;
-
844 -
845 if (!d->sectionHidden.isEmpty()) {
evaluated: !d->sectionHidden.isEmpty()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:4123
4-4123
846 bool firstHidden = d->sectionHidden.testBit(first);
executed (the execution status of this line is deduced): bool firstHidden = d->sectionHidden.testBit(first);
-
847 bool secondHidden = d->sectionHidden.testBit(second);
executed (the execution status of this line is deduced): bool secondHidden = d->sectionHidden.testBit(second);
-
848 d->sectionHidden.setBit(first, secondHidden);
executed (the execution status of this line is deduced): d->sectionHidden.setBit(first, secondHidden);
-
849 d->sectionHidden.setBit(second, firstHidden);
executed (the execution status of this line is deduced): d->sectionHidden.setBit(second, firstHidden);
-
850 }
executed: }
Execution Count:4
4
851 -
852 d->viewport->update();
executed (the execution status of this line is deduced): d->viewport->update();
-
853 emit sectionMoved(firstLogical, first, second);
executed (the execution status of this line is deduced): sectionMoved(firstLogical, first, second);
-
854 emit sectionMoved(secondLogical, second, first);
executed (the execution status of this line is deduced): sectionMoved(secondLogical, second, first);
-
855}
executed: }
Execution Count:4127
4127
856 -
857/*! -
858 \fn void QHeaderView::resizeSection(int logicalIndex, int size) -
859 -
860 Resizes the section specified by \a logicalIndex to \a size measured in -
861 pixels. The size parameter must be a value larger or equal to zero. A -
862 size equal to zero is however not recommended. In that situation hideSection -
863 should be used instead. -
864 -
865 \sa sectionResized(), resizeMode(), sectionSize(), hideSection() -
866*/ -
867 -
868void QHeaderView::resizeSection(int logical, int size) -
869{ -
870 Q_D(QHeaderView);
executed (the execution status of this line is deduced): QHeaderViewPrivate * const d = d_func();
-
871 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
872 return;
executed: return;
Execution Count:611
611
873 -
874 if (isSectionHidden(logical)) {
evaluated: isSectionHidden(logical)
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:17331
13-17331
875 d->hiddenSectionSize.insert(logical, size);
executed (the execution status of this line is deduced): d->hiddenSectionSize.insert(logical, size);
-
876 return;
executed: return;
Execution Count:13
13
877 } -
878 -
879 int visual = visualIndex(logical);
executed (the execution status of this line is deduced): int visual = visualIndex(logical);
-
880 if (visual == -1)
partially evaluated: visual == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:17331
0-17331
881 return;
never executed: return;
0
882 -
883 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
884 d->preventCursorChangeInSetOffset = true;
never executed: d->preventCursorChangeInSetOffset = true;
0
885 -
886 int oldSize = d->headerSectionSize(visual);
executed (the execution status of this line is deduced): int oldSize = d->headerSectionSize(visual);
-
887 if (oldSize == size)
evaluated: oldSize == size
TRUEFALSE
yes
Evaluation Count:89
yes
Evaluation Count:17242
89-17242
888 return;
executed: return;
Execution Count:89
89
889 -
890 d->executePostedLayout();
executed (the execution status of this line is deduced): d->executePostedLayout();
-
891 d->invalidateCachedSizeHint();
executed (the execution status of this line is deduced): d->invalidateCachedSizeHint();
-
892 -
893 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
894 d->lastSectionSize = size;
executed: d->lastSectionSize = size;
Execution Count:2
2
895 -
896 d->createSectionItems(visual, visual, size, d->headerSectionResizeMode(visual));
executed (the execution status of this line is deduced): d->createSectionItems(visual, visual, size, d->headerSectionResizeMode(visual));
-
897 -
898 if (!updatesEnabled()) {
evaluated: !updatesEnabled()
TRUEFALSE
yes
Evaluation Count:15242
yes
Evaluation Count:2000
2000-15242
899 if (d->hasAutoResizeSections())
partially evaluated: d->hasAutoResizeSections()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:15242
0-15242
900 d->doDelayedResizeSections();
never executed: d->doDelayedResizeSections();
0
901 emit sectionResized(logical, oldSize, size);
executed (the execution status of this line is deduced): sectionResized(logical, oldSize, size);
-
902 return;
executed: return;
Execution Count:15242
15242
903 } -
904 -
905 int w = d->viewport->width();
executed (the execution status of this line is deduced): int w = d->viewport->width();
-
906 int h = d->viewport->height();
executed (the execution status of this line is deduced): int h = d->viewport->height();
-
907 int pos = sectionViewportPosition(logical);
executed (the execution status of this line is deduced): int pos = sectionViewportPosition(logical);
-
908 QRect r;
executed (the execution status of this line is deduced): QRect r;
-
909 if (d->orientation == Qt::Horizontal)
evaluated: d->orientation == Qt::Horizontal
TRUEFALSE
yes
Evaluation Count:1294
yes
Evaluation Count:706
706-1294
910 if (isRightToLeft())
partially evaluated: isRightToLeft()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1294
0-1294
911 r.setRect(0, 0, pos + size, h);
never executed: r.setRect(0, 0, pos + size, h);
0
912 else -
913 r.setRect(pos, 0, w - pos, h);
executed: r.setRect(pos, 0, w - pos, h);
Execution Count:1294
1294
914 else -
915 r.setRect(0, pos, w, h - pos);
executed: r.setRect(0, pos, w, h - pos);
Execution Count:706
706
916 -
917 if (d->hasAutoResizeSections()) {
evaluated: d->hasAutoResizeSections()
TRUEFALSE
yes
Evaluation Count:18
yes
Evaluation Count:1982
18-1982
918 d->doDelayedResizeSections();
executed (the execution status of this line is deduced): d->doDelayedResizeSections();
-
919 r = d->viewport->rect();
executed (the execution status of this line is deduced): r = d->viewport->rect();
-
920 }
executed: }
Execution Count:18
18
921 d->viewport->update(r.normalized());
executed (the execution status of this line is deduced): d->viewport->update(r.normalized());
-
922 emit sectionResized(logical, oldSize, size);
executed (the execution status of this line is deduced): sectionResized(logical, oldSize, size);
-
923}
executed: }
Execution Count:2000
2000
924 -
925/*! -
926 Resizes the sections according to the given \a mode, ignoring the current -
927 resize mode. -
928 -
929 \sa resizeMode(), sectionResized() -
930*/ -
931 -
932void QHeaderView::resizeSections(QHeaderView::ResizeMode mode) -
933{ -
934 Q_D(QHeaderView);
executed (the execution status of this line is deduced): QHeaderViewPrivate * const d = d_func();
-
935 d->resizeSections(mode, true);
executed (the execution status of this line is deduced): d->resizeSections(mode, true);
-
936}
executed: }
Execution Count:16
16
937 -
938/*! -
939 \fn void QHeaderView::hideSection(int logicalIndex) -
940 Hides the section specified by \a logicalIndex. -
941 -
942 \sa showSection(), isSectionHidden(), hiddenSectionCount(), -
943 setSectionHidden() -
944*/ -
945 -
946/*! -
947 \fn void QHeaderView::showSection(int logicalIndex) -
948 Shows the section specified by \a logicalIndex. -
949 -
950 \sa hideSection(), isSectionHidden(), hiddenSectionCount(), -
951 setSectionHidden() -
952*/ -
953 -
954/*! -
955 Returns true if the section specified by \a logicalIndex is explicitly -
956 hidden from the user; otherwise returns false. -
957 -
958 \sa hideSection(), showSection(), setSectionHidden(), hiddenSectionCount() -
959*/ -
960 -
961bool QHeaderView::isSectionHidden(int logicalIndex) const -
962{ -
963 Q_D(const QHeaderView);
executed (the execution status of this line is deduced): const QHeaderViewPrivate * const d = d_func();
-
964 d->executePostedLayout();
executed (the execution status of this line is deduced): d->executePostedLayout();
-
965 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
966 return false;
executed: return false;
Execution Count:3738199
3738199
967 int visual = visualIndex(logicalIndex);
executed (the execution status of this line is deduced): int visual = visualIndex(logicalIndex);
-
968 Q_ASSERT(visual != -1);
executed (the execution status of this line is deduced): qt_noop();
-
969 return d->sectionHidden.testBit(visual);
executed: return d->sectionHidden.testBit(visual);
Execution Count:57555
57555
970} -
971 -
972/*! -
973 \since 4.1 -
974 -
975 Returns the number of sections in the header that has been hidden. -
976 -
977 \sa setSectionHidden(), isSectionHidden() -
978*/ -
979int QHeaderView::hiddenSectionCount() const -
980{ -
981 Q_D(const QHeaderView);
executed (the execution status of this line is deduced): const QHeaderViewPrivate * const d = d_func();
-
982 return d->hiddenSectionSize.count();
executed: return d->hiddenSectionSize.count();
Execution Count:5845
5845
983} -
984 -
985/*! -
986 If \a hide is true the section specified by \a logicalIndex is hidden; -
987 otherwise the section is shown. -
988 -
989 \sa isSectionHidden(), hiddenSectionCount() -
990*/ -
991 -
992void QHeaderView::setSectionHidden(int logicalIndex, bool hide) -
993{ -
994 Q_D(QHeaderView);
executed (the execution status of this line is deduced): QHeaderViewPrivate * const d = d_func();
-
995 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
996 return;
executed: return;
Execution Count:176
176
997 -
998 d->executePostedLayout();
executed (the execution status of this line is deduced): d->executePostedLayout();
-
999 int visual = visualIndex(logicalIndex);
executed (the execution status of this line is deduced): int visual = visualIndex(logicalIndex);
-
1000 Q_ASSERT(visual != -1);
executed (the execution status of this line is deduced): qt_noop();
-
1001 if (hide == d->isVisualIndexHidden(visual))
evaluated: hide == d->isVisualIndexHidden(visual)
TRUEFALSE
yes
Evaluation Count:1747
yes
Evaluation Count:11547
1747-11547
1002 return;
executed: return;
Execution Count:1747
1747
1003 if (hide) {
evaluated: hide
TRUEFALSE
yes
Evaluation Count:6995
yes
Evaluation Count:4552
4552-6995
1004 int size = d->headerSectionSize(visual);
executed (the execution status of this line is deduced): int size = d->headerSectionSize(visual);
-
1005 if (!d->hasAutoResizeSections())
evaluated: !d->hasAutoResizeSections()
TRUEFALSE
yes
Evaluation Count:6951
yes
Evaluation Count:44
44-6951
1006 resizeSection(logicalIndex, 0);
executed: resizeSection(logicalIndex, 0);
Execution Count:6951
6951
1007 d->hiddenSectionSize.insert(logicalIndex, size);
executed (the execution status of this line is deduced): d->hiddenSectionSize.insert(logicalIndex, size);
-
1008 if (d->sectionHidden.count() < count())
evaluated: d->sectionHidden.count() < count()
TRUEFALSE
yes
Evaluation Count:228
yes
Evaluation Count:6767
228-6767
1009 d->sectionHidden.resize(count());
executed: d->sectionHidden.resize(count());
Execution Count:228
228
1010 d->sectionHidden.setBit(visual, true);
executed (the execution status of this line is deduced): d->sectionHidden.setBit(visual, true);
-
1011 if (d->hasAutoResizeSections())
evaluated: d->hasAutoResizeSections()
TRUEFALSE
yes
Evaluation Count:44
yes
Evaluation Count:6951
44-6951
1012 d->doDelayedResizeSections();
executed: d->doDelayedResizeSections();
Execution Count:44
44
1013 } else {
executed: }
Execution Count:6995
6995
1014 int size = d->hiddenSectionSize.value(logicalIndex, d->defaultSectionSize);
executed (the execution status of this line is deduced): int size = d->hiddenSectionSize.value(logicalIndex, d->defaultSectionSize);
-
1015 d->hiddenSectionSize.remove(logicalIndex);
executed (the execution status of this line is deduced): d->hiddenSectionSize.remove(logicalIndex);
-
1016 if (d->hiddenSectionSize.isEmpty()) {
evaluated: d->hiddenSectionSize.isEmpty()
TRUEFALSE
yes
Evaluation Count:94
yes
Evaluation Count:4458
94-4458
1017 d->sectionHidden.clear();
executed (the execution status of this line is deduced): d->sectionHidden.clear();
-
1018 } else {
executed: }
Execution Count:94
94
1019 Q_ASSERT(visual <= d->sectionHidden.count());
executed (the execution status of this line is deduced): qt_noop();
-
1020 d->sectionHidden.setBit(visual, false);
executed (the execution status of this line is deduced): d->sectionHidden.setBit(visual, false);
-
1021 }
executed: }
Execution Count:4458
4458
1022 resizeSection(logicalIndex, size);
executed (the execution status of this line is deduced): resizeSection(logicalIndex, size);
-
1023 }
executed: }
Execution Count:4552
4552
1024} -
1025 -
1026/*! -
1027 Returns the number of sections in the header. -
1028 -
1029 \sa sectionCountChanged(), length() -
1030*/ -
1031 -
1032int QHeaderView::count() const -
1033{ -
1034 Q_D(const QHeaderView);
executed (the execution status of this line is deduced): const QHeaderViewPrivate * const d = d_func();
-
1035 //Q_ASSERT(d->sectionCount == d->headerSectionCount()); -
1036 // ### this may affect the lazy layout -
1037 d->executePostedLayout();
executed (the execution status of this line is deduced): d->executePostedLayout();
-
1038 return d->sectionCount();
executed: return d->sectionCount();
Execution Count:511298
511298
1039} -
1040 -
1041/*! -
1042 Returns the visual index position of the section specified by the given -
1043 \a logicalIndex, or -1 otherwise. -
1044 -
1045 Hidden sections still have valid visual indexes. -
1046 -
1047 \sa logicalIndex() -
1048*/ -
1049 -
1050int QHeaderView::visualIndex(int logicalIndex) const -
1051{ -
1052 Q_D(const QHeaderView);
executed (the execution status of this line is deduced): const QHeaderViewPrivate * const d = d_func();
-
1053 if (logicalIndex < 0)
evaluated: logicalIndex < 0
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:617525
7-617525
1054 return -1;
executed: return -1;
Execution Count:7
7
1055 d->executePostedLayout();
executed (the execution status of this line is deduced): d->executePostedLayout();
-
1056 if (d->visualIndices.isEmpty()) { // nothing has been moved, so we have no mapping
evaluated: d->visualIndices.isEmpty()
TRUEFALSE
yes
Evaluation Count:488398
yes
Evaluation Count:129127
129127-488398
1057 if (logicalIndex < d->sectionCount())
evaluated: logicalIndex < d->sectionCount()
TRUEFALSE
yes
Evaluation Count:488007
yes
Evaluation Count:391
391-488007
1058 return logicalIndex;
executed: return logicalIndex;
Execution Count:488007
488007
1059 } 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
1060 int visual = d->visualIndices.at(logicalIndex);
executed (the execution status of this line is deduced): int visual = d->visualIndices.at(logicalIndex);
-
1061 Q_ASSERT(visual < d->sectionCount());
executed (the execution status of this line is deduced): qt_noop();
-
1062 return visual;
executed: return visual;
Execution Count:129080
129080
1063 } -
1064 return -1;
executed: return -1;
Execution Count:438
438
1065} -
1066 -
1067/*! -
1068 Returns the logicalIndex for the section at the given \a visualIndex -
1069 position, or -1 if visualIndex < 0 or visualIndex >= QHeaderView::count(). -
1070 -
1071 Note that the visualIndex is not affected by hidden sections. -
1072 -
1073 \sa visualIndex(), sectionPosition() -
1074*/ -
1075 -
1076int QHeaderView::logicalIndex(int visualIndex) const -
1077{ -
1078 Q_D(const QHeaderView);
executed (the execution status of this line is deduced): const QHeaderViewPrivate * const d = d_func();
-
1079 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
1080 return -1;
executed: return -1;
Execution Count:2065
2065
1081 return d->logicalIndex(visualIndex);
executed: return d->logicalIndex(visualIndex);
Execution Count:238172
238172
1082} -
1083 -
1084/*! -
1085 If \a movable is true, the header may be moved by the user; otherwise it -
1086 is fixed in place. -
1087 -
1088 \sa sectionsMovable(), sectionMoved() -
1089*/ -
1090 -
1091void QHeaderView::setSectionsMovable(bool movable) -
1092{ -
1093 Q_D(QHeaderView);
executed (the execution status of this line is deduced): QHeaderViewPrivate * const d = d_func();
-
1094 d->movableSections = movable;
executed (the execution status of this line is deduced): d->movableSections = movable;
-
1095}
executed: }
Execution Count:674
674
1096 -
1097// ### Qt 6 - remove this obsolete function -
1098/*! -
1099 \obsolete -
1100 \fn void QHeaderView::setMovable(bool movable) -
1101 -
1102 Use setSectionsMovable instead. -
1103 -
1104 \sa setSectionsMovable() -
1105*/ -
1106 -
1107/*! -
1108 Returns true if the header can be moved by the user; otherwise returns -
1109 false. -
1110 -
1111 \sa setSectionsMovable() -
1112*/ -
1113 -
1114bool QHeaderView::sectionsMovable() const -
1115{ -
1116 Q_D(const QHeaderView);
executed (the execution status of this line is deduced): const QHeaderViewPrivate * const d = d_func();
-
1117 return d->movableSections;
executed: return d->movableSections;
Execution Count:3
3
1118} -
1119 -
1120// ### Qt 6 - remove this obsolete function -
1121/*! -
1122 \obsolete -
1123 \fn bool QHeaderView::isMovable() const -
1124 -
1125 Use sectionsMovable instead. -
1126 -
1127 \sa sectionsMovable() -
1128*/ -
1129 -
1130/*! -
1131 If \a clickable is true, the header will respond to single clicks. -
1132 -
1133 \sa sectionsClickable(), sectionClicked(), sectionPressed(), -
1134 setSortIndicatorShown() -
1135*/ -
1136 -
1137void QHeaderView::setSectionsClickable(bool clickable) -
1138{ -
1139 Q_D(QHeaderView);
executed (the execution status of this line is deduced): QHeaderViewPrivate * const d = d_func();
-
1140 d->clickableSections = clickable;
executed (the execution status of this line is deduced): d->clickableSections = clickable;
-
1141}
executed: }
Execution Count:2261
2261
1142 -
1143// ### Qt 6 - remove this obsolete function -
1144/*! -
1145 \obsolete -
1146 \fn void QHeaderView::setClickable(bool clickable) -
1147 -
1148 Use setSectionsClickable instead. -
1149 -
1150 \sa setSectionsClickable() -
1151*/ -
1152 -
1153/*! -
1154 Returns true if the header is clickable; otherwise returns false. A -
1155 clickable header could be set up to allow the user to change the -
1156 representation of the data in the view related to the header. -
1157 -
1158 \sa setSectionsClickable() -
1159*/ -
1160 -
1161bool QHeaderView::sectionsClickable() const -
1162{ -
1163 Q_D(const QHeaderView);
executed (the execution status of this line is deduced): const QHeaderViewPrivate * const d = d_func();
-
1164 return d->clickableSections;
executed: return d->clickableSections;
Execution Count:3
3
1165} -
1166 -
1167// ### Qt 6 - remove this obsolete function -
1168/*! -
1169 \obsolete -
1170 \fn bool QHeaderView::isClickable() const -
1171 -
1172 Use sectionsClickable instead. -
1173 -
1174 \sa sectionsClickable() -
1175*/ -
1176 -
1177void QHeaderView::setHighlightSections(bool highlight) -
1178{ -
1179 Q_D(QHeaderView);
executed (the execution status of this line is deduced): QHeaderViewPrivate * const d = d_func();
-
1180 d->highlightSelected = highlight;
executed (the execution status of this line is deduced): d->highlightSelected = highlight;
-
1181}
executed: }
Execution Count:968
968
1182 -
1183bool QHeaderView::highlightSections() const -
1184{ -
1185 Q_D(const QHeaderView);
executed (the execution status of this line is deduced): const QHeaderViewPrivate * const d = d_func();
-
1186 return d->highlightSelected;
executed: return d->highlightSelected;
Execution Count:4
4
1187} -
1188 -
1189/*! -
1190 Sets the constraints on how the header can be resized to those described -
1191 by the given \a mode. -
1192 -
1193 \sa resizeMode(), length(), sectionResized() -
1194*/ -
1195 -
1196void QHeaderView::setSectionResizeMode(ResizeMode mode) -
1197{ -
1198 Q_D(QHeaderView);
executed (the execution status of this line is deduced): QHeaderViewPrivate * const d = d_func();
-
1199 initializeSections();
executed (the execution status of this line is deduced): initializeSections();
-
1200 d->stretchSections = (mode == Stretch ? count() : 0);
evaluated: mode == Stretch
TRUEFALSE
yes
Evaluation Count:57
yes
Evaluation Count:9
9-57
1201 d->contentsSections = (mode == ResizeToContents ? count() : 0);
evaluated: mode == ResizeToContents
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:62
4-62
1202 d->setGlobalHeaderResizeMode(mode);
executed (the execution status of this line is deduced): d->setGlobalHeaderResizeMode(mode);
-
1203 if (d->hasAutoResizeSections())
evaluated: d->hasAutoResizeSections()
TRUEFALSE
yes
Evaluation Count:62
yes
Evaluation Count:4
4-62
1204 d->doDelayedResizeSections(); // section sizes may change as a result of the new mode
executed: d->doDelayedResizeSections();
Execution Count:62
62
1205}
executed: }
Execution Count:66
66
1206 -
1207/*! -
1208 Sets the constraints on how the section specified by \a logicalIndex in -
1209 the header can be resized to those described by the given \a mode. The logical -
1210 index should exist at the time this function is called. -
1211 -
1212 \note This setting will be ignored for the last section if the stretchLastSection -
1213 property is set to true. This is the default for the horizontal headers provided -
1214 by QTreeView. -
1215 -
1216 \sa setStretchLastSection() -
1217*/ -
1218 -
1219void QHeaderView::setSectionResizeMode(int logicalIndex, ResizeMode mode) -
1220{ -
1221 Q_D(QHeaderView);
executed (the execution status of this line is deduced): QHeaderViewPrivate * const d = d_func();
-
1222 int visual = visualIndex(logicalIndex);
executed (the execution status of this line is deduced): int visual = visualIndex(logicalIndex);
-
1223 Q_ASSERT(visual != -1);
executed (the execution status of this line is deduced): qt_noop();
-
1224 -
1225 ResizeMode old = d->headerSectionResizeMode(visual);
executed (the execution status of this line is deduced): ResizeMode old = d->headerSectionResizeMode(visual);
-
1226 d->setHeaderSectionResizeMode(visual, mode);
executed (the execution status of this line is deduced): d->setHeaderSectionResizeMode(visual, mode);
-
1227 -
1228 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
1229 ++d->stretchSections;
executed: ++d->stretchSections;
Execution Count:4
4
1230 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
1231 ++d->contentsSections;
executed: ++d->contentsSections;
Execution Count:2
2
1232 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
1233 --d->stretchSections;
never executed: --d->stretchSections;
0
1234 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
1235 --d->contentsSections;
never executed: --d->contentsSections;
0
1236 -
1237 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
1238 d->doDelayedResizeSections(); // section sizes may change as a result of the new mode
executed: d->doDelayedResizeSections();
Execution Count:9
9
1239}
executed: }
Execution Count:12
12
1240 -
1241// ### Qt 6 - remove this obsolete function -
1242/*! -
1243 \overload -
1244 \obsolete -
1245 \fn void QHeaderView::setResizeMode(int logicalIndex, ResizeMode mode) -
1246 -
1247 Use setSectionResizeMode instead. -
1248 -
1249 \sa setSectionResizeMode() -
1250*/ -
1251 -
1252/*! -
1253 \obsolete -
1254 \fn void QHeaderView::setResizeMode(ResizeMode mode) -
1255 -
1256 Use setSectionResizeMode instead. -
1257 -
1258 \sa setSectionResizeMode() -
1259*/ -
1260 -
1261/*! -
1262 Returns the resize mode that applies to the section specified by the given -
1263 \a logicalIndex. -
1264 -
1265 \sa setSectionResizeMode() -
1266*/ -
1267 -
1268QHeaderView::ResizeMode QHeaderView::sectionResizeMode(int logicalIndex) const -
1269{ -
1270 Q_D(const QHeaderView);
executed (the execution status of this line is deduced): const QHeaderViewPrivate * const d = d_func();
-
1271 int visual = visualIndex(logicalIndex);
executed (the execution status of this line is deduced): int visual = visualIndex(logicalIndex);
-
1272 if (visual == -1)
evaluated: visual == -1
TRUEFALSE
yes
Evaluation Count:385
yes
Evaluation Count:14982
385-14982
1273 return Fixed; //the default value
executed: return Fixed;
Execution Count:385
385
1274 return d->headerSectionResizeMode(visual);
executed: return d->headerSectionResizeMode(visual);
Execution Count:14982
14982
1275} -
1276 -
1277// ### Qt 6 - remove this obsolete function -
1278/*! -
1279 \obsolete -
1280 \fn QHeaderView::ResizeMode QHeaderView::resizeMode(int logicalIndex) const -
1281 -
1282 Use sectionResizeMode instead. -
1283 -
1284 \sa sectionResizeMode() -
1285*/ -
1286 -
1287/*! -
1288 \since 4.1 -
1289 -
1290 Returns the number of sections that are set to resize mode stretch. In -
1291 views, this can be used to see if the headerview needs to resize the -
1292 sections when the view's geometry changes. -
1293 -
1294 \sa stretchLastSection, resizeMode() -
1295*/ -
1296 -
1297int QHeaderView::stretchSectionCount() const -
1298{ -
1299 Q_D(const QHeaderView);
executed (the execution status of this line is deduced): const QHeaderViewPrivate * const d = d_func();
-
1300 return d->stretchSections;
executed: return d->stretchSections;
Execution Count:3
3
1301} -
1302 -
1303/*! -
1304 \property QHeaderView::showSortIndicator -
1305 \brief whether the sort indicator is shown -
1306 -
1307 By default, this property is false. -
1308 -
1309 \sa setSectionsClickable() -
1310*/ -
1311 -
1312void QHeaderView::setSortIndicatorShown(bool show) -
1313{ -
1314 Q_D(QHeaderView);
executed (the execution status of this line is deduced): QHeaderViewPrivate * const d = d_func();
-
1315 if (d->sortIndicatorShown == show)
evaluated: d->sortIndicatorShown == show
TRUEFALSE
yes
Evaluation Count:1169
yes
Evaluation Count:326
326-1169
1316 return;
executed: return;
Execution Count:1169
1169
1317 -
1318 d->sortIndicatorShown = show;
executed (the execution status of this line is deduced): d->sortIndicatorShown = show;
-
1319 -
1320 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
1321 return;
executed: return;
Execution Count:2
2
1322 -
1323 if (d->headerSectionResizeMode(sortIndicatorSection()) == ResizeToContents)
partially evaluated: d->headerSectionResizeMode(sortIndicatorSection()) == ResizeToContents
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:324
0-324
1324 resizeSections();
never executed: resizeSections();
0
1325 -
1326 d->viewport->update();
executed (the execution status of this line is deduced): d->viewport->update();
-
1327}
executed: }
Execution Count:324
324
1328 -
1329bool QHeaderView::isSortIndicatorShown() const -
1330{ -
1331 Q_D(const QHeaderView);
executed (the execution status of this line is deduced): const QHeaderViewPrivate * const d = d_func();
-
1332 return d->sortIndicatorShown;
executed: return d->sortIndicatorShown;
Execution Count:26862
26862
1333} -
1334 -
1335/*! -
1336 Sets the sort indicator for the section specified by the given -
1337 \a logicalIndex in the direction specified by \a order, and removes the -
1338 sort indicator from any other section that was showing it. -
1339 -
1340 \a logicalIndex may be -1, in which case no sort indicator will be shown -
1341 and the model will return to its natural, unsorted order. Note that not -
1342 all models support this and may even crash in this case. -
1343 -
1344 \sa sortIndicatorSection(), sortIndicatorOrder() -
1345*/ -
1346 -
1347void QHeaderView::setSortIndicator(int logicalIndex, Qt::SortOrder order) -
1348{ -
1349 Q_D(QHeaderView);
executed (the execution status of this line is deduced): QHeaderViewPrivate * const d = d_func();
-
1350 -
1351 // This is so that people can set the position of the sort indicator before the fill the model -
1352 int old = d->sortIndicatorSection;
executed (the execution status of this line is deduced): int old = d->sortIndicatorSection;
-
1353 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
1354 return;
executed: return;
Execution Count:356
356
1355 d->sortIndicatorSection = logicalIndex;
executed (the execution status of this line is deduced): d->sortIndicatorSection = logicalIndex;
-
1356 d->sortIndicatorOrder = order;
executed (the execution status of this line is deduced): d->sortIndicatorOrder = order;
-
1357 -
1358 if (logicalIndex >= d->sectionCount()) {
evaluated: logicalIndex >= d->sectionCount()
TRUEFALSE
yes
Evaluation Count:191
yes
Evaluation Count:112
112-191
1359 emit sortIndicatorChanged(logicalIndex, order);
executed (the execution status of this line is deduced): sortIndicatorChanged(logicalIndex, order);
-
1360 return; // nothing to do
executed: return;
Execution Count:191
191
1361 } -
1362 -
1363 if (old != logicalIndex
evaluated: old != logicalIndex
TRUEFALSE
yes
Evaluation Count:33
yes
Evaluation Count:79
33-79
1364 && ((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
1365 || 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
1366 resizeSections();
executed (the execution status of this line is deduced): resizeSections();
-
1367 d->viewport->update();
executed (the execution status of this line is deduced): d->viewport->update();
-
1368 } else {
executed: }
Execution Count:2
2
1369 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
1370 updateSection(old);
executed: updateSection(old);
Execution Count:31
31
1371 if (logicalIndex >= 0)
partially evaluated: logicalIndex >= 0
TRUEFALSE
yes
Evaluation Count:110
no
Evaluation Count:0
0-110
1372 updateSection(logicalIndex);
executed: updateSection(logicalIndex);
Execution Count:110
110
1373 }
executed: }
Execution Count:110
110
1374 -
1375 emit sortIndicatorChanged(logicalIndex, order);
executed (the execution status of this line is deduced): sortIndicatorChanged(logicalIndex, order);
-
1376}
executed: }
Execution Count:112
112
1377 -
1378/*! -
1379 Returns the logical index of the section that has a sort indicator. -
1380 By default this is section 0. -
1381 -
1382 \sa setSortIndicator(), sortIndicatorOrder(), setSortIndicatorShown() -
1383*/ -
1384 -
1385int QHeaderView::sortIndicatorSection() const -
1386{ -
1387 Q_D(const QHeaderView);
executed (the execution status of this line is deduced): const QHeaderViewPrivate * const d = d_func();
-
1388 return d->sortIndicatorSection;
executed: return d->sortIndicatorSection;
Execution Count:2003
2003
1389} -
1390 -
1391/*! -
1392 Returns the order for the sort indicator. If no section has a sort -
1393 indicator the return value of this function is undefined. -
1394 -
1395 \sa setSortIndicator(), sortIndicatorSection() -
1396*/ -
1397 -
1398Qt::SortOrder QHeaderView::sortIndicatorOrder() const -
1399{ -
1400 Q_D(const QHeaderView);
executed (the execution status of this line is deduced): const QHeaderViewPrivate * const d = d_func();
-
1401 return d->sortIndicatorOrder;
executed: return d->sortIndicatorOrder;
Execution Count:887
887
1402} -
1403 -
1404/*! -
1405 \property QHeaderView::stretchLastSection -
1406 \brief whether the last visible section in the header takes up all the -
1407 available space -
1408 -
1409 The default value is false. -
1410 -
1411 \note The horizontal headers provided by QTreeView are configured with this -
1412 property set to true, ensuring that the view does not waste any of the -
1413 space assigned to it for its header. If this value is set to true, this -
1414 property will override the resize mode set on the last section in the -
1415 header. -
1416 -
1417 \sa setSectionResizeMode() -
1418*/ -
1419bool QHeaderView::stretchLastSection() const -
1420{ -
1421 Q_D(const QHeaderView);
executed (the execution status of this line is deduced): const QHeaderViewPrivate * const d = d_func();
-
1422 return d->stretchLastSection;
executed: return d->stretchLastSection;
Execution Count:18931
18931
1423} -
1424 -
1425void QHeaderView::setStretchLastSection(bool stretch) -
1426{ -
1427 Q_D(QHeaderView);
executed (the execution status of this line is deduced): QHeaderViewPrivate * const d = d_func();
-
1428 d->stretchLastSection = stretch;
executed (the execution status of this line is deduced): d->stretchLastSection = stretch;
-
1429 if (d->state != QHeaderViewPrivate::NoState)
partially evaluated: d->state != QHeaderViewPrivate::NoState
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:884
0-884
1430 return;
never executed: return;
0
1431 if (stretch)
evaluated: stretch
TRUEFALSE
yes
Evaluation Count:681
yes
Evaluation Count:203
203-681
1432 resizeSections();
executed: resizeSections();
Execution Count:681
681
1433 else if (count())
evaluated: count()
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:191
12-191
1434 resizeSection(count() - 1, d->defaultSectionSize);
executed: resizeSection(count() - 1, d->defaultSectionSize);
Execution Count:12
12
1435} -
1436 -
1437/*! -
1438 \since 4.2 -
1439 \property QHeaderView::cascadingSectionResizes -
1440 \brief whether interactive resizing will be cascaded to the following -
1441 sections once the section being resized by the user has reached its -
1442 minimum size -
1443 -
1444 This property only affects sections that have \l Interactive as their -
1445 resize mode. -
1446 -
1447 The default value is false. -
1448 -
1449 \sa setSectionResizeMode() -
1450*/ -
1451bool QHeaderView::cascadingSectionResizes() const -
1452{ -
1453 Q_D(const QHeaderView);
never executed (the execution status of this line is deduced): const QHeaderViewPrivate * const d = d_func();
-
1454 return d->cascadingResizing;
never executed: return d->cascadingResizing;
0
1455} -
1456 -
1457void QHeaderView::setCascadingSectionResizes(bool enable) -
1458{ -
1459 Q_D(QHeaderView);
never executed (the execution status of this line is deduced): QHeaderViewPrivate * const d = d_func();
-
1460 d->cascadingResizing = enable;
never executed (the execution status of this line is deduced): d->cascadingResizing = enable;
-
1461}
never executed: }
0
1462 -
1463/*! -
1464 \property QHeaderView::defaultSectionSize -
1465 \brief the default size of the header sections before resizing. -
1466 -
1467 This property only affects sections that have \l Interactive or \l Fixed -
1468 as their resize mode. -
1469 -
1470 \sa setSectionResizeMode(), minimumSectionSize -
1471*/ -
1472int QHeaderView::defaultSectionSize() const -
1473{ -
1474 Q_D(const QHeaderView);
executed (the execution status of this line is deduced): const QHeaderViewPrivate * const d = d_func();
-
1475 return d->defaultSectionSize;
executed: return d->defaultSectionSize;
Execution Count:39
39
1476} -
1477 -
1478void QHeaderView::setDefaultSectionSize(int size) -
1479{ -
1480 Q_D(QHeaderView);
executed (the execution status of this line is deduced): QHeaderViewPrivate * const d = d_func();
-
1481 if (size < 0)
evaluated: size < 0
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:85
1-85
1482 return;
executed: return;
Execution Count:1
1
1483 d->setDefaultSectionSize(size);
executed (the execution status of this line is deduced): d->setDefaultSectionSize(size);
-
1484}
executed: }
Execution Count:85
85
1485 -
1486/*! -
1487 \since 4.2 -
1488 \property QHeaderView::minimumSectionSize -
1489 \brief the minimum size of the header sections. -
1490 -
1491 The minimum section size is the smallest section size allowed. If the -
1492 minimum section size is set to -1, QHeaderView will use the maximum of -
1493 the \l{QApplication::globalStrut()}{global strut} or the -
1494 \l{fontMetrics()}{font metrics} size. -
1495 -
1496 This property is honored by all \l{ResizeMode}{resize modes}. -
1497 -
1498 \sa setSectionResizeMode(), defaultSectionSize -
1499*/ -
1500int QHeaderView::minimumSectionSize() const -
1501{ -
1502 Q_D(const QHeaderView);
executed (the execution status of this line is deduced): const QHeaderViewPrivate * const d = d_func();
-
1503 if (d->minimumSectionSize == -1) {
evaluated: d->minimumSectionSize == -1
TRUEFALSE
yes
Evaluation Count:5777
yes
Evaluation Count:2
2-5777
1504 QSize strut = QApplication::globalStrut();
executed (the execution status of this line is deduced): QSize strut = QApplication::globalStrut();
-
1505 int margin = style()->pixelMetric(QStyle::PM_HeaderMargin, 0, this);
executed (the execution status of this line is deduced): int margin = style()->pixelMetric(QStyle::PM_HeaderMargin, 0, this);
-
1506 if (d->orientation == Qt::Horizontal)
evaluated: d->orientation == Qt::Horizontal
TRUEFALSE
yes
Evaluation Count:2266
yes
Evaluation Count:3511
2266-3511
1507 return qMax(strut.width(), (fontMetrics().maxWidth() + margin));
executed: return qMax(strut.width(), (fontMetrics().maxWidth() + margin));
Execution Count:2266
2266
1508 return qMax(strut.height(), (fontMetrics().height() + margin));
executed: return qMax(strut.height(), (fontMetrics().height() + margin));
Execution Count:3511
3511
1509 } -
1510 return d->minimumSectionSize;
executed: return d->minimumSectionSize;
Execution Count:2
2
1511} -
1512 -
1513void QHeaderView::setMinimumSectionSize(int size) -
1514{ -
1515 Q_D(QHeaderView);
executed (the execution status of this line is deduced): QHeaderViewPrivate * const d = d_func();
-
1516 if (size < 0)
evaluated: size < 0
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:2
1-2
1517 return;
executed: return;
Execution Count:1
1
1518 d->minimumSectionSize = size;
executed (the execution status of this line is deduced): d->minimumSectionSize = size;
-
1519}
executed: }
Execution Count:2
2
1520 -
1521/*! -
1522 \since 4.1 -
1523 \property QHeaderView::defaultAlignment -
1524 \brief the default alignment of the text in each header section -
1525*/ -
1526 -
1527Qt::Alignment QHeaderView::defaultAlignment() const -
1528{ -
1529 Q_D(const QHeaderView);
executed (the execution status of this line is deduced): const QHeaderViewPrivate * const d = d_func();
-
1530 return d->defaultAlignment;
executed: return d->defaultAlignment;
Execution Count:8
8
1531} -
1532 -
1533void QHeaderView::setDefaultAlignment(Qt::Alignment alignment) -
1534{ -
1535 Q_D(QHeaderView);
executed (the execution status of this line is deduced): QHeaderViewPrivate * const d = d_func();
-
1536 if (d->defaultAlignment == alignment)
partially evaluated: d->defaultAlignment == alignment
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:674
0-674
1537 return;
never executed: return;
0
1538 -
1539 d->defaultAlignment = alignment;
executed (the execution status of this line is deduced): d->defaultAlignment = alignment;
-
1540 d->viewport->update();
executed (the execution status of this line is deduced): d->viewport->update();
-
1541}
executed: }
Execution Count:674
674
1542 -
1543/*! -
1544 \internal -
1545*/ -
1546void QHeaderView::doItemsLayout() -
1547{ -
1548 initializeSections();
executed (the execution status of this line is deduced): initializeSections();
-
1549 QAbstractItemView::doItemsLayout();
executed (the execution status of this line is deduced): QAbstractItemView::doItemsLayout();
-
1550}
executed: }
Execution Count:6312
6312
1551 -
1552/*! -
1553 Returns true if sections in the header has been moved; otherwise returns -
1554 false; -
1555 -
1556 \sa moveSection() -
1557*/ -
1558bool QHeaderView::sectionsMoved() const -
1559{ -
1560 Q_D(const QHeaderView);
executed (the execution status of this line is deduced): const QHeaderViewPrivate * const d = d_func();
-
1561 return !d->visualIndices.isEmpty();
executed: return !d->visualIndices.isEmpty();
Execution Count:4583
4583
1562} -
1563 -
1564/*! -
1565 \since 4.1 -
1566 -
1567 Returns true if sections in the header has been hidden; otherwise returns -
1568 false; -
1569 -
1570 \sa setSectionHidden() -
1571*/ -
1572bool QHeaderView::sectionsHidden() const -
1573{ -
1574 Q_D(const QHeaderView);
executed (the execution status of this line is deduced): const QHeaderViewPrivate * const d = d_func();
-
1575 return !d->hiddenSectionSize.isEmpty();
executed: return !d->hiddenSectionSize.isEmpty();
Execution Count:2430
2430
1576} -
1577 -
1578#ifndef QT_NO_DATASTREAM -
1579/*! -
1580 \since 4.3 -
1581 -
1582 Saves the current state of this header view. -
1583 -
1584 To restore the saved state, pass the return value to restoreState(). -
1585 -
1586 \sa restoreState() -
1587*/ -
1588QByteArray QHeaderView::saveState() const -
1589{ -
1590 Q_D(const QHeaderView);
executed (the execution status of this line is deduced): const QHeaderViewPrivate * const d = d_func();
-
1591 QByteArray data;
executed (the execution status of this line is deduced): QByteArray data;
-
1592 QDataStream stream(&data, QIODevice::WriteOnly);
executed (the execution status of this line is deduced): QDataStream stream(&data, QIODevice::WriteOnly);
-
1593 stream << QHeaderViewPrivate::VersionMarker;
executed (the execution status of this line is deduced): stream << QHeaderViewPrivate::VersionMarker;
-
1594 stream << 0; // current version is 0
executed (the execution status of this line is deduced): stream << 0;
-
1595 d->write(stream);
executed (the execution status of this line is deduced): d->write(stream);
-
1596 return data;
executed: return data;
Execution Count:194
194
1597} -
1598 -
1599/*! -
1600 \since 4.3 -
1601 Restores the \a state of this header view. -
1602 This function returns \c true if the state was restored; otherwise returns -
1603 false. -
1604 -
1605 \sa saveState() -
1606*/ -
1607bool QHeaderView::restoreState(const QByteArray &state) -
1608{ -
1609 Q_D(QHeaderView);
executed (the execution status of this line is deduced): QHeaderViewPrivate * const d = d_func();
-
1610 if (state.isEmpty())
partially evaluated: state.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:109
0-109
1611 return false;
never executed: return false;
0
1612 QByteArray data = state;
executed (the execution status of this line is deduced): QByteArray data = state;
-
1613 QDataStream stream(&data, QIODevice::ReadOnly);
executed (the execution status of this line is deduced): QDataStream stream(&data, QIODevice::ReadOnly);
-
1614 int marker;
executed (the execution status of this line is deduced): int marker;
-
1615 int ver;
executed (the execution status of this line is deduced): int ver;
-
1616 stream >> marker;
executed (the execution status of this line is deduced): stream >> marker;
-
1617 stream >> ver;
executed (the execution status of this line is deduced): stream >> ver;
-
1618 if (stream.status() != QDataStream::Ok
partially evaluated: stream.status() != QDataStream::Ok
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:109
0-109
1619 || marker != QHeaderViewPrivate::VersionMarker
partially evaluated: marker != QHeaderViewPrivate::VersionMarker
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:109
0-109
1620 || ver != 0) // current version is 0
partially evaluated: ver != 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:109
0-109
1621 return false;
never executed: return false;
0
1622 -
1623 if (d->read(stream)) {
partially evaluated: d->read(stream)
TRUEFALSE
yes
Evaluation Count:109
no
Evaluation Count:0
0-109
1624 emit sortIndicatorChanged(d->sortIndicatorSection, d->sortIndicatorOrder );
executed (the execution status of this line is deduced): sortIndicatorChanged(d->sortIndicatorSection, d->sortIndicatorOrder );
-
1625 d->viewport->update();
executed (the execution status of this line is deduced): d->viewport->update();
-
1626 return true;
executed: return true;
Execution Count:109
109
1627 } -
1628 return false;
never executed: return false;
0
1629} -
1630#endif // QT_NO_DATASTREAM -
1631 -
1632/*! -
1633 \reimp -
1634*/ -
1635void QHeaderView::reset() -
1636{ -
1637 QAbstractItemView::reset();
executed (the execution status of this line is deduced): QAbstractItemView::reset();
-
1638 // it would be correct to call clear, but some apps rely -
1639 // on the header keeping the sections, even after calling reset -
1640 //d->clear(); -
1641 initializeSections();
executed (the execution status of this line is deduced): initializeSections();
-
1642}
executed: }
Execution Count:2661
2661
1643 -
1644/*! -
1645 Updates the changed header sections with the given \a orientation, from -
1646 \a logicalFirst to \a logicalLast inclusive. -
1647*/ -
1648void QHeaderView::headerDataChanged(Qt::Orientation orientation, int logicalFirst, int logicalLast) -
1649{ -
1650 Q_D(QHeaderView);
executed (the execution status of this line is deduced): QHeaderViewPrivate * const d = d_func();
-
1651 if (d->orientation != orientation)
evaluated: d->orientation != orientation
TRUEFALSE
yes
Evaluation Count:1289
yes
Evaluation Count:1334
1289-1334
1652 return;
executed: return;
Execution Count:1289
1289
1653 -
1654 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
1655 return;
executed: return;
Execution Count:4
4
1656 -
1657 d->invalidateCachedSizeHint();
executed (the execution status of this line is deduced): d->invalidateCachedSizeHint();
-
1658 -
1659 int firstVisualIndex = INT_MAX, lastVisualIndex = -1;
executed (the execution status of this line is deduced): int firstVisualIndex = 2147483647, lastVisualIndex = -1;
-
1660 -
1661 for (int section = logicalFirst; section <= logicalLast; ++section) {
evaluated: section <= logicalLast
TRUEFALSE
yes
Evaluation Count:8946
yes
Evaluation Count:1330
1330-8946
1662 const int visual = visualIndex(section);
executed (the execution status of this line is deduced): const int visual = visualIndex(section);
-
1663 firstVisualIndex = qMin(firstVisualIndex, visual);
executed (the execution status of this line is deduced): firstVisualIndex = qMin(firstVisualIndex, visual);
-
1664 lastVisualIndex = qMax(lastVisualIndex, visual);
executed (the execution status of this line is deduced): lastVisualIndex = qMax(lastVisualIndex, visual);
-
1665 }
executed: }
Execution Count:8946
8946
1666 -
1667 d->executePostedResize();
executed (the execution status of this line is deduced): d->executePostedResize();
-
1668 const int first = d->headerSectionPosition(firstVisualIndex),
executed (the execution status of this line is deduced): const int first = d->headerSectionPosition(firstVisualIndex),
-
1669 last = d->headerSectionPosition(lastVisualIndex)
executed (the execution status of this line is deduced): last = d->headerSectionPosition(lastVisualIndex)
-
1670 + d->headerSectionSize(lastVisualIndex);
executed (the execution status of this line is deduced): + d->headerSectionSize(lastVisualIndex);
-
1671 -
1672 if (orientation == Qt::Horizontal) {
evaluated: orientation == Qt::Horizontal
TRUEFALSE
yes
Evaluation Count:687
yes
Evaluation Count:643
643-687
1673 d->viewport->update(first, 0, last - first, d->viewport->height());
executed (the execution status of this line is deduced): d->viewport->update(first, 0, last - first, d->viewport->height());
-
1674 } else {
executed: }
Execution Count:687
687
1675 d->viewport->update(0, first, d->viewport->width(), last - first);
executed (the execution status of this line is deduced): d->viewport->update(0, first, d->viewport->width(), last - first);
-
1676 }
executed: }
Execution Count:643
643
1677} -
1678 -
1679/*! -
1680 \internal -
1681 \since 4.2 -
1682 -
1683 Updates the section specified by the given \a logicalIndex. -
1684*/ -
1685 -
1686void QHeaderView::updateSection(int logicalIndex) -
1687{ -
1688 Q_D(QHeaderView);
executed (the execution status of this line is deduced): QHeaderViewPrivate * const d = d_func();
-
1689 if (d->orientation == Qt::Horizontal)
evaluated: d->orientation == Qt::Horizontal
TRUEFALSE
yes
Evaluation Count:164
yes
Evaluation Count:17
17-164
1690 d->viewport->update(QRect(sectionViewportPosition(logicalIndex),
executed: d->viewport->update(QRect(sectionViewportPosition(logicalIndex), 0, sectionSize(logicalIndex), d->viewport->height()));
Execution Count:164
164
1691 0, sectionSize(logicalIndex), d->viewport->height()));
executed: d->viewport->update(QRect(sectionViewportPosition(logicalIndex), 0, sectionSize(logicalIndex), d->viewport->height()));
Execution Count:164
164
1692 else -
1693 d->viewport->update(QRect(0, sectionViewportPosition(logicalIndex),
executed: d->viewport->update(QRect(0, sectionViewportPosition(logicalIndex), d->viewport->width(), sectionSize(logicalIndex)));
Execution Count:17
17
1694 d->viewport->width(), sectionSize(logicalIndex)));
executed: d->viewport->update(QRect(0, sectionViewportPosition(logicalIndex), d->viewport->width(), sectionSize(logicalIndex)));
Execution Count:17
17
1695} -
1696 -
1697/*! -
1698 Resizes the sections according to their size hints. Normally, you do not -
1699 have to call this function. -
1700*/ -
1701 -
1702void QHeaderView::resizeSections() -
1703{ -
1704 Q_D(QHeaderView);
executed (the execution status of this line is deduced): QHeaderViewPrivate * const d = d_func();
-
1705 if (d->hasAutoResizeSections())
evaluated: d->hasAutoResizeSections()
TRUEFALSE
yes
Evaluation Count:4332
yes
Evaluation Count:88825
4332-88825
1706 d->resizeSections(Interactive, false); // no global resize mode
executed: d->resizeSections(Interactive, false);
Execution Count:4332
4332
1707}
executed: }
Execution Count:93157
93157
1708 -
1709/*! -
1710 This slot is called when sections are inserted into the \a parent. -
1711 \a logicalFirst and \a logicalLast indices signify where the new sections -
1712 were inserted. -
1713 -
1714 If only one section is inserted, \a logicalFirst and \a logicalLast will -
1715 be the same. -
1716*/ -
1717 -
1718void QHeaderView::sectionsInserted(const QModelIndex &parent, -
1719 int logicalFirst, int logicalLast) -
1720{ -
1721 Q_D(QHeaderView);
executed (the execution status of this line is deduced): QHeaderViewPrivate * const d = d_func();
-
1722 if (parent != d->root)
evaluated: parent != d->root
TRUEFALSE
yes
Evaluation Count:13
yes
Evaluation Count:13555
13-13555
1723 return; // we only handle changes in the root level
executed: return;
Execution Count:13
13
1724 int oldCount = d->sectionCount();
executed (the execution status of this line is deduced): int oldCount = d->sectionCount();
-
1725 -
1726 d->invalidateCachedSizeHint();
executed (the execution status of this line is deduced): d->invalidateCachedSizeHint();
-
1727 -
1728 if (d->state == QHeaderViewPrivate::ResizeSection)
partially evaluated: d->state == QHeaderViewPrivate::ResizeSection
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13555
0-13555
1729 d->preventCursorChangeInSetOffset = true;
never executed: d->preventCursorChangeInSetOffset = true;
0
1730 -
1731 // add the new sections -
1732 int insertAt = logicalFirst;
executed (the execution status of this line is deduced): int insertAt = logicalFirst;
-
1733 int insertCount = logicalLast - logicalFirst + 1;
executed (the execution status of this line is deduced): int insertCount = logicalLast - logicalFirst + 1;
-
1734 -
1735 QHeaderViewPrivate::SectionItem section(d->defaultSectionSize, d->globalResizeMode);
executed (the execution status of this line is deduced): QHeaderViewPrivate::SectionItem section(d->defaultSectionSize, d->globalResizeMode);
-
1736 d->sectionStartposRecalc = true;
executed (the execution status of this line is deduced): d->sectionStartposRecalc = true;
-
1737 -
1738 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
1739 int insertLength = d->defaultSectionSize * insertCount;
executed (the execution status of this line is deduced): int insertLength = d->defaultSectionSize * insertCount;
-
1740 d->length += insertLength;
executed (the execution status of this line is deduced): d->length += insertLength;
-
1741 d->sectionItems.insert(d->sectionItems.count(), insertCount, section); // append
executed (the execution status of this line is deduced): d->sectionItems.insert(d->sectionItems.count(), insertCount, section);
-
1742 } else {
executed: }
Execution Count:13469
13469
1743 // separate them out into their own sections -
1744 int insertLength = d->defaultSectionSize * insertCount;
executed (the execution status of this line is deduced): int insertLength = d->defaultSectionSize * insertCount;
-
1745 d->length += insertLength;
executed (the execution status of this line is deduced): d->length += insertLength;
-
1746 d->sectionItems.insert(insertAt, insertCount, section);
executed (the execution status of this line is deduced): d->sectionItems.insert(insertAt, insertCount, section);
-
1747 }
executed: }
Execution Count:86
86
1748 -
1749 // update sorting column -
1750 if (d->sortIndicatorSection >= logicalFirst)
evaluated: d->sortIndicatorSection >= logicalFirst
TRUEFALSE
yes
Evaluation Count:13471
yes
Evaluation Count:84
84-13471
1751 d->sortIndicatorSection += insertCount;
executed: d->sortIndicatorSection += insertCount;
Execution Count:13471
13471
1752 -
1753 // update resize mode section counts -
1754 if (d->globalResizeMode == Stretch)
evaluated: d->globalResizeMode == Stretch
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:13554
1-13554
1755 d->stretchSections = d->sectionCount();
executed: d->stretchSections = d->sectionCount();
Execution Count:1
1
1756 else if (d->globalResizeMode == ResizeToContents)
partially evaluated: d->globalResizeMode == ResizeToContents
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13554
0-13554
1757 d->contentsSections = d->sectionCount();
never executed: d->contentsSections = d->sectionCount();
0
1758 -
1759 // clear selection cache -
1760 d->sectionSelected.clear();
executed (the execution status of this line is deduced): d->sectionSelected.clear();
-
1761 -
1762 // update mapping -
1763 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
1764 Q_ASSERT(d->visualIndices.count() == d->logicalIndices.count());
executed (the execution status of this line is deduced): qt_noop();
-
1765 int mappingCount = d->visualIndices.count();
executed (the execution status of this line is deduced): int mappingCount = d->visualIndices.count();
-
1766 for (int i = 0; i < mappingCount; ++i) {
evaluated: i < mappingCount
TRUEFALSE
yes
Evaluation Count:12138
yes
Evaluation Count:26
26-12138
1767 if (d->visualIndices.at(i) >= logicalFirst)
evaluated: d->visualIndices.at(i) >= logicalFirst
TRUEFALSE
yes
Evaluation Count:6022
yes
Evaluation Count:6116
6022-6116
1768 d->visualIndices[i] += insertCount;
executed: d->visualIndices[i] += insertCount;
Execution Count:6022
6022
1769 if (d->logicalIndices.at(i) >= logicalFirst)
evaluated: d->logicalIndices.at(i) >= logicalFirst
TRUEFALSE
yes
Evaluation Count:6022
yes
Evaluation Count:6116
6022-6116
1770 d->logicalIndices[i] += insertCount;
executed: d->logicalIndices[i] += insertCount;
Execution Count:6022
6022
1771 }
executed: }
Execution Count:12138
12138
1772 for (int j = logicalFirst; j <= logicalLast; ++j) {
evaluated: j <= logicalLast
TRUEFALSE
yes
Evaluation Count:4194
yes
Evaluation Count:26
26-4194
1773 d->visualIndices.insert(j, j);
executed (the execution status of this line is deduced): d->visualIndices.insert(j, j);
-
1774 d->logicalIndices.insert(j, j);
executed (the execution status of this line is deduced): d->logicalIndices.insert(j, j);
-
1775 }
executed: }
Execution Count:4194
4194
1776 }
executed: }
Execution Count:26
26
1777 -
1778 // insert sections into sectionsHidden -
1779 if (!d->sectionHidden.isEmpty()) {
evaluated: !d->sectionHidden.isEmpty()
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:13540
15-13540
1780 QBitArray sectionHidden(d->sectionHidden);
executed (the execution status of this line is deduced): QBitArray sectionHidden(d->sectionHidden);
-
1781 sectionHidden.resize(sectionHidden.count() + insertCount);
executed (the execution status of this line is deduced): sectionHidden.resize(sectionHidden.count() + insertCount);
-
1782 sectionHidden.fill(false, logicalFirst, logicalLast + 1);
executed (the execution status of this line is deduced): sectionHidden.fill(false, logicalFirst, logicalLast + 1);
-
1783 for (int j = logicalLast + 1; j < sectionHidden.count(); ++j)
evaluated: j < sectionHidden.count()
TRUEFALSE
yes
Evaluation Count:2036
yes
Evaluation Count:15
15-2036
1784 //here we simply copy the old sectionHidden -
1785 sectionHidden.setBit(j, d->sectionHidden.testBit(j - insertCount));
executed: sectionHidden.setBit(j, d->sectionHidden.testBit(j - insertCount));
Execution Count:2036
2036
1786 d->sectionHidden = sectionHidden;
executed (the execution status of this line is deduced): d->sectionHidden = sectionHidden;
-
1787 }
executed: }
Execution Count:15
15
1788 -
1789 // insert sections into hiddenSectionSize -
1790 QHash<int, int> newHiddenSectionSize; // from logical index to section size
executed (the execution status of this line is deduced): QHash<int, int> newHiddenSectionSize;
-
1791 for (int i = 0; i < logicalFirst; ++i)
evaluated: i < logicalFirst
TRUEFALSE
yes
Evaluation Count:3252532
yes
Evaluation Count:13555
13555-3252532
1792 if (isSectionHidden(i))
evaluated: isSectionHidden(i)
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:3252522
10-3252522
1793 newHiddenSectionSize[i] = d->hiddenSectionSize[i];
executed: newHiddenSectionSize[i] = d->hiddenSectionSize[i];
Execution Count:10
10
1794 for (int j = logicalLast + 1; j < d->sectionCount(); ++j)
evaluated: j < d->sectionCount()
TRUEFALSE
yes
Evaluation Count:6569
yes
Evaluation Count:13555
6569-13555
1795 if (isSectionHidden(j))
evaluated: isSectionHidden(j)
TRUEFALSE
yes
Evaluation Count:547
yes
Evaluation Count:6022
547-6022
1796 newHiddenSectionSize[j] = d->hiddenSectionSize[j - insertCount];
executed: newHiddenSectionSize[j] = d->hiddenSectionSize[j - insertCount];
Execution Count:547
547
1797 d->hiddenSectionSize = newHiddenSectionSize;
executed (the execution status of this line is deduced): d->hiddenSectionSize = newHiddenSectionSize;
-
1798 -
1799 d->doDelayedResizeSections();
executed (the execution status of this line is deduced): d->doDelayedResizeSections();
-
1800 emit sectionCountChanged(oldCount, count());
executed (the execution status of this line is deduced): sectionCountChanged(oldCount, count());
-
1801 -
1802 // if the new sections were not updated by resizing, we need to update now -
1803 if (!d->hasAutoResizeSections())
evaluated: !d->hasAutoResizeSections()
TRUEFALSE
yes
Evaluation Count:13489
yes
Evaluation Count:66
66-13489
1804 d->viewport->update();
executed: d->viewport->update();
Execution Count:13489
13489
1805}
executed: }
Execution Count:13555
13555
1806 -
1807/*! -
1808 This slot is called when sections are removed from the \a parent. -
1809 \a logicalFirst and \a logicalLast signify where the sections were removed. -
1810 -
1811 If only one section is removed, \a logicalFirst and \a logicalLast will -
1812 be the same. -
1813*/ -
1814 -
1815void QHeaderView::sectionsAboutToBeRemoved(const QModelIndex &parent, -
1816 int logicalFirst, int logicalLast) -
1817{ -
1818 Q_UNUSED(parent);
executed (the execution status of this line is deduced): (void)parent;;
-
1819 Q_UNUSED(logicalFirst);
executed (the execution status of this line is deduced): (void)logicalFirst;;
-
1820 Q_UNUSED(logicalLast);
executed (the execution status of this line is deduced): (void)logicalLast;;
-
1821}
executed: }
Execution Count:234
234
1822 -
1823void QHeaderViewPrivate::updateHiddenSections(int logicalFirst, int logicalLast) -
1824{ -
1825 Q_Q(QHeaderView);
executed (the execution status of this line is deduced): QHeaderView * const q = q_func();
-
1826 const int changeCount = logicalLast - logicalFirst + 1;
executed (the execution status of this line is deduced): const int changeCount = logicalLast - logicalFirst + 1;
-
1827 -
1828 // remove sections from hiddenSectionSize -
1829 QHash<int, int> newHiddenSectionSize; // from logical index to section size
executed (the execution status of this line is deduced): QHash<int, int> newHiddenSectionSize;
-
1830 for (int i = 0; i < logicalFirst; ++i)
evaluated: i < logicalFirst
TRUEFALSE
yes
Evaluation Count:6645
yes
Evaluation Count:297
297-6645
1831 if (q->isSectionHidden(i))
evaluated: q->isSectionHidden(i)
TRUEFALSE
yes
Evaluation Count:544
yes
Evaluation Count:6101
544-6101
1832 newHiddenSectionSize[i] = hiddenSectionSize[i];
executed: newHiddenSectionSize[i] = hiddenSectionSize[i];
Execution Count:544
544
1833 for (int j = logicalLast + 1; j < sectionCount(); ++j)
evaluated: j < sectionCount()
TRUEFALSE
yes
Evaluation Count:6256
yes
Evaluation Count:297
297-6256
1834 if (q->isSectionHidden(j))
evaluated: q->isSectionHidden(j)
TRUEFALSE
yes
Evaluation Count:542
yes
Evaluation Count:5714
542-5714
1835 newHiddenSectionSize[j - changeCount] = hiddenSectionSize[j];
executed: newHiddenSectionSize[j - changeCount] = hiddenSectionSize[j];
Execution Count:542
542
1836 hiddenSectionSize = newHiddenSectionSize;
executed (the execution status of this line is deduced): hiddenSectionSize = newHiddenSectionSize;
-
1837 -
1838 // remove sections from sectionsHidden -
1839 if (!sectionHidden.isEmpty()) {
evaluated: !sectionHidden.isEmpty()
TRUEFALSE
yes
Evaluation Count:21
yes
Evaluation Count:276
21-276
1840 const int newsize = qMin(sectionCount() - changeCount, sectionHidden.size());
executed (the execution status of this line is deduced): const int newsize = qMin(sectionCount() - changeCount, sectionHidden.size());
-
1841 QBitArray newSectionHidden(newsize);
executed (the execution status of this line is deduced): QBitArray newSectionHidden(newsize);
-
1842 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
1843 const int logical = logicalIndex(j);
executed (the execution status of this line is deduced): const int logical = logicalIndex(j);
-
1844 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
1845 newSectionHidden[k++] = sectionHidden[j];
executed (the execution status of this line is deduced): newSectionHidden[k++] = sectionHidden[j];
-
1846 }
executed: }
Execution Count:4112
4112
1847 }
executed: }
Execution Count:6242
6242
1848 sectionHidden = newSectionHidden;
executed (the execution status of this line is deduced): sectionHidden = newSectionHidden;
-
1849 }
executed: }
Execution Count:21
21
1850}
executed: }
Execution Count:297
297
1851 -
1852void QHeaderViewPrivate::_q_sectionsRemoved(const QModelIndex &parent, -
1853 int logicalFirst, int logicalLast) -
1854{ -
1855 Q_Q(QHeaderView);
executed (the execution status of this line is deduced): QHeaderView * const q = q_func();
-
1856 if (parent != root)
partially evaluated: parent != root
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:234
0-234
1857 return; // we only handle changes in the root level
never executed: return;
0
1858 if (qMin(logicalFirst, logicalLast) < 0
partially evaluated: qMin(logicalFirst, logicalLast) < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:234
0-234
1859 || qMax(logicalLast, logicalFirst) >= sectionCount())
evaluated: qMax(logicalLast, logicalFirst) >= sectionCount()
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:230
4-230
1860 return;
executed: return;
Execution Count:4
4
1861 int oldCount = q->count();
executed (the execution status of this line is deduced): int oldCount = q->count();
-
1862 int changeCount = logicalLast - logicalFirst + 1;
executed (the execution status of this line is deduced): int changeCount = logicalLast - logicalFirst + 1;
-
1863 -
1864 if (state == QHeaderViewPrivate::ResizeSection)
partially evaluated: state == QHeaderViewPrivate::ResizeSection
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:230
0-230
1865 preventCursorChangeInSetOffset = true;
never executed: preventCursorChangeInSetOffset = true;
0
1866 -
1867 updateHiddenSections(logicalFirst, logicalLast);
executed (the execution status of this line is deduced): updateHiddenSections(logicalFirst, logicalLast);
-
1868 -
1869 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
1870 //Q_ASSERT(headerSectionCount() == sectionCount); -
1871 removeSectionsFromSectionItems(logicalFirst, logicalLast);
executed (the execution status of this line is deduced): removeSectionsFromSectionItems(logicalFirst, logicalLast);
-
1872 } else {
executed: }
Execution Count:201
201
1873 if (logicalFirst == logicalLast) { // Remove just one index.
evaluated: logicalFirst == logicalLast
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:25
4-25
1874 int l = logicalFirst;
executed (the execution status of this line is deduced): int l = logicalFirst;
-
1875 int visual = visualIndices.at(l);
executed (the execution status of this line is deduced): int visual = visualIndices.at(l);
-
1876 Q_ASSERT(sectionCount() == logicalIndices.count());
executed (the execution status of this line is deduced): qt_noop();
-
1877 for (int v = 0; v < sectionCount(); ++v) {
evaluated: v < sectionCount()
TRUEFALSE
yes
Evaluation Count:2000
yes
Evaluation Count:4
4-2000
1878 if (v > visual) {
evaluated: v > visual
TRUEFALSE
yes
Evaluation Count:1976
yes
Evaluation Count:24
24-1976
1879 int logical = logicalIndices.at(v);
executed (the execution status of this line is deduced): int logical = logicalIndices.at(v);
-
1880 --(visualIndices[logical]);
executed (the execution status of this line is deduced): --(visualIndices[logical]);
-
1881 }
executed: }
Execution Count:1976
1976
1882 if (logicalIndex(v) > l) // no need to move the positions before l
evaluated: logicalIndex(v) > l
TRUEFALSE
yes
Evaluation Count:1996
yes
Evaluation Count:4
4-1996
1883 --(logicalIndices[v]);
executed: --(logicalIndices[v]);
Execution Count:1996
1996
1884 }
executed: }
Execution Count:2000
2000
1885 logicalIndices.remove(visual);
executed (the execution status of this line is deduced): logicalIndices.remove(visual);
-
1886 visualIndices.remove(l);
executed (the execution status of this line is deduced): visualIndices.remove(l);
-
1887 //Q_ASSERT(headerSectionCount() == sectionCount); -
1888 removeSectionsFromSectionItems(visual, visual);
executed (the execution status of this line is deduced): removeSectionsFromSectionItems(visual, visual);
-
1889 } else {
executed: }
Execution Count:4
4
1890 sectionStartposRecalc = true; // We will need to recalc positions after removing items
executed (the execution status of this line is deduced): sectionStartposRecalc = true;
-
1891 for (int u = 0; u < sectionItems.count(); ++u) // Store section info
evaluated: u < sectionItems.count()
TRUEFALSE
yes
Evaluation Count:12091
yes
Evaluation Count:25
25-12091
1892 sectionItems.at(u).tmpLogIdx = logicalIndices.at(u);
executed: sectionItems.at(u).tmpLogIdx = logicalIndices.at(u);
Execution Count:12091
12091
1893 for (int v = sectionItems.count() - 1; v >= 0; --v) { // Remove the sections
evaluated: v >= 0
TRUEFALSE
yes
Evaluation Count:12091
yes
Evaluation Count:25
25-12091
1894 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
1895 removeSectionsFromSectionItems(v, v);
executed: removeSectionsFromSectionItems(v, v);
Execution Count:2103
2103
1896 }
executed: }
Execution Count:12091
12091
1897 visualIndices.resize(sectionItems.count());
executed (the execution status of this line is deduced): visualIndices.resize(sectionItems.count());
-
1898 logicalIndices.resize(sectionItems.count());
executed (the execution status of this line is deduced): logicalIndices.resize(sectionItems.count());
-
1899 int* visual_data = visualIndices.data();
executed (the execution status of this line is deduced): int* visual_data = visualIndices.data();
-
1900 int* logical_data = logicalIndices.data();
executed (the execution status of this line is deduced): int* logical_data = logicalIndices.data();
-
1901 for (int w = 0; w < sectionItems.count(); ++w) { // Restore visual and logical indexes
evaluated: w < sectionItems.count()
TRUEFALSE
yes
Evaluation Count:9988
yes
Evaluation Count:25
25-9988
1902 int logindex = sectionItems.at(w).tmpLogIdx;
executed (the execution status of this line is deduced): int logindex = sectionItems.at(w).tmpLogIdx;
-
1903 if (logindex > logicalFirst)
evaluated: logindex > logicalFirst
TRUEFALSE
yes
Evaluation Count:3964
yes
Evaluation Count:6024
3964-6024
1904 logindex -= changeCount;
executed: logindex -= changeCount;
Execution Count:3964
3964
1905 visual_data[logindex] = w;
executed (the execution status of this line is deduced): visual_data[logindex] = w;
-
1906 logical_data[w] = logindex;
executed (the execution status of this line is deduced): logical_data[w] = logindex;
-
1907 }
executed: }
Execution Count:9988
9988
1908 }
executed: }
Execution Count:25
25
1909 // ### handle sectionSelection (sectionHidden is handled by updateHiddenSections) -
1910 } -
1911 -
1912 // update sorting column -
1913 if (sortIndicatorSection >= logicalFirst) {
evaluated: sortIndicatorSection >= logicalFirst
TRUEFALSE
yes
Evaluation Count:203
yes
Evaluation Count:27
27-203
1914 if (sortIndicatorSection <= logicalLast)
evaluated: sortIndicatorSection <= logicalLast
TRUEFALSE
yes
Evaluation Count:22
yes
Evaluation Count:181
22-181
1915 sortIndicatorSection = -1;
executed: sortIndicatorSection = -1;
Execution Count:22
22
1916 else -
1917 sortIndicatorSection -= changeCount;
executed: sortIndicatorSection -= changeCount;
Execution Count:181
181
1918 } -
1919 -
1920 // if we only have the last section (the "end" position) left, the header is empty -
1921 if (sectionCount() <= 0)
evaluated: sectionCount() <= 0
TRUEFALSE
yes
Evaluation Count:35
yes
Evaluation Count:195
35-195
1922 clear();
executed: clear();
Execution Count:35
35
1923 invalidateCachedSizeHint();
executed (the execution status of this line is deduced): invalidateCachedSizeHint();
-
1924 emit q->sectionCountChanged(oldCount, q->count());
executed (the execution status of this line is deduced): q->sectionCountChanged(oldCount, q->count());
-
1925 viewport->update();
executed (the execution status of this line is deduced): viewport->update();
-
1926}
executed: }
Execution Count:230
230
1927 -
1928void QHeaderViewPrivate::_q_layoutAboutToBeChanged() -
1929{ -
1930 //if there is no row/column we can't have mapping for columns -
1931 //because no QModelIndex in the model would be valid -
1932 // ### this is far from being bullet-proof and we would need a real system to -
1933 // ### map columns or rows persistently -
1934 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
1935 || model->columnCount(root) == 0)
evaluated: model->columnCount(root) == 0
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:728
1-728
1936 return;
executed: return;
Execution Count:327
327
1937 -
1938 for (int i = 0; i < sectionHidden.count(); ++i)
evaluated: i < sectionHidden.count()
TRUEFALSE
yes
Evaluation Count:64
yes
Evaluation Count:728
64-728
1939 if (sectionHidden.testBit(i)) // ### note that we are using column or row 0
evaluated: sectionHidden.testBit(i)
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:50
14-50
1940 persistentHiddenSections.append(orientation == Qt::Horizontal
executed: persistentHiddenSections.append(orientation == Qt::Horizontal ? model->index(0, logicalIndex(i), root) : model->index(logicalIndex(i), 0, root));
Execution Count:14
14
1941 ? model->index(0, logicalIndex(i), root)
executed: persistentHiddenSections.append(orientation == Qt::Horizontal ? model->index(0, logicalIndex(i), root) : model->index(logicalIndex(i), 0, root));
Execution Count:14
14
1942 : 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
1943}
executed: }
Execution Count:728
728
1944 -
1945void QHeaderViewPrivate::_q_layoutChanged() -
1946{ -
1947 Q_Q(QHeaderView);
executed (the execution status of this line is deduced): QHeaderView * const q = q_func();
-
1948 viewport->update();
executed (the execution status of this line is deduced): viewport->update();
-
1949 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
1950 if (modelSectionCount() != sectionCount())
evaluated: modelSectionCount() != sectionCount()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:205
2-205
1951 q->initializeSections();
executed: q->initializeSections();
Execution Count:2
2
1952 persistentHiddenSections.clear();
executed (the execution status of this line is deduced): persistentHiddenSections.clear();
-
1953 return;
executed: return;
Execution Count:207
207
1954 } -
1955 -
1956 QBitArray oldSectionHidden = sectionHidden;
executed (the execution status of this line is deduced): QBitArray oldSectionHidden = sectionHidden;
-
1957 bool sectionCountChanged = false;
executed (the execution status of this line is deduced): bool sectionCountChanged = false;
-
1958 -
1959 for (int i = 0; i < persistentHiddenSections.count(); ++i) {
evaluated: i < persistentHiddenSections.count()
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:8
8-14
1960 QModelIndex index = persistentHiddenSections.at(i);
never executed (the execution status of this line is deduced): QModelIndex index = persistentHiddenSections.at(i);
-
1961 if (index.isValid()) {
partially evaluated: index.isValid()
TRUEFALSE
yes
Evaluation Count:14
no
Evaluation Count:0
0-14
1962 const int logical = (orientation == Qt::Horizontal
evaluated: orientation == Qt::Horizontal
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:4
4-10
1963 ? index.column()
executed (the execution status of this line is deduced): ? index.column()
-
1964 : index.row());
executed (the execution status of this line is deduced): : index.row());
-
1965 q->setSectionHidden(logical, true);
executed (the execution status of this line is deduced): q->setSectionHidden(logical, true);
-
1966 oldSectionHidden.setBit(logical, false);
executed (the execution status of this line is deduced): oldSectionHidden.setBit(logical, false);
-
1967 } else if (!sectionCountChanged && (modelSectionCount() != sectionCount())) {
executed: }
Execution Count:14
never evaluated: !sectionCountChanged
never evaluated: (modelSectionCount() != sectionCount())
0-14
1968 sectionCountChanged = true;
never executed (the execution status of this line is deduced): sectionCountChanged = true;
-
1969 break;
never executed: break;
0
1970 } -
1971 } -
1972 persistentHiddenSections.clear();
executed (the execution status of this line is deduced): persistentHiddenSections.clear();
-
1973 -
1974 for (int i = 0; i < oldSectionHidden.count(); ++i) {
evaluated: i < oldSectionHidden.count()
TRUEFALSE
yes
Evaluation Count:64
yes
Evaluation Count:8
8-64
1975 if (oldSectionHidden.testBit(i))
evaluated: oldSectionHidden.testBit(i)
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:61
3-61
1976 q->setSectionHidden(i, false);
executed: q->setSectionHidden(i, false);
Execution Count:3
3
1977 }
executed: }
Execution Count:64
64
1978 -
1979 // the number of sections changed; we need to reread the state of the model -
1980 if (sectionCountChanged)
partially evaluated: sectionCountChanged
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
1981 q->initializeSections();
never executed: q->initializeSections();
0
1982}
executed: }
Execution Count:8
8
1983 -
1984/*! -
1985 \internal -
1986*/ -
1987 -
1988void QHeaderView::initializeSections() -
1989{ -
1990 Q_D(QHeaderView);
executed (the execution status of this line is deduced): QHeaderViewPrivate * const d = d_func();
-
1991 const int oldCount = d->sectionCount();
executed (the execution status of this line is deduced): const int oldCount = d->sectionCount();
-
1992 const int newCount = d->modelSectionCount();
executed (the execution status of this line is deduced): const int newCount = d->modelSectionCount();
-
1993 if (newCount <= 0) {
evaluated: newCount <= 0
TRUEFALSE
yes
Evaluation Count:3927
yes
Evaluation Count:8587
3927-8587
1994 d->clear();
executed (the execution status of this line is deduced): d->clear();
-
1995 emit sectionCountChanged(oldCount, 0);
executed (the execution status of this line is deduced): sectionCountChanged(oldCount, 0);
-
1996 } else if (newCount != oldCount) {
executed: }
Execution Count:3927
evaluated: newCount != oldCount
TRUEFALSE
yes
Evaluation Count:1618
yes
Evaluation Count:6969
1618-6969
1997 const int min = qBound(0, oldCount, newCount - 1);
executed (the execution status of this line is deduced): const int min = qBound(0, oldCount, newCount - 1);
-
1998 initializeSections(min, newCount - 1);
executed (the execution status of this line is deduced): initializeSections(min, newCount - 1);
-
1999 if (stretchLastSection()) // we've already gotten the size hint
evaluated: stretchLastSection()
TRUEFALSE
yes
Evaluation Count:440
yes
Evaluation Count:1178
440-1178
2000 d->lastSectionSize = sectionSize(logicalIndex(d->sectionCount() - 1));
executed: d->lastSectionSize = sectionSize(logicalIndex(d->sectionCount() - 1));
Execution Count:440
440
2001 -
2002 //make sure we update the hidden sections -
2003 if (newCount < oldCount)
evaluated: newCount < oldCount
TRUEFALSE
yes
Evaluation Count:67
yes
Evaluation Count:1551
67-1551
2004 d->updateHiddenSections(0, newCount-1);
executed: d->updateHiddenSections(0, newCount-1);
Execution Count:67
67
2005 }
executed: }
Execution Count:1618
1618
2006} -
2007 -
2008/*! -
2009 \internal -
2010*/ -
2011 -
2012void QHeaderView::initializeSections(int start, int end) -
2013{ -
2014 Q_D(QHeaderView);
executed (the execution status of this line is deduced): QHeaderViewPrivate * const d = d_func();
-
2015 -
2016 Q_ASSERT(start >= 0);
executed (the execution status of this line is deduced): qt_noop();
-
2017 Q_ASSERT(end >= 0);
executed (the execution status of this line is deduced): qt_noop();
-
2018 -
2019 d->invalidateCachedSizeHint();
executed (the execution status of this line is deduced): d->invalidateCachedSizeHint();
-
2020 int oldCount = d->sectionCount();
executed (the execution status of this line is deduced): int oldCount = d->sectionCount();
-
2021 -
2022 if (end + 1 < d->sectionCount()) {
evaluated: end + 1 < d->sectionCount()
TRUEFALSE
yes
Evaluation Count:67
yes
Evaluation Count:1551
67-1551
2023 int newCount = end + 1;
executed (the execution status of this line is deduced): int newCount = end + 1;
-
2024 d->removeSectionsFromSectionItems(newCount, d->sectionCount() - 1);
executed (the execution status of this line is deduced): d->removeSectionsFromSectionItems(newCount, d->sectionCount() - 1);
-
2025 if (!d->hiddenSectionSize.isEmpty()) {
evaluated: !d->hiddenSectionSize.isEmpty()
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:61
6-61
2026 if (oldCount - newCount > d->hiddenSectionSize.count()) {
evaluated: oldCount - newCount > d->hiddenSectionSize.count()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:5
1-5
2027 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
2028 d->hiddenSectionSize.remove(i);
never executed: d->hiddenSectionSize.remove(i);
0
2029 } else {
executed: }
Execution Count:1
1
2030 QHash<int, int>::iterator it = d->hiddenSectionSize.begin();
executed (the execution status of this line is deduced): QHash<int, int>::iterator it = d->hiddenSectionSize.begin();
-
2031 while (it != d->hiddenSectionSize.end()) {
evaluated: it != d->hiddenSectionSize.end()
TRUEFALSE
yes
Evaluation Count:574
yes
Evaluation Count:5
5-574
2032 if (it.key() > end)
evaluated: it.key() > end
TRUEFALSE
yes
Evaluation Count:30
yes
Evaluation Count:544
30-544
2033 it = d->hiddenSectionSize.erase(it);
executed: it = d->hiddenSectionSize.erase(it);
Execution Count:30
30
2034 else -
2035 ++it;
executed: ++it;
Execution Count:544
544
2036 } -
2037 }
executed: }
Execution Count:5
5
2038 } -
2039 }
executed: }
Execution Count:67
67
2040 -
2041 int newSectionCount = end + 1;
executed (the execution status of this line is deduced): int newSectionCount = end + 1;
-
2042 -
2043 if (!d->logicalIndices.isEmpty()) {
evaluated: !d->logicalIndices.isEmpty()
TRUEFALSE
yes
Evaluation Count:29
yes
Evaluation Count:1589
29-1589
2044 if (oldCount <= newSectionCount) {
evaluated: oldCount <= newSectionCount
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:15
14-15
2045 d->logicalIndices.resize(newSectionCount);
executed (the execution status of this line is deduced): d->logicalIndices.resize(newSectionCount);
-
2046 d->visualIndices.resize(newSectionCount);
executed (the execution status of this line is deduced): d->visualIndices.resize(newSectionCount);
-
2047 for (int i = oldCount; i < newSectionCount; ++i) {
evaluated: i < newSectionCount
TRUEFALSE
yes
Evaluation Count:76
yes
Evaluation Count:14
14-76
2048 d->logicalIndices[i] = i;
executed (the execution status of this line is deduced): d->logicalIndices[i] = i;
-
2049 d->visualIndices[i] = i;
executed (the execution status of this line is deduced): d->visualIndices[i] = i;
-
2050 }
executed: }
Execution Count:76
76
2051 } else {
executed: }
Execution Count:14
14
2052 int j = 0;
executed (the execution status of this line is deduced): int j = 0;
-
2053 for (int i = 0; i < oldCount; ++i) {
evaluated: i < oldCount
TRUEFALSE
yes
Evaluation Count:6077
yes
Evaluation Count:15
15-6077
2054 int v = d->logicalIndices.at(i);
executed (the execution status of this line is deduced): int v = d->logicalIndices.at(i);
-
2055 if (v < newSectionCount) {
evaluated: v < newSectionCount
TRUEFALSE
yes
Evaluation Count:6013
yes
Evaluation Count:64
64-6013
2056 d->logicalIndices[j] = v;
executed (the execution status of this line is deduced): d->logicalIndices[j] = v;
-
2057 d->visualIndices[v] = j;
executed (the execution status of this line is deduced): d->visualIndices[v] = j;
-
2058 j++;
executed (the execution status of this line is deduced): j++;
-
2059 }
executed: }
Execution Count:6013
6013
2060 }
executed: }
Execution Count:6077
6077
2061 d->logicalIndices.resize(newSectionCount);
executed (the execution status of this line is deduced): d->logicalIndices.resize(newSectionCount);
-
2062 d->visualIndices.resize(newSectionCount);
executed (the execution status of this line is deduced): d->visualIndices.resize(newSectionCount);
-
2063 }
executed: }
Execution Count:15
15
2064 } -
2065 -
2066 if (d->globalResizeMode == Stretch)
partially evaluated: d->globalResizeMode == Stretch
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1618
0-1618
2067 d->stretchSections = newSectionCount;
never executed: d->stretchSections = newSectionCount;
0
2068 else if (d->globalResizeMode == ResizeToContents)
evaluated: d->globalResizeMode == ResizeToContents
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1617
1-1617
2069 d->contentsSections = newSectionCount;
executed: d->contentsSections = newSectionCount;
Execution Count:1
1
2070 if (!d->sectionHidden.isEmpty())
evaluated: !d->sectionHidden.isEmpty()
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:1608
10-1608
2071 d->sectionHidden.resize(newSectionCount);
executed: d->sectionHidden.resize(newSectionCount);
Execution Count:10
10
2072 -
2073 if (newSectionCount > oldCount)
evaluated: newSectionCount > oldCount
TRUEFALSE
yes
Evaluation Count:1551
yes
Evaluation Count:67
67-1551
2074 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
2075 //Q_ASSERT(d->headerLength() == d->length); -
2076 -
2077 if (d->sectionCount() != oldCount)
partially evaluated: d->sectionCount() != oldCount
TRUEFALSE
yes
Evaluation Count:1618
no
Evaluation Count:0
0-1618
2078 emit sectionCountChanged(oldCount, d->sectionCount());
executed: sectionCountChanged(oldCount, d->sectionCount());
Execution Count:1618
1618
2079 d->viewport->update();
executed (the execution status of this line is deduced): d->viewport->update();
-
2080}
executed: }
Execution Count:1618
1618
2081 -
2082/*! -
2083 \reimp -
2084*/ -
2085 -
2086void QHeaderView::currentChanged(const QModelIndex &current, const QModelIndex &old) -
2087{ -
2088 Q_D(QHeaderView);
executed (the execution status of this line is deduced): QHeaderViewPrivate * const d = d_func();
-
2089 -
2090 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
2091 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
2092 d->viewport->update(QRect(sectionViewportPosition(old.column()), 0,
executed: d->viewport->update(QRect(sectionViewportPosition(old.column()), 0, sectionSize(old.column()), d->viewport->height()));
Execution Count:1134
1134
2093 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
2094 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
2095 d->viewport->update(QRect(sectionViewportPosition(current.column()), 0,
executed: d->viewport->update(QRect(sectionViewportPosition(current.column()), 0, sectionSize(current.column()), d->viewport->height()));
Execution Count:1400
1400
2096 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
2097 } 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
2098 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
2099 d->viewport->update(QRect(0, sectionViewportPosition(old.row()),
executed: d->viewport->update(QRect(0, sectionViewportPosition(old.row()), d->viewport->width(), sectionSize(old.row())));
Execution Count:983
983
2100 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
2101 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
2102 d->viewport->update(QRect(0, sectionViewportPosition(current.row()),
executed: d->viewport->update(QRect(0, sectionViewportPosition(current.row()), d->viewport->width(), sectionSize(current.row())));
Execution Count:1152
1152
2103 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
2104 }
executed: }
Execution Count:1755
1755
2105} -
2106 -
2107 -
2108/*! -
2109 \reimp -
2110*/ -
2111 -
2112bool QHeaderView::event(QEvent *e) -
2113{ -
2114 Q_D(QHeaderView);
executed (the execution status of this line is deduced): QHeaderViewPrivate * const d = d_func();
-
2115 switch (e->type()) { -
2116 case QEvent::HoverEnter: { -
2117 QHoverEvent *he = static_cast<QHoverEvent*>(e);
executed (the execution status of this line is deduced): QHoverEvent *he = static_cast<QHoverEvent*>(e);
-
2118 d->hover = logicalIndexAt(he->pos());
executed (the execution status of this line is deduced): d->hover = logicalIndexAt(he->pos());
-
2119 if (d->hover != -1)
partially evaluated: d->hover != -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
2120 updateSection(d->hover);
never executed: updateSection(d->hover);
0
2121 break; }
executed: break;
Execution Count:2
2
2122 case QEvent::Leave: -
2123 case QEvent::HoverLeave: { -
2124 if (d->hover != -1)
partially evaluated: d->hover != -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
2125 updateSection(d->hover);
never executed: updateSection(d->hover);
0
2126 d->hover = -1;
executed (the execution status of this line is deduced): d->hover = -1;
-
2127 break; }
executed: break;
Execution Count:5
5
2128 case QEvent::HoverMove: { -
2129 QHoverEvent *he = static_cast<QHoverEvent*>(e);
executed (the execution status of this line is deduced): QHoverEvent *he = static_cast<QHoverEvent*>(e);
-
2130 int oldHover = d->hover;
executed (the execution status of this line is deduced): int oldHover = d->hover;
-
2131 d->hover = logicalIndexAt(he->pos());
executed (the execution status of this line is deduced): d->hover = logicalIndexAt(he->pos());
-
2132 if (d->hover != oldHover) {
partially evaluated: d->hover != oldHover
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
2133 if (oldHover != -1)
never evaluated: oldHover != -1
0
2134 updateSection(oldHover);
never executed: updateSection(oldHover);
0
2135 if (d->hover != -1)
never evaluated: d->hover != -1
0
2136 updateSection(d->hover);
never executed: updateSection(d->hover);
0
2137 }
never executed: }
0
2138 break; }
executed: break;
Execution Count:2
2
2139 case QEvent::Timer: { -
2140 QTimerEvent *te = static_cast<QTimerEvent*>(e);
executed (the execution status of this line is deduced): QTimerEvent *te = static_cast<QTimerEvent*>(e);
-
2141 if (te->timerId() == d->delayedResize.timerId()) {
evaluated: te->timerId() == d->delayedResize.timerId()
TRUEFALSE
yes
Evaluation Count:103
yes
Evaluation Count:17
17-103
2142 d->delayedResize.stop();
executed (the execution status of this line is deduced): d->delayedResize.stop();
-
2143 resizeSections();
executed (the execution status of this line is deduced): resizeSections();
-
2144 }
executed: }
Execution Count:103
103
2145 break; }
executed: break;
Execution Count:120
120
2146 default: -
2147 break;
executed: break;
Execution Count:17408
17408
2148 } -
2149 return QAbstractItemView::event(e);
executed: return QAbstractItemView::event(e);
Execution Count:17537
17537
2150} -
2151 -
2152/*! -
2153 \reimp -
2154*/ -
2155 -
2156void QHeaderView::paintEvent(QPaintEvent *e) -
2157{ -
2158 Q_D(QHeaderView);
executed (the execution status of this line is deduced): QHeaderViewPrivate * const d = d_func();
-
2159 -
2160 if (count() == 0)
evaluated: count() == 0
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:813
4-813
2161 return;
executed: return;
Execution Count:4
4
2162 -
2163 QPainter painter(d->viewport);
executed (the execution status of this line is deduced): QPainter painter(d->viewport);
-
2164 const QPoint offset = d->scrollDelayOffset;
executed (the execution status of this line is deduced): const QPoint offset = d->scrollDelayOffset;
-
2165 QRect translatedEventRect = e->rect();
executed (the execution status of this line is deduced): QRect translatedEventRect = e->rect();
-
2166 translatedEventRect.translate(offset);
executed (the execution status of this line is deduced): translatedEventRect.translate(offset);
-
2167 -
2168 int start = -1;
executed (the execution status of this line is deduced): int start = -1;
-
2169 int end = -1;
executed (the execution status of this line is deduced): int end = -1;
-
2170 if (d->orientation == Qt::Horizontal) {
evaluated: d->orientation == Qt::Horizontal
TRUEFALSE
yes
Evaluation Count:535
yes
Evaluation Count:278
278-535
2171 start = visualIndexAt(translatedEventRect.left());
executed (the execution status of this line is deduced): start = visualIndexAt(translatedEventRect.left());
-
2172 end = visualIndexAt(translatedEventRect.right());
executed (the execution status of this line is deduced): end = visualIndexAt(translatedEventRect.right());
-
2173 } else {
executed: }
Execution Count:535
535
2174 start = visualIndexAt(translatedEventRect.top());
executed (the execution status of this line is deduced): start = visualIndexAt(translatedEventRect.top());
-
2175 end = visualIndexAt(translatedEventRect.bottom());
executed (the execution status of this line is deduced): end = visualIndexAt(translatedEventRect.bottom());
-
2176 }
executed: }
Execution Count:278
278
2177 -
2178 if (d->reverse()) {
evaluated: d->reverse()
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:806
7-806
2179 start = (start == -1 ? count() - 1 : start);
evaluated: start == -1
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:4
3-4
2180 end = (end == -1 ? 0 : end);
partially evaluated: end == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7
0-7
2181 } else {
executed: }
Execution Count:7
7
2182 start = (start == -1 ? 0 : start);
partially evaluated: start == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:806
0-806
2183 end = (end == -1 ? count() - 1 : end);
evaluated: end == -1
TRUEFALSE
yes
Evaluation Count:75
yes
Evaluation Count:731
75-731
2184 }
executed: }
Execution Count:806
806
2185 -
2186 int tmp = start;
executed (the execution status of this line is deduced): int tmp = start;
-
2187 start = qMin(start, end);
executed (the execution status of this line is deduced): start = qMin(start, end);
-
2188 end = qMax(tmp, end);
executed (the execution status of this line is deduced): end = qMax(tmp, end);
-
2189 -
2190 d->prepareSectionSelected(); // clear and resize the bit array
executed (the execution status of this line is deduced): d->prepareSectionSelected();
-
2191 -
2192 QRect currentSectionRect;
executed (the execution status of this line is deduced): QRect currentSectionRect;
-
2193 int logical;
executed (the execution status of this line is deduced): int logical;
-
2194 const int width = d->viewport->width();
executed (the execution status of this line is deduced): const int width = d->viewport->width();
-
2195 const int height = d->viewport->height();
executed (the execution status of this line is deduced): const int height = d->viewport->height();
-
2196 for (int i = start; i <= end; ++i) {
evaluated: i <= end
TRUEFALSE
yes
Evaluation Count:2007
yes
Evaluation Count:813
813-2007
2197 if (d->isVisualIndexHidden(i))
evaluated: d->isVisualIndexHidden(i)
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:2004
3-2004
2198 continue;
executed: continue;
Execution Count:3
3
2199 painter.save();
executed (the execution status of this line is deduced): painter.save();
-
2200 logical = logicalIndex(i);
executed (the execution status of this line is deduced): logical = logicalIndex(i);
-
2201 if (d->orientation == Qt::Horizontal) {
evaluated: d->orientation == Qt::Horizontal
TRUEFALSE
yes
Evaluation Count:991
yes
Evaluation Count:1013
991-1013
2202 currentSectionRect.setRect(sectionViewportPosition(logical), 0, sectionSize(logical), height);
executed (the execution status of this line is deduced): currentSectionRect.setRect(sectionViewportPosition(logical), 0, sectionSize(logical), height);
-
2203 } else {
executed: }
Execution Count:991
991
2204 currentSectionRect.setRect(0, sectionViewportPosition(logical), width, sectionSize(logical));
executed (the execution status of this line is deduced): currentSectionRect.setRect(0, sectionViewportPosition(logical), width, sectionSize(logical));
-
2205 }
executed: }
Execution Count:1013
1013
2206 currentSectionRect.translate(offset);
executed (the execution status of this line is deduced): currentSectionRect.translate(offset);
-
2207 -
2208 QVariant variant = d->model->headerData(logical, d->orientation,
executed (the execution status of this line is deduced): QVariant variant = d->model->headerData(logical, d->orientation,
-
2209 Qt::FontRole);
executed (the execution status of this line is deduced): Qt::FontRole);
-
2210 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
2211 QFont sectionFont = qvariant_cast<QFont>(variant);
never executed (the execution status of this line is deduced): QFont sectionFont = qvariant_cast<QFont>(variant);
-
2212 painter.setFont(sectionFont);
never executed (the execution status of this line is deduced): painter.setFont(sectionFont);
-
2213 }
never executed: }
0
2214 paintSection(&painter, currentSectionRect, logical);
executed (the execution status of this line is deduced): paintSection(&painter, currentSectionRect, logical);
-
2215 painter.restore();
executed (the execution status of this line is deduced): painter.restore();
-
2216 }
executed: }
Execution Count:2004
2004
2217 -
2218 QStyleOption opt;
executed (the execution status of this line is deduced): QStyleOption opt;
-
2219 opt.init(this);
executed (the execution status of this line is deduced): opt.init(this);
-
2220 // Paint the area beyond where there are indexes -
2221 if (d->reverse()) {
evaluated: d->reverse()
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:806
7-806
2222 opt.state |= QStyle::State_Horizontal;
executed (the execution status of this line is deduced): opt.state |= QStyle::State_Horizontal;
-
2223 if (currentSectionRect.left() > translatedEventRect.left()) {
partially evaluated: currentSectionRect.left() > translatedEventRect.left()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7
0-7
2224 opt.rect = QRect(translatedEventRect.left(), 0,
never executed (the execution status of this line is deduced): opt.rect = QRect(translatedEventRect.left(), 0,
-
2225 currentSectionRect.left() - translatedEventRect.left(), height);
never executed (the execution status of this line is deduced): currentSectionRect.left() - translatedEventRect.left(), height);
-
2226 style()->drawControl(QStyle::CE_HeaderEmptyArea, &opt, &painter, this);
never executed (the execution status of this line is deduced): style()->drawControl(QStyle::CE_HeaderEmptyArea, &opt, &painter, this);
-
2227 }
never executed: }
0
2228 } 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
2229 // paint to the right -
2230 opt.state |= QStyle::State_Horizontal;
executed (the execution status of this line is deduced): opt.state |= QStyle::State_Horizontal;
-
2231 opt.rect = QRect(currentSectionRect.right() + 1, 0,
executed (the execution status of this line is deduced): opt.rect = QRect(currentSectionRect.right() + 1, 0,
-
2232 translatedEventRect.right() - currentSectionRect.right(), height);
executed (the execution status of this line is deduced): translatedEventRect.right() - currentSectionRect.right(), height);
-
2233 style()->drawControl(QStyle::CE_HeaderEmptyArea, &opt, &painter, this);
executed (the execution status of this line is deduced): style()->drawControl(QStyle::CE_HeaderEmptyArea, &opt, &painter, this);
-
2234 } 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
2235 // paint the bottom section -
2236 opt.state &= ~QStyle::State_Horizontal;
executed (the execution status of this line is deduced): opt.state &= ~QStyle::State_Horizontal;
-
2237 opt.rect = QRect(0, currentSectionRect.bottom() + 1,
executed (the execution status of this line is deduced): opt.rect = QRect(0, currentSectionRect.bottom() + 1,
-
2238 width, height - currentSectionRect.bottom() - 1);
executed (the execution status of this line is deduced): width, height - currentSectionRect.bottom() - 1);
-
2239 style()->drawControl(QStyle::CE_HeaderEmptyArea, &opt, &painter, this);
executed (the execution status of this line is deduced): style()->drawControl(QStyle::CE_HeaderEmptyArea, &opt, &painter, this);
-
2240 }
executed: }
Execution Count:37
37
2241 -
2242#if 0 -
2243 // ### visualize sections -
2244 for (int a = 0, i = 0; i < d->sectionItems.count(); ++i) { -
2245 QColor color((i & 4 ? 255 : 0), (i & 2 ? 255 : 0), (i & 1 ? 255 : 0)); -
2246 if (d->orientation == Qt::Horizontal) -
2247 painter.fillRect(a - d->offset, 0, d->sectionItems.at(i).size, 4, color); -
2248 else -
2249 painter.fillRect(0, a - d->offset, 4, d->sectionItems.at(i).size, color); -
2250 a += d->sectionItems.at(i).size; -
2251 } -
2252 -
2253#endif -
2254} -
2255 -
2256/*! -
2257 \reimp -
2258*/ -
2259 -
2260void QHeaderView::mousePressEvent(QMouseEvent *e) -
2261{ -
2262 Q_D(QHeaderView);
executed (the execution status of this line is deduced): QHeaderViewPrivate * const d = d_func();
-
2263 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
2264 return;
never executed: return;
0
2265 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
2266 int handle = d->sectionHandleAt(pos);
executed (the execution status of this line is deduced): int handle = d->sectionHandleAt(pos);
-
2267 d->originalSize = -1; // clear the stored original size
executed (the execution status of this line is deduced): d->originalSize = -1;
-
2268 if (handle == -1) {
evaluated: handle == -1
TRUEFALSE
yes
Evaluation Count:156
yes
Evaluation Count:19
19-156
2269 d->pressed = logicalIndexAt(pos);
executed (the execution status of this line is deduced): d->pressed = logicalIndexAt(pos);
-
2270 if (d->clickableSections)
evaluated: d->clickableSections
TRUEFALSE
yes
Evaluation Count:12
yes
Evaluation Count:144
12-144
2271 emit sectionPressed(d->pressed);
executed: sectionPressed(d->pressed);
Execution Count:12
12
2272 -
2273 bool acceptMoveSection = d->movableSections;
executed (the execution status of this line is deduced): bool acceptMoveSection = d->movableSections;
-
2274 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
2275 acceptMoveSection = false; // Do not allow moving the tree nod
never executed: acceptMoveSection = false;
0
2276 -
2277 if (acceptMoveSection) {
evaluated: acceptMoveSection
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:155
1-155
2278 d->section = d->target = d->pressed;
executed (the execution status of this line is deduced): d->section = d->target = d->pressed;
-
2279 if (d->section == -1)
partially evaluated: d->section == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
2280 return;
never executed: return;
0
2281 d->state = QHeaderViewPrivate::MoveSection;
executed (the execution status of this line is deduced): d->state = QHeaderViewPrivate::MoveSection;
-
2282 d->setupSectionIndicator(d->section, pos);
executed (the execution status of this line is deduced): d->setupSectionIndicator(d->section, pos);
-
2283 } 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
2284 updateSection(d->pressed);
executed (the execution status of this line is deduced): updateSection(d->pressed);
-
2285 d->state = QHeaderViewPrivate::SelectSections;
executed (the execution status of this line is deduced): d->state = QHeaderViewPrivate::SelectSections;
-
2286 }
executed: }
Execution Count:11
11
2287 } else if (sectionResizeMode(handle) == Interactive) {
partially evaluated: sectionResizeMode(handle) == Interactive
TRUEFALSE
yes
Evaluation Count:19
no
Evaluation Count:0
0-19
2288 d->originalSize = sectionSize(handle);
executed (the execution status of this line is deduced): d->originalSize = sectionSize(handle);
-
2289 d->state = QHeaderViewPrivate::ResizeSection;
executed (the execution status of this line is deduced): d->state = QHeaderViewPrivate::ResizeSection;
-
2290 d->section = handle;
executed (the execution status of this line is deduced): d->section = handle;
-
2291 d->preventCursorChangeInSetOffset = false;
executed (the execution status of this line is deduced): d->preventCursorChangeInSetOffset = false;
-
2292 }
executed: }
Execution Count:19
19
2293 -
2294 d->firstPos = pos;
executed (the execution status of this line is deduced): d->firstPos = pos;
-
2295 d->lastPos = pos;
executed (the execution status of this line is deduced): d->lastPos = pos;
-
2296 -
2297 d->clearCascadingSections();
executed (the execution status of this line is deduced): d->clearCascadingSections();
-
2298}
executed: }
Execution Count:175
175
2299 -
2300/*! -
2301 \reimp -
2302*/ -
2303 -
2304void QHeaderView::mouseMoveEvent(QMouseEvent *e) -
2305{ -
2306 Q_D(QHeaderView);
executed (the execution status of this line is deduced): QHeaderViewPrivate * const d = d_func();
-
2307 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
2308 if (pos < 0)
partially evaluated: pos < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:85
0-85
2309 return;
never executed: return;
0
2310 if (e->buttons() == Qt::NoButton) {
evaluated: e->buttons() == Qt::NoButton
TRUEFALSE
yes
Evaluation Count:77
yes
Evaluation Count:8
8-77
2311#if !defined(Q_WS_MAC) -
2312 // Under Cocoa, when the mouse button is released, may include an extra -
2313 // simulated mouse moved event. The state of the buttons when this event -
2314 // is generated is already "no button" and the code below gets executed -
2315 // just before the mouseReleaseEvent and resets the state. This prevents -
2316 // column dragging from working. So this code is disabled under Cocoa. -
2317 d->state = QHeaderViewPrivate::NoState;
executed (the execution status of this line is deduced): d->state = QHeaderViewPrivate::NoState;
-
2318 d->pressed = -1;
executed (the execution status of this line is deduced): d->pressed = -1;
-
2319#endif -
2320 }
executed: }
Execution Count:77
77
2321 switch (d->state) { -
2322 case QHeaderViewPrivate::ResizeSection: { -
2323 Q_ASSERT(d->originalSize != -1);
never executed (the execution status of this line is deduced): qt_noop();
-
2324 if (d->cascadingResizing) {
never evaluated: d->cascadingResizing
0
2325 int delta = d->reverse() ? d->lastPos - pos : pos - d->lastPos;
never evaluated: d->reverse()
0
2326 int visual = visualIndex(d->section);
never executed (the execution status of this line is deduced): int visual = visualIndex(d->section);
-
2327 d->cascadingResize(visual, d->headerSectionSize(visual) + delta);
never executed (the execution status of this line is deduced): d->cascadingResize(visual, d->headerSectionSize(visual) + delta);
-
2328 } else {
never executed: }
0
2329 int delta = d->reverse() ? d->firstPos - pos : pos - d->firstPos;
never evaluated: d->reverse()
0
2330 resizeSection(d->section, qMax(d->originalSize + delta, minimumSectionSize()));
never executed (the execution status of this line is deduced): resizeSection(d->section, qMax(d->originalSize + delta, minimumSectionSize()));
-
2331 }
never executed: }
0
2332 d->lastPos = pos;
never executed (the execution status of this line is deduced): d->lastPos = pos;
-
2333 return;
never executed: return;
0
2334 } -
2335 case QHeaderViewPrivate::MoveSection: { -
2336 if (d->shouldAutoScroll(e->pos()))
never evaluated: d->shouldAutoScroll(e->pos())
0
2337 d->startAutoScroll();
never executed: d->startAutoScroll();
0
2338 if (qAbs(pos - d->firstPos) >= QApplication::startDragDistance()
never evaluated: qAbs(pos - d->firstPos) >= QApplication::startDragDistance()
0
2339 || !d->sectionIndicator->isHidden()) {
never evaluated: !d->sectionIndicator->isHidden()
0
2340 int visual = visualIndexAt(pos);
never executed (the execution status of this line is deduced): int visual = visualIndexAt(pos);
-
2341 if (visual == -1)
never evaluated: visual == -1
0
2342 return;
never executed: return;
0
2343 if (visual == 0 && logicalIndex(0) == 0 && !d->allowUserMoveOfSection0)
never evaluated: visual == 0
never evaluated: logicalIndex(0) == 0
never evaluated: !d->allowUserMoveOfSection0
0
2344 return;
never executed: return;
0
2345 -
2346 int posThreshold = d->headerSectionPosition(visual) - d->offset + d->headerSectionSize(visual) / 2;
never executed (the execution status of this line is deduced): int posThreshold = d->headerSectionPosition(visual) - d->offset + d->headerSectionSize(visual) / 2;
-
2347 int moving = visualIndex(d->section);
never executed (the execution status of this line is deduced): int moving = visualIndex(d->section);
-
2348 if (visual < moving) {
never evaluated: visual < moving
0
2349 if (pos < posThreshold)
never evaluated: pos < posThreshold
0
2350 d->target = d->logicalIndex(visual);
never executed: d->target = d->logicalIndex(visual);
0
2351 else -
2352 d->target = d->logicalIndex(visual + 1);
never executed: d->target = d->logicalIndex(visual + 1);
0
2353 } else if (visual > moving) {
never evaluated: visual > moving
0
2354 if (pos > posThreshold)
never evaluated: pos > posThreshold
0
2355 d->target = d->logicalIndex(visual);
never executed: d->target = d->logicalIndex(visual);
0
2356 else -
2357 d->target = d->logicalIndex(visual - 1);
never executed: d->target = d->logicalIndex(visual - 1);
0
2358 } else { -
2359 d->target = d->section;
never executed (the execution status of this line is deduced): d->target = d->section;
-
2360 }
never executed: }
0
2361 d->updateSectionIndicator(d->section, pos);
never executed (the execution status of this line is deduced): d->updateSectionIndicator(d->section, pos);
-
2362 }
never executed: }
0
2363 return;
never executed: return;
0
2364 } -
2365 case QHeaderViewPrivate::SelectSections: { -
2366 int logical = logicalIndexAt(pos);
executed (the execution status of this line is deduced): int logical = logicalIndexAt(pos);
-
2367 if (logical == d->pressed)
partially evaluated: logical == d->pressed
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
2368 return; // nothing to do
never executed: return;
0
2369 else if (d->pressed != -1)
partially evaluated: d->pressed != -1
TRUEFALSE
yes
Evaluation Count:8
no
Evaluation Count:0
0-8
2370 updateSection(d->pressed);
executed: updateSection(d->pressed);
Execution Count:8
8
2371 d->pressed = logical;
executed (the execution status of this line is deduced): d->pressed = logical;
-
2372 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
2373 emit sectionEntered(d->pressed);
executed (the execution status of this line is deduced): sectionEntered(d->pressed);
-
2374 updateSection(d->pressed);
executed (the execution status of this line is deduced): updateSection(d->pressed);
-
2375 }
executed: }
Execution Count:8
8
2376 return;
executed: return;
Execution Count:8
8
2377 } -
2378 case QHeaderViewPrivate::NoState: { -
2379#ifndef QT_NO_CURSOR -
2380 int handle = d->sectionHandleAt(pos);
executed (the execution status of this line is deduced): int handle = d->sectionHandleAt(pos);
-
2381 bool hasCursor = testAttribute(Qt::WA_SetCursor);
executed (the execution status of this line is deduced): bool hasCursor = testAttribute(Qt::WA_SetCursor);
-
2382 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
2383 if (!hasCursor)
evaluated: !hasCursor
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:7
3-7
2384 setCursor(d->orientation == Qt::Horizontal ? Qt::SplitHCursor : Qt::SplitVCursor);
executed: setCursor(d->orientation == Qt::Horizontal ? Qt::SplitHCursor : Qt::SplitVCursor);
Execution Count:3
3
2385 } else if (hasCursor) {
executed: }
Execution Count:10
evaluated: hasCursor
TRUEFALSE
yes
Evaluation Count:40
yes
Evaluation Count:27
10-40
2386 unsetCursor();
executed (the execution status of this line is deduced): unsetCursor();
-
2387 }
executed: }
Execution Count:40
40
2388#endif -
2389 return;
executed: return;
Execution Count:77
77
2390 } -
2391 default: -
2392 break;
never executed: break;
0
2393 } -
2394}
never executed: }
0
2395 -
2396/*! -
2397 \reimp -
2398*/ -
2399 -
2400void QHeaderView::mouseReleaseEvent(QMouseEvent *e) -
2401{ -
2402 Q_D(QHeaderView);
executed (the execution status of this line is deduced): QHeaderViewPrivate * const d = d_func();
-
2403 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
2404 switch (d->state) { -
2405 case QHeaderViewPrivate::MoveSection: -
2406 if (!d->sectionIndicator->isHidden()) { // moving
partially evaluated: !d->sectionIndicator->isHidden()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
2407 int from = visualIndex(d->section);
never executed (the execution status of this line is deduced): int from = visualIndex(d->section);
-
2408 Q_ASSERT(from != -1);
never executed (the execution status of this line is deduced): qt_noop();
-
2409 int to = visualIndex(d->target);
never executed (the execution status of this line is deduced): int to = visualIndex(d->target);
-
2410 Q_ASSERT(to != -1);
never executed (the execution status of this line is deduced): qt_noop();
-
2411 moveSection(from, to);
never executed (the execution status of this line is deduced): moveSection(from, to);
-
2412 d->section = d->target = -1;
never executed (the execution status of this line is deduced): d->section = d->target = -1;
-
2413 d->updateSectionIndicator(d->section, pos);
never executed (the execution status of this line is deduced): d->updateSectionIndicator(d->section, pos);
-
2414 break;
never executed: break;
0
2415 } // not moving -
2416 case QHeaderViewPrivate::SelectSections:
code before this statement executed: case QHeaderViewPrivate::SelectSections:
Execution Count:1
1
2417 if (!d->clickableSections) {
partially evaluated: !d->clickableSections
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:11
0-11
2418 int section = logicalIndexAt(pos);
never executed (the execution status of this line is deduced): int section = logicalIndexAt(pos);
-
2419 updateSection(section);
never executed (the execution status of this line is deduced): updateSection(section);
-
2420 }
never executed: }
0
2421 // fall through -
2422 case QHeaderViewPrivate::NoState:
code before this statement executed: case QHeaderViewPrivate::NoState:
Execution Count:11
11
2423 if (d->clickableSections) {
evaluated: d->clickableSections
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:146
11-146
2424 int section = logicalIndexAt(pos);
executed (the execution status of this line is deduced): int section = logicalIndexAt(pos);
-
2425 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
2426 d->flipSortIndicator(section);
executed (the execution status of this line is deduced): d->flipSortIndicator(section);
-
2427 emit sectionClicked(section);
executed (the execution status of this line is deduced): sectionClicked(section);
-
2428 }
executed: }
Execution Count:11
11
2429 if (d->pressed != -1)
partially evaluated: d->pressed != -1
TRUEFALSE
yes
Evaluation Count:11
no
Evaluation Count:0
0-11
2430 updateSection(d->pressed);
executed: updateSection(d->pressed);
Execution Count:11
11
2431 }
executed: }
Execution Count:11
11
2432 break;
executed: break;
Execution Count:157
157
2433 case QHeaderViewPrivate::ResizeSection: -
2434 d->originalSize = -1;
executed (the execution status of this line is deduced): d->originalSize = -1;
-
2435 d->clearCascadingSections();
executed (the execution status of this line is deduced): d->clearCascadingSections();
-
2436 break;
executed: break;
Execution Count:16
16
2437 default: -
2438 break;
never executed: break;
0
2439 } -
2440 d->state = QHeaderViewPrivate::NoState;
executed (the execution status of this line is deduced): d->state = QHeaderViewPrivate::NoState;
-
2441 d->pressed = -1;
executed (the execution status of this line is deduced): d->pressed = -1;
-
2442}
executed: }
Execution Count:173
173
2443 -
2444/*! -
2445 \reimp -
2446*/ -
2447 -
2448void QHeaderView::mouseDoubleClickEvent(QMouseEvent *e) -
2449{ -
2450 Q_D(QHeaderView);
executed (the execution status of this line is deduced): QHeaderViewPrivate * const d = d_func();
-
2451 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
2452 int handle = d->sectionHandleAt(pos);
executed (the execution status of this line is deduced): int handle = d->sectionHandleAt(pos);
-
2453 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
2454 emit sectionHandleDoubleClicked(handle);
executed (the execution status of this line is deduced): sectionHandleDoubleClicked(handle);
-
2455#ifndef QT_NO_CURSOR -
2456 Qt::CursorShape splitCursor = (d->orientation == Qt::Horizontal)
evaluated: (d->orientation == Qt::Horizontal)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:8
1-8
2457 ? Qt::SplitHCursor : Qt::SplitVCursor;
executed (the execution status of this line is deduced): ? Qt::SplitHCursor : Qt::SplitVCursor;
-
2458 if (cursor().shape() == splitCursor) {
evaluated: cursor().shape() == splitCursor
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:7
2-7
2459 // signal handlers may have changed the section size -
2460 handle = d->sectionHandleAt(pos);
executed (the execution status of this line is deduced): handle = d->sectionHandleAt(pos);
-
2461 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
2462 setCursor(Qt::ArrowCursor);
never executed: setCursor(Qt::ArrowCursor);
0
2463 }
executed: }
Execution Count:2
2
2464#endif -
2465 } else {
executed: }
Execution Count:9
9
2466 emit sectionDoubleClicked(logicalIndexAt(e->pos()));
executed (the execution status of this line is deduced): sectionDoubleClicked(logicalIndexAt(e->pos()));
-
2467 }
executed: }
Execution Count:71
71
2468} -
2469 -
2470/*! -
2471 \reimp -
2472*/ -
2473 -
2474bool QHeaderView::viewportEvent(QEvent *e) -
2475{ -
2476 Q_D(QHeaderView);
executed (the execution status of this line is deduced): QHeaderViewPrivate * const d = d_func();
-
2477 switch (e->type()) { -
2478#ifndef QT_NO_TOOLTIP -
2479 case QEvent::ToolTip: { -
2480 QHelpEvent *he = static_cast<QHelpEvent*>(e);
never executed (the execution status of this line is deduced): QHelpEvent *he = static_cast<QHelpEvent*>(e);
-
2481 int logical = logicalIndexAt(he->pos());
never executed (the execution status of this line is deduced): int logical = logicalIndexAt(he->pos());
-
2482 if (logical != -1) {
never evaluated: logical != -1
0
2483 QVariant variant = d->model->headerData(logical, d->orientation, Qt::ToolTipRole);
never executed (the execution status of this line is deduced): QVariant variant = d->model->headerData(logical, d->orientation, Qt::ToolTipRole);
-
2484 if (variant.isValid()) {
never evaluated: variant.isValid()
0
2485 QToolTip::showText(he->globalPos(), variant.toString(), this);
never executed (the execution status of this line is deduced): QToolTip::showText(he->globalPos(), variant.toString(), this);
-
2486 return true;
never executed: return true;
0
2487 } -
2488 }
never executed: }
0
2489 break; }
never executed: break;
0
2490#endif -
2491#ifndef QT_NO_WHATSTHIS -
2492 case QEvent::QueryWhatsThis: { -
2493 QHelpEvent *he = static_cast<QHelpEvent*>(e);
never executed (the execution status of this line is deduced): QHelpEvent *he = static_cast<QHelpEvent*>(e);
-
2494 int logical = logicalIndexAt(he->pos());
never executed (the execution status of this line is deduced): int logical = logicalIndexAt(he->pos());
-
2495 if (logical != -1
never evaluated: logical != -1
0
2496 && d->model->headerData(logical, d->orientation, Qt::WhatsThisRole).isValid())
never evaluated: d->model->headerData(logical, d->orientation, Qt::WhatsThisRole).isValid()
0
2497 return true;
never executed: return true;
0
2498 break; }
never executed: break;
0
2499 case QEvent::WhatsThis: { -
2500 QHelpEvent *he = static_cast<QHelpEvent*>(e);
never executed (the execution status of this line is deduced): QHelpEvent *he = static_cast<QHelpEvent*>(e);
-
2501 int logical = logicalIndexAt(he->pos());
never executed (the execution status of this line is deduced): int logical = logicalIndexAt(he->pos());
-
2502 if (logical != -1) {
never evaluated: logical != -1
0
2503 QVariant whatsthis = d->model->headerData(logical, d->orientation,
never executed (the execution status of this line is deduced): QVariant whatsthis = d->model->headerData(logical, d->orientation,
-
2504 Qt::WhatsThisRole);
never executed (the execution status of this line is deduced): Qt::WhatsThisRole);
-
2505 if (whatsthis.isValid()) {
never evaluated: whatsthis.isValid()
0
2506 QWhatsThis::showText(he->globalPos(), whatsthis.toString(), this);
never executed (the execution status of this line is deduced): QWhatsThis::showText(he->globalPos(), whatsthis.toString(), this);
-
2507 return true;
never executed: return true;
0
2508 } -
2509 }
never executed: }
0
2510 break; }
never executed: break;
0
2511#endif // QT_NO_WHATSTHIS -
2512#ifndef QT_NO_STATUSTIP -
2513 case QEvent::StatusTip: { -
2514 QHelpEvent *he = static_cast<QHelpEvent*>(e);
never executed (the execution status of this line is deduced): QHelpEvent *he = static_cast<QHelpEvent*>(e);
-
2515 int logical = logicalIndexAt(he->pos());
never executed (the execution status of this line is deduced): int logical = logicalIndexAt(he->pos());
-
2516 if (logical != -1) {
never evaluated: logical != -1
0
2517 QString statustip = d->model->headerData(logical, d->orientation,
never executed (the execution status of this line is deduced): QString statustip = d->model->headerData(logical, d->orientation,
-
2518 Qt::StatusTipRole).toString();
never executed (the execution status of this line is deduced): Qt::StatusTipRole).toString();
-
2519 if (!statustip.isEmpty())
never evaluated: !statustip.isEmpty()
0
2520 setStatusTip(statustip);
never executed: setStatusTip(statustip);
0
2521 }
never executed: }
0
2522 return true; }
never executed: return true;
0
2523#endif // QT_NO_STATUSTIP -
2524 case QEvent::Hide: -
2525 case QEvent::Show: -
2526 case QEvent::FontChange: -
2527 case QEvent::StyleChange:{ -
2528 QAbstractScrollArea *parent = qobject_cast<QAbstractScrollArea *>(parentWidget());
executed (the execution status of this line is deduced): QAbstractScrollArea *parent = qobject_cast<QAbstractScrollArea *>(parentWidget());
-
2529 if (parent && parent->isVisible()) // Only resize if we have a visible parent
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
2530 resizeSections();
executed: resizeSections();
Execution Count:629
629
2531 emit geometriesChanged();
executed (the execution status of this line is deduced): geometriesChanged();
-
2532 break;}
executed: break;
Execution Count:1275
1275
2533 case QEvent::ContextMenu: { -
2534 d->state = QHeaderViewPrivate::NoState;
never executed (the execution status of this line is deduced): d->state = QHeaderViewPrivate::NoState;
-
2535 d->pressed = d->section = d->target = -1;
never executed (the execution status of this line is deduced): d->pressed = d->section = d->target = -1;
-
2536 d->updateSectionIndicator(d->section, -1);
never executed (the execution status of this line is deduced): d->updateSectionIndicator(d->section, -1);
-
2537 break; }
never executed: break;
0
2538 case QEvent::Wheel: { -
2539 QAbstractScrollArea *asa = qobject_cast<QAbstractScrollArea *>(parentWidget());
executed (the execution status of this line is deduced): QAbstractScrollArea *asa = qobject_cast<QAbstractScrollArea *>(parentWidget());
-
2540 if (asa)
partially evaluated: asa
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
2541 return QApplication::sendEvent(asa->viewport(), e);
executed: return QApplication::sendEvent(asa->viewport(), e);
Execution Count:1
1
2542 break; }
never executed: break;
0
2543 default: -
2544 break;
executed: break;
Execution Count:10070
10070
2545 } -
2546 return QAbstractItemView::viewportEvent(e);
executed: return QAbstractItemView::viewportEvent(e);
Execution Count:11345
11345
2547} -
2548 -
2549/*! -
2550 Paints the section specified by the given \a logicalIndex, using the given -
2551 \a painter and \a rect. -
2552 -
2553 Normally, you do not have to call this function. -
2554*/ -
2555 -
2556void QHeaderView::paintSection(QPainter *painter, const QRect &rect, int logicalIndex) const -
2557{ -
2558 Q_D(const QHeaderView);
executed (the execution status of this line is deduced): const QHeaderViewPrivate * const d = d_func();
-
2559 if (!rect.isValid())
partially evaluated: !rect.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2005
0-2005
2560 return;
never executed: return;
0
2561 // get the state of the section -
2562 QStyleOptionHeader opt;
executed (the execution status of this line is deduced): QStyleOptionHeader opt;
-
2563 initStyleOption(&opt);
executed (the execution status of this line is deduced): initStyleOption(&opt);
-
2564 QStyle::State state = QStyle::State_None;
executed (the execution status of this line is deduced): QStyle::State state = QStyle::State_None;
-
2565 if (isEnabled())
partially evaluated: isEnabled()
TRUEFALSE
yes
Evaluation Count:2005
no
Evaluation Count:0
0-2005
2566 state |= QStyle::State_Enabled;
executed: state |= QStyle::State_Enabled;
Execution Count:2005
2005
2567 if (window()->isActiveWindow())
evaluated: window()->isActiveWindow()
TRUEFALSE
yes
Evaluation Count:1624
yes
Evaluation Count:381
381-1624
2568 state |= QStyle::State_Active;
executed: state |= QStyle::State_Active;
Execution Count:1624
1624
2569 if (d->clickableSections) {
evaluated: d->clickableSections
TRUEFALSE
yes
Evaluation Count:1514
yes
Evaluation Count:491
491-1514
2570 if (logicalIndex == d->hover)
partially evaluated: logicalIndex == d->hover
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1514
0-1514
2571 state |= QStyle::State_MouseOver;
never executed: state |= QStyle::State_MouseOver;
0
2572 if (logicalIndex == d->pressed)
evaluated: logicalIndex == d->pressed
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1513
1-1513
2573 state |= QStyle::State_Sunken;
executed: state |= QStyle::State_Sunken;
Execution Count:1
1
2574 else if (d->highlightSelected) {
evaluated: d->highlightSelected
TRUEFALSE
yes
Evaluation Count:1388
yes
Evaluation Count:125
125-1388
2575 if (d->sectionIntersectsSelection(logicalIndex))
evaluated: d->sectionIntersectsSelection(logicalIndex)
TRUEFALSE
yes
Evaluation Count:475
yes
Evaluation Count:913
475-913
2576 state |= QStyle::State_On;
executed: state |= QStyle::State_On;
Execution Count:475
475
2577 if (d->isSectionSelected(logicalIndex))
evaluated: d->isSectionSelected(logicalIndex)
TRUEFALSE
yes
Evaluation Count:32
yes
Evaluation Count:1356
32-1356
2578 state |= QStyle::State_Sunken;
executed: state |= QStyle::State_Sunken;
Execution Count:32
32
2579 }
executed: }
Execution Count:1388
1388
2580 -
2581 } -
2582 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
2583 opt.sortIndicator = (sortIndicatorOrder() == Qt::AscendingOrder)
executed: opt.sortIndicator = (sortIndicatorOrder() == Qt::AscendingOrder) ? QStyleOptionHeader::SortDown : QStyleOptionHeader::SortUp;
Execution Count:40
evaluated: (sortIndicatorOrder() == Qt::AscendingOrder)
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:35
5-40
2584 ? QStyleOptionHeader::SortDown : QStyleOptionHeader::SortUp;
executed: opt.sortIndicator = (sortIndicatorOrder() == Qt::AscendingOrder) ? QStyleOptionHeader::SortDown : QStyleOptionHeader::SortUp;
Execution Count:40
40
2585 -
2586 // setup the style options structure -
2587 QVariant textAlignment = d->model->headerData(logicalIndex, d->orientation,
executed (the execution status of this line is deduced): QVariant textAlignment = d->model->headerData(logicalIndex, d->orientation,
-
2588 Qt::TextAlignmentRole);
executed (the execution status of this line is deduced): Qt::TextAlignmentRole);
-
2589 opt.rect = rect;
executed (the execution status of this line is deduced): opt.rect = rect;
-
2590 opt.section = logicalIndex;
executed (the execution status of this line is deduced): opt.section = logicalIndex;
-
2591 opt.state |= state;
executed (the execution status of this line is deduced): opt.state |= state;
-
2592 opt.textAlignment = Qt::Alignment(textAlignment.isValid()
executed (the execution status of this line is deduced): opt.textAlignment = Qt::Alignment(textAlignment.isValid()
-
2593 ? Qt::Alignment(textAlignment.toInt())
executed (the execution status of this line is deduced): ? Qt::Alignment(textAlignment.toInt())
-
2594 : d->defaultAlignment);
executed (the execution status of this line is deduced): : d->defaultAlignment);
-
2595 -
2596 opt.iconAlignment = Qt::AlignVCenter;
executed (the execution status of this line is deduced): opt.iconAlignment = Qt::AlignVCenter;
-
2597 opt.text = d->model->headerData(logicalIndex, d->orientation,
executed (the execution status of this line is deduced): opt.text = d->model->headerData(logicalIndex, d->orientation,
-
2598 Qt::DisplayRole).toString();
executed (the execution status of this line is deduced): Qt::DisplayRole).toString();
-
2599 if (d->textElideMode != Qt::ElideNone)
partially evaluated: d->textElideMode != Qt::ElideNone
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2005
0-2005
2600 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
2601 -
2602 QVariant variant = d->model->headerData(logicalIndex, d->orientation,
executed (the execution status of this line is deduced): QVariant variant = d->model->headerData(logicalIndex, d->orientation,
-
2603 Qt::DecorationRole);
executed (the execution status of this line is deduced): Qt::DecorationRole);
-
2604 opt.icon = qvariant_cast<QIcon>(variant);
executed (the execution status of this line is deduced): opt.icon = qvariant_cast<QIcon>(variant);
-
2605 if (opt.icon.isNull())
partially evaluated: opt.icon.isNull()
TRUEFALSE
yes
Evaluation Count:2005
no
Evaluation Count:0
0-2005
2606 opt.icon = qvariant_cast<QPixmap>(variant);
executed: opt.icon = qvariant_cast<QPixmap>(variant);
Execution Count:2005
2005
2607 QVariant foregroundBrush = d->model->headerData(logicalIndex, d->orientation,
executed (the execution status of this line is deduced): QVariant foregroundBrush = d->model->headerData(logicalIndex, d->orientation,
-
2608 Qt::ForegroundRole);
executed (the execution status of this line is deduced): Qt::ForegroundRole);
-
2609 if (foregroundBrush.canConvert<QBrush>())
partially evaluated: foregroundBrush.canConvert<QBrush>()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2005
0-2005
2610 opt.palette.setBrush(QPalette::ButtonText, qvariant_cast<QBrush>(foregroundBrush));
never executed: opt.palette.setBrush(QPalette::ButtonText, qvariant_cast<QBrush>(foregroundBrush));
0
2611 -
2612 QPointF oldBO = painter->brushOrigin();
executed (the execution status of this line is deduced): QPointF oldBO = painter->brushOrigin();
-
2613 QVariant backgroundBrush = d->model->headerData(logicalIndex, d->orientation,
executed (the execution status of this line is deduced): QVariant backgroundBrush = d->model->headerData(logicalIndex, d->orientation,
-
2614 Qt::BackgroundRole);
executed (the execution status of this line is deduced): Qt::BackgroundRole);
-
2615 if (backgroundBrush.canConvert<QBrush>()) {
partially evaluated: backgroundBrush.canConvert<QBrush>()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2005
0-2005
2616 opt.palette.setBrush(QPalette::Button, qvariant_cast<QBrush>(backgroundBrush));
never executed (the execution status of this line is deduced): opt.palette.setBrush(QPalette::Button, qvariant_cast<QBrush>(backgroundBrush));
-
2617 opt.palette.setBrush(QPalette::Window, qvariant_cast<QBrush>(backgroundBrush));
never executed (the execution status of this line is deduced): opt.palette.setBrush(QPalette::Window, qvariant_cast<QBrush>(backgroundBrush));
-
2618 painter->setBrushOrigin(opt.rect.topLeft());
never executed (the execution status of this line is deduced): painter->setBrushOrigin(opt.rect.topLeft());
-
2619 }
never executed: }
0
2620 -
2621 // the section position -
2622 int visual = visualIndex(logicalIndex);
executed (the execution status of this line is deduced): int visual = visualIndex(logicalIndex);
-
2623 Q_ASSERT(visual != -1);
executed (the execution status of this line is deduced): qt_noop();
-
2624 if (count() == 1)
evaluated: count() == 1
TRUEFALSE
yes
Evaluation Count:139
yes
Evaluation Count:1866
139-1866
2625 opt.position = QStyleOptionHeader::OnlyOneSection;
executed: opt.position = QStyleOptionHeader::OnlyOneSection;
Execution Count:139
139
2626 else if (visual == 0)
evaluated: visual == 0
TRUEFALSE
yes
Evaluation Count:542
yes
Evaluation Count:1324
542-1324
2627 opt.position = QStyleOptionHeader::Beginning;
executed: opt.position = QStyleOptionHeader::Beginning;
Execution Count:542
542
2628 else if (visual == count() - 1)
evaluated: visual == count() - 1
TRUEFALSE
yes
Evaluation Count:143
yes
Evaluation Count:1181
143-1181
2629 opt.position = QStyleOptionHeader::End;
executed: opt.position = QStyleOptionHeader::End;
Execution Count:143
143
2630 else -
2631 opt.position = QStyleOptionHeader::Middle;
executed: opt.position = QStyleOptionHeader::Middle;
Execution Count:1181
1181
2632 opt.orientation = d->orientation;
executed (the execution status of this line is deduced): opt.orientation = d->orientation;
-
2633 // the selected position -
2634 bool previousSelected = d->isSectionSelected(this->logicalIndex(visual - 1));
executed (the execution status of this line is deduced): bool previousSelected = d->isSectionSelected(this->logicalIndex(visual - 1));
-
2635 bool nextSelected = d->isSectionSelected(this->logicalIndex(visual + 1));
executed (the execution status of this line is deduced): bool nextSelected = d->isSectionSelected(this->logicalIndex(visual + 1));
-
2636 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
2637 opt.selectedPosition = QStyleOptionHeader::NextAndPreviousAreSelected;
executed: opt.selectedPosition = QStyleOptionHeader::NextAndPreviousAreSelected;
Execution Count:12
12
2638 else if (previousSelected)
evaluated: previousSelected
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:1988
5-1988
2639 opt.selectedPosition = QStyleOptionHeader::PreviousIsSelected;
executed: opt.selectedPosition = QStyleOptionHeader::PreviousIsSelected;
Execution Count:5
5
2640 else if (nextSelected)
evaluated: nextSelected
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:1981
7-1981
2641 opt.selectedPosition = QStyleOptionHeader::NextIsSelected;
executed: opt.selectedPosition = QStyleOptionHeader::NextIsSelected;
Execution Count:7
7
2642 else -
2643 opt.selectedPosition = QStyleOptionHeader::NotAdjacent;
executed: opt.selectedPosition = QStyleOptionHeader::NotAdjacent;
Execution Count:1981
1981
2644 // draw the section -
2645 style()->drawControl(QStyle::CE_Header, &opt, painter, this);
executed (the execution status of this line is deduced): style()->drawControl(QStyle::CE_Header, &opt, painter, this);
-
2646 -
2647 painter->setBrushOrigin(oldBO);
executed (the execution status of this line is deduced): painter->setBrushOrigin(oldBO);
-
2648}
executed: }
Execution Count:2005
2005
2649 -
2650/*! -
2651 Returns the size of the contents of the section specified by the given -
2652 \a logicalIndex. -
2653 -
2654 \sa defaultSectionSize() -
2655*/ -
2656 -
2657QSize QHeaderView::sectionSizeFromContents(int logicalIndex) const -
2658{ -
2659 Q_D(const QHeaderView);
executed (the execution status of this line is deduced): const QHeaderViewPrivate * const d = d_func();
-
2660 Q_ASSERT(logicalIndex >= 0);
executed (the execution status of this line is deduced): qt_noop();
-
2661 -
2662 ensurePolished();
executed (the execution status of this line is deduced): ensurePolished();
-
2663 -
2664 // use SizeHintRole -
2665 QVariant variant = d->model->headerData(logicalIndex, d->orientation, Qt::SizeHintRole);
executed (the execution status of this line is deduced): QVariant variant = d->model->headerData(logicalIndex, d->orientation, Qt::SizeHintRole);
-
2666 if (variant.isValid())
partially evaluated: variant.isValid()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:24848
0-24848
2667 return qvariant_cast<QSize>(variant);
never executed: return qvariant_cast<QSize>(variant);
0
2668 -
2669 // otherwise use the contents -
2670 QStyleOptionHeader opt;
executed (the execution status of this line is deduced): QStyleOptionHeader opt;
-
2671 initStyleOption(&opt);
executed (the execution status of this line is deduced): initStyleOption(&opt);
-
2672 opt.section = logicalIndex;
executed (the execution status of this line is deduced): opt.section = logicalIndex;
-
2673 QVariant var = d->model->headerData(logicalIndex, d->orientation,
executed (the execution status of this line is deduced): QVariant var = d->model->headerData(logicalIndex, d->orientation,
-
2674 Qt::FontRole);
executed (the execution status of this line is deduced): Qt::FontRole);
-
2675 QFont fnt;
executed (the execution status of this line is deduced): QFont fnt;
-
2676 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
2677 fnt = qvariant_cast<QFont>(var);
never executed: fnt = qvariant_cast<QFont>(var);
0
2678 else -
2679 fnt = font();
executed: fnt = font();
Execution Count:24848
24848
2680 fnt.setBold(true);
executed (the execution status of this line is deduced): fnt.setBold(true);
-
2681 opt.fontMetrics = QFontMetrics(fnt);
executed (the execution status of this line is deduced): opt.fontMetrics = QFontMetrics(fnt);
-
2682 opt.text = d->model->headerData(logicalIndex, d->orientation,
executed (the execution status of this line is deduced): opt.text = d->model->headerData(logicalIndex, d->orientation,
-
2683 Qt::DisplayRole).toString();
executed (the execution status of this line is deduced): Qt::DisplayRole).toString();
-
2684 variant = d->model->headerData(logicalIndex, d->orientation, Qt::DecorationRole);
executed (the execution status of this line is deduced): variant = d->model->headerData(logicalIndex, d->orientation, Qt::DecorationRole);
-
2685 opt.icon = qvariant_cast<QIcon>(variant);
executed (the execution status of this line is deduced): opt.icon = qvariant_cast<QIcon>(variant);
-
2686 if (opt.icon.isNull())
partially evaluated: opt.icon.isNull()
TRUEFALSE
yes
Evaluation Count:24848
no
Evaluation Count:0
0-24848
2687 opt.icon = qvariant_cast<QPixmap>(variant);
executed: opt.icon = qvariant_cast<QPixmap>(variant);
Execution Count:24848
24848
2688 QSize size = style()->sizeFromContents(QStyle::CT_HeaderSection, &opt, QSize(), this);
executed (the execution status of this line is deduced): QSize size = style()->sizeFromContents(QStyle::CT_HeaderSection, &opt, QSize(), this);
-
2689 if (isSortIndicatorShown()) {
evaluated: isSortIndicatorShown()
TRUEFALSE
yes
Evaluation Count:506
yes
Evaluation Count:24342
506-24342
2690 int margin = style()->pixelMetric(QStyle::PM_HeaderMargin, &opt, this);
executed (the execution status of this line is deduced): int margin = style()->pixelMetric(QStyle::PM_HeaderMargin, &opt, this);
-
2691 if (d->orientation == Qt::Horizontal)
partially evaluated: d->orientation == Qt::Horizontal
TRUEFALSE
yes
Evaluation Count:506
no
Evaluation Count:0
0-506
2692 size.rwidth() += size.height() + margin;
executed: size.rwidth() += size.height() + margin;
Execution Count:506
506
2693 else -
2694 size.rheight() += size.width() + margin;
never executed: size.rheight() += size.width() + margin;
0
2695 } -
2696 return size;
executed: return size;
Execution Count:24848
24848
2697} -
2698 -
2699/*! -
2700 Returns the horizontal offset of the header. This is 0 for vertical -
2701 headers. -
2702 -
2703 \sa offset() -
2704*/ -
2705 -
2706int QHeaderView::horizontalOffset() const -
2707{ -
2708 Q_D(const QHeaderView);
executed (the execution status of this line is deduced): const QHeaderViewPrivate * const d = d_func();
-
2709 if (d->orientation == Qt::Horizontal)
evaluated: d->orientation == Qt::Horizontal
TRUEFALSE
yes
Evaluation Count:537
yes
Evaluation Count:294
294-537
2710 return d->offset;
executed: return d->offset;
Execution Count:537
537
2711 return 0;
executed: return 0;
Execution Count:294
294
2712} -
2713 -
2714/*! -
2715 Returns the vertical offset of the header. This is 0 for horizontal -
2716 headers. -
2717 -
2718 \sa offset() -
2719*/ -
2720 -
2721int QHeaderView::verticalOffset() const -
2722{ -
2723 Q_D(const QHeaderView);
executed (the execution status of this line is deduced): const QHeaderViewPrivate * const d = d_func();
-
2724 if (d->orientation == Qt::Vertical)
evaluated: d->orientation == Qt::Vertical
TRUEFALSE
yes
Evaluation Count:295
yes
Evaluation Count:536
295-536
2725 return d->offset;
executed: return d->offset;
Execution Count:295
295
2726 return 0;
executed: return 0;
Execution Count:536
536
2727} -
2728 -
2729/*! -
2730 \reimp -
2731 \internal -
2732*/ -
2733 -
2734void QHeaderView::updateGeometries() -
2735{ -
2736 Q_D(QHeaderView);
executed (the execution status of this line is deduced): QHeaderViewPrivate * const d = d_func();
-
2737 d->layoutChildren();
executed (the execution status of this line is deduced): d->layoutChildren();
-
2738 if (d->hasAutoResizeSections())
evaluated: d->hasAutoResizeSections()
TRUEFALSE
yes
Evaluation Count:6762
yes
Evaluation Count:3301
3301-6762
2739 d->doDelayedResizeSections();
executed: d->doDelayedResizeSections();
Execution Count:6762
6762
2740}
executed: }
Execution Count:10063
10063
2741 -
2742/*! -
2743 \reimp -
2744 \internal -
2745*/ -
2746 -
2747void QHeaderView::scrollContentsBy(int dx, int dy) -
2748{ -
2749 Q_D(QHeaderView);
never executed (the execution status of this line is deduced): QHeaderViewPrivate * const d = d_func();
-
2750 d->scrollDirtyRegion(dx, dy);
never executed (the execution status of this line is deduced): d->scrollDirtyRegion(dx, dy);
-
2751}
never executed: }
0
2752 -
2753/*! -
2754 \reimp -
2755 \internal -
2756*/ -
2757void QHeaderView::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &) -
2758{ -
2759 Q_D(QHeaderView);
executed (the execution status of this line is deduced): QHeaderViewPrivate * const d = d_func();
-
2760 d->invalidateCachedSizeHint();
executed (the execution status of this line is deduced): d->invalidateCachedSizeHint();
-
2761 if (d->hasAutoResizeSections()) {
evaluated: d->hasAutoResizeSections()
TRUEFALSE
yes
Evaluation Count:7682
yes
Evaluation Count:106086
7682-106086
2762 bool resizeRequired = d->globalResizeMode == ResizeToContents;
executed (the execution status of this line is deduced): bool resizeRequired = d->globalResizeMode == ResizeToContents;
-
2763 int first = orientation() == Qt::Horizontal ? topLeft.column() : topLeft.row();
evaluated: orientation() == Qt::Horizontal
TRUEFALSE
yes
Evaluation Count:7052
yes
Evaluation Count:630
630-7052
2764 int last = orientation() == Qt::Horizontal ? bottomRight.column() : bottomRight.row();
evaluated: orientation() == Qt::Horizontal
TRUEFALSE
yes
Evaluation Count:7052
yes
Evaluation Count:630
630-7052
2765 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
2766 resizeRequired = (sectionResizeMode(i) == ResizeToContents);
executed: resizeRequired = (sectionResizeMode(i) == ResizeToContents);
Execution Count:15250
15250
2767 if (resizeRequired)
partially evaluated: resizeRequired
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:7682
0-7682
2768 d->doDelayedResizeSections();
never executed: d->doDelayedResizeSections();
0
2769 }
executed: }
Execution Count:7682
7682
2770}
executed: }
Execution Count:113768
113768
2771 -
2772/*! -
2773 \reimp -
2774 \internal -
2775 -
2776 Empty implementation because the header doesn't show QModelIndex items. -
2777*/ -
2778void QHeaderView::rowsInserted(const QModelIndex &, int, int) -
2779{ -
2780 // do nothing -
2781} -
2782 -
2783/*! -
2784 \reimp -
2785 \internal -
2786 -
2787 Empty implementation because the header doesn't show QModelIndex items. -
2788*/ -
2789 -
2790QRect QHeaderView::visualRect(const QModelIndex &) const -
2791{ -
2792 return QRect();
executed: return QRect();
Execution Count:5449
5449
2793} -
2794 -
2795/*! -
2796 \reimp -
2797 \internal -
2798 -
2799 Empty implementation because the header doesn't show QModelIndex items. -
2800*/ -
2801 -
2802void QHeaderView::scrollTo(const QModelIndex &, ScrollHint) -
2803{ -
2804 // do nothing - the header only displays sections -
2805} -
2806 -
2807/*! -
2808 \reimp -
2809 \internal -
2810 -
2811 Empty implementation because the header doesn't show QModelIndex items. -
2812*/ -
2813 -
2814QModelIndex QHeaderView::indexAt(const QPoint &) const -
2815{ -
2816 return QModelIndex();
executed: return QModelIndex();
Execution Count:25
25
2817} -
2818 -
2819/*! -
2820 \reimp -
2821 \internal -
2822 -
2823 Empty implementation because the header doesn't show QModelIndex items. -
2824*/ -
2825 -
2826bool QHeaderView::isIndexHidden(const QModelIndex &) const -
2827{ -
2828 return true; // the header view has no items, just sections
executed: return true;
Execution Count:1
1
2829} -
2830 -
2831/*! -
2832 \reimp -
2833 \internal -
2834 -
2835 Empty implementation because the header doesn't show QModelIndex items. -
2836*/ -
2837 -
2838QModelIndex QHeaderView::moveCursor(CursorAction, Qt::KeyboardModifiers) -
2839{ -
2840 return QModelIndex();
executed: return QModelIndex();
Execution Count:42
42
2841} -
2842 -
2843/*! -
2844 \reimp -
2845 -
2846 Selects the items in the given \a rect according to the specified -
2847 \a flags. -
2848 -
2849 The base class implementation does nothing. -
2850*/ -
2851 -
2852void QHeaderView::setSelection(const QRect&, QItemSelectionModel::SelectionFlags) -
2853{ -
2854 // do nothing -
2855} -
2856 -
2857/*! -
2858 \internal -
2859*/ -
2860 -
2861QRegion QHeaderView::visualRegionForSelection(const QItemSelection &selection) const -
2862{ -
2863 Q_D(const QHeaderView);
executed (the execution status of this line is deduced): const QHeaderViewPrivate * const d = d_func();
-
2864 const int max = d->modelSectionCount();
executed (the execution status of this line is deduced): const int max = d->modelSectionCount();
-
2865 if (d->orientation == Qt::Horizontal) {
evaluated: d->orientation == Qt::Horizontal
TRUEFALSE
yes
Evaluation Count:2538
yes
Evaluation Count:1606
1606-2538
2866 int left = max;
executed (the execution status of this line is deduced): int left = max;
-
2867 int right = 0;
executed (the execution status of this line is deduced): int right = 0;
-
2868 int rangeLeft, rangeRight;
executed (the execution status of this line is deduced): int rangeLeft, rangeRight;
-
2869 -
2870 for (int i = 0; i < selection.count(); ++i) {
evaluated: i < selection.count()
TRUEFALSE
yes
Evaluation Count:2473
yes
Evaluation Count:2538
2473-2538
2871 QItemSelectionRange r = selection.at(i);
executed (the execution status of this line is deduced): QItemSelectionRange r = selection.at(i);
-
2872 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
2873 continue; // we only know about toplevel items and we don't want invalid ranges
executed: continue;
Execution Count:177
177
2874 // FIXME an item inside the range may be the leftmost or rightmost -
2875 rangeLeft = visualIndex(r.left());
executed (the execution status of this line is deduced): rangeLeft = visualIndex(r.left());
-
2876 if (rangeLeft == -1) // in some cases users may change the selections
partially evaluated: rangeLeft == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2296
0-2296
2877 continue; // before we have a chance to do the layout
never executed: continue;
0
2878 rangeRight = visualIndex(r.right());
executed (the execution status of this line is deduced): rangeRight = visualIndex(r.right());
-
2879 if (rangeRight == -1) // in some cases users may change the selections
partially evaluated: rangeRight == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2296
0-2296
2880 continue; // before we have a chance to do the layout
never executed: continue;
0
2881 if (rangeLeft < left)
evaluated: rangeLeft < left
TRUEFALSE
yes
Evaluation Count:1931
yes
Evaluation Count:365
365-1931
2882 left = rangeLeft;
executed: left = rangeLeft;
Execution Count:1931
1931
2883 if (rangeRight > right)
evaluated: rangeRight > right
TRUEFALSE
yes
Evaluation Count:1485
yes
Evaluation Count:811
811-1485
2884 right = rangeRight;
executed: right = rangeRight;
Execution Count:1485
1485
2885 }
executed: }
Execution Count:2296
2296
2886 -
2887 int logicalLeft = logicalIndex(left);
executed (the execution status of this line is deduced): int logicalLeft = logicalIndex(left);
-
2888 int logicalRight = logicalIndex(right);
executed (the execution status of this line is deduced): int logicalRight = logicalIndex(right);
-
2889 -
2890 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
2891 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
2892 return QRegion();
executed: return QRegion();
Execution Count:609
609
2893 -
2894 int leftPos = sectionViewportPosition(logicalLeft);
executed (the execution status of this line is deduced): int leftPos = sectionViewportPosition(logicalLeft);
-
2895 int rightPos = sectionViewportPosition(logicalRight);
executed (the execution status of this line is deduced): int rightPos = sectionViewportPosition(logicalRight);
-
2896 rightPos += sectionSize(logicalRight);
executed (the execution status of this line is deduced): rightPos += sectionSize(logicalRight);
-
2897 return QRect(leftPos, 0, rightPos - leftPos, height());
executed: return QRect(leftPos, 0, rightPos - leftPos, height());
Execution Count:1929
1929
2898 } -
2899 // orientation() == Qt::Vertical -
2900 int top = max;
executed (the execution status of this line is deduced): int top = max;
-
2901 int bottom = 0;
executed (the execution status of this line is deduced): int bottom = 0;
-
2902 int rangeTop, rangeBottom;
executed (the execution status of this line is deduced): int rangeTop, rangeBottom;
-
2903 -
2904 for (int i = 0; i < selection.count(); ++i) {
evaluated: i < selection.count()
TRUEFALSE
yes
Evaluation Count:1697
yes
Evaluation Count:1606
1606-1697
2905 QItemSelectionRange r = selection.at(i);
executed (the execution status of this line is deduced): QItemSelectionRange r = selection.at(i);
-
2906 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
2907 continue; // we only know about toplevel items
never executed: continue;
0
2908 // FIXME an item inside the range may be the leftmost or rightmost -
2909 rangeTop = visualIndex(r.top());
executed (the execution status of this line is deduced): rangeTop = visualIndex(r.top());
-
2910 if (rangeTop == -1) // in some cases users may change the selections
partially evaluated: rangeTop == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1697
0-1697
2911 continue; // before we have a chance to do the layout
never executed: continue;
0
2912 rangeBottom = visualIndex(r.bottom());
executed (the execution status of this line is deduced): rangeBottom = visualIndex(r.bottom());
-
2913 if (rangeBottom == -1) // in some cases users may change the selections
partially evaluated: rangeBottom == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1697
0-1697
2914 continue; // before we have a chance to do the layout
never executed: continue;
0
2915 if (rangeTop < top)
evaluated: rangeTop < top
TRUEFALSE
yes
Evaluation Count:1350
yes
Evaluation Count:347
347-1350
2916 top = rangeTop;
executed: top = rangeTop;
Execution Count:1350
1350
2917 if (rangeBottom > bottom)
evaluated: rangeBottom > bottom
TRUEFALSE
yes
Evaluation Count:1131
yes
Evaluation Count:566
566-1131
2918 bottom = rangeBottom;
executed: bottom = rangeBottom;
Execution Count:1131
1131
2919 }
executed: }
Execution Count:1697
1697
2920 -
2921 int logicalTop = logicalIndex(top);
executed (the execution status of this line is deduced): int logicalTop = logicalIndex(top);
-
2922 int logicalBottom = logicalIndex(bottom);
executed (the execution status of this line is deduced): int logicalBottom = logicalIndex(bottom);
-
2923 -
2924 if (logicalTop == -1 || logicalBottom == -1)
evaluated: logicalTop == -1
TRUEFALSE
yes
Evaluation Count:272
yes
Evaluation Count:1334
partially evaluated: logicalBottom == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1334
0-1334
2925 return QRect();
executed: return QRect();
Execution Count:272
272
2926 -
2927 int topPos = sectionViewportPosition(logicalTop);
executed (the execution status of this line is deduced): int topPos = sectionViewportPosition(logicalTop);
-
2928 int bottomPos = sectionViewportPosition(logicalBottom) + sectionSize(logicalBottom);
executed (the execution status of this line is deduced): int bottomPos = sectionViewportPosition(logicalBottom) + sectionSize(logicalBottom);
-
2929 -
2930 return QRect(0, topPos, width(), bottomPos - topPos);
executed: return QRect(0, topPos, width(), bottomPos - topPos);
Execution Count:1334
1334
2931} -
2932 -
2933 -
2934// private implementation -
2935 -
2936int QHeaderViewPrivate::sectionHandleAt(int position) -
2937{ -
2938 Q_Q(QHeaderView);
executed (the execution status of this line is deduced): QHeaderView * const q = q_func();
-
2939 int visual = q->visualIndexAt(position);
executed (the execution status of this line is deduced): int visual = q->visualIndexAt(position);
-
2940 if (visual == -1)
partially evaluated: visual == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:334
0-334
2941 return -1;
never executed: return -1;
0
2942 int log = logicalIndex(visual);
executed (the execution status of this line is deduced): int log = logicalIndex(visual);
-
2943 int pos = q->sectionViewportPosition(log);
executed (the execution status of this line is deduced): int pos = q->sectionViewportPosition(log);
-
2944 int grip = q->style()->pixelMetric(QStyle::PM_HeaderGripMargin, 0, q);
executed (the execution status of this line is deduced): int grip = q->style()->pixelMetric(QStyle::PM_HeaderGripMargin, 0, q);
-
2945 -
2946 bool atLeft = position < pos + grip;
executed (the execution status of this line is deduced): bool atLeft = position < pos + grip;
-
2947 bool atRight = (position > pos + q->sectionSize(log) - grip);
executed (the execution status of this line is deduced): bool atRight = (position > pos + q->sectionSize(log) - grip);
-
2948 if (reverse())
partially evaluated: reverse()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:334
0-334
2949 qSwap(atLeft, atRight);
never executed: qSwap(atLeft, atRight);
0
2950 -
2951 if (atLeft) {
evaluated: atLeft
TRUEFALSE
yes
Evaluation Count:38
yes
Evaluation Count:296
38-296
2952 //grip at the beginning of the section -
2953 while(visual > -1) {
partially evaluated: visual > -1
TRUEFALSE
yes
Evaluation Count:38
no
Evaluation Count:0
0-38
2954 int logical = q->logicalIndex(--visual);
executed (the execution status of this line is deduced): int logical = q->logicalIndex(--visual);
-
2955 if (!q->isSectionHidden(logical))
partially evaluated: !q->isSectionHidden(logical)
TRUEFALSE
yes
Evaluation Count:38
no
Evaluation Count:0
0-38
2956 return logical;
executed: return logical;
Execution Count:38
38
2957 }
never executed: }
0
2958 } else if (atRight) {
never executed: }
evaluated: atRight
TRUEFALSE
yes
Evaluation Count:17
yes
Evaluation Count:279
0-279
2959 //grip at the end of the section -
2960 return log;
executed: return log;
Execution Count:17
17
2961 } -
2962 return -1;
executed: return -1;
Execution Count:279
279
2963} -
2964 -
2965void QHeaderViewPrivate::setupSectionIndicator(int section, int position) -
2966{ -
2967 Q_Q(QHeaderView);
executed (the execution status of this line is deduced): QHeaderView * const q = q_func();
-
2968 if (!sectionIndicator) {
partially evaluated: !sectionIndicator
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
2969 sectionIndicator = new QLabel(viewport);
executed (the execution status of this line is deduced): sectionIndicator = new QLabel(viewport);
-
2970 }
executed: }
Execution Count:1
1
2971 -
2972 int w, h;
executed (the execution status of this line is deduced): int w, h;
-
2973 int p = q->sectionViewportPosition(section);
executed (the execution status of this line is deduced): int p = q->sectionViewportPosition(section);
-
2974 if (orientation == Qt::Horizontal) {
partially evaluated: orientation == Qt::Horizontal
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
2975 w = q->sectionSize(section);
executed (the execution status of this line is deduced): w = q->sectionSize(section);
-
2976 h = viewport->height();
executed (the execution status of this line is deduced): h = viewport->height();
-
2977 } else {
executed: }
Execution Count:1
1
2978 w = viewport->width();
never executed (the execution status of this line is deduced): w = viewport->width();
-
2979 h = q->sectionSize(section);
never executed (the execution status of this line is deduced): h = q->sectionSize(section);
-
2980 }
never executed: }
0
2981 sectionIndicator->resize(w, h);
executed (the execution status of this line is deduced): sectionIndicator->resize(w, h);
-
2982 -
2983 QPixmap pm(w, h);
executed (the execution status of this line is deduced): QPixmap pm(w, h);
-
2984 pm.fill(QColor(0, 0, 0, 45));
executed (the execution status of this line is deduced): pm.fill(QColor(0, 0, 0, 45));
-
2985 QRect rect(0, 0, w, h);
executed (the execution status of this line is deduced): QRect rect(0, 0, w, h);
-
2986 -
2987 QPainter painter(&pm);
executed (the execution status of this line is deduced): QPainter painter(&pm);
-
2988 painter.setOpacity(0.75);
executed (the execution status of this line is deduced): painter.setOpacity(0.75);
-
2989 q->paintSection(&painter, rect, section);
executed (the execution status of this line is deduced): q->paintSection(&painter, rect, section);
-
2990 painter.end();
executed (the execution status of this line is deduced): painter.end();
-
2991 -
2992 sectionIndicator->setPixmap(pm);
executed (the execution status of this line is deduced): sectionIndicator->setPixmap(pm);
-
2993 sectionIndicatorOffset = position - qMax(p, 0);
executed (the execution status of this line is deduced): sectionIndicatorOffset = position - qMax(p, 0);
-
2994}
executed: }
Execution Count:1
1
2995 -
2996void QHeaderViewPrivate::updateSectionIndicator(int section, int position) -
2997{ -
2998 if (!sectionIndicator)
never evaluated: !sectionIndicator
0
2999 return;
never executed: return;
0
3000 -
3001 if (section == -1 || target == -1) {
never evaluated: section == -1
never evaluated: target == -1
0
3002 sectionIndicator->hide();
never executed (the execution status of this line is deduced): sectionIndicator->hide();
-
3003 return;
never executed: return;
0
3004 } -
3005 -
3006 if (orientation == Qt::Horizontal)
never evaluated: orientation == Qt::Horizontal
0
3007 sectionIndicator->move(position - sectionIndicatorOffset, 0);
never executed: sectionIndicator->move(position - sectionIndicatorOffset, 0);
0
3008 else -
3009 sectionIndicator->move(0, position - sectionIndicatorOffset);
never executed: sectionIndicator->move(0, position - sectionIndicatorOffset);
0
3010 -
3011 sectionIndicator->show();
never executed (the execution status of this line is deduced): sectionIndicator->show();
-
3012}
never executed: }
0
3013 -
3014/*! -
3015 Initialize \a option with the values from this QHeaderView. This method is -
3016 useful for subclasses when they need a QStyleOptionHeader, but do not want -
3017 to fill in all the information themselves. -
3018 -
3019 \sa QStyleOption::initFrom() -
3020*/ -
3021void QHeaderView::initStyleOption(QStyleOptionHeader *option) const -
3022{ -
3023 Q_D(const QHeaderView);
executed (the execution status of this line is deduced): const QHeaderViewPrivate * const d = d_func();
-
3024 option->initFrom(this);
executed (the execution status of this line is deduced): option->initFrom(this);
-
3025 option->state = QStyle::State_None | QStyle::State_Raised;
executed (the execution status of this line is deduced): option->state = QStyle::State_None | QStyle::State_Raised;
-
3026 option->orientation = d->orientation;
executed (the execution status of this line is deduced): option->orientation = d->orientation;
-
3027 if (d->orientation == Qt::Horizontal)
evaluated: d->orientation == Qt::Horizontal
TRUEFALSE
yes
Evaluation Count:12519
yes
Evaluation Count:14334
12519-14334
3028 option->state |= QStyle::State_Horizontal;
executed: option->state |= QStyle::State_Horizontal;
Execution Count:12519
12519
3029 if (isEnabled())
partially evaluated: isEnabled()
TRUEFALSE
yes
Evaluation Count:26853
no
Evaluation Count:0
0-26853
3030 option->state |= QStyle::State_Enabled;
executed: option->state |= QStyle::State_Enabled;
Execution Count:26853
26853
3031 option->section = 0;
executed (the execution status of this line is deduced): option->section = 0;
-
3032}
executed: }
Execution Count:26853
26853
3033 -
3034bool QHeaderViewPrivate::isSectionSelected(int section) const -
3035{ -
3036 int i = section * 2;
executed (the execution status of this line is deduced): int i = section * 2;
-
3037 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
3038 return false;
executed: return false;
Execution Count:2849
2849
3039 if (sectionSelected.testBit(i)) // if the value was cached
evaluated: sectionSelected.testBit(i)
TRUEFALSE
yes
Evaluation Count:1059
yes
Evaluation Count:1490
1059-1490
3040 return sectionSelected.testBit(i + 1);
executed: return sectionSelected.testBit(i + 1);
Execution Count:1059
1059
3041 bool s = false;
executed (the execution status of this line is deduced): bool s = false;
-
3042 if (orientation == Qt::Horizontal)
evaluated: orientation == Qt::Horizontal
TRUEFALSE
yes
Evaluation Count:737
yes
Evaluation Count:753
737-753
3043 s = isColumnSelected(section);
executed: s = isColumnSelected(section);
Execution Count:737
737
3044 else -
3045 s = isRowSelected(section);
executed: s = isRowSelected(section);
Execution Count:753
753
3046 sectionSelected.setBit(i + 1, s); // selection state
executed (the execution status of this line is deduced): sectionSelected.setBit(i + 1, s);
-
3047 sectionSelected.setBit(i, true); // cache state
executed (the execution status of this line is deduced): sectionSelected.setBit(i, true);
-
3048 return s;
executed: return s;
Execution Count:1490
1490
3049} -
3050 -
3051/*! -
3052 \internal -
3053 Returns the last visible (ie. not hidden) visual index -
3054*/ -
3055int QHeaderViewPrivate::lastVisibleVisualIndex() const -
3056{ -
3057 Q_Q(const QHeaderView);
executed (the execution status of this line is deduced): const QHeaderView * const q = q_func();
-
3058 for (int visual = q->count()-1; visual >= 0; --visual) {
partially evaluated: visual >= 0
TRUEFALSE
yes
Evaluation Count:4928
no
Evaluation Count:0
0-4928
3059 if (!q->isSectionHidden(q->logicalIndex(visual)))
evaluated: !q->isSectionHidden(q->logicalIndex(visual))
TRUEFALSE
yes
Evaluation Count:4903
yes
Evaluation Count:25
25-4903
3060 return visual;
executed: return visual;
Execution Count:4903
4903
3061 }
executed: }
Execution Count:25
25
3062 -
3063 //default value if no section is actually visible -
3064 return -1;
never executed: return -1;
0
3065} -
3066 -
3067/*! -
3068 \internal -
3069 Go through and resize all of the sections applying stretchLastSection, -
3070 manual stretches, sizes, and useGlobalMode. -
3071 -
3072 The different resize modes are: -
3073 Interactive - the user decides the size -
3074 Stretch - take up whatever space is left -
3075 Fixed - the size is set programmatically outside the header -
3076 ResizeToContentes - the size is set based on the contents of the row or column in the parent view -
3077 -
3078 The resize mode will not affect the last section if stretchLastSection is true. -
3079*/ -
3080void QHeaderViewPrivate::resizeSections(QHeaderView::ResizeMode globalMode, bool useGlobalMode) -
3081{ -
3082 Q_Q(QHeaderView);
executed (the execution status of this line is deduced): QHeaderView * const q = q_func();
-
3083 //stop the timer in case it is delayed -
3084 delayedResize.stop();
executed (the execution status of this line is deduced): delayedResize.stop();
-
3085 -
3086 executePostedLayout();
executed (the execution status of this line is deduced): executePostedLayout();
-
3087 if (sectionCount() == 0)
evaluated: sectionCount() == 0
TRUEFALSE
yes
Evaluation Count:818
yes
Evaluation Count:3530
818-3530
3088 return;
executed: return;
Execution Count:818
818
3089 -
3090 if (resizeRecursionBlock)
evaluated: resizeRecursionBlock
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:3528
2-3528
3091 return;
executed: return;
Execution Count:2
2
3092 resizeRecursionBlock = true;
executed (the execution status of this line is deduced): resizeRecursionBlock = true;
-
3093 -
3094 invalidateCachedSizeHint();
executed (the execution status of this line is deduced): invalidateCachedSizeHint();
-
3095 -
3096 const int lastVisibleSection = lastVisibleVisualIndex();
executed (the execution status of this line is deduced): const int lastVisibleSection = lastVisibleVisualIndex();
-
3097 -
3098 // find stretchLastSection if we have it -
3099 int stretchSection = -1;
executed (the execution status of this line is deduced): int stretchSection = -1;
-
3100 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
3101 stretchSection = lastVisibleVisualIndex();
executed: stretchSection = lastVisibleVisualIndex();
Execution Count:1357
1357
3102 -
3103 // count up the number of stretched sections and how much space left for them -
3104 int lengthToStretch = (orientation == Qt::Horizontal ? viewport->width() : viewport->height());
evaluated: orientation == Qt::Horizontal
TRUEFALSE
yes
Evaluation Count:2720
yes
Evaluation Count:808
808-2720
3105 int numberOfStretchedSections = 0;
executed (the execution status of this line is deduced): int numberOfStretchedSections = 0;
-
3106 QList<int> section_sizes;
executed (the execution status of this line is deduced): QList<int> section_sizes;
-
3107 for (int i = 0; i < sectionCount(); ++i) {
evaluated: i < sectionCount()
TRUEFALSE
yes
Evaluation Count:23080
yes
Evaluation Count:3528
3528-23080
3108 if (isVisualIndexHidden(i))
evaluated: isVisualIndexHidden(i)
TRUEFALSE
yes
Evaluation Count:55
yes
Evaluation Count:23025
55-23025
3109 continue;
executed: continue;
Execution Count:55
55
3110 -
3111 QHeaderView::ResizeMode resizeMode;
executed (the execution status of this line is deduced): QHeaderView::ResizeMode resizeMode;
-
3112 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
3113 resizeMode = globalMode;
executed: resizeMode = globalMode;
Execution Count:2090
2090
3114 else -
3115 resizeMode = (i == stretchSection ? QHeaderView::Stretch : headerSectionResizeMode(i));
executed: resizeMode = (i == stretchSection ? QHeaderView::Stretch : headerSectionResizeMode(i));
Execution Count:20935
evaluated: i == stretchSection
TRUEFALSE
yes
Evaluation Count:1357
yes
Evaluation Count:19578
1357-20935
3116 -
3117 if (resizeMode == QHeaderView::Stretch) {
evaluated: resizeMode == QHeaderView::Stretch
TRUEFALSE
yes
Evaluation Count:16589
yes
Evaluation Count:6436
6436-16589
3118 ++numberOfStretchedSections;
executed (the execution status of this line is deduced): ++numberOfStretchedSections;
-
3119 section_sizes.append(headerSectionSize(i));
executed (the execution status of this line is deduced): section_sizes.append(headerSectionSize(i));
-
3120 continue;
executed: continue;
Execution Count:16589
16589
3121 } -
3122 -
3123 // because it isn't stretch, determine its width and remove that from lengthToStretch -
3124 int sectionSize = 0;
executed (the execution status of this line is deduced): int sectionSize = 0;
-
3125 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
3126 sectionSize = headerSectionSize(i);
executed (the execution status of this line is deduced): sectionSize = headerSectionSize(i);
-
3127 } else { // resizeMode == QHeaderView::ResizeToContents
executed: }
Execution Count:4296
4296
3128 int logicalIndex = q->logicalIndex(i);
executed (the execution status of this line is deduced): int logicalIndex = q->logicalIndex(i);
-
3129 sectionSize = qMax(viewSectionSizeHint(logicalIndex),
executed (the execution status of this line is deduced): sectionSize = qMax(viewSectionSizeHint(logicalIndex),
-
3130 q->sectionSizeHint(logicalIndex));
executed (the execution status of this line is deduced): q->sectionSizeHint(logicalIndex));
-
3131 }
executed: }
Execution Count:2140
2140
3132 section_sizes.append(sectionSize);
executed (the execution status of this line is deduced): section_sizes.append(sectionSize);
-
3133 lengthToStretch -= sectionSize;
executed (the execution status of this line is deduced): lengthToStretch -= sectionSize;
-
3134 }
executed: }
Execution Count:6436
6436
3135 -
3136 // calculate the new length for all of the stretched sections -
3137 int stretchSectionLength = -1;
executed (the execution status of this line is deduced): int stretchSectionLength = -1;
-
3138 int pixelReminder = 0;
executed (the execution status of this line is deduced): int pixelReminder = 0;
-
3139 if (numberOfStretchedSections > 0 && lengthToStretch > 0) { // we have room to stretch in
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
3140 int hintLengthForEveryStretchedSection = lengthToStretch / numberOfStretchedSections;
executed (the execution status of this line is deduced): int hintLengthForEveryStretchedSection = lengthToStretch / numberOfStretchedSections;
-
3141 stretchSectionLength = qMax(hintLengthForEveryStretchedSection, q->minimumSectionSize());
executed (the execution status of this line is deduced): stretchSectionLength = qMax(hintLengthForEveryStretchedSection, q->minimumSectionSize());
-
3142 pixelReminder = lengthToStretch % numberOfStretchedSections;
executed (the execution status of this line is deduced): pixelReminder = lengthToStretch % numberOfStretchedSections;
-
3143 }
executed: }
Execution Count:2933
2933
3144 -
3145 // ### The code below would be nicer if it was cleaned up a bit (since spans has been replaced with items) -
3146 int spanStartSection = 0;
executed (the execution status of this line is deduced): int spanStartSection = 0;
-
3147 int previousSectionLength = 0;
executed (the execution status of this line is deduced): int previousSectionLength = 0;
-
3148 -
3149 QHeaderView::ResizeMode previousSectionResizeMode = QHeaderView::Interactive;
executed (the execution status of this line is deduced): QHeaderView::ResizeMode previousSectionResizeMode = QHeaderView::Interactive;
-
3150 -
3151 // resize each section along the total length -
3152 for (int i = 0; i < sectionCount(); ++i) {
evaluated: i < sectionCount()
TRUEFALSE
yes
Evaluation Count:23080
yes
Evaluation Count:3528
3528-23080
3153 int oldSectionLength = headerSectionSize(i);
executed (the execution status of this line is deduced): int oldSectionLength = headerSectionSize(i);
-
3154 int newSectionLength = -1;
executed (the execution status of this line is deduced): int newSectionLength = -1;
-
3155 QHeaderView::ResizeMode newSectionResizeMode = headerSectionResizeMode(i);
executed (the execution status of this line is deduced): QHeaderView::ResizeMode newSectionResizeMode = headerSectionResizeMode(i);
-
3156 -
3157 if (isVisualIndexHidden(i)) {
evaluated: isVisualIndexHidden(i)
TRUEFALSE
yes
Evaluation Count:55
yes
Evaluation Count:23025
55-23025
3158 newSectionLength = 0;
executed (the execution status of this line is deduced): newSectionLength = 0;
-
3159 } else {
executed: }
Execution Count:55
55
3160 QHeaderView::ResizeMode resizeMode;
executed (the execution status of this line is deduced): QHeaderView::ResizeMode resizeMode;
-
3161 if (useGlobalMode)
evaluated: useGlobalMode
TRUEFALSE
yes
Evaluation Count:2090
yes
Evaluation Count:20935
2090-20935
3162 resizeMode = globalMode;
executed: resizeMode = globalMode;
Execution Count:2090
2090
3163 else -
3164 resizeMode = (i == stretchSection
executed: resizeMode = (i == stretchSection ? QHeaderView::Stretch : newSectionResizeMode);
Execution Count:20935
evaluated: i == stretchSection
TRUEFALSE
yes
Evaluation Count:1357
yes
Evaluation Count:19578
1357-20935
3165 ? QHeaderView::Stretch
executed: resizeMode = (i == stretchSection ? QHeaderView::Stretch : newSectionResizeMode);
Execution Count:20935
20935
3166 : newSectionResizeMode);
executed: resizeMode = (i == stretchSection ? QHeaderView::Stretch : newSectionResizeMode);
Execution Count:20935
20935
3167 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
3168 if (i == lastVisibleSection)
evaluated: i == lastVisibleSection
TRUEFALSE
yes
Evaluation Count:2931
yes
Evaluation Count:13084
2931-13084
3169 newSectionLength = qMax(stretchSectionLength, lastSectionSize);
executed: newSectionLength = qMax(stretchSectionLength, lastSectionSize);
Execution Count:2931
2931
3170 else -
3171 newSectionLength = stretchSectionLength;
executed: newSectionLength = stretchSectionLength;
Execution Count:13084
13084
3172 if (pixelReminder > 0) {
evaluated: pixelReminder > 0
TRUEFALSE
yes
Evaluation Count:379
yes
Evaluation Count:15636
379-15636
3173 newSectionLength += 1;
executed (the execution status of this line is deduced): newSectionLength += 1;
-
3174 --pixelReminder;
executed (the execution status of this line is deduced): --pixelReminder;
-
3175 }
executed: }
Execution Count:379
379
3176 section_sizes.removeFirst();
executed (the execution status of this line is deduced): section_sizes.removeFirst();
-
3177 } else {
executed: }
Execution Count:16015
16015
3178 newSectionLength = section_sizes.front();
executed (the execution status of this line is deduced): newSectionLength = section_sizes.front();
-
3179 section_sizes.removeFirst();
executed (the execution status of this line is deduced): section_sizes.removeFirst();
-
3180 }
executed: }
Execution Count:7010
7010
3181 } -
3182 -
3183 //Q_ASSERT(newSectionLength > 0); -
3184 if ((previousSectionResizeMode != newSectionResizeMode
evaluated: previousSectionResizeMode != newSectionResizeMode
TRUEFALSE
yes
Evaluation Count:2224
yes
Evaluation Count:20856
2224-20856
3185 || 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
3186 int spanLength = (i - spanStartSection) * previousSectionLength;
executed (the execution status of this line is deduced): int spanLength = (i - spanStartSection) * previousSectionLength;
-
3187 createSectionItems(spanStartSection, i - 1, spanLength, previousSectionResizeMode);
executed (the execution status of this line is deduced): createSectionItems(spanStartSection, i - 1, spanLength, previousSectionResizeMode);
-
3188 //Q_ASSERT(headerLength() == length); -
3189 spanStartSection = i;
executed (the execution status of this line is deduced): spanStartSection = i;
-
3190 }
executed: }
Execution Count:633
633
3191 -
3192 if (newSectionLength != oldSectionLength)
evaluated: newSectionLength != oldSectionLength
TRUEFALSE
yes
Evaluation Count:1020
yes
Evaluation Count:22060
1020-22060
3193 emit q->sectionResized(logicalIndex(i), oldSectionLength, newSectionLength);
executed: q->sectionResized(logicalIndex(i), oldSectionLength, newSectionLength);
Execution Count:1020
1020
3194 -
3195 previousSectionLength = newSectionLength;
executed (the execution status of this line is deduced): previousSectionLength = newSectionLength;
-
3196 previousSectionResizeMode = newSectionResizeMode;
executed (the execution status of this line is deduced): previousSectionResizeMode = newSectionResizeMode;
-
3197 }
executed: }
Execution Count:23080
23080
3198 -
3199 createSectionItems(spanStartSection, sectionCount() - 1,
executed (the execution status of this line is deduced): createSectionItems(spanStartSection, sectionCount() - 1,
-
3200 (sectionCount() - spanStartSection) * previousSectionLength,
executed (the execution status of this line is deduced): (sectionCount() - spanStartSection) * previousSectionLength,
-
3201 previousSectionResizeMode);
executed (the execution status of this line is deduced): previousSectionResizeMode);
-
3202 //Q_ASSERT(headerLength() == length); -
3203 resizeRecursionBlock = false;
executed (the execution status of this line is deduced): resizeRecursionBlock = false;
-
3204 viewport->update();
executed (the execution status of this line is deduced): viewport->update();
-
3205}
executed: }
Execution Count:3528
3528
3206 -
3207void QHeaderViewPrivate::createSectionItems(int start, int end, int size, QHeaderView::ResizeMode mode) -
3208{ -
3209 int sizePerSection = size / (end - start + 1);
executed (the execution status of this line is deduced): int sizePerSection = size / (end - start + 1);
-
3210 if (end >= sectionItems.count()) {
evaluated: end >= sectionItems.count()
TRUEFALSE
yes
Evaluation Count:1551
yes
Evaluation Count:40735
1551-40735
3211 sectionItems.resize(end + 1);
executed (the execution status of this line is deduced): sectionItems.resize(end + 1);
-
3212 sectionStartposRecalc = true;
executed (the execution status of this line is deduced): sectionStartposRecalc = true;
-
3213 }
executed: }
Execution Count:1551
1551
3214 SectionItem *sectiondata = sectionItems.data();
executed (the execution status of this line is deduced): SectionItem *sectiondata = sectionItems.data();
-
3215 for (int i = start; i <= end; ++i) {
evaluated: i <= end
TRUEFALSE
yes
Evaluation Count:30071161
yes
Evaluation Count:42286
42286-30071161
3216 length += (sizePerSection - sectiondata[i].size);
executed (the execution status of this line is deduced): length += (sizePerSection - sectiondata[i].size);
-
3217 sectionStartposRecalc |= (sectiondata[i].size != sizePerSection);
executed (the execution status of this line is deduced): sectionStartposRecalc |= (sectiondata[i].size != sizePerSection);
-
3218 sectiondata[i].size = sizePerSection;
executed (the execution status of this line is deduced): sectiondata[i].size = sizePerSection;
-
3219 sectiondata[i].resizeMode = mode;
executed (the execution status of this line is deduced): sectiondata[i].resizeMode = mode;
-
3220 }
executed: }
Execution Count:30071161
30071161
3221}
executed: }
Execution Count:42286
42286
3222 -
3223void QHeaderViewPrivate::removeSectionsFromSectionItems(int start, int end) -
3224{ -
3225 // remove sections -
3226 sectionStartposRecalc |= (end != sectionItems.count() - 1);
executed (the execution status of this line is deduced): sectionStartposRecalc |= (end != sectionItems.count() - 1);
-
3227 int removedlength = 0;
executed (the execution status of this line is deduced): int removedlength = 0;
-
3228 for (int u = start; u <= end; ++u)
evaluated: u <= end
TRUEFALSE
yes
Evaluation Count:3093
yes
Evaluation Count:2375
2375-3093
3229 removedlength += sectionItems.at(u).size;
executed: removedlength += sectionItems.at(u).size;
Execution Count:3093
3093
3230 length -= removedlength;
executed (the execution status of this line is deduced): length -= removedlength;
-
3231 sectionItems.remove(start, end - start + 1);
executed (the execution status of this line is deduced): sectionItems.remove(start, end - start + 1);
-
3232}
executed: }
Execution Count:2375
2375
3233 -
3234void QHeaderViewPrivate::clear() -
3235{ -
3236 if (state != NoClear) {
evaluated: state != NoClear
TRUEFALSE
yes
Evaluation Count:3579
yes
Evaluation Count:383
383-3579
3237 length = 0;
executed (the execution status of this line is deduced): length = 0;
-
3238 visualIndices.clear();
executed (the execution status of this line is deduced): visualIndices.clear();
-
3239 logicalIndices.clear();
executed (the execution status of this line is deduced): logicalIndices.clear();
-
3240 sectionSelected.clear();
executed (the execution status of this line is deduced): sectionSelected.clear();
-
3241 sectionHidden.clear();
executed (the execution status of this line is deduced): sectionHidden.clear();
-
3242 hiddenSectionSize.clear();
executed (the execution status of this line is deduced): hiddenSectionSize.clear();
-
3243 sectionItems.clear();
executed (the execution status of this line is deduced): sectionItems.clear();
-
3244 invalidateCachedSizeHint();
executed (the execution status of this line is deduced): invalidateCachedSizeHint();
-
3245 }
executed: }
Execution Count:3579
3579
3246}
executed: }
Execution Count:3962
3962
3247 -
3248void QHeaderViewPrivate::flipSortIndicator(int section) -
3249{ -
3250 Q_Q(QHeaderView);
executed (the execution status of this line is deduced): QHeaderView * const q = q_func();
-
3251 Qt::SortOrder sortOrder;
executed (the execution status of this line is deduced): Qt::SortOrder sortOrder;
-
3252 if (sortIndicatorSection == section) {
evaluated: sortIndicatorSection == section
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:9
2-9
3253 sortOrder = (sortIndicatorOrder == Qt::DescendingOrder) ? Qt::AscendingOrder : Qt::DescendingOrder;
evaluated: (sortIndicatorOrder == Qt::DescendingOrder)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1
3254 } else {
executed: }
Execution Count:2
2
3255 const QVariant value = model->headerData(section, orientation, Qt::InitialSortOrderRole);
executed (the execution status of this line is deduced): const QVariant value = model->headerData(section, orientation, Qt::InitialSortOrderRole);
-
3256 if (value.canConvert(QVariant::Int))
evaluated: value.canConvert(QVariant::Int)
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:7
2-7
3257 sortOrder = static_cast<Qt::SortOrder>(value.toInt());
executed: sortOrder = static_cast<Qt::SortOrder>(value.toInt());
Execution Count:2
2
3258 else -
3259 sortOrder = Qt::AscendingOrder;
executed: sortOrder = Qt::AscendingOrder;
Execution Count:7
7
3260 } -
3261 q->setSortIndicator(section, sortOrder);
executed (the execution status of this line is deduced): q->setSortIndicator(section, sortOrder);
-
3262}
executed: }
Execution Count:11
11
3263 -
3264void QHeaderViewPrivate::cascadingResize(int visual, int newSize) -
3265{ -
3266 Q_Q(QHeaderView);
never executed (the execution status of this line is deduced): QHeaderView * const q = q_func();
-
3267 const int minimumSize = q->minimumSectionSize();
never executed (the execution status of this line is deduced): const int minimumSize = q->minimumSectionSize();
-
3268 const int oldSize = headerSectionSize(visual);
never executed (the execution status of this line is deduced): const int oldSize = headerSectionSize(visual);
-
3269 int delta = newSize - oldSize;
never executed (the execution status of this line is deduced): int delta = newSize - oldSize;
-
3270 -
3271 if (delta > 0) { // larger
never evaluated: delta > 0
0
3272 bool sectionResized = false;
never executed (the execution status of this line is deduced): bool sectionResized = false;
-
3273 -
3274 // restore old section sizes -
3275 for (int i = firstCascadingSection; i < visual; ++i) {
never evaluated: i < visual
0
3276 if (cascadingSectionSize.contains(i)) {
never evaluated: cascadingSectionSize.contains(i)
0
3277 int currentSectionSize = headerSectionSize(i);
never executed (the execution status of this line is deduced): int currentSectionSize = headerSectionSize(i);
-
3278 int originalSectionSize = cascadingSectionSize.value(i);
never executed (the execution status of this line is deduced): int originalSectionSize = cascadingSectionSize.value(i);
-
3279 if (currentSectionSize < originalSectionSize) {
never evaluated: currentSectionSize < originalSectionSize
0
3280 int newSectionSize = currentSectionSize + delta;
never executed (the execution status of this line is deduced): int newSectionSize = currentSectionSize + delta;
-
3281 resizeSectionItem(i, currentSectionSize, newSectionSize);
never executed (the execution status of this line is deduced): resizeSectionItem(i, currentSectionSize, newSectionSize);
-
3282 if (newSectionSize >= originalSectionSize && false)
never evaluated: newSectionSize >= originalSectionSize
never evaluated: false
0
3283 cascadingSectionSize.remove(i); // the section is now restored
never executed: cascadingSectionSize.remove(i);
0
3284 sectionResized = true;
never executed (the execution status of this line is deduced): sectionResized = true;
-
3285 break;
never executed: break;
0
3286 } -
3287 }
never executed: }
0
3288 -
3289 }
never executed: }
0
3290 -
3291 // resize the section -
3292 if (!sectionResized) {
never evaluated: !sectionResized
0
3293 newSize = qMax(newSize, minimumSize);
never executed (the execution status of this line is deduced): newSize = qMax(newSize, minimumSize);
-
3294 if (oldSize != newSize)
never evaluated: oldSize != newSize
0
3295 resizeSectionItem(visual, oldSize, newSize);
never executed: resizeSectionItem(visual, oldSize, newSize);
0
3296 }
never executed: }
0
3297 -
3298 // cascade the section size change -
3299 for (int i = visual + 1; i < sectionCount(); ++i) {
never evaluated: i < sectionCount()
0
3300 if (!sectionIsCascadable(i))
never evaluated: !sectionIsCascadable(i)
0
3301 continue;
never executed: continue;
0
3302 int currentSectionSize = headerSectionSize(i);
never executed (the execution status of this line is deduced): int currentSectionSize = headerSectionSize(i);
-
3303 if (currentSectionSize <= minimumSize)
never evaluated: currentSectionSize <= minimumSize
0
3304 continue;
never executed: continue;
0
3305 int newSectionSize = qMax(currentSectionSize - delta, minimumSize);
never executed (the execution status of this line is deduced): int newSectionSize = qMax(currentSectionSize - delta, minimumSize);
-
3306 //qDebug() << "### cascading to" << i << newSectionSize - currentSectionSize << delta; -
3307 resizeSectionItem(i, currentSectionSize, newSectionSize);
never executed (the execution status of this line is deduced): resizeSectionItem(i, currentSectionSize, newSectionSize);
-
3308 saveCascadingSectionSize(i, currentSectionSize);
never executed (the execution status of this line is deduced): saveCascadingSectionSize(i, currentSectionSize);
-
3309 delta = delta - (currentSectionSize - newSectionSize);
never executed (the execution status of this line is deduced): delta = delta - (currentSectionSize - newSectionSize);
-
3310 //qDebug() << "new delta" << delta; -
3311 //if (newSectionSize != minimumSize) -
3312 if (delta <= 0)
never evaluated: delta <= 0
0
3313 break;
never executed: break;
0
3314 }
never executed: }
0
3315 } else { // smaller
never executed: }
0
3316 bool sectionResized = false;
never executed (the execution status of this line is deduced): bool sectionResized = false;
-
3317 -
3318 // restore old section sizes -
3319 for (int i = lastCascadingSection; i > visual; --i) {
never evaluated: i > visual
0
3320 if (!cascadingSectionSize.contains(i))
never evaluated: !cascadingSectionSize.contains(i)
0
3321 continue;
never executed: continue;
0
3322 int currentSectionSize = headerSectionSize(i);
never executed (the execution status of this line is deduced): int currentSectionSize = headerSectionSize(i);
-
3323 int originalSectionSize = cascadingSectionSize.value(i);
never executed (the execution status of this line is deduced): int originalSectionSize = cascadingSectionSize.value(i);
-
3324 if (currentSectionSize >= originalSectionSize)
never evaluated: currentSectionSize >= originalSectionSize
0
3325 continue;
never executed: continue;
0
3326 int newSectionSize = currentSectionSize - delta;
never executed (the execution status of this line is deduced): int newSectionSize = currentSectionSize - delta;
-
3327 resizeSectionItem(i, currentSectionSize, newSectionSize);
never executed (the execution status of this line is deduced): resizeSectionItem(i, currentSectionSize, newSectionSize);
-
3328 if (newSectionSize >= originalSectionSize && false) {
never evaluated: newSectionSize >= originalSectionSize
never evaluated: false
0
3329 //qDebug() << "section" << i << "restored to" << originalSectionSize; -
3330 cascadingSectionSize.remove(i); // the section is now restored
never executed (the execution status of this line is deduced): cascadingSectionSize.remove(i);
-
3331 }
never executed: }
0
3332 sectionResized = true;
never executed (the execution status of this line is deduced): sectionResized = true;
-
3333 break;
never executed: break;
0
3334 } -
3335 -
3336 // resize the section -
3337 resizeSectionItem(visual, oldSize, qMax(newSize, minimumSize));
never executed (the execution status of this line is deduced): resizeSectionItem(visual, oldSize, qMax(newSize, minimumSize));
-
3338 -
3339 // cascade the section size change -
3340 if (delta < 0 && newSize < minimumSize) {
never evaluated: delta < 0
never evaluated: newSize < minimumSize
0
3341 for (int i = visual - 1; i >= 0; --i) {
never evaluated: i >= 0
0
3342 if (!sectionIsCascadable(i))
never evaluated: !sectionIsCascadable(i)
0
3343 continue;
never executed: continue;
0
3344 int sectionSize = headerSectionSize(i);
never executed (the execution status of this line is deduced): int sectionSize = headerSectionSize(i);
-
3345 if (sectionSize <= minimumSize)
never evaluated: sectionSize <= minimumSize
0
3346 continue;
never executed: continue;
0
3347 resizeSectionItem(i, sectionSize, qMax(sectionSize + delta, minimumSize));
never executed (the execution status of this line is deduced): resizeSectionItem(i, sectionSize, qMax(sectionSize + delta, minimumSize));
-
3348 saveCascadingSectionSize(i, sectionSize);
never executed (the execution status of this line is deduced): saveCascadingSectionSize(i, sectionSize);
-
3349 break;
never executed: break;
0
3350 } -
3351 }
never executed: }
0
3352 -
3353 // let the next section get the space from the resized section -
3354 if (!sectionResized) {
never evaluated: !sectionResized
0
3355 for (int i = visual + 1; i < sectionCount(); ++i) {
never evaluated: i < sectionCount()
0
3356 if (!sectionIsCascadable(i))
never evaluated: !sectionIsCascadable(i)
0
3357 continue;
never executed: continue;
0
3358 int currentSectionSize = headerSectionSize(i);
never executed (the execution status of this line is deduced): int currentSectionSize = headerSectionSize(i);
-
3359 int newSectionSize = qMax(currentSectionSize - delta, minimumSize);
never executed (the execution status of this line is deduced): int newSectionSize = qMax(currentSectionSize - delta, minimumSize);
-
3360 resizeSectionItem(i, currentSectionSize, newSectionSize);
never executed (the execution status of this line is deduced): resizeSectionItem(i, currentSectionSize, newSectionSize);
-
3361 break;
never executed: break;
0
3362 } -
3363 }
never executed: }
0
3364 }
never executed: }
0
3365 -
3366 if (hasAutoResizeSections())
never evaluated: hasAutoResizeSections()
0
3367 doDelayedResizeSections();
never executed: doDelayedResizeSections();
0
3368 -
3369 viewport->update();
never executed (the execution status of this line is deduced): viewport->update();
-
3370}
never executed: }
0
3371 -
3372void QHeaderViewPrivate::setDefaultSectionSize(int size) -
3373{ -
3374 Q_Q(QHeaderView);
executed (the execution status of this line is deduced): QHeaderView * const q = q_func();
-
3375 executePostedLayout();
executed (the execution status of this line is deduced): executePostedLayout();
-
3376 invalidateCachedSizeHint();
executed (the execution status of this line is deduced): invalidateCachedSizeHint();
-
3377 defaultSectionSize = size;
executed (the execution status of this line is deduced): defaultSectionSize = size;
-
3378 if (state == QHeaderViewPrivate::ResizeSection)
partially evaluated: state == QHeaderViewPrivate::ResizeSection
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:85
0-85
3379 preventCursorChangeInSetOffset = true;
never executed: preventCursorChangeInSetOffset = true;
0
3380 for (int i = 0; i < sectionItems.count(); ++i) {
evaluated: i < sectionItems.count()
TRUEFALSE
yes
Evaluation Count:6234
yes
Evaluation Count:85
85-6234
3381 QHeaderViewPrivate::SectionItem &section = sectionItems[i];
executed (the execution status of this line is deduced): QHeaderViewPrivate::SectionItem &section = sectionItems[i];
-
3382 if (sectionHidden.isEmpty() || !sectionHidden.testBit(i)) { // resize on not hidden.
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
3383 const int newSize = size;
executed (the execution status of this line is deduced): const int newSize = size;
-
3384 if (newSize != section.size) {
evaluated: newSize != section.size
TRUEFALSE
yes
Evaluation Count:4207
yes
Evaluation Count:2010
2010-4207
3385 length += newSize - section.size; //the whole length is changed
executed (the execution status of this line is deduced): length += newSize - section.size;
-
3386 const int oldSectionSize = section.sectionSize();
executed (the execution status of this line is deduced): const int oldSectionSize = section.sectionSize();
-
3387 section.size = size;
executed (the execution status of this line is deduced): section.size = size;
-
3388 emit q->sectionResized(logicalIndex(i), oldSectionSize, size);
executed (the execution status of this line is deduced): q->sectionResized(logicalIndex(i), oldSectionSize, size);
-
3389 }
executed: }
Execution Count:4207
4207
3390 }
executed: }
Execution Count:6217
6217
3391 }
executed: }
Execution Count:6234
6234
3392 sectionStartposRecalc = true;
executed (the execution status of this line is deduced): sectionStartposRecalc = true;
-
3393 if (hasAutoResizeSections())
evaluated: hasAutoResizeSections()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:83
2-83
3394 doDelayedResizeSections();
executed: doDelayedResizeSections();
Execution Count:2
2
3395 viewport->update();
executed (the execution status of this line is deduced): viewport->update();
-
3396}
executed: }
Execution Count:85
85
3397 -
3398void QHeaderViewPrivate::recalcSectionStartPos() const // linear (but fast) -
3399{ -
3400 int pixelpos = 0;
executed (the execution status of this line is deduced): int pixelpos = 0;
-
3401 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
3402 i->calculated_startpos = pixelpos; // write into const mutable
executed (the execution status of this line is deduced): i->calculated_startpos = pixelpos;
-
3403 pixelpos += i->size;
executed (the execution status of this line is deduced): pixelpos += i->size;
-
3404 }
executed: }
Execution Count:31526740
31526740
3405 sectionStartposRecalc = false;
executed (the execution status of this line is deduced): sectionStartposRecalc = false;
-
3406}
executed: }
Execution Count:6208
6208
3407 -
3408void QHeaderViewPrivate::resizeSectionItem(int visualIndex, int oldSize, int newSize) -
3409{ -
3410 Q_Q(QHeaderView);
never executed (the execution status of this line is deduced): QHeaderView * const q = q_func();
-
3411 QHeaderView::ResizeMode mode = headerSectionResizeMode(visualIndex);
never executed (the execution status of this line is deduced): QHeaderView::ResizeMode mode = headerSectionResizeMode(visualIndex);
-
3412 createSectionItems(visualIndex, visualIndex, newSize, mode);
never executed (the execution status of this line is deduced): createSectionItems(visualIndex, visualIndex, newSize, mode);
-
3413 emit q->sectionResized(logicalIndex(visualIndex), oldSize, newSize);
never executed (the execution status of this line is deduced): q->sectionResized(logicalIndex(visualIndex), oldSize, newSize);
-
3414}
never executed: }
0
3415 -
3416int QHeaderViewPrivate::headerSectionSize(int visual) const -
3417{ -
3418 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
3419 return sectionItems.at(visual).sectionSize();
executed: return sectionItems.at(visual).sectionSize();
Execution Count:334746
334746
3420 return -1;
never executed: return -1;
0
3421} -
3422 -
3423int QHeaderViewPrivate::headerSectionPosition(int visual) const -
3424{ -
3425 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
3426 if (sectionStartposRecalc)
evaluated: sectionStartposRecalc
TRUEFALSE
yes
Evaluation Count:3055
yes
Evaluation Count:184065
3055-184065
3427 recalcSectionStartPos();
executed: recalcSectionStartPos();
Execution Count:3055
3055
3428 return sectionItems.at(visual).calculated_startpos;
executed: return sectionItems.at(visual).calculated_startpos;
Execution Count:187120
187120
3429 } -
3430 return -1;
never executed: return -1;
0
3431} -
3432 -
3433int QHeaderViewPrivate::headerVisualIndexAt(int position) const -
3434{ -
3435 if (sectionStartposRecalc)
evaluated: sectionStartposRecalc
TRUEFALSE
yes
Evaluation Count:3044
yes
Evaluation Count:90529
3044-90529
3436 recalcSectionStartPos();
executed: recalcSectionStartPos();
Execution Count:3044
3044
3437 int startidx = 0;
executed (the execution status of this line is deduced): int startidx = 0;
-
3438 int endidx = sectionItems.count() - 1;
executed (the execution status of this line is deduced): int endidx = sectionItems.count() - 1;
-
3439 while (startidx <= endidx) {
evaluated: startidx <= endidx
TRUEFALSE
yes
Evaluation Count:563187
yes
Evaluation Count:377
377-563187
3440 int middle = (endidx + startidx) / 2;
executed (the execution status of this line is deduced): int middle = (endidx + startidx) / 2;
-
3441 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
3442 endidx = middle - 1;
executed (the execution status of this line is deduced): endidx = middle - 1;
-
3443 } else {
executed: }
Execution Count:361009
361009
3444 if (sectionItems.at(middle).calculatedEndPos() <= position)
evaluated: sectionItems.at(middle).calculatedEndPos() <= position
TRUEFALSE
yes
Evaluation Count:108982
yes
Evaluation Count:93196
93196-108982
3445 startidx = middle + 1;
executed: startidx = middle + 1;
Execution Count:108982
108982
3446 else // we found it. -
3447 return middle;
executed: return middle;
Execution Count:93196
93196
3448 } -
3449 } -
3450 return -1;
executed: return -1;
Execution Count:377
377
3451} -
3452 -
3453void QHeaderViewPrivate::setHeaderSectionResizeMode(int visual, QHeaderView::ResizeMode mode) -
3454{ -
3455 int size = headerSectionSize(visual);
executed (the execution status of this line is deduced): int size = headerSectionSize(visual);
-
3456 createSectionItems(visual, visual, size, mode);
executed (the execution status of this line is deduced): createSectionItems(visual, visual, size, mode);
-
3457}
executed: }
Execution Count:12
12
3458 -
3459QHeaderView::ResizeMode QHeaderViewPrivate::headerSectionResizeMode(int visual) const -
3460{ -
3461 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
3462 return globalResizeMode;
executed: return globalResizeMode;
Execution Count:195
195
3463 return sectionItems.at(visual).resizeMode;
executed: return sectionItems.at(visual).resizeMode;
Execution Count:94343
94343
3464} -
3465 -
3466void QHeaderViewPrivate::setGlobalHeaderResizeMode(QHeaderView::ResizeMode mode) -
3467{ -
3468 globalResizeMode = mode;
executed (the execution status of this line is deduced): globalResizeMode = mode;
-
3469 for (int i = 0; i < sectionItems.count(); ++i)
evaluated: i < sectionItems.count()
TRUEFALSE
yes
Evaluation Count:444
yes
Evaluation Count:66
66-444
3470 sectionItems[i].resizeMode = mode;
executed: sectionItems[i].resizeMode = mode;
Execution Count:444
444
3471}
executed: }
Execution Count:66
66
3472 -
3473int QHeaderViewPrivate::viewSectionSizeHint(int logical) const -
3474{ -
3475 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
3476 return (orientation == Qt::Horizontal
executed: return (orientation == Qt::Horizontal ? view->sizeHintForColumn(logical) : view->sizeHintForRow(logical));
Execution Count:2140
2140
3477 ? view->sizeHintForColumn(logical)
executed: return (orientation == Qt::Horizontal ? view->sizeHintForColumn(logical) : view->sizeHintForRow(logical));
Execution Count:2140
2140
3478 : view->sizeHintForRow(logical));
executed: return (orientation == Qt::Horizontal ? view->sizeHintForColumn(logical) : view->sizeHintForRow(logical));
Execution Count:2140
2140
3479 } -
3480 return 0;
never executed: return 0;
0
3481} -
3482 -
3483int QHeaderViewPrivate::adjustedVisualIndex(int visualIndex) const -
3484{ -
3485 if (!sectionHidden.isEmpty()) {
evaluated: !sectionHidden.isEmpty()
TRUEFALSE
yes
Evaluation Count:225
yes
Evaluation Count:3084
225-3084
3486 int adjustedVisualIndex = visualIndex;
executed (the execution status of this line is deduced): int adjustedVisualIndex = visualIndex;
-
3487 int currentVisualIndex = 0;
executed (the execution status of this line is deduced): int currentVisualIndex = 0;
-
3488 for (int i = 0; i < sectionItems.count(); ++i) {
partially evaluated: i < sectionItems.count()
TRUEFALSE
yes
Evaluation Count:2279
no
Evaluation Count:0
0-2279
3489 if (sectionHidden.testBit(i))
evaluated: sectionHidden.testBit(i)
TRUEFALSE
yes
Evaluation Count:70
yes
Evaluation Count:2209
70-2209
3490 ++adjustedVisualIndex;
executed: ++adjustedVisualIndex;
Execution Count:70
70
3491 else -
3492 ++currentVisualIndex;
executed: ++currentVisualIndex;
Execution Count:2209
2209
3493 if (currentVisualIndex >= visualIndex)
evaluated: currentVisualIndex >= visualIndex
TRUEFALSE
yes
Evaluation Count:225
yes
Evaluation Count:2054
225-2054
3494 break;
executed: break;
Execution Count:225
225
3495 }
executed: }
Execution Count:2054
2054
3496 visualIndex = adjustedVisualIndex;
executed (the execution status of this line is deduced): visualIndex = adjustedVisualIndex;
-
3497 }
executed: }
Execution Count:225
225
3498 return visualIndex;
executed: return visualIndex;
Execution Count:3309
3309
3499} -
3500 -
3501#ifndef QT_NO_DATASTREAM -
3502void QHeaderViewPrivate::write(QDataStream &out) const -
3503{ -
3504 out << int(orientation);
executed (the execution status of this line is deduced): out << int(orientation);
-
3505 out << int(sortIndicatorOrder);
executed (the execution status of this line is deduced): out << int(sortIndicatorOrder);
-
3506 out << sortIndicatorSection;
executed (the execution status of this line is deduced): out << sortIndicatorSection;
-
3507 out << sortIndicatorShown;
executed (the execution status of this line is deduced): out << sortIndicatorShown;
-
3508 -
3509 out << visualIndices;
executed (the execution status of this line is deduced): out << visualIndices;
-
3510 out << logicalIndices;
executed (the execution status of this line is deduced): out << logicalIndices;
-
3511 -
3512 out << sectionHidden;
executed (the execution status of this line is deduced): out << sectionHidden;
-
3513 out << hiddenSectionSize;
executed (the execution status of this line is deduced): out << hiddenSectionSize;
-
3514 -
3515 out << length;
executed (the execution status of this line is deduced): out << length;
-
3516 out << sectionCount();
executed (the execution status of this line is deduced): out << sectionCount();
-
3517 out << movableSections;
executed (the execution status of this line is deduced): out << movableSections;
-
3518 out << clickableSections;
executed (the execution status of this line is deduced): out << clickableSections;
-
3519 out << highlightSelected;
executed (the execution status of this line is deduced): out << highlightSelected;
-
3520 out << stretchLastSection;
executed (the execution status of this line is deduced): out << stretchLastSection;
-
3521 out << cascadingResizing;
executed (the execution status of this line is deduced): out << cascadingResizing;
-
3522 out << stretchSections;
executed (the execution status of this line is deduced): out << stretchSections;
-
3523 out << contentsSections;
executed (the execution status of this line is deduced): out << contentsSections;
-
3524 out << defaultSectionSize;
executed (the execution status of this line is deduced): out << defaultSectionSize;
-
3525 out << minimumSectionSize;
executed (the execution status of this line is deduced): out << minimumSectionSize;
-
3526 -
3527 out << int(defaultAlignment);
executed (the execution status of this line is deduced): out << int(defaultAlignment);
-
3528 out << int(globalResizeMode);
executed (the execution status of this line is deduced): out << int(globalResizeMode);
-
3529 -
3530 out << sectionItems;
executed (the execution status of this line is deduced): out << sectionItems;
-
3531}
executed: }
Execution Count:194
194
3532 -
3533bool QHeaderViewPrivate::read(QDataStream &in) -
3534{ -
3535 int orient, order, align, global;
executed (the execution status of this line is deduced): int orient, order, align, global;
-
3536 in >> orient;
executed (the execution status of this line is deduced): in >> orient;
-
3537 orientation = (Qt::Orientation)orient;
executed (the execution status of this line is deduced): orientation = (Qt::Orientation)orient;
-
3538 -
3539 in >> order;
executed (the execution status of this line is deduced): in >> order;
-
3540 sortIndicatorOrder = (Qt::SortOrder)order;
executed (the execution status of this line is deduced): sortIndicatorOrder = (Qt::SortOrder)order;
-
3541 -
3542 in >> sortIndicatorSection;
executed (the execution status of this line is deduced): in >> sortIndicatorSection;
-
3543 in >> sortIndicatorShown;
executed (the execution status of this line is deduced): in >> sortIndicatorShown;
-
3544 -
3545 in >> visualIndices;
executed (the execution status of this line is deduced): in >> visualIndices;
-
3546 in >> logicalIndices;
executed (the execution status of this line is deduced): in >> logicalIndices;
-
3547 -
3548 in >> sectionHidden;
executed (the execution status of this line is deduced): in >> sectionHidden;
-
3549 in >> hiddenSectionSize;
executed (the execution status of this line is deduced): in >> hiddenSectionSize;
-
3550 -
3551 in >> length;
executed (the execution status of this line is deduced): in >> length;
-
3552 int unusedSectionCount; // For compatibility
executed (the execution status of this line is deduced): int unusedSectionCount;
-
3553 in >> unusedSectionCount;
executed (the execution status of this line is deduced): in >> unusedSectionCount;
-
3554 in >> movableSections;
executed (the execution status of this line is deduced): in >> movableSections;
-
3555 in >> clickableSections;
executed (the execution status of this line is deduced): in >> clickableSections;
-
3556 in >> highlightSelected;
executed (the execution status of this line is deduced): in >> highlightSelected;
-
3557 in >> stretchLastSection;
executed (the execution status of this line is deduced): in >> stretchLastSection;
-
3558 in >> cascadingResizing;
executed (the execution status of this line is deduced): in >> cascadingResizing;
-
3559 in >> stretchSections;
executed (the execution status of this line is deduced): in >> stretchSections;
-
3560 in >> contentsSections;
executed (the execution status of this line is deduced): in >> contentsSections;
-
3561 in >> defaultSectionSize;
executed (the execution status of this line is deduced): in >> defaultSectionSize;
-
3562 in >> minimumSectionSize;
executed (the execution status of this line is deduced): in >> minimumSectionSize;
-
3563 -
3564 in >> align;
executed (the execution status of this line is deduced): in >> align;
-
3565 defaultAlignment = Qt::Alignment(align);
executed (the execution status of this line is deduced): defaultAlignment = Qt::Alignment(align);
-
3566 -
3567 in >> global;
executed (the execution status of this line is deduced): in >> global;
-
3568 globalResizeMode = (QHeaderView::ResizeMode)global;
executed (the execution status of this line is deduced): globalResizeMode = (QHeaderView::ResizeMode)global;
-
3569 -
3570 in >> sectionItems;
executed (the execution status of this line is deduced): in >> sectionItems;
-
3571 // In Qt4 we had a vector of spans where one span could hold information on more sections. -
3572 // Now we have an itemvector where one items contains information about one section -
3573 // For backward compatibility with Qt4 we do the following -
3574 QVector<SectionItem> newSectionItems;
executed (the execution status of this line is deduced): QVector<SectionItem> newSectionItems;
-
3575 for (int u = 0; u < sectionItems.count(); ++u) {
evaluated: u < sectionItems.count()
TRUEFALSE
yes
Evaluation Count:435
yes
Evaluation Count:109
109-435
3576 int count = sectionItems.at(u).tmpDataStreamSectionCount;
executed (the execution status of this line is deduced): int count = sectionItems.at(u).tmpDataStreamSectionCount;
-
3577 for (int n = 0; n < count; ++n)
evaluated: n < count
TRUEFALSE
yes
Evaluation Count:435
yes
Evaluation Count:435
435
3578 newSectionItems.append(sectionItems[u]);
executed: newSectionItems.append(sectionItems[u]);
Execution Count:435
435
3579 }
executed: }
Execution Count:435
435
3580 sectionItems = newSectionItems;
executed (the execution status of this line is deduced): sectionItems = newSectionItems;
-
3581 recalcSectionStartPos();
executed (the execution status of this line is deduced): recalcSectionStartPos();
-
3582 return true;
executed: return true;
Execution Count:109
109
3583} -
3584 -
3585#endif // QT_NO_DATASTREAM -
3586 -
3587QT_END_NAMESPACE -
3588 -
3589#endif // QT_NO_ITEMVIEWS -
3590 -
3591#include "moc_qheaderview.cpp" -
3592 -
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial