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