| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/widgets/itemviews/qcolumnview.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||
| 2 | - | |||||||||||||||||||
| 3 | - | |||||||||||||||||||
| 4 | - | |||||||||||||||||||
| 5 | - | |||||||||||||||||||
| 6 | - | |||||||||||||||||||
| 7 | QColumnView::QColumnView(QWidget * parent) | - | ||||||||||||||||||
| 8 | : QAbstractItemView(*new QColumnViewPrivate, parent) | - | ||||||||||||||||||
| 9 | { | - | ||||||||||||||||||
| 10 | QColumnViewPrivate * const d = d_func(); | - | ||||||||||||||||||
| 11 | d->initialize(); | - | ||||||||||||||||||
| 12 | } never executed: end of block | 0 | ||||||||||||||||||
| 13 | - | |||||||||||||||||||
| 14 | - | |||||||||||||||||||
| 15 | - | |||||||||||||||||||
| 16 | - | |||||||||||||||||||
| 17 | QColumnView::QColumnView(QColumnViewPrivate & dd, QWidget * parent) | - | ||||||||||||||||||
| 18 | : QAbstractItemView(dd, parent) | - | ||||||||||||||||||
| 19 | { | - | ||||||||||||||||||
| 20 | QColumnViewPrivate * const d = d_func(); | - | ||||||||||||||||||
| 21 | d->initialize(); | - | ||||||||||||||||||
| 22 | } never executed: end of block | 0 | ||||||||||||||||||
| 23 | - | |||||||||||||||||||
| 24 | void QColumnViewPrivate::initialize() | - | ||||||||||||||||||
| 25 | { | - | ||||||||||||||||||
| 26 | QColumnView * const q = q_func(); | - | ||||||||||||||||||
| 27 | q->setTextElideMode(Qt::ElideMiddle); | - | ||||||||||||||||||
| 28 | - | |||||||||||||||||||
| 29 | QObject::connect(¤tAnimation, qFlagLocation("2""finished()" "\0" __FILE__ ":" "109"), q, qFlagLocation("1""_q_changeCurrentColumn()" "\0" __FILE__ ":" "109")); | - | ||||||||||||||||||
| 30 | currentAnimation.setDuration(150); | - | ||||||||||||||||||
| 31 | currentAnimation.setTargetObject(hbar); | - | ||||||||||||||||||
| 32 | currentAnimation.setPropertyName("value"); | - | ||||||||||||||||||
| 33 | currentAnimation.setEasingCurve(QEasingCurve::InOutQuad); | - | ||||||||||||||||||
| 34 | - | |||||||||||||||||||
| 35 | delete itemDelegate; | - | ||||||||||||||||||
| 36 | q->setItemDelegate(new QColumnViewDelegate(q)); | - | ||||||||||||||||||
| 37 | } never executed: end of block | 0 | ||||||||||||||||||
| 38 | - | |||||||||||||||||||
| 39 | - | |||||||||||||||||||
| 40 | - | |||||||||||||||||||
| 41 | - | |||||||||||||||||||
| 42 | QColumnView::~QColumnView() | - | ||||||||||||||||||
| 43 | { | - | ||||||||||||||||||
| 44 | } | - | ||||||||||||||||||
| 45 | void QColumnView::setResizeGripsVisible(bool visible) | - | ||||||||||||||||||
| 46 | { | - | ||||||||||||||||||
| 47 | QColumnViewPrivate * const d = d_func(); | - | ||||||||||||||||||
| 48 | if (d->showResizeGrips == visible
| 0 | ||||||||||||||||||
| 49 | return; never executed: return; | 0 | ||||||||||||||||||
| 50 | d->showResizeGrips = visible; | - | ||||||||||||||||||
| 51 | for (int i = 0; i < d->columns.count()
| 0 | ||||||||||||||||||
| 52 | QAbstractItemView *view = d->columns[i]; | - | ||||||||||||||||||
| 53 | if (visible
| 0 | ||||||||||||||||||
| 54 | QColumnViewGrip *grip = new QColumnViewGrip(view); | - | ||||||||||||||||||
| 55 | view->setCornerWidget(grip); | - | ||||||||||||||||||
| 56 | connect(grip, qFlagLocation("2""gripMoved(int)" "\0" __FILE__ ":" "145"), this, qFlagLocation("1""_q_gripMoved(int)" "\0" __FILE__ ":" "145")); | - | ||||||||||||||||||
| 57 | } never executed: else {end of block | 0 | ||||||||||||||||||
| 58 | QWidget *widget = view->cornerWidget(); | - | ||||||||||||||||||
| 59 | view->setCornerWidget(0); | - | ||||||||||||||||||
| 60 | widget->deleteLater(); | - | ||||||||||||||||||
| 61 | } never executed: end of block | 0 | ||||||||||||||||||
| 62 | } | - | ||||||||||||||||||
| 63 | } never executed: end of block | 0 | ||||||||||||||||||
| 64 | - | |||||||||||||||||||
| 65 | bool QColumnView::resizeGripsVisible() const | - | ||||||||||||||||||
| 66 | { | - | ||||||||||||||||||
| 67 | const QColumnViewPrivate * const d = d_func(); | - | ||||||||||||||||||
| 68 | return never executed: d->showResizeGrips;return d->showResizeGrips;never executed: return d->showResizeGrips; | 0 | ||||||||||||||||||
| 69 | } | - | ||||||||||||||||||
| 70 | - | |||||||||||||||||||
| 71 | - | |||||||||||||||||||
| 72 | - | |||||||||||||||||||
| 73 | - | |||||||||||||||||||
| 74 | void QColumnView::setModel(QAbstractItemModel *model) | - | ||||||||||||||||||
| 75 | { | - | ||||||||||||||||||
| 76 | QColumnViewPrivate * const d = d_func(); | - | ||||||||||||||||||
| 77 | if (model == d->model
| 0 | ||||||||||||||||||
| 78 | return; never executed: return; | 0 | ||||||||||||||||||
| 79 | d->closeColumns(); | - | ||||||||||||||||||
| 80 | QAbstractItemView::setModel(model); | - | ||||||||||||||||||
| 81 | } never executed: end of block | 0 | ||||||||||||||||||
| 82 | - | |||||||||||||||||||
| 83 | - | |||||||||||||||||||
| 84 | - | |||||||||||||||||||
| 85 | - | |||||||||||||||||||
| 86 | void QColumnView::setRootIndex(const QModelIndex &index) | - | ||||||||||||||||||
| 87 | { | - | ||||||||||||||||||
| 88 | QColumnViewPrivate * const d = d_func(); | - | ||||||||||||||||||
| 89 | if (!model()
| 0 | ||||||||||||||||||
| 90 | return; never executed: return; | 0 | ||||||||||||||||||
| 91 | - | |||||||||||||||||||
| 92 | d->closeColumns(); | - | ||||||||||||||||||
| 93 | ((!(d->columns.count() == 0)) ? qt_assert("d->columns.count() == 0",__FILE__,182) : qt_noop()); | - | ||||||||||||||||||
| 94 | - | |||||||||||||||||||
| 95 | QAbstractItemView *view = d->createColumn(index, true); | - | ||||||||||||||||||
| 96 | if (view->selectionModel()
| 0 | ||||||||||||||||||
| 97 | view->selectionModel()->deleteLater(); never executed: view->selectionModel()->deleteLater(); | 0 | ||||||||||||||||||
| 98 | if (view->model()
| 0 | ||||||||||||||||||
| 99 | view->setSelectionModel(selectionModel()); never executed: view->setSelectionModel(selectionModel()); | 0 | ||||||||||||||||||
| 100 | - | |||||||||||||||||||
| 101 | QAbstractItemView::setRootIndex(index); | - | ||||||||||||||||||
| 102 | d->updateScrollbars(); | - | ||||||||||||||||||
| 103 | } never executed: end of block | 0 | ||||||||||||||||||
| 104 | - | |||||||||||||||||||
| 105 | - | |||||||||||||||||||
| 106 | - | |||||||||||||||||||
| 107 | - | |||||||||||||||||||
| 108 | bool QColumnView::isIndexHidden(const QModelIndex &index) const | - | ||||||||||||||||||
| 109 | { | - | ||||||||||||||||||
| 110 | (void)index;; | - | ||||||||||||||||||
| 111 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||
| 112 | } | - | ||||||||||||||||||
| 113 | - | |||||||||||||||||||
| 114 | - | |||||||||||||||||||
| 115 | - | |||||||||||||||||||
| 116 | - | |||||||||||||||||||
| 117 | QModelIndex QColumnView::indexAt(const QPoint &point) const | - | ||||||||||||||||||
| 118 | { | - | ||||||||||||||||||
| 119 | const QColumnViewPrivate * const d = d_func(); | - | ||||||||||||||||||
| 120 | for (int i = 0; i < d->columns.size()
| 0 | ||||||||||||||||||
| 121 | QPoint topLeft = d->columns.at(i)->frameGeometry().topLeft(); | - | ||||||||||||||||||
| 122 | QPoint adjustedPoint(point.x() - topLeft.x(), point.y() - topLeft.y()); | - | ||||||||||||||||||
| 123 | QModelIndex index = d->columns.at(i)->indexAt(adjustedPoint); | - | ||||||||||||||||||
| 124 | if (index.isValid()
| 0 | ||||||||||||||||||
| 125 | return never executed: index;return index;never executed: return index; | 0 | ||||||||||||||||||
| 126 | } never executed: end of block | 0 | ||||||||||||||||||
| 127 | return never executed: QModelIndex();return QModelIndex();never executed: return QModelIndex(); | 0 | ||||||||||||||||||
| 128 | } | - | ||||||||||||||||||
| 129 | - | |||||||||||||||||||
| 130 | - | |||||||||||||||||||
| 131 | - | |||||||||||||||||||
| 132 | - | |||||||||||||||||||
| 133 | QRect QColumnView::visualRect(const QModelIndex &index) const | - | ||||||||||||||||||
| 134 | { | - | ||||||||||||||||||
| 135 | if (!index.isValid()
| 0 | ||||||||||||||||||
| 136 | return never executed: QRect();return QRect();never executed: return QRect(); | 0 | ||||||||||||||||||
| 137 | - | |||||||||||||||||||
| 138 | const QColumnViewPrivate * const d = d_func(); | - | ||||||||||||||||||
| 139 | for (int i = 0; i < d->columns.size()
| 0 | ||||||||||||||||||
| 140 | QRect rect = d->columns.at(i)->visualRect(index); | - | ||||||||||||||||||
| 141 | if (!rect.isNull()
| 0 | ||||||||||||||||||
| 142 | rect.translate(d->columns.at(i)->frameGeometry().topLeft()); | - | ||||||||||||||||||
| 143 | return never executed: rect;return rect;never executed: return rect; | 0 | ||||||||||||||||||
| 144 | } | - | ||||||||||||||||||
| 145 | } never executed: end of block | 0 | ||||||||||||||||||
| 146 | return never executed: QRect();return QRect();never executed: return QRect(); | 0 | ||||||||||||||||||
| 147 | } | - | ||||||||||||||||||
| 148 | - | |||||||||||||||||||
| 149 | - | |||||||||||||||||||
| 150 | - | |||||||||||||||||||
| 151 | - | |||||||||||||||||||
| 152 | void QColumnView::scrollContentsBy(int dx, int dy) | - | ||||||||||||||||||
| 153 | { | - | ||||||||||||||||||
| 154 | QColumnViewPrivate * const d = d_func(); | - | ||||||||||||||||||
| 155 | if (d->columns.isEmpty()
| 0 | ||||||||||||||||||
| 156 | return; never executed: return; | 0 | ||||||||||||||||||
| 157 | - | |||||||||||||||||||
| 158 | dx = isRightToLeft()
| 0 | ||||||||||||||||||
| 159 | for (int i = 0; i < d->columns.count()
| 0 | ||||||||||||||||||
| 160 | d->columns.at(i)->move(d->columns.at(i)->x() + dx, 0); never executed: d->columns.at(i)->move(d->columns.at(i)->x() + dx, 0); | 0 | ||||||||||||||||||
| 161 | d->offset += dx; | - | ||||||||||||||||||
| 162 | QAbstractItemView::scrollContentsBy(dx, dy); | - | ||||||||||||||||||
| 163 | } never executed: end of block | 0 | ||||||||||||||||||
| 164 | - | |||||||||||||||||||
| 165 | - | |||||||||||||||||||
| 166 | - | |||||||||||||||||||
| 167 | - | |||||||||||||||||||
| 168 | void QColumnView::scrollTo(const QModelIndex &index, ScrollHint hint) | - | ||||||||||||||||||
| 169 | { | - | ||||||||||||||||||
| 170 | QColumnViewPrivate * const d = d_func(); | - | ||||||||||||||||||
| 171 | (void)hint;; | - | ||||||||||||||||||
| 172 | if (!index.isValid()
| 0 | ||||||||||||||||||
| 173 | return; never executed: return; | 0 | ||||||||||||||||||
| 174 | - | |||||||||||||||||||
| 175 | - | |||||||||||||||||||
| 176 | if (d->currentAnimation.state() == QPropertyAnimation::Running
| 0 | ||||||||||||||||||
| 177 | return; never executed: return; | 0 | ||||||||||||||||||
| 178 | - | |||||||||||||||||||
| 179 | d->currentAnimation.stop(); | - | ||||||||||||||||||
| 180 | - | |||||||||||||||||||
| 181 | - | |||||||||||||||||||
| 182 | - | |||||||||||||||||||
| 183 | d->closeColumns(index, true); | - | ||||||||||||||||||
| 184 | - | |||||||||||||||||||
| 185 | QModelIndex indexParent = index.parent(); | - | ||||||||||||||||||
| 186 | - | |||||||||||||||||||
| 187 | int currentColumn = 0; | - | ||||||||||||||||||
| 188 | int leftEdge = 0; | - | ||||||||||||||||||
| 189 | while (currentColumn < d->columns.size()
| 0 | ||||||||||||||||||
| 190 | if (indexParent == d->columns.at(currentColumn)->rootIndex()
| 0 | ||||||||||||||||||
| 191 | break; never executed: break; | 0 | ||||||||||||||||||
| 192 | leftEdge += d->columns.at(currentColumn)->width(); | - | ||||||||||||||||||
| 193 | ++currentColumn; | - | ||||||||||||||||||
| 194 | } never executed: end of block | 0 | ||||||||||||||||||
| 195 | - | |||||||||||||||||||
| 196 | - | |||||||||||||||||||
| 197 | if (currentColumn == d->columns.size()
| 0 | ||||||||||||||||||
| 198 | return; never executed: return; | 0 | ||||||||||||||||||
| 199 | - | |||||||||||||||||||
| 200 | int indexColumn = currentColumn; | - | ||||||||||||||||||
| 201 | - | |||||||||||||||||||
| 202 | int visibleWidth = d->columns.at(currentColumn)->width(); | - | ||||||||||||||||||
| 203 | - | |||||||||||||||||||
| 204 | if (currentColumn + 1 < d->columns.size()
| 0 | ||||||||||||||||||
| 205 | ++currentColumn; | - | ||||||||||||||||||
| 206 | visibleWidth += d->columns.at(currentColumn)->width(); | - | ||||||||||||||||||
| 207 | } never executed: end of block | 0 | ||||||||||||||||||
| 208 | - | |||||||||||||||||||
| 209 | int rightEdge = leftEdge + visibleWidth; | - | ||||||||||||||||||
| 210 | if (isRightToLeft()
| 0 | ||||||||||||||||||
| 211 | leftEdge = viewport()->width() - leftEdge; | - | ||||||||||||||||||
| 212 | rightEdge = leftEdge - visibleWidth; | - | ||||||||||||||||||
| 213 | qSwap(rightEdge, leftEdge); | - | ||||||||||||||||||
| 214 | } never executed: end of block | 0 | ||||||||||||||||||
| 215 | - | |||||||||||||||||||
| 216 | - | |||||||||||||||||||
| 217 | if (leftEdge > -horizontalOffset()
| 0 | ||||||||||||||||||
| 218 | && rightEdge <= ( -horizontalOffset() + viewport()->size().width())
| 0 | ||||||||||||||||||
| 219 | d->columns.at(indexColumn)->scrollTo(index); | - | ||||||||||||||||||
| 220 | d->_q_changeCurrentColumn(); | - | ||||||||||||||||||
| 221 | return; never executed: return; | 0 | ||||||||||||||||||
| 222 | } | - | ||||||||||||||||||
| 223 | - | |||||||||||||||||||
| 224 | int newScrollbarValue = 0; | - | ||||||||||||||||||
| 225 | if (isRightToLeft()
| 0 | ||||||||||||||||||
| 226 | if (leftEdge < 0
| 0 | ||||||||||||||||||
| 227 | - | |||||||||||||||||||
| 228 | newScrollbarValue = viewport()->size().width() - leftEdge; | - | ||||||||||||||||||
| 229 | } never executed: else {end of block | 0 | ||||||||||||||||||
| 230 | - | |||||||||||||||||||
| 231 | newScrollbarValue = rightEdge + horizontalOffset(); | - | ||||||||||||||||||
| 232 | } never executed: end of block | 0 | ||||||||||||||||||
| 233 | } else { | - | ||||||||||||||||||
| 234 | if (leftEdge > -horizontalOffset()
| 0 | ||||||||||||||||||
| 235 | - | |||||||||||||||||||
| 236 | newScrollbarValue = rightEdge - viewport()->size().width(); | - | ||||||||||||||||||
| 237 | } never executed: else {end of block | 0 | ||||||||||||||||||
| 238 | - | |||||||||||||||||||
| 239 | newScrollbarValue = leftEdge; | - | ||||||||||||||||||
| 240 | } never executed: end of block | 0 | ||||||||||||||||||
| 241 | } | - | ||||||||||||||||||
| 242 | - | |||||||||||||||||||
| 243 | - | |||||||||||||||||||
| 244 | if (style()->styleHint(QStyle::SH_Widget_Animate, 0, this)
| 0 | ||||||||||||||||||
| 245 | d->currentAnimation.setEndValue(newScrollbarValue); | - | ||||||||||||||||||
| 246 | d->currentAnimation.start(); | - | ||||||||||||||||||
| 247 | } never executed: elseend of block | 0 | ||||||||||||||||||
| 248 | - | |||||||||||||||||||
| 249 | { | - | ||||||||||||||||||
| 250 | horizontalScrollBar()->setValue(newScrollbarValue); | - | ||||||||||||||||||
| 251 | } never executed: end of block | 0 | ||||||||||||||||||
| 252 | } | - | ||||||||||||||||||
| 253 | - | |||||||||||||||||||
| 254 | - | |||||||||||||||||||
| 255 | - | |||||||||||||||||||
| 256 | - | |||||||||||||||||||
| 257 | - | |||||||||||||||||||
| 258 | - | |||||||||||||||||||
| 259 | QModelIndex QColumnView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers) | - | ||||||||||||||||||
| 260 | { | - | ||||||||||||||||||
| 261 | - | |||||||||||||||||||
| 262 | - | |||||||||||||||||||
| 263 | (void)modifiers;; | - | ||||||||||||||||||
| 264 | if (!model()
| 0 | ||||||||||||||||||
| 265 | return never executed: QModelIndex();return QModelIndex();never executed: return QModelIndex(); | 0 | ||||||||||||||||||
| 266 | - | |||||||||||||||||||
| 267 | QModelIndex current = currentIndex(); | - | ||||||||||||||||||
| 268 | if (isRightToLeft()
| 0 | ||||||||||||||||||
| 269 | if (cursorAction == MoveLeft
| 0 | ||||||||||||||||||
| 270 | cursorAction = MoveRight; never executed: cursorAction = MoveRight; | 0 | ||||||||||||||||||
| 271 | else if (cursorAction == MoveRight
| 0 | ||||||||||||||||||
| 272 | cursorAction = MoveLeft; never executed: cursorAction = MoveLeft; | 0 | ||||||||||||||||||
| 273 | } never executed: end of block | 0 | ||||||||||||||||||
| 274 | switch (cursorAction) { | - | ||||||||||||||||||
| 275 | case never executed: MoveLeft:case MoveLeft:never executed: case MoveLeft: | 0 | ||||||||||||||||||
| 276 | if (current.parent().isValid()
| 0 | ||||||||||||||||||
| 277 | return never executed: (current.parent());return (current.parent());never executed: return (current.parent()); | 0 | ||||||||||||||||||
| 278 | else | - | ||||||||||||||||||
| 279 | return never executed: current;return current;never executed: return current; | 0 | ||||||||||||||||||
| 280 | - | |||||||||||||||||||
| 281 | case never executed: MoveRight:case MoveRight:never executed: case MoveRight: | 0 | ||||||||||||||||||
| 282 | if (model()->hasChildren(current)
| 0 | ||||||||||||||||||
| 283 | return never executed: model()->index(0, 0, current);return model()->index(0, 0, current);never executed: return model()->index(0, 0, current); | 0 | ||||||||||||||||||
| 284 | else | - | ||||||||||||||||||
| 285 | return never executed: current.sibling(current.row() + 1, current.column());return current.sibling(current.row() + 1, current.column());never executed: return current.sibling(current.row() + 1, current.column()); | 0 | ||||||||||||||||||
| 286 | - | |||||||||||||||||||
| 287 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||
| 288 | break; never executed: break; | 0 | ||||||||||||||||||
| 289 | } | - | ||||||||||||||||||
| 290 | - | |||||||||||||||||||
| 291 | return never executed: QModelIndex();return QModelIndex();never executed: return QModelIndex(); | 0 | ||||||||||||||||||
| 292 | } | - | ||||||||||||||||||
| 293 | - | |||||||||||||||||||
| 294 | - | |||||||||||||||||||
| 295 | - | |||||||||||||||||||
| 296 | - | |||||||||||||||||||
| 297 | void QColumnView::resizeEvent(QResizeEvent *event) | - | ||||||||||||||||||
| 298 | { | - | ||||||||||||||||||
| 299 | QColumnViewPrivate * const d = d_func(); | - | ||||||||||||||||||
| 300 | d->doLayout(); | - | ||||||||||||||||||
| 301 | d->updateScrollbars(); | - | ||||||||||||||||||
| 302 | if (!isRightToLeft()
| 0 | ||||||||||||||||||
| 303 | int diff = event->oldSize().width() - event->size().width(); | - | ||||||||||||||||||
| 304 | if (diff < 0
| 0 | ||||||||||||||||||
| 305 | && horizontalScrollBar()->value() == horizontalScrollBar()->maximum()
| 0 | ||||||||||||||||||
| 306 | horizontalScrollBar()->setMaximum(horizontalScrollBar()->maximum() + diff); | - | ||||||||||||||||||
| 307 | } never executed: end of block | 0 | ||||||||||||||||||
| 308 | } never executed: end of block | 0 | ||||||||||||||||||
| 309 | QAbstractItemView::resizeEvent(event); | - | ||||||||||||||||||
| 310 | } never executed: end of block | 0 | ||||||||||||||||||
| 311 | - | |||||||||||||||||||
| 312 | - | |||||||||||||||||||
| 313 | - | |||||||||||||||||||
| 314 | - | |||||||||||||||||||
| 315 | void QColumnViewPrivate::updateScrollbars() | - | ||||||||||||||||||
| 316 | { | - | ||||||||||||||||||
| 317 | QColumnView * const q = q_func(); | - | ||||||||||||||||||
| 318 | - | |||||||||||||||||||
| 319 | if (currentAnimation.state() == QPropertyAnimation::Running
| 0 | ||||||||||||||||||
| 320 | return; never executed: return; | 0 | ||||||||||||||||||
| 321 | - | |||||||||||||||||||
| 322 | - | |||||||||||||||||||
| 323 | - | |||||||||||||||||||
| 324 | int horizontalLength = 0; | - | ||||||||||||||||||
| 325 | if (!columns.isEmpty()
| 0 | ||||||||||||||||||
| 326 | horizontalLength = (columns.constLast()->x() + columns.constLast()->width()) - columns.constFirst()->x(); | - | ||||||||||||||||||
| 327 | if (horizontalLength <= 0
| 0 | ||||||||||||||||||
| 328 | horizontalLength = (columns.constFirst()->x() + columns.constFirst()->width()) - columns.constLast()->x(); never executed: horizontalLength = (columns.constFirst()->x() + columns.constFirst()->width()) - columns.constLast()->x(); | 0 | ||||||||||||||||||
| 329 | } never executed: end of block | 0 | ||||||||||||||||||
| 330 | - | |||||||||||||||||||
| 331 | QSize viewportSize = viewport->size(); | - | ||||||||||||||||||
| 332 | if (horizontalLength < viewportSize.width()
| 0 | ||||||||||||||||||
| 333 | hbar->setRange(0, 0); | - | ||||||||||||||||||
| 334 | } never executed: else {end of block | 0 | ||||||||||||||||||
| 335 | int visibleLength = qMin(horizontalLength + q->horizontalOffset(), viewportSize.width()); | - | ||||||||||||||||||
| 336 | int hiddenLength = horizontalLength - visibleLength; | - | ||||||||||||||||||
| 337 | if (hiddenLength != hbar->maximum()
| 0 | ||||||||||||||||||
| 338 | hbar->setRange(0, hiddenLength); never executed: hbar->setRange(0, hiddenLength); | 0 | ||||||||||||||||||
| 339 | } never executed: end of block | 0 | ||||||||||||||||||
| 340 | if (!columns.isEmpty()
| 0 | ||||||||||||||||||
| 341 | int pageStepSize = columns.at(0)->width(); | - | ||||||||||||||||||
| 342 | if (pageStepSize != hbar->pageStep()
| 0 | ||||||||||||||||||
| 343 | hbar->setPageStep(pageStepSize); never executed: hbar->setPageStep(pageStepSize); | 0 | ||||||||||||||||||
| 344 | } never executed: end of block | 0 | ||||||||||||||||||
| 345 | bool visible = (hbar->maximum() > 0); | - | ||||||||||||||||||
| 346 | if (visible != hbar->isVisible()
| 0 | ||||||||||||||||||
| 347 | hbar->setVisible(visible); never executed: hbar->setVisible(visible); | 0 | ||||||||||||||||||
| 348 | } never executed: end of block | 0 | ||||||||||||||||||
| 349 | - | |||||||||||||||||||
| 350 | - | |||||||||||||||||||
| 351 | - | |||||||||||||||||||
| 352 | - | |||||||||||||||||||
| 353 | int QColumnView::horizontalOffset() const | - | ||||||||||||||||||
| 354 | { | - | ||||||||||||||||||
| 355 | const QColumnViewPrivate * const d = d_func(); | - | ||||||||||||||||||
| 356 | return never executed: d->offset;return d->offset;never executed: return d->offset; | 0 | ||||||||||||||||||
| 357 | } | - | ||||||||||||||||||
| 358 | - | |||||||||||||||||||
| 359 | - | |||||||||||||||||||
| 360 | - | |||||||||||||||||||
| 361 | - | |||||||||||||||||||
| 362 | int QColumnView::verticalOffset() const | - | ||||||||||||||||||
| 363 | { | - | ||||||||||||||||||
| 364 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 365 | } | - | ||||||||||||||||||
| 366 | - | |||||||||||||||||||
| 367 | - | |||||||||||||||||||
| 368 | - | |||||||||||||||||||
| 369 | - | |||||||||||||||||||
| 370 | QRegion QColumnView::visualRegionForSelection(const QItemSelection &selection) const | - | ||||||||||||||||||
| 371 | { | - | ||||||||||||||||||
| 372 | int ranges = selection.count(); | - | ||||||||||||||||||
| 373 | - | |||||||||||||||||||
| 374 | if (ranges == 0
| 0 | ||||||||||||||||||
| 375 | return never executed: QRect();return QRect();never executed: return QRect(); | 0 | ||||||||||||||||||
| 376 | - | |||||||||||||||||||
| 377 | - | |||||||||||||||||||
| 378 | - | |||||||||||||||||||
| 379 | int firstRow = selection.at(0).top(); | - | ||||||||||||||||||
| 380 | int lastRow = selection.at(0).top(); | - | ||||||||||||||||||
| 381 | for (int i = 0; i < ranges
| 0 | ||||||||||||||||||
| 382 | firstRow = qMin(firstRow, selection.at(i).top()); | - | ||||||||||||||||||
| 383 | lastRow = qMax(lastRow, selection.at(i).bottom()); | - | ||||||||||||||||||
| 384 | } never executed: end of block | 0 | ||||||||||||||||||
| 385 | - | |||||||||||||||||||
| 386 | QModelIndex firstIdx = model()->index(qMin(firstRow, lastRow), 0, rootIndex()); | - | ||||||||||||||||||
| 387 | QModelIndex lastIdx = model()->index(qMax(firstRow, lastRow), 0, rootIndex()); | - | ||||||||||||||||||
| 388 | - | |||||||||||||||||||
| 389 | if (firstIdx == lastIdx
| 0 | ||||||||||||||||||
| 390 | return never executed: visualRect(firstIdx);return visualRect(firstIdx);never executed: return visualRect(firstIdx); | 0 | ||||||||||||||||||
| 391 | - | |||||||||||||||||||
| 392 | QRegion firstRegion = visualRect(firstIdx); | - | ||||||||||||||||||
| 393 | QRegion lastRegion = visualRect(lastIdx); | - | ||||||||||||||||||
| 394 | return never executed: firstRegion.united(lastRegion);return firstRegion.united(lastRegion);never executed: return firstRegion.united(lastRegion); | 0 | ||||||||||||||||||
| 395 | } | - | ||||||||||||||||||
| 396 | - | |||||||||||||||||||
| 397 | - | |||||||||||||||||||
| 398 | - | |||||||||||||||||||
| 399 | - | |||||||||||||||||||
| 400 | void QColumnView::setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags command) | - | ||||||||||||||||||
| 401 | { | - | ||||||||||||||||||
| 402 | (void)rect;; | - | ||||||||||||||||||
| 403 | (void)command;; | - | ||||||||||||||||||
| 404 | } never executed: end of block | 0 | ||||||||||||||||||
| 405 | - | |||||||||||||||||||
| 406 | - | |||||||||||||||||||
| 407 | - | |||||||||||||||||||
| 408 | - | |||||||||||||||||||
| 409 | void QColumnView::setSelectionModel(QItemSelectionModel *newSelectionModel) | - | ||||||||||||||||||
| 410 | { | - | ||||||||||||||||||
| 411 | const QColumnViewPrivate * const d = d_func(); | - | ||||||||||||||||||
| 412 | for (int i = 0; i < d->columns.size()
| 0 | ||||||||||||||||||
| 413 | if (d->columns.at(i)->selectionModel() == selectionModel()
| 0 | ||||||||||||||||||
| 414 | d->columns.at(i)->setSelectionModel(newSelectionModel); | - | ||||||||||||||||||
| 415 | break; never executed: break; | 0 | ||||||||||||||||||
| 416 | } | - | ||||||||||||||||||
| 417 | } never executed: end of block | 0 | ||||||||||||||||||
| 418 | QAbstractItemView::setSelectionModel(newSelectionModel); | - | ||||||||||||||||||
| 419 | } never executed: end of block | 0 | ||||||||||||||||||
| 420 | - | |||||||||||||||||||
| 421 | - | |||||||||||||||||||
| 422 | - | |||||||||||||||||||
| 423 | - | |||||||||||||||||||
| 424 | QSize QColumnView::sizeHint() const | - | ||||||||||||||||||
| 425 | { | - | ||||||||||||||||||
| 426 | const QColumnViewPrivate * const d = d_func(); | - | ||||||||||||||||||
| 427 | QSize sizeHint; | - | ||||||||||||||||||
| 428 | for (int i = 0; i < d->columns.size()
| 0 | ||||||||||||||||||
| 429 | sizeHint += d->columns.at(i)->sizeHint(); | - | ||||||||||||||||||
| 430 | } never executed: end of block | 0 | ||||||||||||||||||
| 431 | return never executed: sizeHint.expandedTo(QAbstractItemView::sizeHint());return sizeHint.expandedTo(QAbstractItemView::sizeHint());never executed: return sizeHint.expandedTo(QAbstractItemView::sizeHint()); | 0 | ||||||||||||||||||
| 432 | } | - | ||||||||||||||||||
| 433 | - | |||||||||||||||||||
| 434 | - | |||||||||||||||||||
| 435 | - | |||||||||||||||||||
| 436 | - | |||||||||||||||||||
| 437 | - | |||||||||||||||||||
| 438 | void QColumnViewPrivate::_q_gripMoved(int offset) | - | ||||||||||||||||||
| 439 | { | - | ||||||||||||||||||
| 440 | QColumnView * const q = q_func(); | - | ||||||||||||||||||
| 441 | - | |||||||||||||||||||
| 442 | QObject *grip = q->sender(); | - | ||||||||||||||||||
| 443 | ((!(grip)) ? qt_assert("grip",__FILE__,532) : qt_noop()); | - | ||||||||||||||||||
| 444 | - | |||||||||||||||||||
| 445 | if (q->isRightToLeft()
| 0 | ||||||||||||||||||
| 446 | offset = -1 * offset; never executed: offset = -1 * offset; | 0 | ||||||||||||||||||
| 447 | - | |||||||||||||||||||
| 448 | bool found = false; | - | ||||||||||||||||||
| 449 | for (int i = 0; i < columns.size()
| 0 | ||||||||||||||||||
| 450 | if (!found
| 0 | ||||||||||||||||||
| 451 | found = true; | - | ||||||||||||||||||
| 452 | columnSizes[i] = columns.at(i)->width(); | - | ||||||||||||||||||
| 453 | if (q->isRightToLeft()
| 0 | ||||||||||||||||||
| 454 | columns.at(i)->move(columns.at(i)->x() + offset, 0); never executed: columns.at(i)->move(columns.at(i)->x() + offset, 0); | 0 | ||||||||||||||||||
| 455 | continue; never executed: continue; | 0 | ||||||||||||||||||
| 456 | } | - | ||||||||||||||||||
| 457 | if (!found
| 0 | ||||||||||||||||||
| 458 | continue; never executed: continue; | 0 | ||||||||||||||||||
| 459 | - | |||||||||||||||||||
| 460 | int currentX = columns.at(i)->x(); | - | ||||||||||||||||||
| 461 | columns.at(i)->move(currentX + offset, 0); | - | ||||||||||||||||||
| 462 | } never executed: end of block | 0 | ||||||||||||||||||
| 463 | - | |||||||||||||||||||
| 464 | updateScrollbars(); | - | ||||||||||||||||||
| 465 | } never executed: end of block | 0 | ||||||||||||||||||
| 466 | void QColumnViewPrivate::closeColumns(const QModelIndex &parent, bool build) | - | ||||||||||||||||||
| 467 | { | - | ||||||||||||||||||
| 468 | if (columns.isEmpty()
| 0 | ||||||||||||||||||
| 469 | return; never executed: return; | 0 | ||||||||||||||||||
| 470 | - | |||||||||||||||||||
| 471 | bool clearAll = !parent.isValid(); | - | ||||||||||||||||||
| 472 | bool passThroughRoot = false; | - | ||||||||||||||||||
| 473 | - | |||||||||||||||||||
| 474 | QVector<QModelIndex> dirsToAppend; | - | ||||||||||||||||||
| 475 | - | |||||||||||||||||||
| 476 | - | |||||||||||||||||||
| 477 | int currentColumn = -1; | - | ||||||||||||||||||
| 478 | QModelIndex parentIndex = parent; | - | ||||||||||||||||||
| 479 | while (currentColumn == -1
| 0 | ||||||||||||||||||
| 480 | if (columns.isEmpty()
| 0 | ||||||||||||||||||
| 481 | break; never executed: break; | 0 | ||||||||||||||||||
| 482 | parentIndex = parentIndex.parent(); | - | ||||||||||||||||||
| 483 | if (root == parentIndex
| 0 | ||||||||||||||||||
| 484 | passThroughRoot = true; never executed: passThroughRoot = true; | 0 | ||||||||||||||||||
| 485 | if (!parentIndex.isValid()
| 0 | ||||||||||||||||||
| 486 | break; never executed: break; | 0 | ||||||||||||||||||
| 487 | for (int i = columns.size() - 1; i >= 0
| 0 | ||||||||||||||||||
| 488 | if (columns.at(i)->rootIndex() == parentIndex
| 0 | ||||||||||||||||||
| 489 | currentColumn = i; | - | ||||||||||||||||||
| 490 | break; never executed: break; | 0 | ||||||||||||||||||
| 491 | } | - | ||||||||||||||||||
| 492 | } never executed: end of block | 0 | ||||||||||||||||||
| 493 | if (currentColumn == -1
| 0 | ||||||||||||||||||
| 494 | dirsToAppend.append(parentIndex); never executed: dirsToAppend.append(parentIndex); | 0 | ||||||||||||||||||
| 495 | } never executed: end of block | 0 | ||||||||||||||||||
| 496 | - | |||||||||||||||||||
| 497 | - | |||||||||||||||||||
| 498 | - | |||||||||||||||||||
| 499 | if (!clearAll
| 0 | ||||||||||||||||||
| 500 | return; never executed: return; | 0 | ||||||||||||||||||
| 501 | - | |||||||||||||||||||
| 502 | if (currentColumn == -1
| 0 | ||||||||||||||||||
| 503 | currentColumn = 0; never executed: currentColumn = 0; | 0 | ||||||||||||||||||
| 504 | - | |||||||||||||||||||
| 505 | - | |||||||||||||||||||
| 506 | bool alreadyExists = false; | - | ||||||||||||||||||
| 507 | if (build
| 0 | ||||||||||||||||||
| 508 | bool viewingParent = (columns.at(currentColumn + 1)->rootIndex() == parent); | - | ||||||||||||||||||
| 509 | bool viewingChild = (!model->hasChildren(parent)
| 0 | ||||||||||||||||||
| 510 | && !columns.at(currentColumn + 1)->rootIndex().isValid()
| 0 | ||||||||||||||||||
| 511 | if (viewingParent
| 0 | ||||||||||||||||||
| 512 | currentColumn++; | - | ||||||||||||||||||
| 513 | alreadyExists = true; | - | ||||||||||||||||||
| 514 | } never executed: end of block | 0 | ||||||||||||||||||
| 515 | } never executed: end of block | 0 | ||||||||||||||||||
| 516 | - | |||||||||||||||||||
| 517 | - | |||||||||||||||||||
| 518 | for (int i = columns.size() - 1; i > currentColumn
| 0 | ||||||||||||||||||
| 519 | QAbstractItemView* notShownAnymore = columns.at(i); | - | ||||||||||||||||||
| 520 | columns.removeAt(i); | - | ||||||||||||||||||
| 521 | notShownAnymore->setVisible(false); | - | ||||||||||||||||||
| 522 | if (notShownAnymore != previewColumn
| 0 | ||||||||||||||||||
| 523 | notShownAnymore->deleteLater(); never executed: notShownAnymore->deleteLater(); | 0 | ||||||||||||||||||
| 524 | } never executed: end of block | 0 | ||||||||||||||||||
| 525 | - | |||||||||||||||||||
| 526 | if (columns.isEmpty()
| 0 | ||||||||||||||||||
| 527 | offset = 0; | - | ||||||||||||||||||
| 528 | updateScrollbars(); | - | ||||||||||||||||||
| 529 | } never executed: end of block | 0 | ||||||||||||||||||
| 530 | - | |||||||||||||||||||
| 531 | - | |||||||||||||||||||
| 532 | while (!dirsToAppend.isEmpty()
| 0 | ||||||||||||||||||
| 533 | QAbstractItemView *newView = createColumn(dirsToAppend.takeLast(), true); | - | ||||||||||||||||||
| 534 | if (!dirsToAppend.isEmpty()
| 0 | ||||||||||||||||||
| 535 | newView->setCurrentIndex(dirsToAppend.constLast()); never executed: newView->setCurrentIndex(dirsToAppend.constLast()); | 0 | ||||||||||||||||||
| 536 | } never executed: end of block | 0 | ||||||||||||||||||
| 537 | - | |||||||||||||||||||
| 538 | if (build
| 0 | ||||||||||||||||||
| 539 | createColumn(parent, false); never executed: createColumn(parent, false); | 0 | ||||||||||||||||||
| 540 | } never executed: end of block | 0 | ||||||||||||||||||
| 541 | - | |||||||||||||||||||
| 542 | void QColumnViewPrivate::_q_clicked(const QModelIndex &index) | - | ||||||||||||||||||
| 543 | { | - | ||||||||||||||||||
| 544 | QColumnView * const q = q_func(); | - | ||||||||||||||||||
| 545 | QModelIndex parent = index.parent(); | - | ||||||||||||||||||
| 546 | QAbstractItemView *columnClicked = 0; | - | ||||||||||||||||||
| 547 | for (int column = 0; column < columns.count()
| 0 | ||||||||||||||||||
| 548 | if (columns.at(column)->rootIndex() == parent
| 0 | ||||||||||||||||||
| 549 | columnClicked = columns[column]; | - | ||||||||||||||||||
| 550 | break; never executed: break; | 0 | ||||||||||||||||||
| 551 | } | - | ||||||||||||||||||
| 552 | } never executed: end of block | 0 | ||||||||||||||||||
| 553 | if (q->selectionModel()
| 0 | ||||||||||||||||||
| 554 | QItemSelectionModel::SelectionFlags flags = QItemSelectionModel::Current; | - | ||||||||||||||||||
| 555 | if (columnClicked->selectionModel()->isSelected(index)
| 0 | ||||||||||||||||||
| 556 | flags |= QItemSelectionModel::Select; never executed: flags |= QItemSelectionModel::Select; | 0 | ||||||||||||||||||
| 557 | q->selectionModel()->setCurrentIndex(index, flags); | - | ||||||||||||||||||
| 558 | } never executed: end of block | 0 | ||||||||||||||||||
| 559 | } never executed: end of block | 0 | ||||||||||||||||||
| 560 | QAbstractItemView *QColumnViewPrivate::createColumn(const QModelIndex &index, bool show) | - | ||||||||||||||||||
| 561 | { | - | ||||||||||||||||||
| 562 | QColumnView * const q = q_func(); | - | ||||||||||||||||||
| 563 | QAbstractItemView *view = 0; | - | ||||||||||||||||||
| 564 | if (model->hasChildren(index)
| 0 | ||||||||||||||||||
| 565 | view = q->createColumn(index); | - | ||||||||||||||||||
| 566 | q->connect(view, qFlagLocation("2""clicked(QModelIndex)" "\0" __FILE__ ":" "674"), | - | ||||||||||||||||||
| 567 | q, qFlagLocation("1""_q_clicked(QModelIndex)" "\0" __FILE__ ":" "675")); | - | ||||||||||||||||||
| 568 | } never executed: else {end of block | 0 | ||||||||||||||||||
| 569 | if (!previewColumn
| 0 | ||||||||||||||||||
| 570 | setPreviewWidget(new QWidget(q)); never executed: setPreviewWidget(new QWidget(q)); | 0 | ||||||||||||||||||
| 571 | view = previewColumn; | - | ||||||||||||||||||
| 572 | view->setMinimumWidth(qMax(view->minimumWidth(), previewWidget->minimumWidth())); | - | ||||||||||||||||||
| 573 | } never executed: end of block | 0 | ||||||||||||||||||
| 574 | - | |||||||||||||||||||
| 575 | q->connect(view, qFlagLocation("2""activated(QModelIndex)" "\0" __FILE__ ":" "683"), | - | ||||||||||||||||||
| 576 | q, qFlagLocation("2""activated(QModelIndex)" "\0" __FILE__ ":" "684")); | - | ||||||||||||||||||
| 577 | q->connect(view, qFlagLocation("2""clicked(QModelIndex)" "\0" __FILE__ ":" "685"), | - | ||||||||||||||||||
| 578 | q, qFlagLocation("2""clicked(QModelIndex)" "\0" __FILE__ ":" "686")); | - | ||||||||||||||||||
| 579 | q->connect(view, qFlagLocation("2""doubleClicked(QModelIndex)" "\0" __FILE__ ":" "687"), | - | ||||||||||||||||||
| 580 | q, qFlagLocation("2""doubleClicked(QModelIndex)" "\0" __FILE__ ":" "688")); | - | ||||||||||||||||||
| 581 | q->connect(view, qFlagLocation("2""entered(QModelIndex)" "\0" __FILE__ ":" "689"), | - | ||||||||||||||||||
| 582 | q, qFlagLocation("2""entered(QModelIndex)" "\0" __FILE__ ":" "690")); | - | ||||||||||||||||||
| 583 | q->connect(view, qFlagLocation("2""pressed(QModelIndex)" "\0" __FILE__ ":" "691"), | - | ||||||||||||||||||
| 584 | q, qFlagLocation("2""pressed(QModelIndex)" "\0" __FILE__ ":" "692")); | - | ||||||||||||||||||
| 585 | - | |||||||||||||||||||
| 586 | view->setFocusPolicy(Qt::NoFocus); | - | ||||||||||||||||||
| 587 | view->setParent(viewport); | - | ||||||||||||||||||
| 588 | ((!(view)) ? qt_assert("view",__FILE__,696) : qt_noop()); | - | ||||||||||||||||||
| 589 | - | |||||||||||||||||||
| 590 | - | |||||||||||||||||||
| 591 | if (showResizeGrips
| 0 | ||||||||||||||||||
| 592 | QColumnViewGrip *grip = new QColumnViewGrip(view); | - | ||||||||||||||||||
| 593 | view->setCornerWidget(grip); | - | ||||||||||||||||||
| 594 | q->connect(grip, qFlagLocation("2""gripMoved(int)" "\0" __FILE__ ":" "702"), q, qFlagLocation("1""_q_gripMoved(int)" "\0" __FILE__ ":" "702")); | - | ||||||||||||||||||
| 595 | } never executed: end of block | 0 | ||||||||||||||||||
| 596 | - | |||||||||||||||||||
| 597 | if (columnSizes.count() > columns.count()
| 0 | ||||||||||||||||||
| 598 | view->setGeometry(0, 0, columnSizes.at(columns.count()), viewport->height()); | - | ||||||||||||||||||
| 599 | } never executed: else {end of block | 0 | ||||||||||||||||||
| 600 | int initialWidth = view->sizeHint().width(); | - | ||||||||||||||||||
| 601 | if (q->isRightToLeft()
| 0 | ||||||||||||||||||
| 602 | view->setGeometry(viewport->width() - initialWidth, 0, initialWidth, viewport->height()); never executed: view->setGeometry(viewport->width() - initialWidth, 0, initialWidth, viewport->height()); | 0 | ||||||||||||||||||
| 603 | else | - | ||||||||||||||||||
| 604 | view->setGeometry(0, 0, initialWidth, viewport->height()); never executed: view->setGeometry(0, 0, initialWidth, viewport->height()); | 0 | ||||||||||||||||||
| 605 | columnSizes.resize(qMax(columnSizes.count(), columns.count() + 1)); | - | ||||||||||||||||||
| 606 | columnSizes[columns.count()] = initialWidth; | - | ||||||||||||||||||
| 607 | } never executed: end of block | 0 | ||||||||||||||||||
| 608 | if (!columns.isEmpty()
| 0 | ||||||||||||||||||
| 609 | columns.constLast()->setVisible(true); never executed: columns.constLast()->setVisible(true); | 0 | ||||||||||||||||||
| 610 | - | |||||||||||||||||||
| 611 | columns.append(view); | - | ||||||||||||||||||
| 612 | doLayout(); | - | ||||||||||||||||||
| 613 | updateScrollbars(); | - | ||||||||||||||||||
| 614 | if (show
| 0 | ||||||||||||||||||
| 615 | view->setVisible(true); never executed: view->setVisible(true); | 0 | ||||||||||||||||||
| 616 | return never executed: view;return view;never executed: return view; | 0 | ||||||||||||||||||
| 617 | } | - | ||||||||||||||||||
| 618 | QAbstractItemView *QColumnView::createColumn(const QModelIndex &index) | - | ||||||||||||||||||
| 619 | { | - | ||||||||||||||||||
| 620 | QListView *view = new QListView(viewport()); | - | ||||||||||||||||||
| 621 | - | |||||||||||||||||||
| 622 | initializeColumn(view); | - | ||||||||||||||||||
| 623 | - | |||||||||||||||||||
| 624 | view->setRootIndex(index); | - | ||||||||||||||||||
| 625 | if (model()->canFetchMore(index)
| 0 | ||||||||||||||||||
| 626 | model()->fetchMore(index); never executed: model()->fetchMore(index); | 0 | ||||||||||||||||||
| 627 | - | |||||||||||||||||||
| 628 | return never executed: view;return view;never executed: return view; | 0 | ||||||||||||||||||
| 629 | } | - | ||||||||||||||||||
| 630 | void QColumnView::initializeColumn(QAbstractItemView *column) const | - | ||||||||||||||||||
| 631 | { | - | ||||||||||||||||||
| 632 | const QColumnViewPrivate * const d = d_func(); | - | ||||||||||||||||||
| 633 | - | |||||||||||||||||||
| 634 | column->setFrameShape(QFrame::NoFrame); | - | ||||||||||||||||||
| 635 | column->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); | - | ||||||||||||||||||
| 636 | column->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); | - | ||||||||||||||||||
| 637 | column->setMinimumWidth(100); | - | ||||||||||||||||||
| 638 | column->setAttribute(Qt::WA_MacShowFocusRect, false); | - | ||||||||||||||||||
| 639 | - | |||||||||||||||||||
| 640 | - | |||||||||||||||||||
| 641 | column->setDragDropMode(dragDropMode()); | - | ||||||||||||||||||
| 642 | column->setDragDropOverwriteMode(dragDropOverwriteMode()); | - | ||||||||||||||||||
| 643 | column->setDropIndicatorShown(showDropIndicator()); | - | ||||||||||||||||||
| 644 | - | |||||||||||||||||||
| 645 | column->setAlternatingRowColors(alternatingRowColors()); | - | ||||||||||||||||||
| 646 | column->setAutoScroll(hasAutoScroll()); | - | ||||||||||||||||||
| 647 | column->setEditTriggers(editTriggers()); | - | ||||||||||||||||||
| 648 | column->setHorizontalScrollMode(horizontalScrollMode()); | - | ||||||||||||||||||
| 649 | column->setIconSize(iconSize()); | - | ||||||||||||||||||
| 650 | column->setSelectionBehavior(selectionBehavior()); | - | ||||||||||||||||||
| 651 | column->setSelectionMode(selectionMode()); | - | ||||||||||||||||||
| 652 | column->setTabKeyNavigation(tabKeyNavigation()); | - | ||||||||||||||||||
| 653 | column->setTextElideMode(textElideMode()); | - | ||||||||||||||||||
| 654 | column->setVerticalScrollMode(verticalScrollMode()); | - | ||||||||||||||||||
| 655 | - | |||||||||||||||||||
| 656 | column->setModel(model()); | - | ||||||||||||||||||
| 657 | - | |||||||||||||||||||
| 658 | - | |||||||||||||||||||
| 659 | for (auto i = d->rowDelegates.cbegin(), end = d->rowDelegates.cend(); i != end
| 0 | ||||||||||||||||||
| 660 | column->setItemDelegateForRow(i.key(), i.value()); never executed: column->setItemDelegateForRow(i.key(), i.value()); | 0 | ||||||||||||||||||
| 661 | - | |||||||||||||||||||
| 662 | - | |||||||||||||||||||
| 663 | QAbstractItemDelegate *delegate = column->itemDelegate(); | - | ||||||||||||||||||
| 664 | column->setItemDelegate(d->itemDelegate); | - | ||||||||||||||||||
| 665 | delete delegate; | - | ||||||||||||||||||
| 666 | } never executed: end of block | 0 | ||||||||||||||||||
| 667 | - | |||||||||||||||||||
| 668 | - | |||||||||||||||||||
| 669 | - | |||||||||||||||||||
| 670 | - | |||||||||||||||||||
| 671 | - | |||||||||||||||||||
| 672 | - | |||||||||||||||||||
| 673 | QWidget *QColumnView::previewWidget() const | - | ||||||||||||||||||
| 674 | { | - | ||||||||||||||||||
| 675 | const QColumnViewPrivate * const d = d_func(); | - | ||||||||||||||||||
| 676 | return never executed: d->previewWidget;return d->previewWidget;never executed: return d->previewWidget; | 0 | ||||||||||||||||||
| 677 | } | - | ||||||||||||||||||
| 678 | void QColumnView::setPreviewWidget(QWidget *widget) | - | ||||||||||||||||||
| 679 | { | - | ||||||||||||||||||
| 680 | QColumnViewPrivate * const d = d_func(); | - | ||||||||||||||||||
| 681 | d->setPreviewWidget(widget); | - | ||||||||||||||||||
| 682 | } never executed: end of block | 0 | ||||||||||||||||||
| 683 | - | |||||||||||||||||||
| 684 | - | |||||||||||||||||||
| 685 | - | |||||||||||||||||||
| 686 | - | |||||||||||||||||||
| 687 | void QColumnViewPrivate::setPreviewWidget(QWidget *widget) | - | ||||||||||||||||||
| 688 | { | - | ||||||||||||||||||
| 689 | QColumnView * const q = q_func(); | - | ||||||||||||||||||
| 690 | if (previewColumn
| 0 | ||||||||||||||||||
| 691 | if (!columns.isEmpty()
| 0 | ||||||||||||||||||
| 692 | columns.removeLast(); never executed: columns.removeLast(); | 0 | ||||||||||||||||||
| 693 | previewColumn->deleteLater(); | - | ||||||||||||||||||
| 694 | } never executed: end of block | 0 | ||||||||||||||||||
| 695 | QColumnViewPreviewColumn *column = new QColumnViewPreviewColumn(q); | - | ||||||||||||||||||
| 696 | column->setPreviewWidget(widget); | - | ||||||||||||||||||
| 697 | previewColumn = column; | - | ||||||||||||||||||
| 698 | previewColumn->hide(); | - | ||||||||||||||||||
| 699 | previewColumn->setFrameShape(QFrame::NoFrame); | - | ||||||||||||||||||
| 700 | previewColumn->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); | - | ||||||||||||||||||
| 701 | previewColumn->setSelectionMode(QAbstractItemView::NoSelection); | - | ||||||||||||||||||
| 702 | previewColumn->setMinimumWidth(qMax(previewColumn->verticalScrollBar()->width(), | - | ||||||||||||||||||
| 703 | previewColumn->minimumWidth())); | - | ||||||||||||||||||
| 704 | previewWidget = widget; | - | ||||||||||||||||||
| 705 | previewWidget->setParent(previewColumn->viewport()); | - | ||||||||||||||||||
| 706 | } never executed: end of block | 0 | ||||||||||||||||||
| 707 | void QColumnView::setColumnWidths(const QList<int> &list) | - | ||||||||||||||||||
| 708 | { | - | ||||||||||||||||||
| 709 | QColumnViewPrivate * const d = d_func(); | - | ||||||||||||||||||
| 710 | int i = 0; | - | ||||||||||||||||||
| 711 | const int listCount = list.count(); | - | ||||||||||||||||||
| 712 | const int count = qMin(listCount, d->columns.count()); | - | ||||||||||||||||||
| 713 | for (; i < count
| 0 | ||||||||||||||||||
| 714 | d->columns.at(i)->resize(list.at(i), d->columns.at(i)->height()); | - | ||||||||||||||||||
| 715 | d->columnSizes[i] = list.at(i); | - | ||||||||||||||||||
| 716 | } never executed: end of block | 0 | ||||||||||||||||||
| 717 | - | |||||||||||||||||||
| 718 | d->columnSizes.reserve(listCount); | - | ||||||||||||||||||
| 719 | for (; i < listCount
| 0 | ||||||||||||||||||
| 720 | d->columnSizes.append(list.at(i)); never executed: d->columnSizes.append(list.at(i)); | 0 | ||||||||||||||||||
| 721 | } never executed: end of block | 0 | ||||||||||||||||||
| 722 | - | |||||||||||||||||||
| 723 | - | |||||||||||||||||||
| 724 | - | |||||||||||||||||||
| 725 | - | |||||||||||||||||||
| 726 | - | |||||||||||||||||||
| 727 | - | |||||||||||||||||||
| 728 | QList<int> QColumnView::columnWidths() const | - | ||||||||||||||||||
| 729 | { | - | ||||||||||||||||||
| 730 | const QColumnViewPrivate * const d = d_func(); | - | ||||||||||||||||||
| 731 | QList<int> list; | - | ||||||||||||||||||
| 732 | const int columnCount = d->columns.count(); | - | ||||||||||||||||||
| 733 | list.reserve(columnCount); | - | ||||||||||||||||||
| 734 | for (int i = 0; i < columnCount
| 0 | ||||||||||||||||||
| 735 | list.append(d->columnSizes.at(i)); never executed: list.append(d->columnSizes.at(i)); | 0 | ||||||||||||||||||
| 736 | return never executed: list;return list;never executed: return list; | 0 | ||||||||||||||||||
| 737 | } | - | ||||||||||||||||||
| 738 | - | |||||||||||||||||||
| 739 | - | |||||||||||||||||||
| 740 | - | |||||||||||||||||||
| 741 | - | |||||||||||||||||||
| 742 | void QColumnView::rowsInserted(const QModelIndex &parent, int start, int end) | - | ||||||||||||||||||
| 743 | { | - | ||||||||||||||||||
| 744 | QAbstractItemView::rowsInserted(parent, start, end); | - | ||||||||||||||||||
| 745 | d_func()->checkColumnCreation(parent); | - | ||||||||||||||||||
| 746 | } never executed: end of block | 0 | ||||||||||||||||||
| 747 | - | |||||||||||||||||||
| 748 | - | |||||||||||||||||||
| 749 | - | |||||||||||||||||||
| 750 | - | |||||||||||||||||||
| 751 | void QColumnView::currentChanged(const QModelIndex ¤t, const QModelIndex &previous) | - | ||||||||||||||||||
| 752 | { | - | ||||||||||||||||||
| 753 | QColumnViewPrivate * const d = d_func(); | - | ||||||||||||||||||
| 754 | if (!current.isValid()
| 0 | ||||||||||||||||||
| 755 | QAbstractItemView::currentChanged(current, previous); | - | ||||||||||||||||||
| 756 | return; never executed: return; | 0 | ||||||||||||||||||
| 757 | } | - | ||||||||||||||||||
| 758 | - | |||||||||||||||||||
| 759 | QModelIndex currentParent = current.parent(); | - | ||||||||||||||||||
| 760 | - | |||||||||||||||||||
| 761 | if (currentParent == previous.parent()
| 0 | ||||||||||||||||||
| 762 | && model()->hasChildren(current)
| 0 | ||||||||||||||||||
| 763 | for (int i = 0; i < d->columns.size()
| 0 | ||||||||||||||||||
| 764 | if (currentParent == d->columns.at(i)->rootIndex()
| 0 | ||||||||||||||||||
| 765 | if (d->columns.size() > i + 1
| 0 | ||||||||||||||||||
| 766 | QAbstractItemView::currentChanged(current, previous); | - | ||||||||||||||||||
| 767 | return; never executed: return; | 0 | ||||||||||||||||||
| 768 | } | - | ||||||||||||||||||
| 769 | break; never executed: break; | 0 | ||||||||||||||||||
| 770 | } | - | ||||||||||||||||||
| 771 | } never executed: end of block | 0 | ||||||||||||||||||
| 772 | } never executed: end of block | 0 | ||||||||||||||||||
| 773 | - | |||||||||||||||||||
| 774 | - | |||||||||||||||||||
| 775 | bool found = false; | - | ||||||||||||||||||
| 776 | if (currentParent == previous
| 0 | ||||||||||||||||||
| 777 | for (int i = 0; i < d->columns.size()
| 0 | ||||||||||||||||||
| 778 | if (currentParent == d->columns.at(i)->rootIndex()
| 0 | ||||||||||||||||||
| 779 | found = true; | - | ||||||||||||||||||
| 780 | if (d->columns.size() < i + 2
| 0 | ||||||||||||||||||
| 781 | d->createColumn(current, false); | - | ||||||||||||||||||
| 782 | } never executed: end of block | 0 | ||||||||||||||||||
| 783 | break; never executed: break; | 0 | ||||||||||||||||||
| 784 | } | - | ||||||||||||||||||
| 785 | } never executed: end of block | 0 | ||||||||||||||||||
| 786 | } never executed: end of block | 0 | ||||||||||||||||||
| 787 | if (!found
| 0 | ||||||||||||||||||
| 788 | d->closeColumns(current, true); never executed: d->closeColumns(current, true); | 0 | ||||||||||||||||||
| 789 | - | |||||||||||||||||||
| 790 | if (!model()->hasChildren(current)
| 0 | ||||||||||||||||||
| 791 | updatePreviewWidget(current); never executed: updatePreviewWidget(current); | 0 | ||||||||||||||||||
| 792 | - | |||||||||||||||||||
| 793 | QAbstractItemView::currentChanged(current, previous); | - | ||||||||||||||||||
| 794 | } never executed: end of block | 0 | ||||||||||||||||||
| 795 | - | |||||||||||||||||||
| 796 | - | |||||||||||||||||||
| 797 | - | |||||||||||||||||||
| 798 | - | |||||||||||||||||||
| 799 | - | |||||||||||||||||||
| 800 | void QColumnViewPrivate::_q_changeCurrentColumn() | - | ||||||||||||||||||
| 801 | { | - | ||||||||||||||||||
| 802 | QColumnView * const q = q_func(); | - | ||||||||||||||||||
| 803 | if (columns.isEmpty()
| 0 | ||||||||||||||||||
| 804 | return; never executed: return; | 0 | ||||||||||||||||||
| 805 | - | |||||||||||||||||||
| 806 | QModelIndex current = q->currentIndex(); | - | ||||||||||||||||||
| 807 | if (!current.isValid()
| 0 | ||||||||||||||||||
| 808 | return; never executed: return; | 0 | ||||||||||||||||||
| 809 | - | |||||||||||||||||||
| 810 | - | |||||||||||||||||||
| 811 | closeColumns(current, true); | - | ||||||||||||||||||
| 812 | - | |||||||||||||||||||
| 813 | - | |||||||||||||||||||
| 814 | int currentColumn = qMax(0, columns.size() - 2); | - | ||||||||||||||||||
| 815 | QAbstractItemView *parentColumn = columns.at(currentColumn); | - | ||||||||||||||||||
| 816 | if (q->hasFocus()
| 0 | ||||||||||||||||||
| 817 | parentColumn->setFocus(Qt::OtherFocusReason); never executed: parentColumn->setFocus(Qt::OtherFocusReason); | 0 | ||||||||||||||||||
| 818 | q->setFocusProxy(parentColumn); | - | ||||||||||||||||||
| 819 | - | |||||||||||||||||||
| 820 | - | |||||||||||||||||||
| 821 | for (int i = 0; i < columns.size()
| 0 | ||||||||||||||||||
| 822 | if (columns.at(i)->selectionModel() == q->selectionModel()
| 0 | ||||||||||||||||||
| 823 | QItemSelectionModel *replacementSelectionModel = | - | ||||||||||||||||||
| 824 | new QItemSelectionModel(parentColumn->model()); | - | ||||||||||||||||||
| 825 | replacementSelectionModel->setCurrentIndex( | - | ||||||||||||||||||
| 826 | q->selectionModel()->currentIndex(), QItemSelectionModel::Current); | - | ||||||||||||||||||
| 827 | replacementSelectionModel->select( | - | ||||||||||||||||||
| 828 | q->selectionModel()->selection(), QItemSelectionModel::Select); | - | ||||||||||||||||||
| 829 | QAbstractItemView *view = columns.at(i); | - | ||||||||||||||||||
| 830 | view->setSelectionModel(replacementSelectionModel); | - | ||||||||||||||||||
| 831 | view->setFocusPolicy(Qt::NoFocus); | - | ||||||||||||||||||
| 832 | if (columns.size() > i + 1
| 0 | ||||||||||||||||||
| 833 | const QModelIndex newRootIndex = columns.at(i + 1)->rootIndex(); | - | ||||||||||||||||||
| 834 | if (newRootIndex.isValid()
| 0 | ||||||||||||||||||
| 835 | view->setCurrentIndex(newRootIndex); never executed: view->setCurrentIndex(newRootIndex); | 0 | ||||||||||||||||||
| 836 | } never executed: end of block | 0 | ||||||||||||||||||
| 837 | break; never executed: break; | 0 | ||||||||||||||||||
| 838 | } | - | ||||||||||||||||||
| 839 | } never executed: end of block | 0 | ||||||||||||||||||
| 840 | parentColumn->selectionModel()->deleteLater(); | - | ||||||||||||||||||
| 841 | parentColumn->setFocusPolicy(Qt::StrongFocus); | - | ||||||||||||||||||
| 842 | parentColumn->setSelectionModel(q->selectionModel()); | - | ||||||||||||||||||
| 843 | - | |||||||||||||||||||
| 844 | if (currentColumn > 0
| 0 | ||||||||||||||||||
| 845 | parentColumn = columns.at(currentColumn - 1); | - | ||||||||||||||||||
| 846 | if (parentColumn->currentIndex() != current.parent()
| 0 | ||||||||||||||||||
| 847 | parentColumn->setCurrentIndex(current.parent()); never executed: parentColumn->setCurrentIndex(current.parent()); | 0 | ||||||||||||||||||
| 848 | } never executed: end of block | 0 | ||||||||||||||||||
| 849 | - | |||||||||||||||||||
| 850 | if (columns.constLast()->isHidden()
| 0 | ||||||||||||||||||
| 851 | columns.constLast()->setVisible(true); | - | ||||||||||||||||||
| 852 | } never executed: end of block | 0 | ||||||||||||||||||
| 853 | if (columns.constLast()->selectionModel()
| 0 | ||||||||||||||||||
| 854 | columns.constLast()->selectionModel()->clear(); never executed: columns.constLast()->selectionModel()->clear(); | 0 | ||||||||||||||||||
| 855 | updateScrollbars(); | - | ||||||||||||||||||
| 856 | } never executed: end of block | 0 | ||||||||||||||||||
| 857 | - | |||||||||||||||||||
| 858 | - | |||||||||||||||||||
| 859 | - | |||||||||||||||||||
| 860 | - | |||||||||||||||||||
| 861 | void QColumnView::selectAll() | - | ||||||||||||||||||
| 862 | { | - | ||||||||||||||||||
| 863 | if (!model()
| 0 | ||||||||||||||||||
| 864 | return; never executed: return; | 0 | ||||||||||||||||||
| 865 | - | |||||||||||||||||||
| 866 | QModelIndexList indexList = selectionModel()->selectedIndexes(); | - | ||||||||||||||||||
| 867 | QModelIndex parent = rootIndex(); | - | ||||||||||||||||||
| 868 | QItemSelection selection; | - | ||||||||||||||||||
| 869 | if (indexList.count() >= 1
| 0 | ||||||||||||||||||
| 870 | parent = indexList.at(0).parent(); never executed: parent = indexList.at(0).parent(); | 0 | ||||||||||||||||||
| 871 | if (indexList.count() == 1
| 0 | ||||||||||||||||||
| 872 | parent = indexList.at(0); | - | ||||||||||||||||||
| 873 | if (!model()->hasChildren(parent)
| 0 | ||||||||||||||||||
| 874 | parent = parent.parent(); never executed: parent = parent.parent(); | 0 | ||||||||||||||||||
| 875 | else | - | ||||||||||||||||||
| 876 | selection.append(QItemSelectionRange(parent, parent)); never executed: selection.append(QItemSelectionRange(parent, parent)); | 0 | ||||||||||||||||||
| 877 | } | - | ||||||||||||||||||
| 878 | - | |||||||||||||||||||
| 879 | QModelIndex tl = model()->index(0, 0, parent); | - | ||||||||||||||||||
| 880 | QModelIndex br = model()->index(model()->rowCount(parent) - 1, | - | ||||||||||||||||||
| 881 | model()->columnCount(parent) - 1, | - | ||||||||||||||||||
| 882 | parent); | - | ||||||||||||||||||
| 883 | selection.append(QItemSelectionRange(tl, br)); | - | ||||||||||||||||||
| 884 | selectionModel()->select(selection, QItemSelectionModel::ClearAndSelect); | - | ||||||||||||||||||
| 885 | } never executed: end of block | 0 | ||||||||||||||||||
| 886 | - | |||||||||||||||||||
| 887 | - | |||||||||||||||||||
| 888 | - | |||||||||||||||||||
| 889 | - | |||||||||||||||||||
| 890 | QColumnViewPrivate::QColumnViewPrivate() | - | ||||||||||||||||||
| 891 | : QAbstractItemViewPrivate() | - | ||||||||||||||||||
| 892 | ,showResizeGrips(true) | - | ||||||||||||||||||
| 893 | ,offset(0) | - | ||||||||||||||||||
| 894 | ,previewWidget(0) | - | ||||||||||||||||||
| 895 | ,previewColumn(0) | - | ||||||||||||||||||
| 896 | { | - | ||||||||||||||||||
| 897 | } never executed: end of block | 0 | ||||||||||||||||||
| 898 | - | |||||||||||||||||||
| 899 | QColumnViewPrivate::~QColumnViewPrivate() | - | ||||||||||||||||||
| 900 | { | - | ||||||||||||||||||
| 901 | } | - | ||||||||||||||||||
| 902 | - | |||||||||||||||||||
| 903 | - | |||||||||||||||||||
| 904 | - | |||||||||||||||||||
| 905 | - | |||||||||||||||||||
| 906 | - | |||||||||||||||||||
| 907 | void QColumnViewPrivate::_q_columnsInserted(const QModelIndex &parent, int start, int end) | - | ||||||||||||||||||
| 908 | { | - | ||||||||||||||||||
| 909 | QAbstractItemViewPrivate::_q_columnsInserted(parent, start, end); | - | ||||||||||||||||||
| 910 | checkColumnCreation(parent); | - | ||||||||||||||||||
| 911 | } never executed: end of block | 0 | ||||||||||||||||||
| 912 | - | |||||||||||||||||||
| 913 | - | |||||||||||||||||||
| 914 | - | |||||||||||||||||||
| 915 | - | |||||||||||||||||||
| 916 | - | |||||||||||||||||||
| 917 | - | |||||||||||||||||||
| 918 | - | |||||||||||||||||||
| 919 | void QColumnViewPrivate::checkColumnCreation(const QModelIndex &parent) | - | ||||||||||||||||||
| 920 | { | - | ||||||||||||||||||
| 921 | if (parent == q_func()->currentIndex()
| 0 | ||||||||||||||||||
| 922 | - | |||||||||||||||||||
| 923 | - | |||||||||||||||||||
| 924 | for (int i = 0; i < columns.count()
| 0 | ||||||||||||||||||
| 925 | QAbstractItemView *view = columns.at(i); | - | ||||||||||||||||||
| 926 | if (view->rootIndex() == parent
| 0 | ||||||||||||||||||
| 927 | if (view == previewColumn
| 0 | ||||||||||||||||||
| 928 | - | |||||||||||||||||||
| 929 | closeColumns(parent, false); | - | ||||||||||||||||||
| 930 | createColumn(parent, true ); | - | ||||||||||||||||||
| 931 | } never executed: end of block | 0 | ||||||||||||||||||
| 932 | break; never executed: break; | 0 | ||||||||||||||||||
| 933 | } | - | ||||||||||||||||||
| 934 | } never executed: end of block | 0 | ||||||||||||||||||
| 935 | } never executed: end of block | 0 | ||||||||||||||||||
| 936 | } never executed: end of block | 0 | ||||||||||||||||||
| 937 | - | |||||||||||||||||||
| 938 | - | |||||||||||||||||||
| 939 | - | |||||||||||||||||||
| 940 | - | |||||||||||||||||||
| 941 | - | |||||||||||||||||||
| 942 | void QColumnViewPrivate::doLayout() | - | ||||||||||||||||||
| 943 | { | - | ||||||||||||||||||
| 944 | QColumnView * const q = q_func(); | - | ||||||||||||||||||
| 945 | if (!model
| 0 | ||||||||||||||||||
| 946 | return; never executed: return; | 0 | ||||||||||||||||||
| 947 | - | |||||||||||||||||||
| 948 | int viewportHeight = viewport->height(); | - | ||||||||||||||||||
| 949 | int x = columns.at(0)->x(); | - | ||||||||||||||||||
| 950 | - | |||||||||||||||||||
| 951 | if (q->isRightToLeft()
| 0 | ||||||||||||||||||
| 952 | x = viewport->width() + q->horizontalOffset(); | - | ||||||||||||||||||
| 953 | for (int i = 0; i < columns.size()
| 0 | ||||||||||||||||||
| 954 | QAbstractItemView *view = columns.at(i); | - | ||||||||||||||||||
| 955 | x -= view->width(); | - | ||||||||||||||||||
| 956 | if (x != view->x()
| 0 | ||||||||||||||||||
| 957 | view->setGeometry(x, 0, view->width(), viewportHeight); never executed: view->setGeometry(x, 0, view->width(), viewportHeight); | 0 | ||||||||||||||||||
| 958 | } never executed: end of block | 0 | ||||||||||||||||||
| 959 | } never executed: else {end of block | 0 | ||||||||||||||||||
| 960 | for (int i = 0; i < columns.size()
| 0 | ||||||||||||||||||
| 961 | QAbstractItemView *view = columns.at(i); | - | ||||||||||||||||||
| 962 | int currentColumnWidth = view->width(); | - | ||||||||||||||||||
| 963 | if (x != view->x()
| 0 | ||||||||||||||||||
| 964 | view->setGeometry(x, 0, currentColumnWidth, viewportHeight); never executed: view->setGeometry(x, 0, currentColumnWidth, viewportHeight); | 0 | ||||||||||||||||||
| 965 | x += currentColumnWidth; | - | ||||||||||||||||||
| 966 | } never executed: end of block | 0 | ||||||||||||||||||
| 967 | } never executed: end of block | 0 | ||||||||||||||||||
| 968 | } | - | ||||||||||||||||||
| 969 | void QColumnViewDelegate::paint(QPainter *painter, | - | ||||||||||||||||||
| 970 | const QStyleOptionViewItem &option, | - | ||||||||||||||||||
| 971 | const QModelIndex &index) const | - | ||||||||||||||||||
| 972 | { | - | ||||||||||||||||||
| 973 | drawBackground(painter, option, index ); | - | ||||||||||||||||||
| 974 | - | |||||||||||||||||||
| 975 | bool reverse = (option.direction == Qt::RightToLeft); | - | ||||||||||||||||||
| 976 | int width = ((option.rect.height() * 2) / 3); | - | ||||||||||||||||||
| 977 | - | |||||||||||||||||||
| 978 | QStyleOptionViewItem opt = option; | - | ||||||||||||||||||
| 979 | if (reverse
| 0 | ||||||||||||||||||
| 980 | opt.rect.adjust(width,0,0,0); never executed: opt.rect.adjust(width,0,0,0); | 0 | ||||||||||||||||||
| 981 | else | - | ||||||||||||||||||
| 982 | opt.rect.adjust(0,0,-width,0); never executed: opt.rect.adjust(0,0,-width,0); | 0 | ||||||||||||||||||
| 983 | - | |||||||||||||||||||
| 984 | if (!(index.model()->flags(index) & Qt::ItemIsEnabled)
| 0 | ||||||||||||||||||
| 985 | opt.showDecorationSelected = true; | - | ||||||||||||||||||
| 986 | opt.state |= QStyle::State_Selected; | - | ||||||||||||||||||
| 987 | } never executed: end of block | 0 | ||||||||||||||||||
| 988 | - | |||||||||||||||||||
| 989 | QItemDelegate::paint(painter, opt, index); | - | ||||||||||||||||||
| 990 | - | |||||||||||||||||||
| 991 | if (reverse
| 0 | ||||||||||||||||||
| 992 | opt.rect = QRect(option.rect.x(), option.rect.y(), width, option.rect.height()); never executed: opt.rect = QRect(option.rect.x(), option.rect.y(), width, option.rect.height()); | 0 | ||||||||||||||||||
| 993 | else | - | ||||||||||||||||||
| 994 | opt.rect = QRect(option.rect.x() + option.rect.width() - width, option.rect.y(), never executed: opt.rect = QRect(option.rect.x() + option.rect.width() - width, option.rect.y(), width, option.rect.height()); | 0 | ||||||||||||||||||
| 995 | width, option.rect.height()); never executed: opt.rect = QRect(option.rect.x() + option.rect.width() - width, option.rect.y(), width, option.rect.height()); | 0 | ||||||||||||||||||
| 996 | - | |||||||||||||||||||
| 997 | - | |||||||||||||||||||
| 998 | if (index.model()->hasChildren(index)
| 0 | ||||||||||||||||||
| 999 | const QWidget *view = opt.widget; | - | ||||||||||||||||||
| 1000 | QStyle *style = view
| 0 | ||||||||||||||||||
| 1001 | style->drawPrimitive(QStyle::PE_IndicatorColumnViewArrow, &opt, painter, view); | - | ||||||||||||||||||
| 1002 | } never executed: end of block | 0 | ||||||||||||||||||
| 1003 | } never executed: end of block | 0 | ||||||||||||||||||
| 1004 | - | |||||||||||||||||||
| 1005 | - | |||||||||||||||||||
| 1006 | - | |||||||||||||||||||
| Switch to Source code | Preprocessed file |