| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/widgets/itemviews/qheaderview.cpp | 
| Switch to Source code | Preprocessed file | 
| 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 never executed:   out;return out;never executed:  return out; | 0 | ||||||||||||||||||||||||
| 14 | } | - | ||||||||||||||||||||||||
| 15 | - | |||||||||||||||||||||||||
| 16 | QDataStream &operator>>(QDataStream &in, QHeaderViewPrivate::SectionItem §ion) | - | ||||||||||||||||||||||||
| 17 | { | - | ||||||||||||||||||||||||
| 18 | section.read(in); | - | ||||||||||||||||||||||||
| 19 |     return never executed:   in;return in;never executed:  return in; | 0 | ||||||||||||||||||||||||
| 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 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 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 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 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 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 67 | - | |||||||||||||||||||||||||
| 68 | - | |||||||||||||||||||||||||
| 69 | - | |||||||||||||||||||||||||
| 70 | - | |||||||||||||||||||||||||
| 71 | void QHeaderView::setModel(QAbstractItemModel *model) | - | ||||||||||||||||||||||||
| 72 | { | - | ||||||||||||||||||||||||
| 73 |     if (model == this->model()
  | 0 | ||||||||||||||||||||||||
| 74 |         return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 75 | QHeaderViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 76 | d->persistentHiddenSections.clear(); | - | ||||||||||||||||||||||||
| 77 |     if (d->model
 
  | 0 | ||||||||||||||||||||||||
| 78 |     if (d->orientation == Qt::Horizontal
  | 0 | ||||||||||||||||||||||||
| 79 | QObject::disconnect(d->model, qFlagLocation("2""columnsInserted(QModelIndex,int,int)" "\0" __FILE__ ":" "356"), | - | ||||||||||||||||||||||||
| 80 | this, qFlagLocation("1""sectionsInserted(QModelIndex,int,int)" "\0" __FILE__ ":" "357")); | - | ||||||||||||||||||||||||
| 81 | QObject::disconnect(d->model, qFlagLocation("2""columnsAboutToBeRemoved(QModelIndex,int,int)" "\0" __FILE__ ":" "358"), | - | ||||||||||||||||||||||||
| 82 | this, qFlagLocation("1""sectionsAboutToBeRemoved(QModelIndex,int,int)" "\0" __FILE__ ":" "359")); | - | ||||||||||||||||||||||||
| 83 | QObject::disconnect(d->model, qFlagLocation("2""columnsRemoved(QModelIndex,int,int)" "\0" __FILE__ ":" "360"), | - | ||||||||||||||||||||||||
| 84 | this, qFlagLocation("1""_q_sectionsRemoved(QModelIndex,int,int)" "\0" __FILE__ ":" "361")); | - | ||||||||||||||||||||||||
| 85 | QObject::disconnect(d->model, qFlagLocation("2""columnsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)" "\0" __FILE__ ":" "362"), | - | ||||||||||||||||||||||||
| 86 | this, qFlagLocation("1""_q_layoutAboutToBeChanged()" "\0" __FILE__ ":" "363")); | - | ||||||||||||||||||||||||
| 87 |     } never executed:   else {end of block | 0 | ||||||||||||||||||||||||
| 88 | QObject::disconnect(d->model, qFlagLocation("2""rowsInserted(QModelIndex,int,int)" "\0" __FILE__ ":" "365"), | - | ||||||||||||||||||||||||
| 89 | this, qFlagLocation("1""sectionsInserted(QModelIndex,int,int)" "\0" __FILE__ ":" "366")); | - | ||||||||||||||||||||||||
| 90 | QObject::disconnect(d->model, qFlagLocation("2""rowsAboutToBeRemoved(QModelIndex,int,int)" "\0" __FILE__ ":" "367"), | - | ||||||||||||||||||||||||
| 91 | this, qFlagLocation("1""sectionsAboutToBeRemoved(QModelIndex,int,int)" "\0" __FILE__ ":" "368")); | - | ||||||||||||||||||||||||
| 92 | QObject::disconnect(d->model, qFlagLocation("2""rowsRemoved(QModelIndex,int,int)" "\0" __FILE__ ":" "369"), | - | ||||||||||||||||||||||||
| 93 | this, qFlagLocation("1""_q_sectionsRemoved(QModelIndex,int,int)" "\0" __FILE__ ":" "370")); | - | ||||||||||||||||||||||||
| 94 | QObject::disconnect(d->model, qFlagLocation("2""rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)" "\0" __FILE__ ":" "371"), | - | ||||||||||||||||||||||||
| 95 | this, qFlagLocation("1""_q_layoutAboutToBeChanged()" "\0" __FILE__ ":" "372")); | - | ||||||||||||||||||||||||
| 96 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 97 | QObject::disconnect(d->model, qFlagLocation("2""headerDataChanged(Qt::Orientation,int,int)" "\0" __FILE__ ":" "374"), | - | ||||||||||||||||||||||||
| 98 | this, qFlagLocation("1""headerDataChanged(Qt::Orientation,int,int)" "\0" __FILE__ ":" "375")); | - | ||||||||||||||||||||||||
| 99 | QObject::disconnect(d->model, qFlagLocation("2""layoutAboutToBeChanged()" "\0" __FILE__ ":" "376"), | - | ||||||||||||||||||||||||
| 100 | this, qFlagLocation("1""_q_layoutAboutToBeChanged()" "\0" __FILE__ ":" "377")); | - | ||||||||||||||||||||||||
| 101 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 102 | - | |||||||||||||||||||||||||
| 103 |     if (model
 
  | 0 | ||||||||||||||||||||||||
| 104 |         if (d->orientation == Qt::Horizontal
  | 0 | ||||||||||||||||||||||||
| 105 | QObject::connect(model, qFlagLocation("2""columnsInserted(QModelIndex,int,int)" "\0" __FILE__ ":" "382"), | - | ||||||||||||||||||||||||
| 106 | this, qFlagLocation("1""sectionsInserted(QModelIndex,int,int)" "\0" __FILE__ ":" "383")); | - | ||||||||||||||||||||||||
| 107 | QObject::connect(model, qFlagLocation("2""columnsAboutToBeRemoved(QModelIndex,int,int)" "\0" __FILE__ ":" "384"), | - | ||||||||||||||||||||||||
| 108 | this, qFlagLocation("1""sectionsAboutToBeRemoved(QModelIndex,int,int)" "\0" __FILE__ ":" "385")); | - | ||||||||||||||||||||||||
| 109 | QObject::connect(model, qFlagLocation("2""columnsRemoved(QModelIndex,int,int)" "\0" __FILE__ ":" "386"), | - | ||||||||||||||||||||||||
| 110 | this, qFlagLocation("1""_q_sectionsRemoved(QModelIndex,int,int)" "\0" __FILE__ ":" "387")); | - | ||||||||||||||||||||||||
| 111 | QObject::connect(model, qFlagLocation("2""columnsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)" "\0" __FILE__ ":" "388"), | - | ||||||||||||||||||||||||
| 112 | this, qFlagLocation("1""_q_layoutAboutToBeChanged()" "\0" __FILE__ ":" "389")); | - | ||||||||||||||||||||||||
| 113 |         } never executed:   else {end of block | 0 | ||||||||||||||||||||||||
| 114 | QObject::connect(model, qFlagLocation("2""rowsInserted(QModelIndex,int,int)" "\0" __FILE__ ":" "391"), | - | ||||||||||||||||||||||||
| 115 | this, qFlagLocation("1""sectionsInserted(QModelIndex,int,int)" "\0" __FILE__ ":" "392")); | - | ||||||||||||||||||||||||
| 116 | QObject::connect(model, qFlagLocation("2""rowsAboutToBeRemoved(QModelIndex,int,int)" "\0" __FILE__ ":" "393"), | - | ||||||||||||||||||||||||
| 117 | this, qFlagLocation("1""sectionsAboutToBeRemoved(QModelIndex,int,int)" "\0" __FILE__ ":" "394")); | - | ||||||||||||||||||||||||
| 118 | QObject::connect(model, qFlagLocation("2""rowsRemoved(QModelIndex,int,int)" "\0" __FILE__ ":" "395"), | - | ||||||||||||||||||||||||
| 119 | this, qFlagLocation("1""_q_sectionsRemoved(QModelIndex,int,int)" "\0" __FILE__ ":" "396")); | - | ||||||||||||||||||||||||
| 120 | QObject::connect(model, qFlagLocation("2""rowsAboutToBeMoved(QModelIndex,int,int,QModelIndex,int)" "\0" __FILE__ ":" "397"), | - | ||||||||||||||||||||||||
| 121 | this, qFlagLocation("1""_q_layoutAboutToBeChanged()" "\0" __FILE__ ":" "398")); | - | ||||||||||||||||||||||||
| 122 |         } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 123 | QObject::connect(model, qFlagLocation("2""headerDataChanged(Qt::Orientation,int,int)" "\0" __FILE__ ":" "400"), | - | ||||||||||||||||||||||||
| 124 | this, qFlagLocation("1""headerDataChanged(Qt::Orientation,int,int)" "\0" __FILE__ ":" "401")); | - | ||||||||||||||||||||||||
| 125 | QObject::connect(model, qFlagLocation("2""layoutAboutToBeChanged()" "\0" __FILE__ ":" "402"), | - | ||||||||||||||||||||||||
| 126 | this, qFlagLocation("1""_q_layoutAboutToBeChanged()" "\0" __FILE__ ":" "403")); | - | ||||||||||||||||||||||||
| 127 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 128 | - | |||||||||||||||||||||||||
| 129 | d->state = QHeaderViewPrivate::NoClear; | - | ||||||||||||||||||||||||
| 130 | QAbstractItemView::setModel(model); | - | ||||||||||||||||||||||||
| 131 | d->state = QHeaderViewPrivate::NoState; | - | ||||||||||||||||||||||||
| 132 | - | |||||||||||||||||||||||||
| 133 | - | |||||||||||||||||||||||||
| 134 | - | |||||||||||||||||||||||||
| 135 | - | |||||||||||||||||||||||||
| 136 | initializeSections(); | - | ||||||||||||||||||||||||
| 137 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 138 | - | |||||||||||||||||||||||||
| 139 | - | |||||||||||||||||||||||||
| 140 | - | |||||||||||||||||||||||||
| 141 | - | |||||||||||||||||||||||||
| 142 | - | |||||||||||||||||||||||||
| 143 | - | |||||||||||||||||||||||||
| 144 | - | |||||||||||||||||||||||||
| 145 | Qt::Orientation QHeaderView::orientation() const | - | ||||||||||||||||||||||||
| 146 | { | - | ||||||||||||||||||||||||
| 147 | const QHeaderViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 148 |     return never executed:   d->orientation;return d->orientation;never executed:  return d->orientation; | 0 | ||||||||||||||||||||||||
| 149 | } | - | ||||||||||||||||||||||||
| 150 | int QHeaderView::offset() const | - | ||||||||||||||||||||||||
| 151 | { | - | ||||||||||||||||||||||||
| 152 | const QHeaderViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 153 |     return never executed:   d->offset;return d->offset;never executed:  return d->offset; | 0 | ||||||||||||||||||||||||
| 154 | } | - | ||||||||||||||||||||||||
| 155 | void QHeaderView::setOffset(int newOffset) | - | ||||||||||||||||||||||||
| 156 | { | - | ||||||||||||||||||||||||
| 157 | QHeaderViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 158 |     if (d->offset == (int)newOffset
  | 0 | ||||||||||||||||||||||||
| 159 |         return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 160 | int ndelta = d->offset - newOffset; | - | ||||||||||||||||||||||||
| 161 | d->offset = newOffset; | - | ||||||||||||||||||||||||
| 162 |     if (d->orientation == Qt::Horizontal
  | 0 | ||||||||||||||||||||||||
| 163 |         d->viewport->scroll(isRightToLeft() ? -ndelta : ndelta, 0); never executed:  d->viewport->scroll(isRightToLeft() ? -ndelta : ndelta, 0); | 0 | ||||||||||||||||||||||||
| 164 | else | - | ||||||||||||||||||||||||
| 165 |         d->viewport->scroll(0, ndelta); never executed:  d->viewport->scroll(0, ndelta); | 0 | ||||||||||||||||||||||||
| 166 |     if (d->state == QHeaderViewPrivate::ResizeSection
 
  | 0 | ||||||||||||||||||||||||
| 167 | QPoint cursorPos = QCursor::pos(); | - | ||||||||||||||||||||||||
| 168 |         if (d->orientation == Qt::Horizontal
  | 0 | ||||||||||||||||||||||||
| 169 |             QCursor::setPos(cursorPos.x() + ndelta, cursorPos.y()); never executed:  QCursor::setPos(cursorPos.x() + ndelta, cursorPos.y()); | 0 | ||||||||||||||||||||||||
| 170 | else | - | ||||||||||||||||||||||||
| 171 |             QCursor::setPos(cursorPos.x(), cursorPos.y() + ndelta); never executed:  QCursor::setPos(cursorPos.x(), cursorPos.y() + ndelta); | 0 | ||||||||||||||||||||||||
| 172 | d->firstPos += ndelta; | - | ||||||||||||||||||||||||
| 173 | d->lastPos += ndelta; | - | ||||||||||||||||||||||||
| 174 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 175 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 176 | void QHeaderView::setOffsetToSectionPosition(int visualSectionNumber) | - | ||||||||||||||||||||||||
| 177 | { | - | ||||||||||||||||||||||||
| 178 | QHeaderViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 179 |     if (visualSectionNumber > -1
 
  | 0 | ||||||||||||||||||||||||
| 180 | int position = d->headerSectionPosition(d->adjustedVisualIndex(visualSectionNumber)); | - | ||||||||||||||||||||||||
| 181 | setOffset(position); | - | ||||||||||||||||||||||||
| 182 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 183 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 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
  | 0 | ||||||||||||||||||||||||
| 195 | int position = length() - size; | - | ||||||||||||||||||||||||
| 196 | setOffset(position); | - | ||||||||||||||||||||||||
| 197 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 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 never executed:   d->length;return d->length;never executed:  return d->length; | 0 | ||||||||||||||||||||||||
| 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()
  | 0 | ||||||||||||||||||||||||
| 224 |         return never executed:   d->cachedSizeHint;return d->cachedSizeHint;never executed:  return d->cachedSizeHint; | 0 | ||||||||||||||||||||||||
| 225 | d->cachedSizeHint = QSize(0, 0); | - | ||||||||||||||||||||||||
| 226 | const int sectionCount = count(); | - | ||||||||||||||||||||||||
| 227 | - | |||||||||||||||||||||||||
| 228 | - | |||||||||||||||||||||||||
| 229 | int i = 0; | - | ||||||||||||||||||||||||
| 230 |     for (int checked = 0; checked
 
 
  | 0 | ||||||||||||||||||||||||
| 231 |         if (isSectionHidden(i)
  | 0 | ||||||||||||||||||||||||
| 232 |             continue; never executed:  continue; | 0 | ||||||||||||||||||||||||
| 233 | checked++; | - | ||||||||||||||||||||||||
| 234 | QSize hint = sectionSizeFromContents(i); | - | ||||||||||||||||||||||||
| 235 | d->cachedSizeHint = d->cachedSizeHint.expandedTo(hint); | - | ||||||||||||||||||||||||
| 236 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 237 | - | |||||||||||||||||||||||||
| 238 | i = qMax(i, sectionCount - 100 ); | - | ||||||||||||||||||||||||
| 239 |     for (int j = sectionCount - 1, checked = 0; j >= i
 
 
  | 0 | ||||||||||||||||||||||||
| 240 |         if (isSectionHidden(j)
  | 0 | ||||||||||||||||||||||||
| 241 |             continue; never executed:  continue; | 0 | ||||||||||||||||||||||||
| 242 | checked++; | - | ||||||||||||||||||||||||
| 243 | QSize hint = sectionSizeFromContents(j); | - | ||||||||||||||||||||||||
| 244 | d->cachedSizeHint = d->cachedSizeHint.expandedTo(hint); | - | ||||||||||||||||||||||||
| 245 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 246 |     return never executed:   d->cachedSizeHint;return d->cachedSizeHint;never executed:  return d->cachedSizeHint; | 0 | ||||||||||||||||||||||||
| 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
  | 0 | ||||||||||||||||||||||||
| 258 | QAbstractScrollArea *parent = qobject_cast<QAbstractScrollArea*>(parentWidget()); | - | ||||||||||||||||||||||||
| 259 |         if (parent
  | 0 | ||||||||||||||||||||||||
| 260 |             parent->updateGeometry(); never executed:  parent->updateGeometry(); | 0 | ||||||||||||||||||||||||
| 261 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 262 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 263 | int QHeaderView::sectionSizeHint(int logicalIndex) const | - | ||||||||||||||||||||||||
| 264 | { | - | ||||||||||||||||||||||||
| 265 | const QHeaderViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 266 |     if (isSectionHidden(logicalIndex)
  | 0 | ||||||||||||||||||||||||
| 267 |         return never executed:   0;return 0;never executed:  return 0; | 0 | ||||||||||||||||||||||||
| 268 |     if (logicalIndex < 0
 
  | 0 | ||||||||||||||||||||||||
| 269 |         return never executed:   -1;return -1;never executed:  return -1; | 0 | ||||||||||||||||||||||||
| 270 | QSize size; | - | ||||||||||||||||||||||||
| 271 | QVariant value = d->model->headerData(logicalIndex, d->orientation, Qt::SizeHintRole); | - | ||||||||||||||||||||||||
| 272 |     if (value.isValid()
  | 0 | ||||||||||||||||||||||||
| 273 |         size = qvariant_cast<QSize>(value); never executed:  size = qvariant_cast<QSize>(value); | 0 | ||||||||||||||||||||||||
| 274 | else | - | ||||||||||||||||||||||||
| 275 |         size = sectionSizeFromContents(logicalIndex); never executed:  size = sectionSizeFromContents(logicalIndex); | 0 | ||||||||||||||||||||||||
| 276 |     int hint = d->orientation == Qt::Horizontal
  | 0 | ||||||||||||||||||||||||
| 277 |     return never executed:   qBound(minimumSectionSize(), hint, maximumSectionSize());return qBound(minimumSectionSize(), hint, maximumSectionSize());never executed:  return qBound(minimumSectionSize(), hint, maximumSectionSize()); | 0 | ||||||||||||||||||||||||
| 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
  | 0 | ||||||||||||||||||||||||
| 287 |         return never executed:   -1;return -1;never executed:  return -1; | 0 | ||||||||||||||||||||||||
| 288 | - | |||||||||||||||||||||||||
| 289 |     if (d->reverse()
  | 0 | ||||||||||||||||||||||||
| 290 |         vposition = d->viewport->width() - vposition; never executed:  vposition = d->viewport->width() - vposition; | 0 | ||||||||||||||||||||||||
| 291 | vposition += d->offset; | - | ||||||||||||||||||||||||
| 292 | - | |||||||||||||||||||||||||
| 293 |     if (vposition > d->length
  | 0 | ||||||||||||||||||||||||
| 294 |         return never executed:   -1;return -1;never executed:  return -1; | 0 | ||||||||||||||||||||||||
| 295 | int visual = d->headerVisualIndexAt(vposition); | - | ||||||||||||||||||||||||
| 296 |     if (visual < 0
  | 0 | ||||||||||||||||||||||||
| 297 |         return never executed:   -1;return -1;never executed:  return -1; | 0 | ||||||||||||||||||||||||
| 298 | - | |||||||||||||||||||||||||
| 299 |     while (d->isVisualIndexHidden(visual)
  | 0 | ||||||||||||||||||||||||
| 300 | ++visual; | - | ||||||||||||||||||||||||
| 301 |         if (visual >= count
  | 0 | ||||||||||||||||||||||||
| 302 |             return never executed:   -1;return -1;never executed:  return -1; | 0 | ||||||||||||||||||||||||
| 303 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 304 |     return never executed:   visual;return visual;never executed:  return visual; | 0 | ||||||||||||||||||||||||
| 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
  | 0 | ||||||||||||||||||||||||
| 317 |         return never executed:   logicalIndex(visual);return logicalIndex(visual);never executed:  return logicalIndex(visual); | 0 | ||||||||||||||||||||||||
| 318 |     return never executed:   -1;return -1;never executed:  return -1; | 0 | ||||||||||||||||||||||||
| 319 | } | - | ||||||||||||||||||||||||
| 320 | int QHeaderView::sectionSize(int logicalIndex) const | - | ||||||||||||||||||||||||
| 321 | { | - | ||||||||||||||||||||||||
| 322 | const QHeaderViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 323 |     if (isSectionHidden(logicalIndex)
  | 0 | ||||||||||||||||||||||||
| 324 |         return never executed:   0;return 0;never executed:  return 0; | 0 | ||||||||||||||||||||||||
| 325 |     if (logicalIndex < 0
 
  | 0 | ||||||||||||||||||||||||
| 326 |         return never executed:   0;return 0;never executed:  return 0; | 0 | ||||||||||||||||||||||||
| 327 | int visual = visualIndex(logicalIndex); | - | ||||||||||||||||||||||||
| 328 |     if (visual == -1
  | 0 | ||||||||||||||||||||||||
| 329 |         return never executed:   0;return 0;never executed:  return 0; | 0 | ||||||||||||||||||||||||
| 330 | d->executePostedResize(); | - | ||||||||||||||||||||||||
| 331 |     return never executed:   d->headerSectionSize(visual);return d->headerSectionSize(visual);never executed:  return d->headerSectionSize(visual); | 0 | ||||||||||||||||||||||||
| 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
  | 0 | ||||||||||||||||||||||||
| 340 |         return never executed:   -1;return -1;never executed:  return -1; | 0 | ||||||||||||||||||||||||
| 341 | d->executePostedResize(); | - | ||||||||||||||||||||||||
| 342 |     return never executed:   d->headerSectionPosition(visual);return d->headerSectionPosition(visual);never executed:  return d->headerSectionPosition(visual); | 0 | ||||||||||||||||||||||||
| 343 | } | - | ||||||||||||||||||||||||
| 344 | int QHeaderView::sectionViewportPosition(int logicalIndex) const | - | ||||||||||||||||||||||||
| 345 | { | - | ||||||||||||||||||||||||
| 346 | const QHeaderViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 347 |     if (logicalIndex >= count()
  | 0 | ||||||||||||||||||||||||
| 348 |         return never executed:   -1;return -1;never executed:  return -1; | 0 | ||||||||||||||||||||||||
| 349 | int position = sectionPosition(logicalIndex); | - | ||||||||||||||||||||||||
| 350 |     if (position < 0
  | 0 | ||||||||||||||||||||||||
| 351 |         return never executed:   position;return position;never executed:  return position; | 0 | ||||||||||||||||||||||||
| 352 | int offsetPosition = position - d->offset; | - | ||||||||||||||||||||||||
| 353 |     if (d->reverse()
  | 0 | ||||||||||||||||||||||||
| 354 |         return never executed:   d->viewport->width() - (offsetPosition + sectionSize(logicalIndex));return d->viewport->width() - (offsetPosition + sectionSize(logicalIndex));never executed:  return d->viewport->width() - (offsetPosition + sectionSize(logicalIndex)); | 0 | ||||||||||||||||||||||||
| 355 |     return never executed:   offsetPosition;return offsetPosition;never executed:  return offsetPosition; | 0 | ||||||||||||||||||||||||
| 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__,731) : qt_noop()); | - | ||||||||||||||||||||||||
| 364 | ((!(targetPosition < rangeStart || targetPosition >= rangeEnd)) ? qt_assert("targetPosition < rangeStart || targetPosition >= rangeEnd",__FILE__,732) : 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
  | 0 | ||||||||||||||||||||||||
| 369 |     typename Container::size_type last = forwardMove
  | 0 | ||||||||||||||||||||||||
| 370 | std::rotate(c.begin() + first, c.begin() + mid, c.begin() + last); | - | ||||||||||||||||||||||||
| 371 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 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
 
 
 
  | 0 | ||||||||||||||||||||||||
| 385 |         return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 386 | - | |||||||||||||||||||||||||
| 387 |     if (from == to
  | 0 | ||||||||||||||||||||||||
| 388 | int logical = logicalIndex(from); | - | ||||||||||||||||||||||||
| 389 | ((!(logical != -1)) ? qt_assert("logical != -1",__FILE__,757) : qt_noop()); | - | ||||||||||||||||||||||||
| 390 | updateSection(logical); | - | ||||||||||||||||||||||||
| 391 |         return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 392 | } | - | ||||||||||||||||||||||||
| 393 | - | |||||||||||||||||||||||||
| 394 | 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
  | 0 | ||||||||||||||||||||||||
| 402 |         while (visual < to
  | 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:   else {end of block | 0 | ||||||||||||||||||||||||
| 408 |         while (visual > to
  | 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()
  | 0 | ||||||||||||||||||||||||
| 422 |         d->doDelayedResizeSections(); never executed:  d->doDelayedResizeSections(); | 0 | ||||||||||||||||||||||||
| 423 | d->viewport->update(); | - | ||||||||||||||||||||||||
| 424 | - | |||||||||||||||||||||||||
| 425 | sectionMoved(logical, from, to); | - | ||||||||||||||||||||||||
| 426 | - | |||||||||||||||||||||||||
| 427 |     if (stretchLastSection()
  | 0 | ||||||||||||||||||||||||
| 428 | const int lastSectionVisualIdx = visualIndex(d->lastSectionLogicalIdx); | - | ||||||||||||||||||||||||
| 429 |         if (from >= lastSectionVisualIdx
 
  | 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
  | 0 | ||||||||||||||||||||||||
| 438 |         return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 439 | d->executePostedLayout(); | - | ||||||||||||||||||||||||
| 440 |     if (first < 0
 
 
 
  | 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
  | 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()
  | 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()
  | 0 | ||||||||||||||||||||||||
| 477 | const int lastSectionVisualIdx = visualIndex(d->lastSectionLogicalIdx); | - | ||||||||||||||||||||||||
| 478 |         if (first >= lastSectionVisualIdx
 
  | 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
 
 
 
  | 0 | ||||||||||||||||||||||||
| 486 |         return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 487 | - | |||||||||||||||||||||||||
| 488 |     if (isSectionHidden(logical)
  | 0 | ||||||||||||||||||||||||
| 489 | d->hiddenSectionSize.insert(logical, size); | - | ||||||||||||||||||||||||
| 490 |         return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 491 | } | - | ||||||||||||||||||||||||
| 492 | - | |||||||||||||||||||||||||
| 493 | int visual = visualIndex(logical); | - | ||||||||||||||||||||||||
| 494 |     if (visual == -1
  | 0 | ||||||||||||||||||||||||
| 495 |         return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 496 | - | |||||||||||||||||||||||||
| 497 |     if (d->state == QHeaderViewPrivate::ResizeSection
 
 
  | 0 | ||||||||||||||||||||||||
| 498 |         d->preventCursorChangeInSetOffset = true; never executed:  d->preventCursorChangeInSetOffset = true; | 0 | ||||||||||||||||||||||||
| 499 | - | |||||||||||||||||||||||||
| 500 | int oldSize = d->headerSectionSize(visual); | - | ||||||||||||||||||||||||
| 501 |     if (oldSize == size
  | 0 | ||||||||||||||||||||||||
| 502 |         return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 503 | - | |||||||||||||||||||||||||
| 504 | d->executePostedLayout(); | - | ||||||||||||||||||||||||
| 505 | d->invalidateCachedSizeHint(); | - | ||||||||||||||||||||||||
| 506 | - | |||||||||||||||||||||||||
| 507 |     if (stretchLastSection()
 
  | 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()
  | 0 | ||||||||||||||||||||||||
| 513 |         if (d->hasAutoResizeSections()
  | 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
  | 0 | ||||||||||||||||||||||||
| 524 |         if (isRightToLeft()
  | 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()
  | 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
 
  | 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 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 547 | bool QHeaderView::isSectionHidden(int logicalIndex) const | - | ||||||||||||||||||||||||
| 548 | { | - | ||||||||||||||||||||||||
| 549 | const QHeaderViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 550 | d->executePostedLayout(); | - | ||||||||||||||||||||||||
| 551 |     if (d->hiddenSectionSize.isEmpty()
 
 
  | 0 | ||||||||||||||||||||||||
| 552 |         return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||||||||
| 553 | int visual = visualIndex(logicalIndex); | - | ||||||||||||||||||||||||
| 554 | ((!(visual != -1)) ? qt_assert("visual != -1",__FILE__,982) : qt_noop()); | - | ||||||||||||||||||||||||
| 555 |     return never executed:   d->isVisualIndexHidden(visual);return d->isVisualIndexHidden(visual);never executed:  return d->isVisualIndexHidden(visual); | 0 | ||||||||||||||||||||||||
| 556 | } | - | ||||||||||||||||||||||||
| 557 | int QHeaderView::hiddenSectionCount() const | - | ||||||||||||||||||||||||
| 558 | { | - | ||||||||||||||||||||||||
| 559 | const QHeaderViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 560 |     return never executed:   d->hiddenSectionSize.count();return d->hiddenSectionSize.count();never executed:  return d->hiddenSectionSize.count(); | 0 | ||||||||||||||||||||||||
| 561 | } | - | ||||||||||||||||||||||||
| 562 | void QHeaderView::setSectionHidden(int logicalIndex, bool hide) | - | ||||||||||||||||||||||||
| 563 | { | - | ||||||||||||||||||||||||
| 564 | QHeaderViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 565 |     if (logicalIndex < 0
 
  | 0 | ||||||||||||||||||||||||
| 566 |         return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 567 | - | |||||||||||||||||||||||||
| 568 | d->executePostedLayout(); | - | ||||||||||||||||||||||||
| 569 | int visual = visualIndex(logicalIndex); | - | ||||||||||||||||||||||||
| 570 | ((!(visual != -1)) ? qt_assert("visual != -1",__FILE__,1014) : qt_noop()); | - | ||||||||||||||||||||||||
| 571 |     if (hide == d->isVisualIndexHidden(visual)
  | 0 | ||||||||||||||||||||||||
| 572 |         return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 573 |     if (hide
  | 0 | ||||||||||||||||||||||||
| 574 |         const bool isHidingLastSection = (stretchLastSection()
 
  | 0 | ||||||||||||||||||||||||
| 575 |         if (isHidingLastSection
  | 0 | ||||||||||||||||||||||||
| 576 |             d->restoreSizeOnPrevLastSection(); never executed:  d->restoreSizeOnPrevLastSection(); | 0 | ||||||||||||||||||||||||
| 577 | int size = d->headerSectionSize(visual); | - | ||||||||||||||||||||||||
| 578 |         if (!d->hasAutoResizeSections()
  | 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
  | 0 | ||||||||||||||||||||||||
| 583 |             d->setNewLastSection(d->lastVisibleVisualIndex()); never executed:  d->setNewLastSection(d->lastVisibleVisualIndex()); | 0 | ||||||||||||||||||||||||
| 584 |         if (d->hasAutoResizeSections()
  | 0 | ||||||||||||||||||||||||
| 585 |             d->doDelayedResizeSections(); never executed:  d->doDelayedResizeSections(); | 0 | ||||||||||||||||||||||||
| 586 |     } never executed:   else {end of block | 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()
 
  | 0 | ||||||||||||||||||||||||
| 593 |         if (newLastSection
  | 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 never executed:   d->sectionCount();return d->sectionCount();never executed:  return d->sectionCount(); | 0 | ||||||||||||||||||||||||
| 613 | } | - | ||||||||||||||||||||||||
| 614 | int QHeaderView::visualIndex(int logicalIndex) const | - | ||||||||||||||||||||||||
| 615 | { | - | ||||||||||||||||||||||||
| 616 | const QHeaderViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 617 |     if (logicalIndex < 0
  | 0 | ||||||||||||||||||||||||
| 618 |         return never executed:   -1;return -1;never executed:  return -1; | 0 | ||||||||||||||||||||||||
| 619 | d->executePostedLayout(); | - | ||||||||||||||||||||||||
| 620 |     if (d->visualIndices.isEmpty()
  | 0 | ||||||||||||||||||||||||
| 621 |         if (logicalIndex < d->sectionCount()
  | 0 | ||||||||||||||||||||||||
| 622 |             return never executed:   logicalIndex;return logicalIndex;never executed:  return logicalIndex; | 0 | ||||||||||||||||||||||||
| 623 |     } never executed:   else if (logicalIndex < d->visualIndices.count()end of block
  | 0 | ||||||||||||||||||||||||
| 624 | int visual = d->visualIndices.at(logicalIndex); | - | ||||||||||||||||||||||||
| 625 | ((!(visual < d->sectionCount())) ? qt_assert("visual < d->sectionCount()",__FILE__,1079) : qt_noop()); | - | ||||||||||||||||||||||||
| 626 |         return never executed:   visual;return visual;never executed:  return visual; | 0 | ||||||||||||||||||||||||
| 627 | } | - | ||||||||||||||||||||||||
| 628 |     return never executed:   -1;return -1;never executed:  return -1; | 0 | ||||||||||||||||||||||||
| 629 | } | - | ||||||||||||||||||||||||
| 630 | int QHeaderView::logicalIndex(int visualIndex) const | - | ||||||||||||||||||||||||
| 631 | { | - | ||||||||||||||||||||||||
| 632 | const QHeaderViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 633 |     if (visualIndex < 0
 
  | 0 | ||||||||||||||||||||||||
| 634 |         return never executed:   -1;return -1;never executed:  return -1; | 0 | ||||||||||||||||||||||||
| 635 |     return never executed:   d->logicalIndex(visualIndex);return d->logicalIndex(visualIndex);never executed:  return d->logicalIndex(visualIndex); | 0 | ||||||||||||||||||||||||
| 636 | } | - | ||||||||||||||||||||||||
| 637 | void QHeaderView::setSectionsMovable(bool movable) | - | ||||||||||||||||||||||||
| 638 | { | - | ||||||||||||||||||||||||
| 639 | QHeaderViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 640 | d->movableSections = movable; | - | ||||||||||||||||||||||||
| 641 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 642 | bool QHeaderView::sectionsMovable() const | - | ||||||||||||||||||||||||
| 643 | { | - | ||||||||||||||||||||||||
| 644 | const QHeaderViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 645 |     return never executed:   d->movableSections;return d->movableSections;never executed:  return d->movableSections; | 0 | ||||||||||||||||||||||||
| 646 | } | - | ||||||||||||||||||||||||
| 647 | void QHeaderView::setSectionsClickable(bool clickable) | - | ||||||||||||||||||||||||
| 648 | { | - | ||||||||||||||||||||||||
| 649 | QHeaderViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 650 | d->clickableSections = clickable; | - | ||||||||||||||||||||||||
| 651 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 652 | bool QHeaderView::sectionsClickable() const | - | ||||||||||||||||||||||||
| 653 | { | - | ||||||||||||||||||||||||
| 654 | const QHeaderViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 655 |     return never executed:   d->clickableSections;return d->clickableSections;never executed:  return d->clickableSections; | 0 | ||||||||||||||||||||||||
| 656 | } | - | ||||||||||||||||||||||||
| 657 | void QHeaderView::setHighlightSections(bool highlight) | - | ||||||||||||||||||||||||
| 658 | { | - | ||||||||||||||||||||||||
| 659 | QHeaderViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 660 | d->highlightSelected = highlight; | - | ||||||||||||||||||||||||
| 661 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 662 | - | |||||||||||||||||||||||||
| 663 | bool QHeaderView::highlightSections() const | - | ||||||||||||||||||||||||
| 664 | { | - | ||||||||||||||||||||||||
| 665 | const QHeaderViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 666 |     return never executed:   d->highlightSelected;return d->highlightSelected;never executed:  return d->highlightSelected; | 0 | ||||||||||||||||||||||||
| 667 | } | - | ||||||||||||||||||||||||
| 668 | void QHeaderView::setSectionResizeMode(ResizeMode mode) | - | ||||||||||||||||||||||||
| 669 | { | - | ||||||||||||||||||||||||
| 670 | QHeaderViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 671 | initializeSections(); | - | ||||||||||||||||||||||||
| 672 |     d->stretchSections = (mode == Stretch
  | 0 | ||||||||||||||||||||||||
| 673 |     d->contentsSections = (mode == ResizeToContents
  | 0 | ||||||||||||||||||||||||
| 674 | d->setGlobalHeaderResizeMode(mode); | - | ||||||||||||||||||||||||
| 675 |     if (d->hasAutoResizeSections()
  | 0 | ||||||||||||||||||||||||
| 676 |         d->doDelayedResizeSections(); never executed:  d->doDelayedResizeSections(); | 0 | ||||||||||||||||||||||||
| 677 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 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__,1253) : qt_noop()); | - | ||||||||||||||||||||||||
| 683 | - | |||||||||||||||||||||||||
| 684 | ResizeMode old = d->headerSectionResizeMode(visual); | - | ||||||||||||||||||||||||
| 685 | d->setHeaderSectionResizeMode(visual, mode); | - | ||||||||||||||||||||||||
| 686 | - | |||||||||||||||||||||||||
| 687 |     if (mode == Stretch
 
  | 0 | ||||||||||||||||||||||||
| 688 |         ++ never executed:  d->stretchSections;++d->stretchSections;never executed:  ++d->stretchSections; | 0 | ||||||||||||||||||||||||
| 689 |     else if (mode == ResizeToContents
 
  | 0 | ||||||||||||||||||||||||
| 690 |         ++ never executed:  d->contentsSections;++d->contentsSections;never executed:  ++d->contentsSections; | 0 | ||||||||||||||||||||||||
| 691 |     else if (mode != Stretch
 
  | 0 | ||||||||||||||||||||||||
| 692 |         -- never executed:  d->stretchSections;--d->stretchSections;never executed:  --d->stretchSections; | 0 | ||||||||||||||||||||||||
| 693 |     else if (mode != ResizeToContents
 
  | 0 | ||||||||||||||||||||||||
| 694 |         -- never executed:  d->contentsSections;--d->contentsSections;never executed:  --d->contentsSections; | 0 | ||||||||||||||||||||||||
| 695 | - | |||||||||||||||||||||||||
| 696 |     if (d->hasAutoResizeSections()
 
  | 0 | ||||||||||||||||||||||||
| 697 |         d->doDelayedResizeSections(); never executed:  d->doDelayedResizeSections(); | 0 | ||||||||||||||||||||||||
| 698 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 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
  | 0 | ||||||||||||||||||||||||
| 704 |         return never executed:   Fixed;return Fixed;never executed:  return Fixed; | 0 | ||||||||||||||||||||||||
| 705 |     return never executed:   d->headerSectionResizeMode(visual);return d->headerSectionResizeMode(visual);never executed:  return d->headerSectionResizeMode(visual); | 0 | ||||||||||||||||||||||||
| 706 | } | - | ||||||||||||||||||||||||
| 707 | void QHeaderView::setResizeContentsPrecision(int precision) | - | ||||||||||||||||||||||||
| 708 | { | - | ||||||||||||||||||||||||
| 709 | QHeaderViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 710 | d->resizeContentsPrecision = precision; | - | ||||||||||||||||||||||||
| 711 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 712 | int QHeaderView::resizeContentsPrecision() const | - | ||||||||||||||||||||||||
| 713 | { | - | ||||||||||||||||||||||||
| 714 | const QHeaderViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 715 |     return never executed:   d->resizeContentsPrecision;return d->resizeContentsPrecision;never executed:  return d->resizeContentsPrecision; | 0 | ||||||||||||||||||||||||
| 716 | } | - | ||||||||||||||||||||||||
| 717 | int QHeaderView::stretchSectionCount() const | - | ||||||||||||||||||||||||
| 718 | { | - | ||||||||||||||||||||||||
| 719 | const QHeaderViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 720 |     return never executed:   d->stretchSections;return d->stretchSections;never executed:  return d->stretchSections; | 0 | ||||||||||||||||||||||||
| 721 | } | - | ||||||||||||||||||||||||
| 722 | void QHeaderView::setSortIndicatorShown(bool show) | - | ||||||||||||||||||||||||
| 723 | { | - | ||||||||||||||||||||||||
| 724 | QHeaderViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 725 |     if (d->sortIndicatorShown == show
  | 0 | ||||||||||||||||||||||||
| 726 |         return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 727 | - | |||||||||||||||||||||||||
| 728 | d->sortIndicatorShown = show; | - | ||||||||||||||||||||||||
| 729 | - | |||||||||||||||||||||||||
| 730 |     if (sortIndicatorSection() < 0
 
  | 0 | ||||||||||||||||||||||||
| 731 |         return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 732 | - | |||||||||||||||||||||||||
| 733 |     if (d->headerSectionResizeMode(sortIndicatorSection()) == ResizeToContents
  | 0 | ||||||||||||||||||||||||
| 734 |         resizeSections(); never executed:  resizeSections(); | 0 | ||||||||||||||||||||||||
| 735 | - | |||||||||||||||||||||||||
| 736 | d->viewport->update(); | - | ||||||||||||||||||||||||
| 737 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 738 | - | |||||||||||||||||||||||||
| 739 | bool QHeaderView::isSortIndicatorShown() const | - | ||||||||||||||||||||||||
| 740 | { | - | ||||||||||||||||||||||||
| 741 | const QHeaderViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 742 |     return never executed:   d->sortIndicatorShown;return d->sortIndicatorShown;never executed:  return d->sortIndicatorShown; | 0 | ||||||||||||||||||||||||
| 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
 
  | 0 | ||||||||||||||||||||||||
| 751 |         return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 752 | d->sortIndicatorSection = logicalIndex; | - | ||||||||||||||||||||||||
| 753 | d->sortIndicatorOrder = order; | - | ||||||||||||||||||||||||
| 754 | - | |||||||||||||||||||||||||
| 755 |     if (logicalIndex >= d->sectionCount()
  | 0 | ||||||||||||||||||||||||
| 756 | sortIndicatorChanged(logicalIndex, order); | - | ||||||||||||||||||||||||
| 757 |         return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 758 | } | - | ||||||||||||||||||||||||
| 759 | - | |||||||||||||||||||||||||
| 760 |     if (old != logicalIndex
  | 0 | ||||||||||||||||||||||||
| 761 |         && ((logicalIndex >= 0
 
  | 0 | ||||||||||||||||||||||||
| 762 |             || old >= d->sectionCount()
 
 
  | 0 | ||||||||||||||||||||||||
| 763 | resizeSections(); | - | ||||||||||||||||||||||||
| 764 | d->viewport->update(); | - | ||||||||||||||||||||||||
| 765 |     } never executed:   else {end of block | 0 | ||||||||||||||||||||||||
| 766 |         if (old >= 0
 
  | 0 | ||||||||||||||||||||||||
| 767 |             updateSection(old); never executed:  updateSection(old); | 0 | ||||||||||||||||||||||||
| 768 |         if (logicalIndex >= 0
  | 0 | ||||||||||||||||||||||||
| 769 |             updateSection(logicalIndex); never executed:  updateSection(logicalIndex); | 0 | ||||||||||||||||||||||||
| 770 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 771 | - | |||||||||||||||||||||||||
| 772 | sortIndicatorChanged(logicalIndex, order); | - | ||||||||||||||||||||||||
| 773 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 774 | int QHeaderView::sortIndicatorSection() const | - | ||||||||||||||||||||||||
| 775 | { | - | ||||||||||||||||||||||||
| 776 | const QHeaderViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 777 |     return never executed:   d->sortIndicatorSection;return d->sortIndicatorSection;never executed:  return d->sortIndicatorSection; | 0 | ||||||||||||||||||||||||
| 778 | } | - | ||||||||||||||||||||||||
| 779 | Qt::SortOrder QHeaderView::sortIndicatorOrder() const | - | ||||||||||||||||||||||||
| 780 | { | - | ||||||||||||||||||||||||
| 781 | const QHeaderViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 782 |     return never executed:   d->sortIndicatorOrder;return d->sortIndicatorOrder;never executed:  return d->sortIndicatorOrder; | 0 | ||||||||||||||||||||||||
| 783 | } | - | ||||||||||||||||||||||||
| 784 | bool QHeaderView::stretchLastSection() const | - | ||||||||||||||||||||||||
| 785 | { | - | ||||||||||||||||||||||||
| 786 | const QHeaderViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 787 |     return never executed:   d->stretchLastSection;return d->stretchLastSection;never executed:  return d->stretchLastSection; | 0 | ||||||||||||||||||||||||
| 788 | } | - | ||||||||||||||||||||||||
| 789 | - | |||||||||||||||||||||||||
| 790 | void QHeaderView::setStretchLastSection(bool stretch) | - | ||||||||||||||||||||||||
| 791 | { | - | ||||||||||||||||||||||||
| 792 | QHeaderViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 793 |     if (d->stretchLastSection == stretch
  | 0 | ||||||||||||||||||||||||
| 794 |         return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 795 | d->stretchLastSection = stretch; | - | ||||||||||||||||||||||||
| 796 |     if (d->state != QHeaderViewPrivate::NoState
  | 0 | ||||||||||||||||||||||||
| 797 |         return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 798 |     if (stretch
  | 0 | ||||||||||||||||||||||||
| 799 | d->setNewLastSection(d->lastVisibleVisualIndex()); | - | ||||||||||||||||||||||||
| 800 | resizeSections(); | - | ||||||||||||||||||||||||
| 801 |     } never executed:   else {end of block | 0 | ||||||||||||||||||||||||
| 802 | d->restoreSizeOnPrevLastSection(); | - | ||||||||||||||||||||||||
| 803 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 804 | } | - | ||||||||||||||||||||||||
| 805 | bool QHeaderView::cascadingSectionResizes() const | - | ||||||||||||||||||||||||
| 806 | { | - | ||||||||||||||||||||||||
| 807 | const QHeaderViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 808 |     return never executed:   d->cascadingResizing;return d->cascadingResizing;never executed:  return d->cascadingResizing; | 0 | ||||||||||||||||||||||||
| 809 | } | - | ||||||||||||||||||||||||
| 810 | - | |||||||||||||||||||||||||
| 811 | void QHeaderView::setCascadingSectionResizes(bool enable) | - | ||||||||||||||||||||||||
| 812 | { | - | ||||||||||||||||||||||||
| 813 | QHeaderViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 814 | d->cascadingResizing = enable; | - | ||||||||||||||||||||||||
| 815 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 816 | int QHeaderView::defaultSectionSize() const | - | ||||||||||||||||||||||||
| 817 | { | - | ||||||||||||||||||||||||
| 818 | const QHeaderViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 819 |     return never executed:   d->defaultSectionSize;return d->defaultSectionSize;never executed:  return d->defaultSectionSize; | 0 | ||||||||||||||||||||||||
| 820 | } | - | ||||||||||||||||||||||||
| 821 | - | |||||||||||||||||||||||||
| 822 | void QHeaderView::setDefaultSectionSize(int size) | - | ||||||||||||||||||||||||
| 823 | { | - | ||||||||||||||||||||||||
| 824 | QHeaderViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 825 |     if (size < 0
 
  | 0 | ||||||||||||||||||||||||
| 826 |         return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 827 | d->setDefaultSectionSize(size); | - | ||||||||||||||||||||||||
| 828 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 829 | - | |||||||||||||||||||||||||
| 830 | void QHeaderView::resetDefaultSectionSize() | - | ||||||||||||||||||||||||
| 831 | { | - | ||||||||||||||||||||||||
| 832 | QHeaderViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 833 |     if (d->customDefaultSectionSize
  | 0 | ||||||||||||||||||||||||
| 834 | d->updateDefaultSectionSizeFromStyle(); | - | ||||||||||||||||||||||||
| 835 | d->customDefaultSectionSize = false; | - | ||||||||||||||||||||||||
| 836 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 837 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 838 | int QHeaderView::minimumSectionSize() const | - | ||||||||||||||||||||||||
| 839 | { | - | ||||||||||||||||||||||||
| 840 | const QHeaderViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 841 |     if (d->minimumSectionSize == -1
  | 0 | ||||||||||||||||||||||||
| 842 | QSize strut = QApplication::globalStrut(); | - | ||||||||||||||||||||||||
| 843 | int margin = 2 * style()->pixelMetric(QStyle::PM_HeaderMargin, 0, this); | - | ||||||||||||||||||||||||
| 844 |         if (d->orientation == Qt::Horizontal
  | 0 | ||||||||||||||||||||||||
| 845 |             return never executed:   qMax(strut.width(), (fontMetrics().maxWidth() + margin));return qMax(strut.width(), (fontMetrics().maxWidth() + margin));never executed:  return qMax(strut.width(), (fontMetrics().maxWidth() + margin)); | 0 | ||||||||||||||||||||||||
| 846 |         return never executed:   qMax(strut.height(), (fontMetrics().height() + margin));return qMax(strut.height(), (fontMetrics().height() + margin));never executed:  return qMax(strut.height(), (fontMetrics().height() + margin)); | 0 | ||||||||||||||||||||||||
| 847 | } | - | ||||||||||||||||||||||||
| 848 |     return never executed:   d->minimumSectionSize;return d->minimumSectionSize;never executed:  return d->minimumSectionSize; | 0 | ||||||||||||||||||||||||
| 849 | } | - | ||||||||||||||||||||||||
| 850 | - | |||||||||||||||||||||||||
| 851 | void QHeaderView::setMinimumSectionSize(int size) | - | ||||||||||||||||||||||||
| 852 | { | - | ||||||||||||||||||||||||
| 853 | QHeaderViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 854 |     if (size < -1
 
  | 0 | ||||||||||||||||||||||||
| 855 |         return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 856 | d->minimumSectionSize = size; | - | ||||||||||||||||||||||||
| 857 |     if (d->minimumSectionSize > maximumSectionSize()
  | 0 | ||||||||||||||||||||||||
| 858 |         d->maximumSectionSize = size; never executed:  d->maximumSectionSize = size; | 0 | ||||||||||||||||||||||||
| 859 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 860 | int QHeaderView::maximumSectionSize() const | - | ||||||||||||||||||||||||
| 861 | { | - | ||||||||||||||||||||||||
| 862 | const QHeaderViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 863 |     if (d->maximumSectionSize == -1
  | 0 | ||||||||||||||||||||||||
| 864 |         return never executed:   maxSizeSection;return maxSizeSection;never executed:  return maxSizeSection; | 0 | ||||||||||||||||||||||||
| 865 |     return never executed:   d->maximumSectionSize;return d->maximumSectionSize;never executed:  return d->maximumSectionSize; | 0 | ||||||||||||||||||||||||
| 866 | } | - | ||||||||||||||||||||||||
| 867 | - | |||||||||||||||||||||||||
| 868 | void QHeaderView::setMaximumSectionSize(int size) | - | ||||||||||||||||||||||||
| 869 | { | - | ||||||||||||||||||||||||
| 870 | QHeaderViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 871 |     if (size == -1
  | 0 | ||||||||||||||||||||||||
| 872 | d->maximumSectionSize = maxSizeSection; | - | ||||||||||||||||||||||||
| 873 |         return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 874 | } | - | ||||||||||||||||||||||||
| 875 |     if (size < 0
 
  | 0 | ||||||||||||||||||||||||
| 876 |         return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 877 |     if (minimumSectionSize() > size
  | 0 | ||||||||||||||||||||||||
| 878 |         d->minimumSectionSize = size; never executed:  d->minimumSectionSize = size; | 0 | ||||||||||||||||||||||||
| 879 | - | |||||||||||||||||||||||||
| 880 | d->maximumSectionSize = size; | - | ||||||||||||||||||||||||
| 881 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 882 | Qt::Alignment QHeaderView::defaultAlignment() const | - | ||||||||||||||||||||||||
| 883 | { | - | ||||||||||||||||||||||||
| 884 | const QHeaderViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 885 |     return never executed:   d->defaultAlignment;return d->defaultAlignment;never executed:  return d->defaultAlignment; | 0 | ||||||||||||||||||||||||
| 886 | } | - | ||||||||||||||||||||||||
| 887 | - | |||||||||||||||||||||||||
| 888 | void QHeaderView::setDefaultAlignment(Qt::Alignment alignment) | - | ||||||||||||||||||||||||
| 889 | { | - | ||||||||||||||||||||||||
| 890 | QHeaderViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 891 |     if (d->defaultAlignment == alignment
  | 0 | ||||||||||||||||||||||||
| 892 |         return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 893 | - | |||||||||||||||||||||||||
| 894 | d->defaultAlignment = alignment; | - | ||||||||||||||||||||||||
| 895 | d->viewport->update(); | - | ||||||||||||||||||||||||
| 896 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 897 | - | |||||||||||||||||||||||||
| 898 | - | |||||||||||||||||||||||||
| 899 | - | |||||||||||||||||||||||||
| 900 | - | |||||||||||||||||||||||||
| 901 | void QHeaderView::doItemsLayout() | - | ||||||||||||||||||||||||
| 902 | { | - | ||||||||||||||||||||||||
| 903 | initializeSections(); | - | ||||||||||||||||||||||||
| 904 | QAbstractItemView::doItemsLayout(); | - | ||||||||||||||||||||||||
| 905 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 906 | - | |||||||||||||||||||||||||
| 907 | - | |||||||||||||||||||||||||
| 908 | - | |||||||||||||||||||||||||
| 909 | - | |||||||||||||||||||||||||
| 910 | - | |||||||||||||||||||||||||
| 911 | - | |||||||||||||||||||||||||
| 912 | - | |||||||||||||||||||||||||
| 913 | bool QHeaderView::sectionsMoved() const | - | ||||||||||||||||||||||||
| 914 | { | - | ||||||||||||||||||||||||
| 915 | const QHeaderViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 916 |     return never executed:   !d->visualIndices.isEmpty();return !d->visualIndices.isEmpty();never executed:  return !d->visualIndices.isEmpty(); | 0 | ||||||||||||||||||||||||
| 917 | } | - | ||||||||||||||||||||||||
| 918 | bool QHeaderView::sectionsHidden() const | - | ||||||||||||||||||||||||
| 919 | { | - | ||||||||||||||||||||||||
| 920 | const QHeaderViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 921 |     return never executed:   !d->hiddenSectionSize.isEmpty();return !d->hiddenSectionSize.isEmpty();never executed:  return !d->hiddenSectionSize.isEmpty(); | 0 | ||||||||||||||||||||||||
| 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 never executed:   data;return data;never executed:  return data; | 0 | ||||||||||||||||||||||||
| 932 | } | - | ||||||||||||||||||||||||
| 933 | bool QHeaderView::restoreState(const QByteArray &state) | - | ||||||||||||||||||||||||
| 934 | { | - | ||||||||||||||||||||||||
| 935 | QHeaderViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 936 |     if (state.isEmpty()
  | 0 | ||||||||||||||||||||||||
| 937 |         return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||||||||
| 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
  | 0 | ||||||||||||||||||||||||
| 945 |         || marker != QHeaderViewPrivate::VersionMarker
  | 0 | ||||||||||||||||||||||||
| 946 |         || ver != 0
  | 0 | ||||||||||||||||||||||||
| 947 |         return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||||||||
| 948 | - | |||||||||||||||||||||||||
| 949 |     if (d->read(stream)
  | 0 | ||||||||||||||||||||||||
| 950 | sortIndicatorChanged(d->sortIndicatorSection, d->sortIndicatorOrder ); | - | ||||||||||||||||||||||||
| 951 | d->viewport->update(); | - | ||||||||||||||||||||||||
| 952 |         return never executed:   true;return true;never executed:  return true; | 0 | ||||||||||||||||||||||||
| 953 | } | - | ||||||||||||||||||||||||
| 954 |     return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||||||||
| 955 | } | - | ||||||||||||||||||||||||
| 956 | - | |||||||||||||||||||||||||
| 957 | - | |||||||||||||||||||||||||
| 958 | - | |||||||||||||||||||||||||
| 959 | - | |||||||||||||||||||||||||
| 960 | - | |||||||||||||||||||||||||
| 961 | void QHeaderView::reset() | - | ||||||||||||||||||||||||
| 962 | { | - | ||||||||||||||||||||||||
| 963 | QAbstractItemView::reset(); | - | ||||||||||||||||||||||||
| 964 | - | |||||||||||||||||||||||||
| 965 | - | |||||||||||||||||||||||||
| 966 | - | |||||||||||||||||||||||||
| 967 | initializeSections(); | - | ||||||||||||||||||||||||
| 968 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 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
  | 0 | ||||||||||||||||||||||||
| 978 |         return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 979 | - | |||||||||||||||||||||||||
| 980 |     if (logicalFirst < 0
 
 
 
  | 0 | ||||||||||||||||||||||||
| 981 |         return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 982 | - | |||||||||||||||||||||||||
| 983 | d->invalidateCachedSizeHint(); | - | ||||||||||||||||||||||||
| 984 | - | |||||||||||||||||||||||||
| 985 | int firstVisualIndex = 2147483647, lastVisualIndex = -1; | - | ||||||||||||||||||||||||
| 986 | - | |||||||||||||||||||||||||
| 987 |     for (int section = logicalFirst; section <= logicalLast
  | 0 | ||||||||||||||||||||||||
| 988 | const int visual = visualIndex(section); | - | ||||||||||||||||||||||||
| 989 | firstVisualIndex = qMin(firstVisualIndex, visual); | - | ||||||||||||||||||||||||
| 990 | lastVisualIndex = qMax(lastVisualIndex, visual); | - | ||||||||||||||||||||||||
| 991 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 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
  | 0 | ||||||||||||||||||||||||
| 999 | d->viewport->update(first, 0, last - first, d->viewport->height()); | - | ||||||||||||||||||||||||
| 1000 |     } never executed:   else {end of block | 0 | ||||||||||||||||||||||||
| 1001 | d->viewport->update(0, first, d->viewport->width(), last - first); | - | ||||||||||||||||||||||||
| 1002 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1003 | } | - | ||||||||||||||||||||||||
| 1004 | void QHeaderView::updateSection(int logicalIndex) | - | ||||||||||||||||||||||||
| 1005 | { | - | ||||||||||||||||||||||||
| 1006 | QHeaderViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1007 |     if (d->orientation == Qt::Horizontal
  | 0 | ||||||||||||||||||||||||
| 1008 |         d->viewport->update(QRect(sectionViewportPosition(logicalIndex), never executed:  d->viewport->update(QRect(sectionViewportPosition(logicalIndex), 0, sectionSize(logicalIndex), d->viewport->height())); | 0 | ||||||||||||||||||||||||
| 1009 |                                   0, sectionSize(logicalIndex), d->viewport->height())); never executed:  d->viewport->update(QRect(sectionViewportPosition(logicalIndex), 0, sectionSize(logicalIndex), d->viewport->height())); | 0 | ||||||||||||||||||||||||
| 1010 | else | - | ||||||||||||||||||||||||
| 1011 |         d->viewport->update(QRect(0, sectionViewportPosition(logicalIndex), never executed:  d->viewport->update(QRect(0, sectionViewportPosition(logicalIndex), d->viewport->width(), sectionSize(logicalIndex))); | 0 | ||||||||||||||||||||||||
| 1012 |                                   d->viewport->width(), sectionSize(logicalIndex))); never executed:  d->viewport->update(QRect(0, sectionViewportPosition(logicalIndex), d->viewport->width(), sectionSize(logicalIndex))); | 0 | ||||||||||||||||||||||||
| 1013 | } | - | ||||||||||||||||||||||||
| 1014 | - | |||||||||||||||||||||||||
| 1015 | - | |||||||||||||||||||||||||
| 1016 | - | |||||||||||||||||||||||||
| 1017 | - | |||||||||||||||||||||||||
| 1018 | - | |||||||||||||||||||||||||
| 1019 | - | |||||||||||||||||||||||||
| 1020 | void QHeaderView::resizeSections() | - | ||||||||||||||||||||||||
| 1021 | { | - | ||||||||||||||||||||||||
| 1022 | QHeaderViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1023 |     if (d->hasAutoResizeSections()
  | 0 | ||||||||||||||||||||||||
| 1024 |         d->resizeSections(Interactive, false); never executed:  d->resizeSections(Interactive, false); | 0 | ||||||||||||||||||||||||
| 1025 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1026 | void QHeaderView::sectionsInserted(const QModelIndex &parent, | - | ||||||||||||||||||||||||
| 1027 | int logicalFirst, int logicalLast) | - | ||||||||||||||||||||||||
| 1028 | { | - | ||||||||||||||||||||||||
| 1029 | QHeaderViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1030 |     if (parent != d->root
  | 0 | ||||||||||||||||||||||||
| 1031 |         return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 1032 | int oldCount = d->sectionCount(); | - | ||||||||||||||||||||||||
| 1033 | - | |||||||||||||||||||||||||
| 1034 | d->invalidateCachedSizeHint(); | - | ||||||||||||||||||||||||
| 1035 | - | |||||||||||||||||||||||||
| 1036 |     if (d->state == QHeaderViewPrivate::ResizeSection
  | 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()
  | 0 | ||||||||||||||||||||||||
| 1045 | - | |||||||||||||||||||||||||
| 1046 | int visualIndexForStretch = d->lastSectionLogicalIdx; | - | ||||||||||||||||||||||||
| 1047 |         if (d->lastSectionLogicalIdx >= 0
 
  | 0 | ||||||||||||||||||||||||
| 1048 |             visualIndexForStretch = d->visualIndices[d->lastSectionLogicalIdx]; never executed:  visualIndexForStretch = d->visualIndices[d->lastSectionLogicalIdx]; | 0 | ||||||||||||||||||||||||
| 1049 | - | |||||||||||||||||||||||||
| 1050 | - | |||||||||||||||||||||||||
| 1051 |         if (d->lastSectionLogicalIdx < 0
 
  | 0 | ||||||||||||||||||||||||
| 1052 |             lastSectionActualChange = true; never executed:  lastSectionActualChange = true; | 0 | ||||||||||||||||||||||||
| 1053 | - | |||||||||||||||||||||||||
| 1054 |         if (d->lastSectionLogicalIdx >= logicalFirst
  | 0 | ||||||||||||||||||||||||
| 1055 |             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()
 
  | 0 | ||||||||||||||||||||||||
| 1062 | int insertLength = d->defaultSectionSize * insertCount; | - | ||||||||||||||||||||||||
| 1063 | d->length += insertLength; | - | ||||||||||||||||||||||||
| 1064 | d->sectionItems.insert(d->sectionItems.count(), insertCount, section); | - | ||||||||||||||||||||||||
| 1065 |     } never executed:   else {end of block | 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
  | 0 | ||||||||||||||||||||||||
| 1074 |         d->sortIndicatorSection += insertCount; never executed:  d->sortIndicatorSection += insertCount; | 0 | ||||||||||||||||||||||||
| 1075 | - | |||||||||||||||||||||||||
| 1076 | - | |||||||||||||||||||||||||
| 1077 |     if (d->globalResizeMode == Stretch
  | 0 | ||||||||||||||||||||||||
| 1078 |         d->stretchSections = d->sectionCount(); never executed:  d->stretchSections = d->sectionCount(); | 0 | ||||||||||||||||||||||||
| 1079 |     else if (d->globalResizeMode == ResizeToContents
  | 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()
 
  | 0 | ||||||||||||||||||||||||
| 1087 | ((!(d->visualIndices.count() == d->logicalIndices.count())) ? qt_assert("d->visualIndices.count() == d->logicalIndices.count()",__FILE__,1911) : qt_noop()); | - | ||||||||||||||||||||||||
| 1088 | int mappingCount = d->visualIndices.count(); | - | ||||||||||||||||||||||||
| 1089 |         for (int i = 0; i < mappingCount
  | 0 | ||||||||||||||||||||||||
| 1090 |             if (d->visualIndices.at(i) >= logicalFirst
  | 0 | ||||||||||||||||||||||||
| 1091 |                d->visualIndices[i] += insertCount; never executed:  d->visualIndices[i] += insertCount; | 0 | ||||||||||||||||||||||||
| 1092 |             if (d->logicalIndices.at(i) >= logicalFirst
  | 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
  | 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
  | 0 | ||||||||||||||||||||||||
| 1105 | const int oldIndex = it.key(); | - | ||||||||||||||||||||||||
| 1106 |         const int newIndex = (
 
  | 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
  | 0 | ||||||||||||||||||||||||
| 1115 |         d->maybeRestorePrevLastSectionAndStretchLast(); never executed:  d->maybeRestorePrevLastSectionAndStretchLast(); | 0 | ||||||||||||||||||||||||
| 1116 | - | |||||||||||||||||||||||||
| 1117 | - | |||||||||||||||||||||||||
| 1118 |     if (!d->hasAutoResizeSections()
  | 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 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 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
  | 0 | ||||||||||||||||||||||||
| 1137 |         if (q->isSectionHidden(i)
  | 0 | ||||||||||||||||||||||||
| 1138 |             newHiddenSectionSize[i] = hiddenSectionSize[i]; never executed:  newHiddenSectionSize[i] = hiddenSectionSize[i]; | 0 | ||||||||||||||||||||||||
| 1139 |     for (int j = logicalLast + 1; j < sectionCount()
  | 0 | ||||||||||||||||||||||||
| 1140 |         if (q->isSectionHidden(j)
  | 0 | ||||||||||||||||||||||||
| 1141 |             newHiddenSectionSize[j - changeCount] = hiddenSectionSize[j]; never executed:  newHiddenSectionSize[j - changeCount] = hiddenSectionSize[j]; | 0 | ||||||||||||||||||||||||
| 1142 | hiddenSectionSize = newHiddenSectionSize; | - | ||||||||||||||||||||||||
| 1143 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 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
  | 0 | ||||||||||||||||||||||||
| 1150 |         return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 1151 |     if (qMin(logicalFirst, logicalLast) < 0
  | 0 | ||||||||||||||||||||||||
| 1152 |         || qMax(logicalLast, logicalFirst) >= sectionCount()
  | 0 | ||||||||||||||||||||||||
| 1153 |         return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 1154 | int oldCount = q->count(); | - | ||||||||||||||||||||||||
| 1155 | int changeCount = logicalLast - logicalFirst + 1; | - | ||||||||||||||||||||||||
| 1156 | - | |||||||||||||||||||||||||
| 1157 |     if (state == QHeaderViewPrivate::ResizeSection
  | 0 | ||||||||||||||||||||||||
| 1158 |         preventCursorChangeInSetOffset = true; never executed:  preventCursorChangeInSetOffset = true; | 0 | ||||||||||||||||||||||||
| 1159 | - | |||||||||||||||||||||||||
| 1160 | updateHiddenSections(logicalFirst, logicalLast); | - | ||||||||||||||||||||||||
| 1161 | - | |||||||||||||||||||||||||
| 1162 |     if (visualIndices.isEmpty()
 
  | 0 | ||||||||||||||||||||||||
| 1163 | - | |||||||||||||||||||||||||
| 1164 | removeSectionsFromSectionItems(logicalFirst, logicalLast); | - | ||||||||||||||||||||||||
| 1165 |     } never executed:   else {end of block | 0 | ||||||||||||||||||||||||
| 1166 |         if (logicalFirst == logicalLast
  | 0 | ||||||||||||||||||||||||
| 1167 | int l = logicalFirst; | - | ||||||||||||||||||||||||
| 1168 | int visual = visualIndices.at(l); | - | ||||||||||||||||||||||||
| 1169 | ((!(sectionCount() == logicalIndices.count())) ? qt_assert("sectionCount() == logicalIndices.count()",__FILE__,2002) : qt_noop()); | - | ||||||||||||||||||||||||
| 1170 |             for (int v = 0; v < sectionCount()
  | 0 | ||||||||||||||||||||||||
| 1171 |                 if (v > visual
  | 0 | ||||||||||||||||||||||||
| 1172 | int logical = logicalIndices.at(v); | - | ||||||||||||||||||||||||
| 1173 | --(visualIndices[logical]); | - | ||||||||||||||||||||||||
| 1174 |                 } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1175 |                 if (logicalIndex(v) > l
  | 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:   else {end of block | 0 | ||||||||||||||||||||||||
| 1183 | sectionStartposRecalc = true; | - | ||||||||||||||||||||||||
| 1184 |             for (int u = 0; u < sectionItems.count()
  | 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
  | 0 | ||||||||||||||||||||||||
| 1187 |                 if (logicalFirst <= sectionItems.at(v).tmpLogIdx
 
  | 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()
  | 0 | ||||||||||||||||||||||||
| 1195 | int logindex = sectionItems.at(w).tmpLogIdx; | - | ||||||||||||||||||||||||
| 1196 |                 if (logindex > logicalFirst
  | 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
  | 0 | ||||||||||||||||||||||||
| 1207 |         if (sortIndicatorSection <= logicalLast
  | 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
  | 0 | ||||||||||||||||||||||||
| 1215 |         clear(); never executed:  clear(); | 0 | ||||||||||||||||||||||||
| 1216 | invalidateCachedSizeHint(); | - | ||||||||||||||||||||||||
| 1217 | q->sectionCountChanged(oldCount, q->count()); | - | ||||||||||||||||||||||||
| 1218 | - | |||||||||||||||||||||||||
| 1219 |     if (q->stretchLastSection()
  | 0 | ||||||||||||||||||||||||
| 1220 |         const bool lastSectionRemoved = lastSectionLogicalIdx >= logicalFirst
 
  | 0 | ||||||||||||||||||||||||
| 1221 |         if (lastSectionRemoved
  | 0 | ||||||||||||||||||||||||
| 1222 |             setNewLastSection(lastVisibleVisualIndex()); never executed:  setNewLastSection(lastVisibleVisualIndex()); | 0 | ||||||||||||||||||||||||
| 1223 | else | - | ||||||||||||||||||||||||
| 1224 |             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
 
  | 0 | ||||||||||||||||||||||||
| 1238 |         || model->columnCount(root) == 0
  | 0 | ||||||||||||||||||||||||
| 1239 |         return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 1240 | - | |||||||||||||||||||||||||
| 1241 |     if (hiddenSectionSize.count() == 0
  | 0 | ||||||||||||||||||||||||
| 1242 |         return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 1243 | - | |||||||||||||||||||||||||
| 1244 |     for (int i = 0; i < sectionItems.count()
  | 0 | ||||||||||||||||||||||||
| 1245 |         if (isVisualIndexHidden(i)
  | 0 | ||||||||||||||||||||||||
| 1246 |             persistentHiddenSections.append(orientation == Qt::Horizontal never executed:  persistentHiddenSections.append(orientation == Qt::Horizontal ? model->index(0, logicalIndex(i), root) : model->index(logicalIndex(i), 0, root)); | 0 | ||||||||||||||||||||||||
| 1247 |                                             ? model->index(0, logicalIndex(i), root) never executed:  persistentHiddenSections.append(orientation == Qt::Horizontal ? model->index(0, logicalIndex(i), root) : model->index(logicalIndex(i), 0, root)); | 0 | ||||||||||||||||||||||||
| 1248 |                                             : model->index(logicalIndex(i), 0, root)); never executed:  persistentHiddenSections.append(orientation == Qt::Horizontal ? model->index(0, logicalIndex(i), root) : model->index(logicalIndex(i), 0, root)); | 0 | ||||||||||||||||||||||||
| 1249 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1250 | - | |||||||||||||||||||||||||
| 1251 | void QHeaderViewPrivate::_q_layoutChanged() | - | ||||||||||||||||||||||||
| 1252 | { | - | ||||||||||||||||||||||||
| 1253 | QHeaderView * const q = q_func(); | - | ||||||||||||||||||||||||
| 1254 | viewport->update(); | - | ||||||||||||||||||||||||
| 1255 |     if (persistentHiddenSections.isEmpty()
 
  | 0 | ||||||||||||||||||||||||
| 1256 |         if (modelSectionCount() != sectionCount()
  | 0 | ||||||||||||||||||||||||
| 1257 |             q->initializeSections(); never executed:  q->initializeSections(); | 0 | ||||||||||||||||||||||||
| 1258 | persistentHiddenSections.clear(); | - | ||||||||||||||||||||||||
| 1259 |         return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 1260 | } | - | ||||||||||||||||||||||||
| 1261 | - | |||||||||||||||||||||||||
| 1262 | QBitArray oldSectionHidden = sectionsHiddenToBitVector(); | - | ||||||||||||||||||||||||
| 1263 | oldSectionHidden.resize(sectionItems.size()); | - | ||||||||||||||||||||||||
| 1264 | bool sectionCountChanged = false; | - | ||||||||||||||||||||||||
| 1265 | - | |||||||||||||||||||||||||
| 1266 |     for (int i = 0; i < persistentHiddenSections.count()
  | 0 | ||||||||||||||||||||||||
| 1267 | QModelIndex index = persistentHiddenSections.at(i); | - | ||||||||||||||||||||||||
| 1268 |         if (index.isValid()
  | 0 | ||||||||||||||||||||||||
| 1269 |             const int logical = (orientation == Qt::Horizontal
  | 0 | ||||||||||||||||||||||||
| 1270 | ? index.column() | - | ||||||||||||||||||||||||
| 1271 | : index.row()); | - | ||||||||||||||||||||||||
| 1272 | q->setSectionHidden(logical, true); | - | ||||||||||||||||||||||||
| 1273 | oldSectionHidden.setBit(logical, false); | - | ||||||||||||||||||||||||
| 1274 |         } never executed:   else if (!sectionCountChangedend of block
 
 
  | 0 | ||||||||||||||||||||||||
| 1275 | sectionCountChanged = true; | - | ||||||||||||||||||||||||
| 1276 |             break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 1277 | } | - | ||||||||||||||||||||||||
| 1278 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1279 | persistentHiddenSections.clear(); | - | ||||||||||||||||||||||||
| 1280 | - | |||||||||||||||||||||||||
| 1281 |     for (int i = 0; i < oldSectionHidden.count()
  | 0 | ||||||||||||||||||||||||
| 1282 |         if (oldSectionHidden.testBit(i)
  | 0 | ||||||||||||||||||||||||
| 1283 |             q->setSectionHidden(i, false); never executed:  q->setSectionHidden(i, false); | 0 | ||||||||||||||||||||||||
| 1284 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1285 | - | |||||||||||||||||||||||||
| 1286 | - | |||||||||||||||||||||||||
| 1287 |     if (sectionCountChanged
  | 0 | ||||||||||||||||||||||||
| 1288 |         q->initializeSections(); never executed:  q->initializeSections(); | 0 | ||||||||||||||||||||||||
| 1289 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 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
  | 0 | ||||||||||||||||||||||||
| 1301 | d->clear(); | - | ||||||||||||||||||||||||
| 1302 | sectionCountChanged(oldCount, 0); | - | ||||||||||||||||||||||||
| 1303 |     } never executed:   else if (newCount != oldCountend of block
  | 0 | ||||||||||||||||||||||||
| 1304 | const int min = qBound(0, oldCount, newCount - 1); | - | ||||||||||||||||||||||||
| 1305 | initializeSections(min, newCount - 1); | - | ||||||||||||||||||||||||
| 1306 |         if (stretchLastSection()
  | 0 | ||||||||||||||||||||||||
| 1307 |             d->maybeRestorePrevLastSectionAndStretchLast(); never executed:  d->maybeRestorePrevLastSectionAndStretchLast(); | 0 | ||||||||||||||||||||||||
| 1308 | - | |||||||||||||||||||||||||
| 1309 | - | |||||||||||||||||||||||||
| 1310 |         if (newCount < oldCount
  | 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__,2156) : qt_noop()); | - | ||||||||||||||||||||||||
| 1324 | ((!(end >= 0)) ? qt_assert("end >= 0",__FILE__,2157) : qt_noop()); | - | ||||||||||||||||||||||||
| 1325 | - | |||||||||||||||||||||||||
| 1326 | d->invalidateCachedSizeHint(); | - | ||||||||||||||||||||||||
| 1327 | int oldCount = d->sectionCount(); | - | ||||||||||||||||||||||||
| 1328 | - | |||||||||||||||||||||||||
| 1329 |     if (end + 1 < d->sectionCount()
  | 0 | ||||||||||||||||||||||||
| 1330 | int newCount = end + 1; | - | ||||||||||||||||||||||||
| 1331 | d->removeSectionsFromSectionItems(newCount, d->sectionCount() - 1); | - | ||||||||||||||||||||||||
| 1332 |         if (!d->hiddenSectionSize.isEmpty()
  | 0 | ||||||||||||||||||||||||
| 1333 |             if (oldCount - newCount > d->hiddenSectionSize.count()
  | 0 | ||||||||||||||||||||||||
| 1334 |                 for (int i = end + 1; i < d->sectionCount()
  | 0 | ||||||||||||||||||||||||
| 1335 |                     d->hiddenSectionSize.remove(i); never executed:  d->hiddenSectionSize.remove(i); | 0 | ||||||||||||||||||||||||
| 1336 |             } never executed:   else {end of block | 0 | ||||||||||||||||||||||||
| 1337 | QHash<int, int>::iterator it = d->hiddenSectionSize.begin(); | - | ||||||||||||||||||||||||
| 1338 |                 while (it != d->hiddenSectionSize.end()
  | 0 | ||||||||||||||||||||||||
| 1339 |                     if (it.key() > end
  | 0 | ||||||||||||||||||||||||
| 1340 |                         it = d->hiddenSectionSize.erase(it); never executed:  it = d->hiddenSectionSize.erase(it); | 0 | ||||||||||||||||||||||||
| 1341 | else | - | ||||||||||||||||||||||||
| 1342 |                         ++ never executed:  it;++it;never executed:  ++it; | 0 | ||||||||||||||||||||||||
| 1343 | } | - | ||||||||||||||||||||||||
| 1344 |             } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1345 | } | - | ||||||||||||||||||||||||
| 1346 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1347 | - | |||||||||||||||||||||||||
| 1348 | int newSectionCount = end + 1; | - | ||||||||||||||||||||||||
| 1349 | - | |||||||||||||||||||||||||
| 1350 |     if (!d->logicalIndices.isEmpty()
  | 0 | ||||||||||||||||||||||||
| 1351 |         if (oldCount <= newSectionCount
  | 0 | ||||||||||||||||||||||||
| 1352 | d->logicalIndices.resize(newSectionCount); | - | ||||||||||||||||||||||||
| 1353 | d->visualIndices.resize(newSectionCount); | - | ||||||||||||||||||||||||
| 1354 |             for (int i = oldCount; i < newSectionCount
  | 0 | ||||||||||||||||||||||||
| 1355 | d->logicalIndices[i] = i; | - | ||||||||||||||||||||||||
| 1356 | d->visualIndices[i] = i; | - | ||||||||||||||||||||||||
| 1357 |             } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1358 |         } never executed:   else {end of block | 0 | ||||||||||||||||||||||||
| 1359 | int j = 0; | - | ||||||||||||||||||||||||
| 1360 |             for (int i = 0; i < oldCount
  | 0 | ||||||||||||||||||||||||
| 1361 | int v = d->logicalIndices.at(i); | - | ||||||||||||||||||||||||
| 1362 |                 if (v < newSectionCount
  | 0 | ||||||||||||||||||||||||
| 1363 | d->logicalIndices[j] = v; | - | ||||||||||||||||||||||||
| 1364 | d->visualIndices[v] = j; | - | ||||||||||||||||||||||||
| 1365 | j++; | - | ||||||||||||||||||||||||
| 1366 |                 } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1367 |             } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1368 | d->logicalIndices.resize(newSectionCount); | - | ||||||||||||||||||||||||
| 1369 | d->visualIndices.resize(newSectionCount); | - | ||||||||||||||||||||||||
| 1370 |         } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1371 | } | - | ||||||||||||||||||||||||
| 1372 | - | |||||||||||||||||||||||||
| 1373 |     if (d->globalResizeMode == Stretch
  | 0 | ||||||||||||||||||||||||
| 1374 |         d->stretchSections = newSectionCount; never executed:  d->stretchSections = newSectionCount; | 0 | ||||||||||||||||||||||||
| 1375 |     else if (d->globalResizeMode == ResizeToContents
  | 0 | ||||||||||||||||||||||||
| 1376 |          d->contentsSections = newSectionCount; never executed:  d->contentsSections = newSectionCount; | 0 | ||||||||||||||||||||||||
| 1377 | - | |||||||||||||||||||||||||
| 1378 |     if (newSectionCount > oldCount
  | 0 | ||||||||||||||||||||||||
| 1379 |         d->createSectionItems(start, end, (end - start + 1) * d->defaultSectionSize, d->globalResizeMode); never executed:  d->createSectionItems(start, end, (end - start + 1) * d->defaultSectionSize, d->globalResizeMode); | 0 | ||||||||||||||||||||||||
| 1380 | - | |||||||||||||||||||||||||
| 1381 | - | |||||||||||||||||||||||||
| 1382 |     if (d->sectionCount() != oldCount
  | 0 | ||||||||||||||||||||||||
| 1383 |         sectionCountChanged(oldCount, d->sectionCount()); never executed:  sectionCountChanged(oldCount, d->sectionCount()); | 0 | ||||||||||||||||||||||||
| 1384 | d->viewport->update(); | - | ||||||||||||||||||||||||
| 1385 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 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
 
  | 0 | ||||||||||||||||||||||||
| 1396 |         if (old.isValid()
 
  | 0 | ||||||||||||||||||||||||
| 1397 |             d->viewport->update(QRect(sectionViewportPosition(old.column()), 0, never executed:  d->viewport->update(QRect(sectionViewportPosition(old.column()), 0, sectionSize(old.column()), d->viewport->height())); | 0 | ||||||||||||||||||||||||
| 1398 |                                     sectionSize(old.column()), d->viewport->height())); never executed:  d->viewport->update(QRect(sectionViewportPosition(old.column()), 0, sectionSize(old.column()), d->viewport->height())); | 0 | ||||||||||||||||||||||||
| 1399 |         if (current.isValid()
 
  | 0 | ||||||||||||||||||||||||
| 1400 |             d->viewport->update(QRect(sectionViewportPosition(current.column()), 0, never executed:  d->viewport->update(QRect(sectionViewportPosition(current.column()), 0, sectionSize(current.column()), d->viewport->height())); | 0 | ||||||||||||||||||||||||
| 1401 |                                     sectionSize(current.column()), d->viewport->height())); never executed:  d->viewport->update(QRect(sectionViewportPosition(current.column()), 0, sectionSize(current.column()), d->viewport->height())); | 0 | ||||||||||||||||||||||||
| 1402 |     } never executed:   else if (d->orientation == Qt::Verticalend of block
 
  | 0 | ||||||||||||||||||||||||
| 1403 |         if (old.isValid()
 
  | 0 | ||||||||||||||||||||||||
| 1404 |             d->viewport->update(QRect(0, sectionViewportPosition(old.row()), never executed:  d->viewport->update(QRect(0, sectionViewportPosition(old.row()), d->viewport->width(), sectionSize(old.row()))); | 0 | ||||||||||||||||||||||||
| 1405 |                                     d->viewport->width(), sectionSize(old.row()))); never executed:  d->viewport->update(QRect(0, sectionViewportPosition(old.row()), d->viewport->width(), sectionSize(old.row()))); | 0 | ||||||||||||||||||||||||
| 1406 |         if (current.isValid()
 
  | 0 | ||||||||||||||||||||||||
| 1407 |             d->viewport->update(QRect(0, sectionViewportPosition(current.row()), never executed:  d->viewport->update(QRect(0, sectionViewportPosition(current.row()), d->viewport->width(), sectionSize(current.row()))); | 0 | ||||||||||||||||||||||||
| 1408 |                                     d->viewport->width(), sectionSize(current.row()))); never executed:  d->viewport->update(QRect(0, sectionViewportPosition(current.row()), d->viewport->width(), sectionSize(current.row()))); | 0 | ||||||||||||||||||||||||
| 1409 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1410 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 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 never executed:   QEvent::HoverEnter:case QEvent::HoverEnter:never executed:   {case QEvent::HoverEnter: | 0 | ||||||||||||||||||||||||
| 1422 | QHoverEvent *he = static_cast<QHoverEvent*>(e); | - | ||||||||||||||||||||||||
| 1423 | d->hover = logicalIndexAt(he->pos()); | - | ||||||||||||||||||||||||
| 1424 |         if (d->hover != -1
  | 0 | ||||||||||||||||||||||||
| 1425 |             updateSection(d->hover); never executed:  updateSection(d->hover); | 0 | ||||||||||||||||||||||||
| 1426 |         break; never executed:   }break; | 0 | ||||||||||||||||||||||||
| 1427 |     case never executed:   QEvent::Leave:case QEvent::Leave:never executed:  case QEvent::Leave: | 0 | ||||||||||||||||||||||||
| 1428 |     case never executed:   QEvent::HoverLeave:case QEvent::HoverLeave:never executed:   {case QEvent::HoverLeave: | 0 | ||||||||||||||||||||||||
| 1429 |         if (d->hover != -1
  | 0 | ||||||||||||||||||||||||
| 1430 |             updateSection(d->hover); never executed:  updateSection(d->hover); | 0 | ||||||||||||||||||||||||
| 1431 | d->hover = -1; | - | ||||||||||||||||||||||||
| 1432 |         break; never executed:   }break; | 0 | ||||||||||||||||||||||||
| 1433 |     case never executed:   QEvent::HoverMove:case QEvent::HoverMove:never executed:   {case QEvent::HoverMove: | 0 | ||||||||||||||||||||||||
| 1434 | QHoverEvent *he = static_cast<QHoverEvent*>(e); | - | ||||||||||||||||||||||||
| 1435 | int oldHover = d->hover; | - | ||||||||||||||||||||||||
| 1436 | d->hover = logicalIndexAt(he->pos()); | - | ||||||||||||||||||||||||
| 1437 |         if (d->hover != oldHover
  | 0 | ||||||||||||||||||||||||
| 1438 |             if (oldHover != -1
  | 0 | ||||||||||||||||||||||||
| 1439 |                 updateSection(oldHover); never executed:  updateSection(oldHover); | 0 | ||||||||||||||||||||||||
| 1440 |             if (d->hover != -1
  | 0 | ||||||||||||||||||||||||
| 1441 |                 updateSection(d->hover); never executed:  updateSection(d->hover); | 0 | ||||||||||||||||||||||||
| 1442 |         } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1443 |         break; never executed:   }break; | 0 | ||||||||||||||||||||||||
| 1444 |     case never executed:   QEvent::Timer:case QEvent::Timer:never executed:   {case QEvent::Timer: | 0 | ||||||||||||||||||||||||
| 1445 | QTimerEvent *te = static_cast<QTimerEvent*>(e); | - | ||||||||||||||||||||||||
| 1446 |         if (te->timerId() == d->delayedResize.timerId()
  | 0 | ||||||||||||||||||||||||
| 1447 | d->delayedResize.stop(); | - | ||||||||||||||||||||||||
| 1448 | resizeSections(); | - | ||||||||||||||||||||||||
| 1449 |         } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1450 |         break; never executed:   }break; | 0 | ||||||||||||||||||||||||
| 1451 |     case never executed:   QEvent::StyleChange:case QEvent::StyleChange:never executed:  case QEvent::StyleChange: | 0 | ||||||||||||||||||||||||
| 1452 |         if (!d->customDefaultSectionSize
  | 0 | ||||||||||||||||||||||||
| 1453 |             d->updateDefaultSectionSizeFromStyle(); never executed:  d->updateDefaultSectionSizeFromStyle(); | 0 | ||||||||||||||||||||||||
| 1454 |         break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 1455 |     default never executed:  :default:never executed:  default: | 0 | ||||||||||||||||||||||||
| 1456 |         break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 1457 | } | - | ||||||||||||||||||||||||
| 1458 |     return never executed:   QAbstractItemView::event(e);return QAbstractItemView::event(e);never executed:  return QAbstractItemView::event(e); | 0 | ||||||||||||||||||||||||
| 1459 | } | - | ||||||||||||||||||||||||
| 1460 | - | |||||||||||||||||||||||||
| 1461 | - | |||||||||||||||||||||||||
| 1462 | - | |||||||||||||||||||||||||
| 1463 | - | |||||||||||||||||||||||||
| 1464 | - | |||||||||||||||||||||||||
| 1465 | void QHeaderView::paintEvent(QPaintEvent *e) | - | ||||||||||||||||||||||||
| 1466 | { | - | ||||||||||||||||||||||||
| 1467 | QHeaderViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1468 | - | |||||||||||||||||||||||||
| 1469 |     if (count() == 0
  | 0 | ||||||||||||||||||||||||
| 1470 |         return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 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
  | 0 | ||||||||||||||||||||||||
| 1480 | start = visualIndexAt(translatedEventRect.left()); | - | ||||||||||||||||||||||||
| 1481 | end = visualIndexAt(translatedEventRect.right()); | - | ||||||||||||||||||||||||
| 1482 |     } never executed:   else {end of block | 0 | ||||||||||||||||||||||||
| 1483 | start = visualIndexAt(translatedEventRect.top()); | - | ||||||||||||||||||||||||
| 1484 | end = visualIndexAt(translatedEventRect.bottom()); | - | ||||||||||||||||||||||||
| 1485 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1486 | - | |||||||||||||||||||||||||
| 1487 |     if (d->reverse()
  | 0 | ||||||||||||||||||||||||
| 1488 |         start = (start == -1
  | 0 | ||||||||||||||||||||||||
| 1489 |         end = (end == -1
  | 0 | ||||||||||||||||||||||||
| 1490 |     } never executed:   else {end of block | 0 | ||||||||||||||||||||||||
| 1491 |         start = (start == -1
  | 0 | ||||||||||||||||||||||||
| 1492 |         end = (end == -1
  | 0 | ||||||||||||||||||||||||
| 1493 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 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
  | 0 | ||||||||||||||||||||||||
| 1506 |         if (d->isVisualIndexHidden(i)
  | 0 | ||||||||||||||||||||||||
| 1507 |             continue; never executed:  continue; | 0 | ||||||||||||||||||||||||
| 1508 | painter.save(); | - | ||||||||||||||||||||||||
| 1509 | logical = logicalIndex(i); | - | ||||||||||||||||||||||||
| 1510 |         if (d->orientation == Qt::Horizontal
  | 0 | ||||||||||||||||||||||||
| 1511 | currentSectionRect.setRect(sectionViewportPosition(logical), 0, sectionSize(logical), height); | - | ||||||||||||||||||||||||
| 1512 |         } never executed:   else {end of block | 0 | ||||||||||||||||||||||||
| 1513 | currentSectionRect.setRect(0, sectionViewportPosition(logical), width, sectionSize(logical)); | - | ||||||||||||||||||||||||
| 1514 |         } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1515 | currentSectionRect.translate(offset); | - | ||||||||||||||||||||||||
| 1516 | - | |||||||||||||||||||||||||
| 1517 | QVariant variant = d->model->headerData(logical, d->orientation, | - | ||||||||||||||||||||||||
| 1518 | Qt::FontRole); | - | ||||||||||||||||||||||||
| 1519 |         if (variant.isValid()
 
  | 0 | ||||||||||||||||||||||||
| 1520 | QFont sectionFont = qvariant_cast<QFont>(variant); | - | ||||||||||||||||||||||||
| 1521 | painter.setFont(sectionFont); | - | ||||||||||||||||||||||||
| 1522 |         } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1523 | paintSection(&painter, currentSectionRect, logical); | - | ||||||||||||||||||||||||
| 1524 | painter.restore(); | - | ||||||||||||||||||||||||
| 1525 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1526 | - | |||||||||||||||||||||||||
| 1527 | QStyleOption opt; | - | ||||||||||||||||||||||||
| 1528 | opt.init(this); | - | ||||||||||||||||||||||||
| 1529 | - | |||||||||||||||||||||||||
| 1530 |     if (d->reverse()
  | 0 | ||||||||||||||||||||||||
| 1531 | opt.state |= QStyle::State_Horizontal; | - | ||||||||||||||||||||||||
| 1532 |         if (currentSectionRect.left() > translatedEventRect.left()
  | 0 | ||||||||||||||||||||||||
| 1533 | opt.rect = QRect(translatedEventRect.left(), 0, | - | ||||||||||||||||||||||||
| 1534 | currentSectionRect.left() - translatedEventRect.left(), height); | - | ||||||||||||||||||||||||
| 1535 | style()->drawControl(QStyle::CE_HeaderEmptyArea, &opt, &painter, this); | - | ||||||||||||||||||||||||
| 1536 |         } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1537 |     } never executed:   else if (currentSectionRect.right() < translatedEventRect.right()end of block
  | 0 | ||||||||||||||||||||||||
| 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 |     } never executed:   else if (currentSectionRect.bottom() < translatedEventRect.bottom()end of block
  | 0 | ||||||||||||||||||||||||
| 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 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1550 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1551 | - | |||||||||||||||||||||||||
| 1552 | - | |||||||||||||||||||||||||
| 1553 | - | |||||||||||||||||||||||||
| 1554 | - | |||||||||||||||||||||||||
| 1555 | - | |||||||||||||||||||||||||
| 1556 | void QHeaderView::mousePressEvent(QMouseEvent *e) | - | ||||||||||||||||||||||||
| 1557 | { | - | ||||||||||||||||||||||||
| 1558 | QHeaderViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1559 |     if (d->state != QHeaderViewPrivate::NoState
 
  | 0 | ||||||||||||||||||||||||
| 1560 |         return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 1561 |     int pos = d->orientation == Qt::Horizontal
  | 0 | ||||||||||||||||||||||||
| 1562 | int handle = d->sectionHandleAt(pos); | - | ||||||||||||||||||||||||
| 1563 | d->originalSize = -1; | - | ||||||||||||||||||||||||
| 1564 |     if (handle == -1
  | 0 | ||||||||||||||||||||||||
| 1565 | d->pressed = logicalIndexAt(pos); | - | ||||||||||||||||||||||||
| 1566 |         if (d->clickableSections
  | 0 | ||||||||||||||||||||||||
| 1567 |             sectionPressed(d->pressed); never executed:  sectionPressed(d->pressed); | 0 | ||||||||||||||||||||||||
| 1568 | - | |||||||||||||||||||||||||
| 1569 | bool acceptMoveSection = d->movableSections; | - | ||||||||||||||||||||||||
| 1570 |         if (acceptMoveSection
 
 
  | 0 | ||||||||||||||||||||||||
| 1571 |             acceptMoveSection = false; never executed:  acceptMoveSection = false; | 0 | ||||||||||||||||||||||||
| 1572 | - | |||||||||||||||||||||||||
| 1573 |         if (acceptMoveSection
  | 0 | ||||||||||||||||||||||||
| 1574 | d->section = d->target = d->pressed; | - | ||||||||||||||||||||||||
| 1575 |             if (d->section == -1
  | 0 | ||||||||||||||||||||||||
| 1576 |                 return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 1577 | d->state = QHeaderViewPrivate::MoveSection; | - | ||||||||||||||||||||||||
| 1578 | d->setupSectionIndicator(d->section, pos); | - | ||||||||||||||||||||||||
| 1579 |         } never executed:   else if (d->clickableSectionsend of block
 
  | 0 | ||||||||||||||||||||||||
| 1580 | updateSection(d->pressed); | - | ||||||||||||||||||||||||
| 1581 | d->state = QHeaderViewPrivate::SelectSections; | - | ||||||||||||||||||||||||
| 1582 |         } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1583 |     } never executed:   else if (sectionResizeMode(handle) == Interactiveend of block
  | 0 | ||||||||||||||||||||||||
| 1584 | d->originalSize = sectionSize(handle); | - | ||||||||||||||||||||||||
| 1585 | d->state = QHeaderViewPrivate::ResizeSection; | - | ||||||||||||||||||||||||
| 1586 | d->section = handle; | - | ||||||||||||||||||||||||
| 1587 | d->preventCursorChangeInSetOffset = false; | - | ||||||||||||||||||||||||
| 1588 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1589 | - | |||||||||||||||||||||||||
| 1590 | d->firstPos = pos; | - | ||||||||||||||||||||||||
| 1591 | d->lastPos = pos; | - | ||||||||||||||||||||||||
| 1592 | - | |||||||||||||||||||||||||
| 1593 | d->clearCascadingSections(); | - | ||||||||||||||||||||||||
| 1594 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 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
  | 0 | ||||||||||||||||||||||||
| 1604 |     if (pos < 0
 
  | 0 | ||||||||||||||||||||||||
| 1605 |         return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 1606 |     if (e->buttons() == Qt::NoButton
  | 0 | ||||||||||||||||||||||||
| 1607 | - | |||||||||||||||||||||||||
| 1608 | - | |||||||||||||||||||||||||
| 1609 | - | |||||||||||||||||||||||||
| 1610 | - | |||||||||||||||||||||||||
| 1611 | - | |||||||||||||||||||||||||
| 1612 | - | |||||||||||||||||||||||||
| 1613 | d->state = QHeaderViewPrivate::NoState; | - | ||||||||||||||||||||||||
| 1614 | d->pressed = -1; | - | ||||||||||||||||||||||||
| 1615 | - | |||||||||||||||||||||||||
| 1616 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1617 | switch (d->state) { | - | ||||||||||||||||||||||||
| 1618 |         case never executed:   QHeaderViewPrivate::ResizeSection:case QHeaderViewPrivate::ResizeSection:never executed:   {case QHeaderViewPrivate::ResizeSection: | 0 | ||||||||||||||||||||||||
| 1619 | ((!(d->originalSize != -1)) ? qt_assert("d->originalSize != -1",__FILE__,2465) : qt_noop()); | - | ||||||||||||||||||||||||
| 1620 |             if (d->cascadingResizing
  | 0 | ||||||||||||||||||||||||
| 1621 |                 int delta = d->reverse()
  | 0 | ||||||||||||||||||||||||
| 1622 | int visual = visualIndex(d->section); | - | ||||||||||||||||||||||||
| 1623 | d->cascadingResize(visual, d->headerSectionSize(visual) + delta); | - | ||||||||||||||||||||||||
| 1624 |             } never executed:   else {end of block | 0 | ||||||||||||||||||||||||
| 1625 |                 int delta = d->reverse()
  | 0 | ||||||||||||||||||||||||
| 1626 | int newsize = qBound(minimumSectionSize(), d->originalSize + delta, maximumSectionSize()); | - | ||||||||||||||||||||||||
| 1627 | resizeSection(d->section, newsize); | - | ||||||||||||||||||||||||
| 1628 |             } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1629 | d->lastPos = pos; | - | ||||||||||||||||||||||||
| 1630 |             return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 1631 | } | - | ||||||||||||||||||||||||
| 1632 |         case never executed:   QHeaderViewPrivate::MoveSection:case QHeaderViewPrivate::MoveSection:never executed:   {case QHeaderViewPrivate::MoveSection: | 0 | ||||||||||||||||||||||||
| 1633 |             if (d->shouldAutoScroll(e->pos())
  | 0 | ||||||||||||||||||||||||
| 1634 |                 d->startAutoScroll(); never executed:  d->startAutoScroll(); | 0 | ||||||||||||||||||||||||
| 1635 |             if (qAbs(pos - d->firstPos) >= QApplication::startDragDistance()
  | 0 | ||||||||||||||||||||||||
| 1636 |                 || !d->sectionIndicator->isHidden()
  | 0 | ||||||||||||||||||||||||
| 1637 | int visual = visualIndexAt(pos); | - | ||||||||||||||||||||||||
| 1638 |                 if (visual == -1
  | 0 | ||||||||||||||||||||||||
| 1639 |                     return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 1640 |                 if (visual == 0
 
 
  | 0 | ||||||||||||||||||||||||
| 1641 |                     return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 1642 | - | |||||||||||||||||||||||||
| 1643 | int posThreshold = d->headerSectionPosition(visual) - d->offset + d->headerSectionSize(visual) / 2; | - | ||||||||||||||||||||||||
| 1644 | int moving = visualIndex(d->section); | - | ||||||||||||||||||||||||
| 1645 |                 if (visual < moving
  | 0 | ||||||||||||||||||||||||
| 1646 |                     if (pos < posThreshold
  | 0 | ||||||||||||||||||||||||
| 1647 |                         d->target = d->logicalIndex(visual); never executed:  d->target = d->logicalIndex(visual); | 0 | ||||||||||||||||||||||||
| 1648 | else | - | ||||||||||||||||||||||||
| 1649 |                         d->target = d->logicalIndex(visual + 1); never executed:  d->target = d->logicalIndex(visual + 1); | 0 | ||||||||||||||||||||||||
| 1650 |                 } else if (visual > moving
  | 0 | ||||||||||||||||||||||||
| 1651 |                     if (pos > posThreshold
  | 0 | ||||||||||||||||||||||||
| 1652 |                         d->target = d->logicalIndex(visual); never executed:  d->target = d->logicalIndex(visual); | 0 | ||||||||||||||||||||||||
| 1653 | else | - | ||||||||||||||||||||||||
| 1654 |                         d->target = d->logicalIndex(visual - 1); never executed:  d->target = d->logicalIndex(visual - 1); | 0 | ||||||||||||||||||||||||
| 1655 | } else { | - | ||||||||||||||||||||||||
| 1656 | d->target = d->section; | - | ||||||||||||||||||||||||
| 1657 |                 } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1658 | d->updateSectionIndicator(d->section, pos); | - | ||||||||||||||||||||||||
| 1659 |             } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1660 |             return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 1661 | } | - | ||||||||||||||||||||||||
| 1662 |         case never executed:   QHeaderViewPrivate::SelectSections:case QHeaderViewPrivate::SelectSections:never executed:   {case QHeaderViewPrivate::SelectSections: | 0 | ||||||||||||||||||||||||
| 1663 | int logical = logicalIndexAt(qMax(-d->offset, pos)); | - | ||||||||||||||||||||||||
| 1664 |             if (logical == -1
 
  | 0 | ||||||||||||||||||||||||
| 1665 |                 logical = logicalIndex(d->lastVisibleVisualIndex()); never executed:  logical = logicalIndex(d->lastVisibleVisualIndex()); | 0 | ||||||||||||||||||||||||
| 1666 |             if (logical == d->pressed
  | 0 | ||||||||||||||||||||||||
| 1667 |                 return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 1668 |             else if (d->pressed != -1
  | 0 | ||||||||||||||||||||||||
| 1669 |                 updateSection(d->pressed); never executed:  updateSection(d->pressed); | 0 | ||||||||||||||||||||||||
| 1670 | d->pressed = logical; | - | ||||||||||||||||||||||||
| 1671 |             if (d->clickableSections
 
  | 0 | ||||||||||||||||||||||||
| 1672 | sectionEntered(d->pressed); | - | ||||||||||||||||||||||||
| 1673 | updateSection(d->pressed); | - | ||||||||||||||||||||||||
| 1674 |             } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1675 |             return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 1676 | } | - | ||||||||||||||||||||||||
| 1677 |         case never executed:   QHeaderViewPrivate::NoState:case QHeaderViewPrivate::NoState:never executed:   {case QHeaderViewPrivate::NoState: | 0 | ||||||||||||||||||||||||
| 1678 | - | |||||||||||||||||||||||||
| 1679 | int handle = d->sectionHandleAt(pos); | - | ||||||||||||||||||||||||
| 1680 | bool hasCursor = testAttribute(Qt::WA_SetCursor); | - | ||||||||||||||||||||||||
| 1681 |             if (handle != -1
 
 
  | 0 | ||||||||||||||||||||||||
| 1682 |                 if (!hasCursor
  | 0 | ||||||||||||||||||||||||
| 1683 |                     setCursor(d->orientation == Qt::Horizontal ? Qt::SplitHCursor : Qt::SplitVCursor); never executed:  setCursor(d->orientation == Qt::Horizontal ? Qt::SplitHCursor : Qt::SplitVCursor); | 0 | ||||||||||||||||||||||||
| 1684 |             } never executed:   else if (hasCursorend of block
  | 0 | ||||||||||||||||||||||||
| 1685 | unsetCursor(); | - | ||||||||||||||||||||||||
| 1686 |             } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1687 | - | |||||||||||||||||||||||||
| 1688 |             return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 1689 | } | - | ||||||||||||||||||||||||
| 1690 |         default never executed:  :default:never executed:  default: | 0 | ||||||||||||||||||||||||
| 1691 |             break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 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
  | 0 | ||||||||||||||||||||||||
| 1703 | switch (d->state) { | - | ||||||||||||||||||||||||
| 1704 |     case never executed:   QHeaderViewPrivate::MoveSection:case QHeaderViewPrivate::MoveSection:never executed:  case QHeaderViewPrivate::MoveSection: | 0 | ||||||||||||||||||||||||
| 1705 |         if (!d->sectionIndicator->isHidden()
  | 0 | ||||||||||||||||||||||||
| 1706 | int from = visualIndex(d->section); | - | ||||||||||||||||||||||||
| 1707 | ((!(from != -1)) ? qt_assert("from != -1",__FILE__,2553) : qt_noop()); | - | ||||||||||||||||||||||||
| 1708 | int to = visualIndex(d->target); | - | ||||||||||||||||||||||||
| 1709 | ((!(to != -1)) ? qt_assert("to != -1",__FILE__,2555) : qt_noop()); | - | ||||||||||||||||||||||||
| 1710 | moveSection(from, to); | - | ||||||||||||||||||||||||
| 1711 | d->section = d->target = -1; | - | ||||||||||||||||||||||||
| 1712 | d->updateSectionIndicator(d->section, pos); | - | ||||||||||||||||||||||||
| 1713 |             break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 1714 | } | - | ||||||||||||||||||||||||
| 1715 |     case never executed:   QHeaderViewPrivate::SelectSections:case QHeaderViewPrivate::SelectSections:never executed:  case QHeaderViewPrivate::SelectSections:code before this statement never executed:  case QHeaderViewPrivate::SelectSections: | 0 | ||||||||||||||||||||||||
| 1716 |         if (!d->clickableSections
  | 0 | ||||||||||||||||||||||||
| 1717 | int section = logicalIndexAt(pos); | - | ||||||||||||||||||||||||
| 1718 | updateSection(section); | - | ||||||||||||||||||||||||
| 1719 |         } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1720 | - | |||||||||||||||||||||||||
| 1721 |     case never executed:   QHeaderViewPrivate::NoState:case QHeaderViewPrivate::NoState:never executed:  case QHeaderViewPrivate::NoState:code before this statement never executed:  case QHeaderViewPrivate::NoState: | 0 | ||||||||||||||||||||||||
| 1722 |         if (d->clickableSections
  | 0 | ||||||||||||||||||||||||
| 1723 | int section = logicalIndexAt(pos); | - | ||||||||||||||||||||||||
| 1724 |             if (section != -1
 
  | 0 | ||||||||||||||||||||||||
| 1725 | d->flipSortIndicator(section); | - | ||||||||||||||||||||||||
| 1726 | sectionClicked(section); | - | ||||||||||||||||||||||||
| 1727 |             } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1728 |             if (d->pressed != -1
  | 0 | ||||||||||||||||||||||||
| 1729 |                 updateSection(d->pressed); never executed:  updateSection(d->pressed); | 0 | ||||||||||||||||||||||||
| 1730 |         } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1731 |         break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 1732 |     case never executed:   QHeaderViewPrivate::ResizeSection:case QHeaderViewPrivate::ResizeSection:never executed:  case QHeaderViewPrivate::ResizeSection: | 0 | ||||||||||||||||||||||||
| 1733 | d->originalSize = -1; | - | ||||||||||||||||||||||||
| 1734 | d->clearCascadingSections(); | - | ||||||||||||||||||||||||
| 1735 |         break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 1736 |     default never executed:  :default:never executed:  default: | 0 | ||||||||||||||||||||||||
| 1737 |         break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 1738 | } | - | ||||||||||||||||||||||||
| 1739 | d->state = QHeaderViewPrivate::NoState; | - | ||||||||||||||||||||||||
| 1740 | d->pressed = -1; | - | ||||||||||||||||||||||||
| 1741 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 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
  | 0 | ||||||||||||||||||||||||
| 1751 | int handle = d->sectionHandleAt(pos); | - | ||||||||||||||||||||||||
| 1752 |     if (handle > -1
 
  | 0 | ||||||||||||||||||||||||
| 1753 | sectionHandleDoubleClicked(handle); | - | ||||||||||||||||||||||||
| 1754 | - | |||||||||||||||||||||||||
| 1755 |         Qt::CursorShape splitCursor = (
 
  | 0 | ||||||||||||||||||||||||
| 1756 | ? Qt::SplitHCursor : Qt::SplitVCursor; | - | ||||||||||||||||||||||||
| 1757 |         if (cursor().shape() == splitCursor
  | 0 | ||||||||||||||||||||||||
| 1758 | - | |||||||||||||||||||||||||
| 1759 | handle = d->sectionHandleAt(pos); | - | ||||||||||||||||||||||||
| 1760 |             if (!(handle > -1
 
  | 0 | ||||||||||||||||||||||||
| 1761 |                 setCursor(Qt::ArrowCursor); never executed:  setCursor(Qt::ArrowCursor); | 0 | ||||||||||||||||||||||||
| 1762 |         } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1763 | - | |||||||||||||||||||||||||
| 1764 |     } never executed:   else {end of block | 0 | ||||||||||||||||||||||||
| 1765 | sectionDoubleClicked(logicalIndexAt(e->pos())); | - | ||||||||||||||||||||||||
| 1766 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 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 never executed:   QEvent::ToolTip:case QEvent::ToolTip:never executed:   {case QEvent::ToolTip: | 0 | ||||||||||||||||||||||||
| 1779 | QHelpEvent *he = static_cast<QHelpEvent*>(e); | - | ||||||||||||||||||||||||
| 1780 | int logical = logicalIndexAt(he->pos()); | - | ||||||||||||||||||||||||
| 1781 |         if (logical != -1
  | 0 | ||||||||||||||||||||||||
| 1782 | QVariant variant = d->model->headerData(logical, d->orientation, Qt::ToolTipRole); | - | ||||||||||||||||||||||||
| 1783 |             if (variant.isValid()
  | 0 | ||||||||||||||||||||||||
| 1784 | QToolTip::showText(he->globalPos(), variant.toString(), this); | - | ||||||||||||||||||||||||
| 1785 |                 return never executed:   true;return true;never executed:  return true; | 0 | ||||||||||||||||||||||||
| 1786 | } | - | ||||||||||||||||||||||||
| 1787 |         } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1788 |         break; never executed:   }break; | 0 | ||||||||||||||||||||||||
| 1789 | - | |||||||||||||||||||||||||
| 1790 | - | |||||||||||||||||||||||||
| 1791 |     case never executed:   QEvent::QueryWhatsThis:case QEvent::QueryWhatsThis:never executed:   {case QEvent::QueryWhatsThis: | 0 | ||||||||||||||||||||||||
| 1792 | QHelpEvent *he = static_cast<QHelpEvent*>(e); | - | ||||||||||||||||||||||||
| 1793 | int logical = logicalIndexAt(he->pos()); | - | ||||||||||||||||||||||||
| 1794 |         if (logical != -1
  | 0 | ||||||||||||||||||||||||
| 1795 |             && d->model->headerData(logical, d->orientation, Qt::WhatsThisRole).isValid()
  | 0 | ||||||||||||||||||||||||
| 1796 |             return never executed:   true;return true;never executed:  return true; | 0 | ||||||||||||||||||||||||
| 1797 |         break; never executed:   }break; | 0 | ||||||||||||||||||||||||
| 1798 |     case never executed:   QEvent::WhatsThis:case QEvent::WhatsThis:never executed:   {case QEvent::WhatsThis: | 0 | ||||||||||||||||||||||||
| 1799 | QHelpEvent *he = static_cast<QHelpEvent*>(e); | - | ||||||||||||||||||||||||
| 1800 | int logical = logicalIndexAt(he->pos()); | - | ||||||||||||||||||||||||
| 1801 |         if (logical != -1
  | 0 | ||||||||||||||||||||||||
| 1802 | QVariant whatsthis = d->model->headerData(logical, d->orientation, | - | ||||||||||||||||||||||||
| 1803 | Qt::WhatsThisRole); | - | ||||||||||||||||||||||||
| 1804 |              if (whatsthis.isValid()
  | 0 | ||||||||||||||||||||||||
| 1805 | QWhatsThis::showText(he->globalPos(), whatsthis.toString(), this); | - | ||||||||||||||||||||||||
| 1806 |                  return never executed:   true;return true;never executed:  return true; | 0 | ||||||||||||||||||||||||
| 1807 | } | - | ||||||||||||||||||||||||
| 1808 |         } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1809 |         break; never executed:   }break; | 0 | ||||||||||||||||||||||||
| 1810 | - | |||||||||||||||||||||||||
| 1811 | - | |||||||||||||||||||||||||
| 1812 |     case never executed:   QEvent::StatusTip:case QEvent::StatusTip:never executed:   {case QEvent::StatusTip: | 0 | ||||||||||||||||||||||||
| 1813 | QHelpEvent *he = static_cast<QHelpEvent*>(e); | - | ||||||||||||||||||||||||
| 1814 | int logical = logicalIndexAt(he->pos()); | - | ||||||||||||||||||||||||
| 1815 |         if (logical != -1
  | 0 | ||||||||||||||||||||||||
| 1816 | QString statustip = d->model->headerData(logical, d->orientation, | - | ||||||||||||||||||||||||
| 1817 | Qt::StatusTipRole).toString(); | - | ||||||||||||||||||||||||
| 1818 |             if (!statustip.isEmpty()
  | 0 | ||||||||||||||||||||||||
| 1819 |                 setStatusTip(statustip); never executed:  setStatusTip(statustip); | 0 | ||||||||||||||||||||||||
| 1820 |         } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1821 |         return never executed:   true;return true;never executed:   }return true; | 0 | ||||||||||||||||||||||||
| 1822 | - | |||||||||||||||||||||||||
| 1823 |     case never executed:   QEvent::FontChange:case QEvent::FontChange:never executed:  case QEvent::FontChange: | 0 | ||||||||||||||||||||||||
| 1824 |     case never executed:   QEvent::StyleChange:case QEvent::StyleChange:never executed:  case QEvent::StyleChange: | 0 | ||||||||||||||||||||||||
| 1825 | d->invalidateCachedSizeHint(); | - | ||||||||||||||||||||||||
| 1826 | - | |||||||||||||||||||||||||
| 1827 |     case never executed:   QEvent::Hide:case QEvent::Hide:never executed:  case QEvent::Hide:code before this statement never executed:  case QEvent::Hide: | 0 | ||||||||||||||||||||||||
| 1828 |     case never executed:   QEvent::Show:case QEvent::Show:never executed:   {case QEvent::Show: | 0 | ||||||||||||||||||||||||
| 1829 | QAbstractScrollArea *parent = qobject_cast<QAbstractScrollArea *>(parentWidget()); | - | ||||||||||||||||||||||||
| 1830 |         if (parent
 
  | 0 | ||||||||||||||||||||||||
| 1831 |             resizeSections(); never executed:  resizeSections(); | 0 | ||||||||||||||||||||||||
| 1832 | geometriesChanged(); | - | ||||||||||||||||||||||||
| 1833 |         break; never executed:  }break; | 0 | ||||||||||||||||||||||||
| 1834 |     case never executed:   QEvent::ContextMenu:case QEvent::ContextMenu:never executed:   {case QEvent::ContextMenu: | 0 | ||||||||||||||||||||||||
| 1835 | d->state = QHeaderViewPrivate::NoState; | - | ||||||||||||||||||||||||
| 1836 | d->pressed = d->section = d->target = -1; | - | ||||||||||||||||||||||||
| 1837 | d->updateSectionIndicator(d->section, -1); | - | ||||||||||||||||||||||||
| 1838 |         break; never executed:   }break; | 0 | ||||||||||||||||||||||||
| 1839 |     case never executed:   QEvent::Wheel:case QEvent::Wheel:never executed:   {case QEvent::Wheel: | 0 | ||||||||||||||||||||||||
| 1840 | QAbstractScrollArea *asa = qobject_cast<QAbstractScrollArea *>(parentWidget()); | - | ||||||||||||||||||||||||
| 1841 |         if (asa
  | 0 | ||||||||||||||||||||||||
| 1842 |             return never executed:   QApplication::sendEvent(asa->viewport(), e);return QApplication::sendEvent(asa->viewport(), e);never executed:  return QApplication::sendEvent(asa->viewport(), e); | 0 | ||||||||||||||||||||||||
| 1843 |         break; never executed:   }break; | 0 | ||||||||||||||||||||||||
| 1844 |     default never executed:  :default:never executed:  default: | 0 | ||||||||||||||||||||||||
| 1845 |         break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 1846 | } | - | ||||||||||||||||||||||||
| 1847 |     return never executed:   QAbstractItemView::viewportEvent(e);return QAbstractItemView::viewportEvent(e);never executed:  return QAbstractItemView::viewportEvent(e); | 0 | ||||||||||||||||||||||||
| 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()
  | 0 | ||||||||||||||||||||||||
| 1853 |         return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 1854 | - | |||||||||||||||||||||||||
| 1855 | QStyleOptionHeader opt; | - | ||||||||||||||||||||||||
| 1856 | initStyleOption(&opt); | - | ||||||||||||||||||||||||
| 1857 | QStyle::State state = QStyle::State_None; | - | ||||||||||||||||||||||||
| 1858 |     if (isEnabled()
  | 0 | ||||||||||||||||||||||||
| 1859 |         state |= QStyle::State_Enabled; never executed:  state |= QStyle::State_Enabled; | 0 | ||||||||||||||||||||||||
| 1860 |     if (window()->isActiveWindow()
  | 0 | ||||||||||||||||||||||||
| 1861 |         state |= QStyle::State_Active; never executed:  state |= QStyle::State_Active; | 0 | ||||||||||||||||||||||||
| 1862 |     if (d->clickableSections
  | 0 | ||||||||||||||||||||||||
| 1863 |         if (logicalIndex == d->hover
  | 0 | ||||||||||||||||||||||||
| 1864 |             state |= QStyle::State_MouseOver; never executed:  state |= QStyle::State_MouseOver; | 0 | ||||||||||||||||||||||||
| 1865 |         if (logicalIndex == d->pressed
  | 0 | ||||||||||||||||||||||||
| 1866 |             state |= QStyle::State_Sunken; never executed:  state |= QStyle::State_Sunken; | 0 | ||||||||||||||||||||||||
| 1867 |         else if (d->highlightSelected
  | 0 | ||||||||||||||||||||||||
| 1868 |             if (d->sectionIntersectsSelection(logicalIndex)
  | 0 | ||||||||||||||||||||||||
| 1869 |                 state |= QStyle::State_On; never executed:  state |= QStyle::State_On; | 0 | ||||||||||||||||||||||||
| 1870 |             if (d->isSectionSelected(logicalIndex)
  | 0 | ||||||||||||||||||||||||
| 1871 |                 state |= QStyle::State_Sunken; never executed:  state |= QStyle::State_Sunken; | 0 | ||||||||||||||||||||||||
| 1872 |         } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1873 | - | |||||||||||||||||||||||||
| 1874 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1875 |     if (isSortIndicatorShown()
 
  | 0 | ||||||||||||||||||||||||
| 1876 |         opt.sortIndicator = (
 
 never executed:  opt.sortIndicator = (sortIndicatorOrder() == Qt::AscendingOrder) ? QStyleOptionHeader::SortDown : QStyleOptionHeader::SortUp; | 0 | ||||||||||||||||||||||||
| 1877 |                             ? QStyleOptionHeader::SortDown : QStyleOptionHeader::SortUp; never executed:  opt.sortIndicator = (sortIndicatorOrder() == Qt::AscendingOrder) ? QStyleOptionHeader::SortDown : QStyleOptionHeader::SortUp; | 0 | ||||||||||||||||||||||||
| 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()
 
 
  | 0 | ||||||||||||||||||||||||
| 1898 |         margin += style()->pixelMetric(QStyle::PM_HeaderMarkSize, 0, this); never executed:  margin += style()->pixelMetric(QStyle::PM_HeaderMarkSize, 0, this); | 0 | ||||||||||||||||||||||||
| 1899 | - | |||||||||||||||||||||||||
| 1900 |     if (d->textElideMode != Qt::ElideNone
  | 0 | ||||||||||||||||||||||||
| 1901 |         opt.text = opt.fontMetrics.elidedText(opt.text, d->textElideMode , rect.width() - margin); never executed:  opt.text = opt.fontMetrics.elidedText(opt.text, d->textElideMode , rect.width() - margin); | 0 | ||||||||||||||||||||||||
| 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()
  | 0 | ||||||||||||||||||||||||
| 1907 |         opt.icon = qvariant_cast<QPixmap>(variant); never executed:  opt.icon = qvariant_cast<QPixmap>(variant); | 0 | ||||||||||||||||||||||||
| 1908 | QVariant foregroundBrush = d->model->headerData(logicalIndex, d->orientation, | - | ||||||||||||||||||||||||
| 1909 | Qt::ForegroundRole); | - | ||||||||||||||||||||||||
| 1910 |     if (foregroundBrush.canConvert<QBrush>()
  | 0 | ||||||||||||||||||||||||
| 1911 |         opt.palette.setBrush(QPalette::ButtonText, qvariant_cast<QBrush>(foregroundBrush)); never executed:  opt.palette.setBrush(QPalette::ButtonText, qvariant_cast<QBrush>(foregroundBrush)); | 0 | ||||||||||||||||||||||||
| 1912 | - | |||||||||||||||||||||||||
| 1913 | QPointF oldBO = painter->brushOrigin(); | - | ||||||||||||||||||||||||
| 1914 | QVariant backgroundBrush = d->model->headerData(logicalIndex, d->orientation, | - | ||||||||||||||||||||||||
| 1915 | Qt::BackgroundRole); | - | ||||||||||||||||||||||||
| 1916 |     if (backgroundBrush.canConvert<QBrush>()
  | 0 | ||||||||||||||||||||||||
| 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 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1921 | - | |||||||||||||||||||||||||
| 1922 | - | |||||||||||||||||||||||||
| 1923 | int visual = visualIndex(logicalIndex); | - | ||||||||||||||||||||||||
| 1924 | ((!(visual != -1)) ? qt_assert("visual != -1",__FILE__,2778) : qt_noop()); | - | ||||||||||||||||||||||||
| 1925 | bool first = d->isFirstVisibleSection(visual); | - | ||||||||||||||||||||||||
| 1926 | bool last = d->isLastVisibleSection(visual); | - | ||||||||||||||||||||||||
| 1927 |     if (first
 
  | 0 | ||||||||||||||||||||||||
| 1928 |         opt.position = QStyleOptionHeader::OnlyOneSection; never executed:  opt.position = QStyleOptionHeader::OnlyOneSection; | 0 | ||||||||||||||||||||||||
| 1929 |     else if (first
  | 0 | ||||||||||||||||||||||||
| 1930 |         opt.position = QStyleOptionHeader::Beginning; never executed:  opt.position = QStyleOptionHeader::Beginning; | 0 | ||||||||||||||||||||||||
| 1931 |     else if (last
  | 0 | ||||||||||||||||||||||||
| 1932 |         opt.position = QStyleOptionHeader::End; never executed:  opt.position = QStyleOptionHeader::End; | 0 | ||||||||||||||||||||||||
| 1933 | else | - | ||||||||||||||||||||||||
| 1934 |         opt.position = QStyleOptionHeader::Middle; never executed:  opt.position = QStyleOptionHeader::Middle; | 0 | ||||||||||||||||||||||||
| 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
 
  | 0 | ||||||||||||||||||||||||
| 1940 |         opt.selectedPosition = QStyleOptionHeader::NextAndPreviousAreSelected; never executed:  opt.selectedPosition = QStyleOptionHeader::NextAndPreviousAreSelected; | 0 | ||||||||||||||||||||||||
| 1941 |     else if (previousSelected
  | 0 | ||||||||||||||||||||||||
| 1942 |         opt.selectedPosition = QStyleOptionHeader::PreviousIsSelected; never executed:  opt.selectedPosition = QStyleOptionHeader::PreviousIsSelected; | 0 | ||||||||||||||||||||||||
| 1943 |     else if (nextSelected
  | 0 | ||||||||||||||||||||||||
| 1944 |         opt.selectedPosition = QStyleOptionHeader::NextIsSelected; never executed:  opt.selectedPosition = QStyleOptionHeader::NextIsSelected; | 0 | ||||||||||||||||||||||||
| 1945 | else | - | ||||||||||||||||||||||||
| 1946 |         opt.selectedPosition = QStyleOptionHeader::NotAdjacent; never executed:  opt.selectedPosition = QStyleOptionHeader::NotAdjacent; | 0 | ||||||||||||||||||||||||
| 1947 | - | |||||||||||||||||||||||||
| 1948 | style()->drawControl(QStyle::CE_Header, &opt, painter, this); | - | ||||||||||||||||||||||||
| 1949 | - | |||||||||||||||||||||||||
| 1950 | painter->setBrushOrigin(oldBO); | - | ||||||||||||||||||||||||
| 1951 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 1952 | QSize QHeaderView::sectionSizeFromContents(int logicalIndex) const | - | ||||||||||||||||||||||||
| 1953 | { | - | ||||||||||||||||||||||||
| 1954 | const QHeaderViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1955 | ((!(logicalIndex >= 0)) ? qt_assert("logicalIndex >= 0",__FILE__,2817) : qt_noop()); | - | ||||||||||||||||||||||||
| 1956 | - | |||||||||||||||||||||||||
| 1957 | ensurePolished(); | - | ||||||||||||||||||||||||
| 1958 | - | |||||||||||||||||||||||||
| 1959 | - | |||||||||||||||||||||||||
| 1960 | QVariant variant = d->model->headerData(logicalIndex, d->orientation, Qt::SizeHintRole); | - | ||||||||||||||||||||||||
| 1961 |     if (variant.isValid()
  | 0 | ||||||||||||||||||||||||
| 1962 |         return never executed:   qvariant_cast<QSize>(variant);return qvariant_cast<QSize>(variant);never executed:  return qvariant_cast<QSize>(variant); | 0 | ||||||||||||||||||||||||
| 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()
 
  | 0 | ||||||||||||||||||||||||
| 1972 |         fnt = qvariant_cast<QFont>(var); never executed:  fnt = qvariant_cast<QFont>(var); | 0 | ||||||||||||||||||||||||
| 1973 | else | - | ||||||||||||||||||||||||
| 1974 |         fnt = font(); never executed:  fnt = font(); | 0 | ||||||||||||||||||||||||
| 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()
  | 0 | ||||||||||||||||||||||||
| 1982 |         opt.icon = qvariant_cast<QPixmap>(variant); never executed:  opt.icon = qvariant_cast<QPixmap>(variant); | 0 | ||||||||||||||||||||||||
| 1983 |     if (isSortIndicatorShown()
  | 0 | ||||||||||||||||||||||||
| 1984 |         opt.sortIndicator = QStyleOptionHeader::SortDown; never executed:  opt.sortIndicator = QStyleOptionHeader::SortDown; | 0 | ||||||||||||||||||||||||
| 1985 |     return never executed:   style()->sizeFromContents(QStyle::CT_HeaderSection, &opt, QSize(), this);return style()->sizeFromContents(QStyle::CT_HeaderSection, &opt, QSize(), this);never executed:  return style()->sizeFromContents(QStyle::CT_HeaderSection, &opt, QSize(), this); | 0 | ||||||||||||||||||||||||
| 1986 | } | - | ||||||||||||||||||||||||
| 1987 | int QHeaderView::horizontalOffset() const | - | ||||||||||||||||||||||||
| 1988 | { | - | ||||||||||||||||||||||||
| 1989 | const QHeaderViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1990 |     if (d->orientation == Qt::Horizontal
  | 0 | ||||||||||||||||||||||||
| 1991 |         return never executed:   d->offset;return d->offset;never executed:  return d->offset; | 0 | ||||||||||||||||||||||||
| 1992 |     return never executed:   0;return 0;never executed:  return 0; | 0 | ||||||||||||||||||||||||
| 1993 | } | - | ||||||||||||||||||||||||
| 1994 | int QHeaderView::verticalOffset() const | - | ||||||||||||||||||||||||
| 1995 | { | - | ||||||||||||||||||||||||
| 1996 | const QHeaderViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1997 |     if (d->orientation == Qt::Vertical
  | 0 | ||||||||||||||||||||||||
| 1998 |         return never executed:   d->offset;return d->offset;never executed:  return d->offset; | 0 | ||||||||||||||||||||||||
| 1999 |     return never executed:   0;return 0;never executed:  return 0; | 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()
  | 0 | ||||||||||||||||||||||||
| 2012 |         d->doDelayedResizeSections(); never executed:  d->doDelayedResizeSections(); | 0 | ||||||||||||||||||||||||
| 2013 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 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 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 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()
  | 0 | ||||||||||||||||||||||||
| 2035 | bool resizeRequired = d->globalResizeMode == ResizeToContents; | - | ||||||||||||||||||||||||
| 2036 |         int first = orientation() == Qt::Horizontal
  | 0 | ||||||||||||||||||||||||
| 2037 |         int last = orientation() == Qt::Horizontal
  | 0 | ||||||||||||||||||||||||
| 2038 |         for (int i = first; i <= last
 
  | 0 | ||||||||||||||||||||||||
| 2039 |             resizeRequired = (sectionResizeMode(i) == ResizeToContents); never executed:  resizeRequired = (sectionResizeMode(i) == ResizeToContents); | 0 | ||||||||||||||||||||||||
| 2040 |         if (resizeRequired
  | 0 | ||||||||||||||||||||||||
| 2041 |             d->doDelayedResizeSections(); never executed:  d->doDelayedResizeSections(); | 0 | ||||||||||||||||||||||||
| 2042 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2043 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 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 never executed:   QRect();return QRect();never executed:  return QRect(); | 0 | ||||||||||||||||||||||||
| 2058 | } | - | ||||||||||||||||||||||||
| 2059 | void QHeaderView::scrollTo(const QModelIndex &, ScrollHint) | - | ||||||||||||||||||||||||
| 2060 | { | - | ||||||||||||||||||||||||
| 2061 | - | |||||||||||||||||||||||||
| 2062 | } | - | ||||||||||||||||||||||||
| 2063 | QModelIndex QHeaderView::indexAt(const QPoint &) const | - | ||||||||||||||||||||||||
| 2064 | { | - | ||||||||||||||||||||||||
| 2065 |     return never executed:   QModelIndex();return QModelIndex();never executed:  return QModelIndex(); | 0 | ||||||||||||||||||||||||
| 2066 | } | - | ||||||||||||||||||||||||
| 2067 | bool QHeaderView::isIndexHidden(const QModelIndex &) const | - | ||||||||||||||||||||||||
| 2068 | { | - | ||||||||||||||||||||||||
| 2069 |     return never executed:   true;return true;never executed:  return true; | 0 | ||||||||||||||||||||||||
| 2070 | } | - | ||||||||||||||||||||||||
| 2071 | QModelIndex QHeaderView::moveCursor(CursorAction, Qt::KeyboardModifiers) | - | ||||||||||||||||||||||||
| 2072 | { | - | ||||||||||||||||||||||||
| 2073 |     return never executed:   QModelIndex();return QModelIndex();never executed:  return QModelIndex(); | 0 | ||||||||||||||||||||||||
| 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
  | 0 | ||||||||||||||||||||||||
| 2090 | int logicalLeft = max; | - | ||||||||||||||||||||||||
| 2091 | int logicalRight = 0; | - | ||||||||||||||||||||||||
| 2092 | - | |||||||||||||||||||||||||
| 2093 |         if (d->visualIndices.empty()
  | 0 | ||||||||||||||||||||||||
| 2094 | - | |||||||||||||||||||||||||
| 2095 | for (const auto &r : selection) { | - | ||||||||||||||||||||||||
| 2096 |                 if (r.parent().isValid()
 
  | 0 | ||||||||||||||||||||||||
| 2097 |                     continue; never executed:  continue; | 0 | ||||||||||||||||||||||||
| 2098 |                 if (r.left() < logicalLeft
  | 0 | ||||||||||||||||||||||||
| 2099 |                     logicalLeft = r.left(); never executed:  logicalLeft = r.left(); | 0 | ||||||||||||||||||||||||
| 2100 |                 if (r.right() > logicalRight
  | 0 | ||||||||||||||||||||||||
| 2101 |                     logicalRight = r.right(); never executed:  logicalRight = r.right(); | 0 | ||||||||||||||||||||||||
| 2102 |             } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2103 |         } never executed:   else {end of block | 0 | ||||||||||||||||||||||||
| 2104 | int left = max; | - | ||||||||||||||||||||||||
| 2105 | int right = 0; | - | ||||||||||||||||||||||||
| 2106 | for (const auto &r : selection) { | - | ||||||||||||||||||||||||
| 2107 |                 if (r.parent().isValid()
 
  | 0 | ||||||||||||||||||||||||
| 2108 |                     continue; never executed:  continue; | 0 | ||||||||||||||||||||||||
| 2109 |                 for (int k = r.left(); k <= r.right()
  | 0 | ||||||||||||||||||||||||
| 2110 | int visual = visualIndex(k); | - | ||||||||||||||||||||||||
| 2111 |                     if (visual == -1
  | 0 | ||||||||||||||||||||||||
| 2112 |                         continue; never executed:  continue; | 0 | ||||||||||||||||||||||||
| 2113 |                     if (visual < left
  | 0 | ||||||||||||||||||||||||
| 2114 |                         left = visual; never executed:  left = visual; | 0 | ||||||||||||||||||||||||
| 2115 |                     if (visual > right
  | 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
 
  | 0 | ||||||||||||||||||||||||
| 2124 |             logicalRight < 0
 
  | 0 | ||||||||||||||||||||||||
| 2125 |             return never executed:   QRegion();return 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:   QRect(leftPos, 0, rightPos - leftPos, height());return 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()
  | 0 | ||||||||||||||||||||||||
| 2137 | - | |||||||||||||||||||||||||
| 2138 | for (const auto &r : selection) { | - | ||||||||||||||||||||||||
| 2139 |             if (r.parent().isValid()
 
  | 0 | ||||||||||||||||||||||||
| 2140 |                 continue; never executed:  continue; | 0 | ||||||||||||||||||||||||
| 2141 |             if (r.top() < logicalTop
  | 0 | ||||||||||||||||||||||||
| 2142 |                 logicalTop = r.top(); never executed:  logicalTop = r.top(); | 0 | ||||||||||||||||||||||||
| 2143 |             if (r.bottom() > logicalBottom
  | 0 | ||||||||||||||||||||||||
| 2144 |                 logicalBottom = r.bottom(); never executed:  logicalBottom = r.bottom(); | 0 | ||||||||||||||||||||||||
| 2145 |         } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2146 |     } never executed:   else {end of block | 0 | ||||||||||||||||||||||||
| 2147 | int top = max; | - | ||||||||||||||||||||||||
| 2148 | int bottom = 0; | - | ||||||||||||||||||||||||
| 2149 | - | |||||||||||||||||||||||||
| 2150 | for (const auto &r : selection) { | - | ||||||||||||||||||||||||
| 2151 |             if (r.parent().isValid()
 
  | 0 | ||||||||||||||||||||||||
| 2152 |                 continue; never executed:  continue; | 0 | ||||||||||||||||||||||||
| 2153 |             for (int k = r.top(); k <= r.bottom()
  | 0 | ||||||||||||||||||||||||
| 2154 | int visual = visualIndex(k); | - | ||||||||||||||||||||||||
| 2155 |                 if (visual == -1
  | 0 | ||||||||||||||||||||||||
| 2156 |                     continue; never executed:  continue; | 0 | ||||||||||||||||||||||||
| 2157 |                 if (visual < top
  | 0 | ||||||||||||||||||||||||
| 2158 |                     top = visual; never executed:  top = visual; | 0 | ||||||||||||||||||||||||
| 2159 |                 if (visual > bottom
  | 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
 
  | 0 | ||||||||||||||||||||||||
| 2169 |         logicalBottom < 0
 
  | 0 | ||||||||||||||||||||||||
| 2170 |         return never executed:   QRegion();return QRegion();never executed:  return QRegion(); | 0 | ||||||||||||||||||||||||
| 2171 | - | |||||||||||||||||||||||||
| 2172 | int topPos = sectionViewportPosition(logicalTop); | - | ||||||||||||||||||||||||
| 2173 | int bottomPos = sectionViewportPosition(logicalBottom) + sectionSize(logicalBottom); | - | ||||||||||||||||||||||||
| 2174 | - | |||||||||||||||||||||||||
| 2175 |     return never executed:   QRect(0, topPos, width(), bottomPos - topPos);return 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
  | 0 | ||||||||||||||||||||||||
| 2186 |         return never executed:   -1;return -1;never executed:  return -1; | 0 | ||||||||||||||||||||||||
| 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()
  | 0 | ||||||||||||||||||||||||
| 2194 |         qSwap(atLeft, atRight); never executed:  qSwap(atLeft, atRight); | 0 | ||||||||||||||||||||||||
| 2195 | - | |||||||||||||||||||||||||
| 2196 |     if (atLeft
  | 0 | ||||||||||||||||||||||||
| 2197 | - | |||||||||||||||||||||||||
| 2198 |         while(visual > -1
  | 0 | ||||||||||||||||||||||||
| 2199 | int logical = q->logicalIndex(--visual); | - | ||||||||||||||||||||||||
| 2200 |             if (!q->isSectionHidden(logical)
  | 0 | ||||||||||||||||||||||||
| 2201 |                 return never executed:   logical;return logical;never executed:  return logical; | 0 | ||||||||||||||||||||||||
| 2202 |         } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2203 |     } never executed:   else if (atRightend of block
  | 0 | ||||||||||||||||||||||||
| 2204 | - | |||||||||||||||||||||||||
| 2205 |         return never executed:   log;return log;never executed:  return log; | 0 | ||||||||||||||||||||||||
| 2206 | } | - | ||||||||||||||||||||||||
| 2207 |     return never executed:   -1;return -1;never executed:  return -1; | 0 | ||||||||||||||||||||||||
| 2208 | } | - | ||||||||||||||||||||||||
| 2209 | - | |||||||||||||||||||||||||
| 2210 | void QHeaderViewPrivate::setupSectionIndicator(int section, int position) | - | ||||||||||||||||||||||||
| 2211 | { | - | ||||||||||||||||||||||||
| 2212 | QHeaderView * const q = q_func(); | - | ||||||||||||||||||||||||
| 2213 |     if (!sectionIndicator
  | 0 | ||||||||||||||||||||||||
| 2214 | sectionIndicator = new QLabel(viewport); | - | ||||||||||||||||||||||||
| 2215 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2216 | - | |||||||||||||||||||||||||
| 2217 | int w, h; | - | ||||||||||||||||||||||||
| 2218 | int p = q->sectionViewportPosition(section); | - | ||||||||||||||||||||||||
| 2219 |     if (orientation == Qt::Horizontal
  | 0 | ||||||||||||||||||||||||
| 2220 | w = q->sectionSize(section); | - | ||||||||||||||||||||||||
| 2221 | h = viewport->height(); | - | ||||||||||||||||||||||||
| 2222 |     } never executed:   else {end of block | 0 | ||||||||||||||||||||||||
| 2223 | w = viewport->width(); | - | ||||||||||||||||||||||||
| 2224 | h = q->sectionSize(section); | - | ||||||||||||||||||||||||
| 2225 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 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 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2240 | - | |||||||||||||||||||||||||
| 2241 | void QHeaderViewPrivate::updateSectionIndicator(int section, int position) | - | ||||||||||||||||||||||||
| 2242 | { | - | ||||||||||||||||||||||||
| 2243 |     if (!sectionIndicator
  | 0 | ||||||||||||||||||||||||
| 2244 |         return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 2245 | - | |||||||||||||||||||||||||
| 2246 |     if (section == -1
 
  | 0 | ||||||||||||||||||||||||
| 2247 | sectionIndicator->hide(); | - | ||||||||||||||||||||||||
| 2248 |         return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 2249 | } | - | ||||||||||||||||||||||||
| 2250 | - | |||||||||||||||||||||||||
| 2251 |     if (orientation == Qt::Horizontal
  | 0 | ||||||||||||||||||||||||
| 2252 |         sectionIndicator->move(position - sectionIndicatorOffset, 0); never executed:  sectionIndicator->move(position - sectionIndicatorOffset, 0); | 0 | ||||||||||||||||||||||||
| 2253 | else | - | ||||||||||||||||||||||||
| 2254 |         sectionIndicator->move(0, position - sectionIndicatorOffset); never executed:  sectionIndicator->move(0, position - sectionIndicatorOffset); | 0 | ||||||||||||||||||||||||
| 2255 | - | |||||||||||||||||||||||||
| 2256 | sectionIndicator->show(); | - | ||||||||||||||||||||||||
| 2257 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 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
  | 0 | ||||||||||||||||||||||||
| 2265 |         option->state |= QStyle::State_Horizontal; never executed:  option->state |= QStyle::State_Horizontal; | 0 | ||||||||||||||||||||||||
| 2266 |     if (isEnabled()
  | 0 | ||||||||||||||||||||||||
| 2267 |         option->state |= QStyle::State_Enabled; never executed:  option->state |= QStyle::State_Enabled; | 0 | ||||||||||||||||||||||||
| 2268 | option->section = 0; | - | ||||||||||||||||||||||||
| 2269 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2270 | - | |||||||||||||||||||||||||
| 2271 | bool QHeaderViewPrivate::isSectionSelected(int section) const | - | ||||||||||||||||||||||||
| 2272 | { | - | ||||||||||||||||||||||||
| 2273 | int i = section * 2; | - | ||||||||||||||||||||||||
| 2274 |     if (i < 0
 
  | 0 | ||||||||||||||||||||||||
| 2275 |         return never executed:   false;return false;never executed:  return false; | 0 | ||||||||||||||||||||||||
| 2276 |     if (sectionSelected.testBit(i)
  | 0 | ||||||||||||||||||||||||
| 2277 |         return never executed:   sectionSelected.testBit(i + 1);return sectionSelected.testBit(i + 1);never executed:  return sectionSelected.testBit(i + 1); | 0 | ||||||||||||||||||||||||
| 2278 | bool s = false; | - | ||||||||||||||||||||||||
| 2279 |     if (orientation == Qt::Horizontal
  | 0 | ||||||||||||||||||||||||
| 2280 |         s = isColumnSelected(section); never executed:  s = isColumnSelected(section); | 0 | ||||||||||||||||||||||||
| 2281 | else | - | ||||||||||||||||||||||||
| 2282 |         s = isRowSelected(section); never executed:  s = isRowSelected(section); | 0 | ||||||||||||||||||||||||
| 2283 | sectionSelected.setBit(i + 1, s); | - | ||||||||||||||||||||||||
| 2284 | sectionSelected.setBit(i, true); | - | ||||||||||||||||||||||||
| 2285 |     return never executed:   s;return s;never executed:  return s; | 0 | ||||||||||||||||||||||||
| 2286 | } | - | ||||||||||||||||||||||||
| 2287 | - | |||||||||||||||||||||||||
| 2288 | bool QHeaderViewPrivate::isFirstVisibleSection(int section) const | - | ||||||||||||||||||||||||
| 2289 | { | - | ||||||||||||||||||||||||
| 2290 |     if (sectionStartposRecalc
  | 0 | ||||||||||||||||||||||||
| 2291 |         recalcSectionStartPos(); never executed:  recalcSectionStartPos(); | 0 | ||||||||||||||||||||||||
| 2292 | const SectionItem &item = sectionItems.at(section); | - | ||||||||||||||||||||||||
| 2293 |     return never executed:   item.size > 0 && item.calculated_startpos == 0;return item.size > 0 && item.calculated_startpos == 0;never executed:  return item.size > 0 && item.calculated_startpos == 0; | 0 | ||||||||||||||||||||||||
| 2294 | } | - | ||||||||||||||||||||||||
| 2295 | - | |||||||||||||||||||||||||
| 2296 | bool QHeaderViewPrivate::isLastVisibleSection(int section) const | - | ||||||||||||||||||||||||
| 2297 | { | - | ||||||||||||||||||||||||
| 2298 |     if (sectionStartposRecalc
  | 0 | ||||||||||||||||||||||||
| 2299 |         recalcSectionStartPos(); never executed:  recalcSectionStartPos(); | 0 | ||||||||||||||||||||||||
| 2300 | const SectionItem &item = sectionItems.at(section); | - | ||||||||||||||||||||||||
| 2301 |     return never executed:   item.size > 0 && item.calculatedEndPos() == length;return item.size > 0 && item.calculatedEndPos() == length;never executed:  return item.size > 0 && item.calculatedEndPos() == length; | 0 | ||||||||||||||||||||||||
| 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
  | 0 | ||||||||||||||||||||||||
| 2312 |         if (!q->isSectionHidden(q->logicalIndex(visual))
  | 0 | ||||||||||||||||||||||||
| 2313 |             return never executed:   visual;return visual;never executed:  return visual; | 0 | ||||||||||||||||||||||||
| 2314 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2315 | - | |||||||||||||||||||||||||
| 2316 | - | |||||||||||||||||||||||||
| 2317 |     return never executed:   -1;return -1;never executed:  return -1; | 0 | ||||||||||||||||||||||||
| 2318 | } | - | ||||||||||||||||||||||||
| 2319 | - | |||||||||||||||||||||||||
| 2320 | void QHeaderViewPrivate::restoreSizeOnPrevLastSection() | - | ||||||||||||||||||||||||
| 2321 | { | - | ||||||||||||||||||||||||
| 2322 | QHeaderView * const q = q_func(); | - | ||||||||||||||||||||||||
| 2323 |     if (lastSectionLogicalIdx < 0
  | 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()
  | 0 | ||||||||||||||||||||||||
| 2343 |         return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 2344 | - | |||||||||||||||||||||||||
| 2345 | int nowLastVisualSection = lastVisibleVisualIndex(); | - | ||||||||||||||||||||||||
| 2346 |     if (lastSectionLogicalIdx == q->logicalIndex(nowLastVisualSection)
  | 0 | ||||||||||||||||||||||||
| 2347 |         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
  | 0 | ||||||||||||||||||||||||
| 2362 |         return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 2363 | - | |||||||||||||||||||||||||
| 2364 |     if (resizeRecursionBlock
  | 0 | ||||||||||||||||||||||||
| 2365 |         return; never executed:  return; | 0 | ||||||||||||||||||||||||
| 2366 | resizeRecursionBlock = true; | - | ||||||||||||||||||||||||
| 2367 | - | |||||||||||||||||||||||||
| 2368 | invalidateCachedSizeHint(); | - | ||||||||||||||||||||||||
| 2369 | const int lastSectionVisualIdx = q->visualIndex(lastSectionLogicalIdx); | - | ||||||||||||||||||||||||
| 2370 | - | |||||||||||||||||||||||||
| 2371 | - | |||||||||||||||||||||||||
| 2372 | int stretchSection = -1; | - | ||||||||||||||||||||||||
| 2373 |     if (stretchLastSection
 
  | 0 | ||||||||||||||||||||||||
| 2374 |         stretchSection = lastSectionVisualIdx; never executed:  stretchSection = lastSectionVisualIdx; | 0 | ||||||||||||||||||||||||
| 2375 | - | |||||||||||||||||||||||||
| 2376 | - | |||||||||||||||||||||||||
| 2377 |     int lengthToStretch = (orientation == Qt::Horizontal
  | 0 | ||||||||||||||||||||||||
| 2378 | int numberOfStretchedSections = 0; | - | ||||||||||||||||||||||||
| 2379 | QList<int> section_sizes; | - | ||||||||||||||||||||||||
| 2380 |     for (int i = 0; i < sectionCount()
  | 0 | ||||||||||||||||||||||||
| 2381 |         if (isVisualIndexHidden(i)
  | 0 | ||||||||||||||||||||||||
| 2382 |             continue; never executed:  continue; | 0 | ||||||||||||||||||||||||
| 2383 | - | |||||||||||||||||||||||||
| 2384 | QHeaderView::ResizeMode resizeMode; | - | ||||||||||||||||||||||||
| 2385 |         if (useGlobalMode
 
 
  | 0 | ||||||||||||||||||||||||
| 2386 |             resizeMode = globalMode; never executed:  resizeMode = globalMode; | 0 | ||||||||||||||||||||||||
| 2387 | else | - | ||||||||||||||||||||||||
| 2388 |             resizeMode = (i == stretchSection
 never executed:  resizeMode = (i == stretchSection ? QHeaderView::Stretch : headerSectionResizeMode(i)); | 0 | ||||||||||||||||||||||||
| 2389 | - | |||||||||||||||||||||||||
| 2390 |         if (resizeMode == QHeaderView::Stretch
  | 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
 
  | 0 | ||||||||||||||||||||||||
| 2399 | sectionSize = headerSectionSize(i); | - | ||||||||||||||||||||||||
| 2400 |         } never executed:   else {end of block | 0 | ||||||||||||||||||||||||
| 2401 | int logicalIndex = q->logicalIndex(i); | - | ||||||||||||||||||||||||
| 2402 | sectionSize = qMax(viewSectionSizeHint(logicalIndex), | - | ||||||||||||||||||||||||
| 2403 | q->sectionSizeHint(logicalIndex)); | - | ||||||||||||||||||||||||
| 2404 |             if (sectionSize > q->maximumSectionSize()
  | 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
 
  | 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()
  | 0 | ||||||||||||||||||||||||
| 2428 | int oldSectionLength = headerSectionSize(i); | - | ||||||||||||||||||||||||
| 2429 | int newSectionLength = -1; | - | ||||||||||||||||||||||||
| 2430 | QHeaderView::ResizeMode newSectionResizeMode = headerSectionResizeMode(i); | - | ||||||||||||||||||||||||
| 2431 | - | |||||||||||||||||||||||||
| 2432 |         if (isVisualIndexHidden(i)
  | 0 | ||||||||||||||||||||||||
| 2433 | newSectionLength = 0; | - | ||||||||||||||||||||||||
| 2434 |         } never executed:   else {end of block | 0 | ||||||||||||||||||||||||
| 2435 | QHeaderView::ResizeMode resizeMode; | - | ||||||||||||||||||||||||
| 2436 |             if (useGlobalMode
  | 0 | ||||||||||||||||||||||||
| 2437 |                 resizeMode = globalMode; never executed:  resizeMode = globalMode; | 0 | ||||||||||||||||||||||||
| 2438 | else | - | ||||||||||||||||||||||||
| 2439 |                 resizeMode = (i == stretchSection
 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
 
  | 0 | ||||||||||||||||||||||||
| 2443 |                 if (i == lastSectionVisualIdx
  | 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
  | 0 | ||||||||||||||||||||||||
| 2448 | newSectionLength += 1; | - | ||||||||||||||||||||||||
| 2449 | --pixelReminder; | - | ||||||||||||||||||||||||
| 2450 |                 } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2451 | section_sizes.removeFirst(); | - | ||||||||||||||||||||||||
| 2452 |             } never executed:   else {end of block | 0 | ||||||||||||||||||||||||
| 2453 | newSectionLength = section_sizes.takeFirst(); | - | ||||||||||||||||||||||||
| 2454 |             } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2455 | } | - | ||||||||||||||||||||||||
| 2456 | - | |||||||||||||||||||||||||
| 2457 | - | |||||||||||||||||||||||||
| 2458 |         if ((previousSectionResizeMode != newSectionResizeMode
  | 0 | ||||||||||||||||||||||||
| 2459 |             || previousSectionLength != newSectionLength
 
  | 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
  | 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()
  | 0 | ||||||||||||||||||||||||
| 2485 | sectionItems.resize(end + 1); | - | ||||||||||||||||||||||||
| 2486 | sectionStartposRecalc = true; | - | ||||||||||||||||||||||||
| 2487 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2488 | SectionItem *sectiondata = sectionItems.data(); | - | ||||||||||||||||||||||||
| 2489 |     for (int i = start; i <= end
  | 0 | ||||||||||||||||||||||||
| 2490 | length += (sizePerSection - sectiondata[i].size); | - | ||||||||||||||||||||||||
| 2491 | sectionStartposRecalc |= (sectiondata[i].size != sizePerSection); | - | ||||||||||||||||||||||||
| 2492 | sectiondata[i].size = sizePerSection; | - | ||||||||||||||||||||||||
| 2493 | sectiondata[i].resizeMode = mode; | - | ||||||||||||||||||||||||
| 2494 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2495 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 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
  | 0 | ||||||||||||||||||||||||
| 2503 |         removedlength += sectionItems.at(u).size; never executed:  removedlength += sectionItems.at(u).size; | 0 | ||||||||||||||||||||||||
| 2504 | length -= removedlength; | - | ||||||||||||||||||||||||
| 2505 | sectionItems.remove(start, end - start + 1); | - | ||||||||||||||||||||||||
| 2506 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2507 | - | |||||||||||||||||||||||||
| 2508 | void QHeaderViewPrivate::clear() | - | ||||||||||||||||||||||||
| 2509 | { | - | ||||||||||||||||||||||||
| 2510 |     if (state != NoClear
  | 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
  | 0 | ||||||||||||||||||||||||
| 2527 |         sortOrder = (
 
  | 0 | ||||||||||||||||||||||||
| 2528 |     } never executed:   else {end of block | 0 | ||||||||||||||||||||||||
| 2529 | const QVariant value = model->headerData(section, orientation, Qt::InitialSortOrderRole); | - | ||||||||||||||||||||||||
| 2530 |         if (value.canConvert(QVariant::Int)
  | 0 | ||||||||||||||||||||||||
| 2531 |             sortOrder = static_cast<Qt::SortOrder>(value.toInt()); never executed:  sortOrder = static_cast<Qt::SortOrder>(value.toInt()); | 0 | ||||||||||||||||||||||||
| 2532 | else | - | ||||||||||||||||||||||||
| 2533 |             sortOrder = Qt::AscendingOrder; never executed:  sortOrder = Qt::AscendingOrder; | 0 | ||||||||||||||||||||||||
| 2534 | } | - | ||||||||||||||||||||||||
| 2535 | q->setSortIndicator(section, sortOrder); | - | ||||||||||||||||||||||||
| 2536 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 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
  | 0 | ||||||||||||||||||||||||
| 2546 | bool sectionResized = false; | - | ||||||||||||||||||||||||
| 2547 | - | |||||||||||||||||||||||||
| 2548 | - | |||||||||||||||||||||||||
| 2549 |         for (int i = firstCascadingSection; i < visual
  | 0 | ||||||||||||||||||||||||
| 2550 |             if (cascadingSectionSize.contains(i)
  | 0 | ||||||||||||||||||||||||
| 2551 | int currentSectionSize = headerSectionSize(i); | - | ||||||||||||||||||||||||
| 2552 | int originalSectionSize = cascadingSectionSize.value(i); | - | ||||||||||||||||||||||||
| 2553 |                 if (currentSectionSize < originalSectionSize
  | 0 | ||||||||||||||||||||||||
| 2554 | int newSectionSize = currentSectionSize + delta; | - | ||||||||||||||||||||||||
| 2555 | resizeSectionItem(i, currentSectionSize, newSectionSize); | - | ||||||||||||||||||||||||
| 2556 |                     if (newSectionSize >= originalSectionSize
 
  | - | ||||||||||||||||||||||||
| 2557 |                         cascadingSectionSize.remove(i); dead code:  cascadingSectionSize.remove(i); | - | ||||||||||||||||||||||||
| 2558 | sectionResized = true; | - | ||||||||||||||||||||||||
| 2559 |                     break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 2560 | } | - | ||||||||||||||||||||||||
| 2561 |             } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2562 | - | |||||||||||||||||||||||||
| 2563 |         } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2564 | - | |||||||||||||||||||||||||
| 2565 | - | |||||||||||||||||||||||||
| 2566 |         if (!sectionResized
  | 0 | ||||||||||||||||||||||||
| 2567 | newSize = qMax(newSize, minimumSize); | - | ||||||||||||||||||||||||
| 2568 |             if (oldSize != newSize
  | 0 | ||||||||||||||||||||||||
| 2569 |                 resizeSectionItem(visual, oldSize, newSize); never executed:  resizeSectionItem(visual, oldSize, newSize); | 0 | ||||||||||||||||||||||||
| 2570 |         } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2571 | - | |||||||||||||||||||||||||
| 2572 | - | |||||||||||||||||||||||||
| 2573 |         for (int i = visual + 1; i < sectionCount()
  | 0 | ||||||||||||||||||||||||
| 2574 |             if (!sectionIsCascadable(i)
  | 0 | ||||||||||||||||||||||||
| 2575 |                 continue; never executed:  continue; | 0 | ||||||||||||||||||||||||
| 2576 | int currentSectionSize = headerSectionSize(i); | - | ||||||||||||||||||||||||
| 2577 |             if (currentSectionSize <= minimumSize
  | 0 | ||||||||||||||||||||||||
| 2578 |                 continue; never executed:  continue; | 0 | ||||||||||||||||||||||||
| 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
  | 0 | ||||||||||||||||||||||||
| 2587 |                 break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 2588 |         } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2589 |     } never executed:   else {end of block | 0 | ||||||||||||||||||||||||
| 2590 | bool sectionResized = false; | - | ||||||||||||||||||||||||
| 2591 | - | |||||||||||||||||||||||||
| 2592 | - | |||||||||||||||||||||||||
| 2593 |         for (int i = lastCascadingSection; i > visual
  | 0 | ||||||||||||||||||||||||
| 2594 |             if (!cascadingSectionSize.contains(i)
  | 0 | ||||||||||||||||||||||||
| 2595 |                 continue; never executed:  continue; | 0 | ||||||||||||||||||||||||
| 2596 | int currentSectionSize = headerSectionSize(i); | - | ||||||||||||||||||||||||
| 2597 | int originalSectionSize = cascadingSectionSize.value(i); | - | ||||||||||||||||||||||||
| 2598 |             if (currentSectionSize >= originalSectionSize
  | 0 | ||||||||||||||||||||||||
| 2599 |                 continue; never executed:  continue; | 0 | ||||||||||||||||||||||||
| 2600 | int newSectionSize = currentSectionSize - delta; | - | ||||||||||||||||||||||||
| 2601 | resizeSectionItem(i, currentSectionSize, newSectionSize); | - | ||||||||||||||||||||||||
| 2602 |             if (newSectionSize >= originalSectionSize
 
 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; never executed:  break; | 0 | ||||||||||||||||||||||||
| 2608 | } | - | ||||||||||||||||||||||||
| 2609 | - | |||||||||||||||||||||||||
| 2610 | - | |||||||||||||||||||||||||
| 2611 | resizeSectionItem(visual, oldSize, qMax(newSize, minimumSize)); | - | ||||||||||||||||||||||||
| 2612 | - | |||||||||||||||||||||||||
| 2613 | - | |||||||||||||||||||||||||
| 2614 |         if (delta < 0
 
  | 0 | ||||||||||||||||||||||||
| 2615 |             for (int i = visual - 1; i >= 0
  | 0 | ||||||||||||||||||||||||
| 2616 |                 if (!sectionIsCascadable(i)
  | 0 | ||||||||||||||||||||||||
| 2617 |                     continue; never executed:  continue; | 0 | ||||||||||||||||||||||||
| 2618 | int sectionSize = headerSectionSize(i); | - | ||||||||||||||||||||||||
| 2619 |                 if (sectionSize <= minimumSize
  | 0 | ||||||||||||||||||||||||
| 2620 |                     continue; never executed:  continue; | 0 | ||||||||||||||||||||||||
| 2621 | resizeSectionItem(i, sectionSize, qMax(sectionSize + delta, minimumSize)); | - | ||||||||||||||||||||||||
| 2622 | saveCascadingSectionSize(i, sectionSize); | - | ||||||||||||||||||||||||
| 2623 |                 break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 2624 | } | - | ||||||||||||||||||||||||
| 2625 |         } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2626 | - | |||||||||||||||||||||||||
| 2627 | - | |||||||||||||||||||||||||
| 2628 |         if (!sectionResized
  | 0 | ||||||||||||||||||||||||
| 2629 |             for (int i = visual + 1; i < sectionCount()
  | 0 | ||||||||||||||||||||||||
| 2630 |                 if (!sectionIsCascadable(i)
  | 0 | ||||||||||||||||||||||||
| 2631 |                     continue; never executed:  continue; | 0 | ||||||||||||||||||||||||
| 2632 | int currentSectionSize = headerSectionSize(i); | - | ||||||||||||||||||||||||
| 2633 | int newSectionSize = qMax(currentSectionSize - delta, minimumSize); | - | ||||||||||||||||||||||||
| 2634 | resizeSectionItem(i, currentSectionSize, newSectionSize); | - | ||||||||||||||||||||||||
| 2635 |                 break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 2636 | } | - | ||||||||||||||||||||||||
| 2637 |         } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2638 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2639 | - | |||||||||||||||||||||||||
| 2640 |     if (hasAutoResizeSections()
  | 0 | ||||||||||||||||||||||||
| 2641 |         doDelayedResizeSections(); never executed:  doDelayedResizeSections(); | 0 | ||||||||||||||||||||||||
| 2642 | - | |||||||||||||||||||||||||
| 2643 | viewport->update(); | - | ||||||||||||||||||||||||
| 2644 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 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
  | 0 | ||||||||||||||||||||||||
| 2654 |         preventCursorChangeInSetOffset = true; never executed:  preventCursorChangeInSetOffset = true; | 0 | ||||||||||||||||||||||||
| 2655 |     for (int i = 0; i < sectionItems.count()
  | 0 | ||||||||||||||||||||||||
| 2656 | QHeaderViewPrivate::SectionItem §ion = sectionItems[i]; | - | ||||||||||||||||||||||||
| 2657 |         if (hiddenSectionSize.isEmpty()
 
  | 0 | ||||||||||||||||||||||||
| 2658 | const int newSize = size; | - | ||||||||||||||||||||||||
| 2659 |             if (newSize != section.size
  | 0 | ||||||||||||||||||||||||
| 2660 | length += newSize - section.size; | - | ||||||||||||||||||||||||
| 2661 | const int oldSectionSize = section.sectionSize(); | - | ||||||||||||||||||||||||
| 2662 | section.size = size; | - | ||||||||||||||||||||||||
| 2663 | q->sectionResized(logicalIndex(i), oldSectionSize, size); | - | ||||||||||||||||||||||||
| 2664 |             } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2665 |         } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2666 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2667 | sectionStartposRecalc = true; | - | ||||||||||||||||||||||||
| 2668 |     if (hasAutoResizeSections()
  | 0 | ||||||||||||||||||||||||
| 2669 |         doDelayedResizeSections(); never executed:  doDelayedResizeSections(); | 0 | ||||||||||||||||||||||||
| 2670 | viewport->update(); | - | ||||||||||||||||||||||||
| 2671 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2672 | - | |||||||||||||||||||||||||
| 2673 | void QHeaderViewPrivate::updateDefaultSectionSizeFromStyle() | - | ||||||||||||||||||||||||
| 2674 | { | - | ||||||||||||||||||||||||
| 2675 | QHeaderView * const q = q_func(); | - | ||||||||||||||||||||||||
| 2676 |     if (orientation == Qt::Horizontal
  | 0 | ||||||||||||||||||||||||
| 2677 | defaultSectionSize = q->style()->pixelMetric(QStyle::PM_HeaderDefaultSectionSizeHorizontal, 0, q); | - | ||||||||||||||||||||||||
| 2678 |     } never executed:   else {end of block | 0 | ||||||||||||||||||||||||
| 2679 | defaultSectionSize = qMax(q->minimumSectionSize(), | - | ||||||||||||||||||||||||
| 2680 | q->style()->pixelMetric(QStyle::PM_HeaderDefaultSectionSizeVertical, 0, q)); | - | ||||||||||||||||||||||||
| 2681 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2682 | } | - | ||||||||||||||||||||||||
| 2683 | - | |||||||||||||||||||||||||
| 2684 | void QHeaderViewPrivate::recalcSectionStartPos() const | - | ||||||||||||||||||||||||
| 2685 | { | - | ||||||||||||||||||||||||
| 2686 | int pixelpos = 0; | - | ||||||||||||||||||||||||
| 2687 |     for (QVector<SectionItem>::const_iterator i = sectionItems.constBegin(); i != sectionItems.constEnd()
  | 0 | ||||||||||||||||||||||||
| 2688 | i->calculated_startpos = pixelpos; | - | ||||||||||||||||||||||||
| 2689 | pixelpos += i->size; | - | ||||||||||||||||||||||||
| 2690 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2691 | sectionStartposRecalc = false; | - | ||||||||||||||||||||||||
| 2692 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 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 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2701 | - | |||||||||||||||||||||||||
| 2702 | int QHeaderViewPrivate::headerSectionSize(int visual) const | - | ||||||||||||||||||||||||
| 2703 | { | - | ||||||||||||||||||||||||
| 2704 |     if (visual < sectionCount()
 
  | 0 | ||||||||||||||||||||||||
| 2705 |         return never executed:   sectionItems.at(visual).sectionSize();return sectionItems.at(visual).sectionSize();never executed:  return sectionItems.at(visual).sectionSize(); | 0 | ||||||||||||||||||||||||
| 2706 |     return never executed:   -1;return -1;never executed:  return -1; | 0 | ||||||||||||||||||||||||
| 2707 | } | - | ||||||||||||||||||||||||
| 2708 | - | |||||||||||||||||||||||||
| 2709 | int QHeaderViewPrivate::headerSectionPosition(int visual) const | - | ||||||||||||||||||||||||
| 2710 | { | - | ||||||||||||||||||||||||
| 2711 |     if (visual < sectionCount()
 
  | 0 | ||||||||||||||||||||||||
| 2712 |         if (sectionStartposRecalc
  | 0 | ||||||||||||||||||||||||
| 2713 |             recalcSectionStartPos(); never executed:  recalcSectionStartPos(); | 0 | ||||||||||||||||||||||||
| 2714 |         return never executed:   sectionItems.at(visual).calculated_startpos;return sectionItems.at(visual).calculated_startpos;never executed:  return sectionItems.at(visual).calculated_startpos; | 0 | ||||||||||||||||||||||||
| 2715 | } | - | ||||||||||||||||||||||||
| 2716 |     return never executed:   -1;return -1;never executed:  return -1; | 0 | ||||||||||||||||||||||||
| 2717 | } | - | ||||||||||||||||||||||||
| 2718 | - | |||||||||||||||||||||||||
| 2719 | int QHeaderViewPrivate::headerVisualIndexAt(int position) const | - | ||||||||||||||||||||||||
| 2720 | { | - | ||||||||||||||||||||||||
| 2721 |     if (sectionStartposRecalc
  | 0 | ||||||||||||||||||||||||
| 2722 |         recalcSectionStartPos(); never executed:  recalcSectionStartPos(); | 0 | ||||||||||||||||||||||||
| 2723 | int startidx = 0; | - | ||||||||||||||||||||||||
| 2724 | int endidx = sectionItems.count() - 1; | - | ||||||||||||||||||||||||
| 2725 |     while (startidx <= endidx
  | 0 | ||||||||||||||||||||||||
| 2726 | int middle = (endidx + startidx) / 2; | - | ||||||||||||||||||||||||
| 2727 |         if (sectionItems.at(middle).calculated_startpos > position
  | 0 | ||||||||||||||||||||||||
| 2728 | endidx = middle - 1; | - | ||||||||||||||||||||||||
| 2729 |         } never executed:   else {end of block | 0 | ||||||||||||||||||||||||
| 2730 |             if (sectionItems.at(middle).calculatedEndPos() <= position
  | 0 | ||||||||||||||||||||||||
| 2731 |                 startidx = middle + 1; never executed:  startidx = middle + 1; | 0 | ||||||||||||||||||||||||
| 2732 | else | - | ||||||||||||||||||||||||
| 2733 |                 return never executed:   middle;return middle;never executed:  return middle; | 0 | ||||||||||||||||||||||||
| 2734 | } | - | ||||||||||||||||||||||||
| 2735 | } | - | ||||||||||||||||||||||||
| 2736 |     return never executed:   -1;return -1;never executed:  return -1; | 0 | ||||||||||||||||||||||||
| 2737 | } | - | ||||||||||||||||||||||||
| 2738 | - | |||||||||||||||||||||||||
| 2739 | void QHeaderViewPrivate::setHeaderSectionResizeMode(int visual, QHeaderView::ResizeMode mode) | - | ||||||||||||||||||||||||
| 2740 | { | - | ||||||||||||||||||||||||
| 2741 | int size = headerSectionSize(visual); | - | ||||||||||||||||||||||||
| 2742 | createSectionItems(visual, visual, size, mode); | - | ||||||||||||||||||||||||
| 2743 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2744 | - | |||||||||||||||||||||||||
| 2745 | QHeaderView::ResizeMode QHeaderViewPrivate::headerSectionResizeMode(int visual) const | - | ||||||||||||||||||||||||
| 2746 | { | - | ||||||||||||||||||||||||
| 2747 |     if (visual < 0
 
  | 0 | ||||||||||||||||||||||||
| 2748 |         return never executed:   globalResizeMode;return globalResizeMode;never executed:  return globalResizeMode; | 0 | ||||||||||||||||||||||||
| 2749 |     return never executed:   static_cast<QHeaderView::ResizeMode>(sectionItems.at(visual).resizeMode);return static_cast<QHeaderView::ResizeMode>(sectionItems.at(visual).resizeMode);never executed:  return static_cast<QHeaderView::ResizeMode>(sectionItems.at(visual).resizeMode); | 0 | ||||||||||||||||||||||||
| 2750 | } | - | ||||||||||||||||||||||||
| 2751 | - | |||||||||||||||||||||||||
| 2752 | void QHeaderViewPrivate::setGlobalHeaderResizeMode(QHeaderView::ResizeMode mode) | - | ||||||||||||||||||||||||
| 2753 | { | - | ||||||||||||||||||||||||
| 2754 | globalResizeMode = mode; | - | ||||||||||||||||||||||||
| 2755 |     for (int i = 0; i < sectionItems.count()
  | 0 | ||||||||||||||||||||||||
| 2756 |         sectionItems[i].resizeMode = mode; never executed:  sectionItems[i].resizeMode = mode; | 0 | ||||||||||||||||||||||||
| 2757 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2758 | - | |||||||||||||||||||||||||
| 2759 | int QHeaderViewPrivate::viewSectionSizeHint(int logical) const | - | ||||||||||||||||||||||||
| 2760 | { | - | ||||||||||||||||||||||||
| 2761 |     if (QAbstractItemView *view = qobject_cast<QAbstractItemView*>(parent)
  | 0 | ||||||||||||||||||||||||
| 2762 |         return never executed:   (orientation == Qt::Horizontalreturn (orientation == Qt::Horizontal ? view->sizeHintForColumn(logical) : view->sizeHintForRow(logical));never executed:  return (orientation == Qt::Horizontal ? view->sizeHintForColumn(logical) : view->sizeHintForRow(logical)); | 0 | ||||||||||||||||||||||||
| 2763 |                 ? view->sizeHintForColumn(logical) never executed:  return (orientation == Qt::Horizontal ? view->sizeHintForColumn(logical) : view->sizeHintForRow(logical)); | 0 | ||||||||||||||||||||||||
| 2764 |                 : view->sizeHintForRow(logical)); never executed:  return (orientation == Qt::Horizontal ? view->sizeHintForColumn(logical) : view->sizeHintForRow(logical)); | 0 | ||||||||||||||||||||||||
| 2765 | } | - | ||||||||||||||||||||||||
| 2766 |     return never executed:   0;return 0;never executed:  return 0; | 0 | ||||||||||||||||||||||||
| 2767 | } | - | ||||||||||||||||||||||||
| 2768 | - | |||||||||||||||||||||||||
| 2769 | int QHeaderViewPrivate::adjustedVisualIndex(int visualIndex) const | - | ||||||||||||||||||||||||
| 2770 | { | - | ||||||||||||||||||||||||
| 2771 |     if (!hiddenSectionSize.isEmpty()
  | 0 | ||||||||||||||||||||||||
| 2772 | int adjustedVisualIndex = visualIndex; | - | ||||||||||||||||||||||||
| 2773 | int currentVisualIndex = 0; | - | ||||||||||||||||||||||||
| 2774 |         for (int i = 0; i < sectionItems.count()
  | 0 | ||||||||||||||||||||||||
| 2775 |             if (isVisualIndexHidden(i)
  | 0 | ||||||||||||||||||||||||
| 2776 |                 ++ never executed:  adjustedVisualIndex;++adjustedVisualIndex;never executed:  ++adjustedVisualIndex; | 0 | ||||||||||||||||||||||||
| 2777 | else | - | ||||||||||||||||||||||||
| 2778 |                 ++ never executed:  currentVisualIndex;++currentVisualIndex;never executed:  ++currentVisualIndex; | 0 | ||||||||||||||||||||||||
| 2779 |             if (currentVisualIndex >= visualIndex
  | 0 | ||||||||||||||||||||||||
| 2780 |                 break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 2781 |         } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2782 | visualIndex = adjustedVisualIndex; | - | ||||||||||||||||||||||||
| 2783 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2784 |     return never executed:   visualIndex;return visualIndex;never executed:  return visualIndex; | 0 | ||||||||||||||||||||||||
| 2785 | } | - | ||||||||||||||||||||||||
| 2786 | - | |||||||||||||||||||||||||
| 2787 | void QHeaderViewPrivate::setScrollOffset(const QScrollBar *scrollBar, QAbstractItemView::ScrollMode scrollMode) | - | ||||||||||||||||||||||||
| 2788 | { | - | ||||||||||||||||||||||||
| 2789 | QHeaderView * const q = q_func(); | - | ||||||||||||||||||||||||
| 2790 |     if (scrollMode == QAbstractItemView::ScrollPerItem
  | 0 | ||||||||||||||||||||||||
| 2791 |         if (scrollBar->maximum() > 0
 
  | 0 | ||||||||||||||||||||||||
| 2792 |             q->setOffsetToLastSection(); never executed:  q->setOffsetToLastSection(); | 0 | ||||||||||||||||||||||||
| 2793 | else | - | ||||||||||||||||||||||||
| 2794 |             q->setOffsetToSectionPosition(scrollBar->value()); never executed:  q->setOffsetToSectionPosition(scrollBar->value()); | 0 | ||||||||||||||||||||||||
| 2795 | } else { | - | ||||||||||||||||||||||||
| 2796 | q->setOffset(scrollBar->value()); | - | ||||||||||||||||||||||||
| 2797 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 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
 
  | 0 | ||||||||||||||||||||||||
| 2874 |         return never executed:   false;return 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()
  | 0 | ||||||||||||||||||||||||
| 2896 | int count = sectionItemsIn.at(u).tmpDataStreamSectionCount; | - | ||||||||||||||||||||||||
| 2897 |         if (count > 0
  | 0 | ||||||||||||||||||||||||
| 2898 |             sectionItemsIn[u].size /= count; never executed:  sectionItemsIn[u].size /= count; | 0 | ||||||||||||||||||||||||
| 2899 |         for (int n = 0; n < count
  | 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
  | 0 | ||||||||||||||||||||||||
| 2907 |         return never executed:   false;return 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
  | 0 | ||||||||||||||||||||||||
| 2938 |         resizeContentsPrecision = tmpint; never executed:  resizeContentsPrecision = tmpint; | 0 | ||||||||||||||||||||||||
| 2939 | - | |||||||||||||||||||||||||
| 2940 | bool tmpbool; | - | ||||||||||||||||||||||||
| 2941 | in >> tmpbool; | - | ||||||||||||||||||||||||
| 2942 |     if (in.status() == QDataStream::Ok
  | 0 | ||||||||||||||||||||||||
| 2943 | customDefaultSectionSize = tmpbool; | - | ||||||||||||||||||||||||
| 2944 |         if (!customDefaultSectionSize
  | 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
  | 0 | ||||||||||||||||||||||||
| 2952 |         lastSectionSize = inLastSectionSize; never executed:  lastSectionSize = inLastSectionSize; | 0 | ||||||||||||||||||||||||
| 2953 | - | |||||||||||||||||||||||||
| 2954 | lastSectionLogicalIdx = -1; | - | ||||||||||||||||||||||||
| 2955 |     if (stretchLastSection
  | 0 | ||||||||||||||||||||||||
| 2956 | lastSectionLogicalIdx = q->logicalIndex(lastVisibleVisualIndex()); | - | ||||||||||||||||||||||||
| 2957 | doDelayedResizeSections(); | - | ||||||||||||||||||||||||
| 2958 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 2959 | - | |||||||||||||||||||||||||
| 2960 |     return never executed:   true;return true;never executed:  return true; | 0 | ||||||||||||||||||||||||
| 2961 | } | - | ||||||||||||||||||||||||
| 2962 | - | |||||||||||||||||||||||||
| 2963 | - | |||||||||||||||||||||||||
| 2964 | - | |||||||||||||||||||||||||
| 2965 | - | |||||||||||||||||||||||||
| 2966 | - | |||||||||||||||||||||||||
| 2967 | - | |||||||||||||||||||||||||
| 2968 | - | |||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |