| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/widgets/itemviews/qabstractitemview.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||
| 3 | - | |||||||||||||||||||||||||
| 4 | - | |||||||||||||||||||||||||
| 5 | - | |||||||||||||||||||||||||
| 6 | - | |||||||||||||||||||||||||
| 7 | - | |||||||||||||||||||||||||
| 8 | - | |||||||||||||||||||||||||
| 9 | - | |||||||||||||||||||||||||
| 10 | - | |||||||||||||||||||||||||
| 11 | - | |||||||||||||||||||||||||
| 12 | QAbstractItemViewPrivate::QAbstractItemViewPrivate() | - | ||||||||||||||||||||||||
| 13 | : model(QAbstractItemModelPrivate::staticEmptyModel()), | - | ||||||||||||||||||||||||
| 14 | itemDelegate(0), | - | ||||||||||||||||||||||||
| 15 | selectionModel(0), | - | ||||||||||||||||||||||||
| 16 | ctrlDragSelectionFlag(QItemSelectionModel::NoUpdate), | - | ||||||||||||||||||||||||
| 17 | noSelectionOnMousePress(false), | - | ||||||||||||||||||||||||
| 18 | selectionMode(QAbstractItemView::ExtendedSelection), | - | ||||||||||||||||||||||||
| 19 | selectionBehavior(QAbstractItemView::SelectItems), | - | ||||||||||||||||||||||||
| 20 | currentlyCommittingEditor(0), | - | ||||||||||||||||||||||||
| 21 | pressedModifiers(Qt::NoModifier), | - | ||||||||||||||||||||||||
| 22 | pressedPosition(QPoint(-1, -1)), | - | ||||||||||||||||||||||||
| 23 | pressedAlreadySelected(false), | - | ||||||||||||||||||||||||
| 24 | viewportEnteredNeeded(false), | - | ||||||||||||||||||||||||
| 25 | state(QAbstractItemView::NoState), | - | ||||||||||||||||||||||||
| 26 | stateBeforeAnimation(QAbstractItemView::NoState), | - | ||||||||||||||||||||||||
| 27 | editTriggers(QAbstractItemView::DoubleClicked|QAbstractItemView::EditKeyPressed), | - | ||||||||||||||||||||||||
| 28 | lastTrigger(QAbstractItemView::NoEditTriggers), | - | ||||||||||||||||||||||||
| 29 | tabKeyNavigation(false), | - | ||||||||||||||||||||||||
| 30 | - | |||||||||||||||||||||||||
| 31 | showDropIndicator(true), | - | ||||||||||||||||||||||||
| 32 | dragEnabled(false), | - | ||||||||||||||||||||||||
| 33 | dragDropMode(QAbstractItemView::NoDragDrop), | - | ||||||||||||||||||||||||
| 34 | overwrite(false), | - | ||||||||||||||||||||||||
| 35 | dropIndicatorPosition(QAbstractItemView::OnItem), | - | ||||||||||||||||||||||||
| 36 | defaultDropAction(Qt::IgnoreAction), | - | ||||||||||||||||||||||||
| 37 | - | |||||||||||||||||||||||||
| 38 | autoScroll(true), | - | ||||||||||||||||||||||||
| 39 | autoScrollMargin(16), | - | ||||||||||||||||||||||||
| 40 | autoScrollCount(0), | - | ||||||||||||||||||||||||
| 41 | shouldScrollToCurrentOnShow(false), | - | ||||||||||||||||||||||||
| 42 | shouldClearStatusTip(false), | - | ||||||||||||||||||||||||
| 43 | alternatingColors(false), | - | ||||||||||||||||||||||||
| 44 | textElideMode(Qt::ElideRight), | - | ||||||||||||||||||||||||
| 45 | verticalScrollMode(QAbstractItemView::ScrollPerItem), | - | ||||||||||||||||||||||||
| 46 | horizontalScrollMode(QAbstractItemView::ScrollPerItem), | - | ||||||||||||||||||||||||
| 47 | currentIndexSet(false), | - | ||||||||||||||||||||||||
| 48 | wrapItemText(false), | - | ||||||||||||||||||||||||
| 49 | delayedPendingLayout(true), | - | ||||||||||||||||||||||||
| 50 | moveCursorUpdatedView(false), | - | ||||||||||||||||||||||||
| 51 | verticalScrollModeSet(false), | - | ||||||||||||||||||||||||
| 52 | horizontalScrollModeSet(false) | - | ||||||||||||||||||||||||
| 53 | { | - | ||||||||||||||||||||||||
| 54 | keyboardInputTime.invalidate(); | - | ||||||||||||||||||||||||
| 55 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 56 | - | |||||||||||||||||||||||||
| 57 | QAbstractItemViewPrivate::~QAbstractItemViewPrivate() | - | ||||||||||||||||||||||||
| 58 | { | - | ||||||||||||||||||||||||
| 59 | } | - | ||||||||||||||||||||||||
| 60 | - | |||||||||||||||||||||||||
| 61 | void QAbstractItemViewPrivate::init() | - | ||||||||||||||||||||||||
| 62 | { | - | ||||||||||||||||||||||||
| 63 | QAbstractItemView * const q = q_func(); | - | ||||||||||||||||||||||||
| 64 | q->setItemDelegate(new QStyledItemDelegate(q)); | - | ||||||||||||||||||||||||
| 65 | - | |||||||||||||||||||||||||
| 66 | vbar->setRange(0, 0); | - | ||||||||||||||||||||||||
| 67 | hbar->setRange(0, 0); | - | ||||||||||||||||||||||||
| 68 | - | |||||||||||||||||||||||||
| 69 | QObject::connect(vbar, qFlagLocation("2""actionTriggered(int)" "\0" __FILE__ ":" "132"), | - | ||||||||||||||||||||||||
| 70 | q, qFlagLocation("1""verticalScrollbarAction(int)" "\0" __FILE__ ":" "133")); | - | ||||||||||||||||||||||||
| 71 | QObject::connect(hbar, qFlagLocation("2""actionTriggered(int)" "\0" __FILE__ ":" "134"), | - | ||||||||||||||||||||||||
| 72 | q, qFlagLocation("1""horizontalScrollbarAction(int)" "\0" __FILE__ ":" "135")); | - | ||||||||||||||||||||||||
| 73 | QObject::connect(vbar, qFlagLocation("2""valueChanged(int)" "\0" __FILE__ ":" "136"), | - | ||||||||||||||||||||||||
| 74 | q, qFlagLocation("1""verticalScrollbarValueChanged(int)" "\0" __FILE__ ":" "137")); | - | ||||||||||||||||||||||||
| 75 | QObject::connect(hbar, qFlagLocation("2""valueChanged(int)" "\0" __FILE__ ":" "138"), | - | ||||||||||||||||||||||||
| 76 | q, qFlagLocation("1""horizontalScrollbarValueChanged(int)" "\0" __FILE__ ":" "139")); | - | ||||||||||||||||||||||||
| 77 | - | |||||||||||||||||||||||||
| 78 | viewport->setBackgroundRole(QPalette::Base); | - | ||||||||||||||||||||||||
| 79 | - | |||||||||||||||||||||||||
| 80 | q->setAttribute(Qt::WA_InputMethodEnabled); | - | ||||||||||||||||||||||||
| 81 | - | |||||||||||||||||||||||||
| 82 | verticalScrollMode = static_cast<QAbstractItemView::ScrollMode>(q->style()->styleHint(QStyle::SH_ItemView_ScrollMode, 0, q, 0)); | - | ||||||||||||||||||||||||
| 83 | horizontalScrollMode = static_cast<QAbstractItemView::ScrollMode>(q->style()->styleHint(QStyle::SH_ItemView_ScrollMode, 0, q, 0)); | - | ||||||||||||||||||||||||
| 84 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 85 | - | |||||||||||||||||||||||||
| 86 | void QAbstractItemViewPrivate::setHoverIndex(const QPersistentModelIndex &index) | - | ||||||||||||||||||||||||
| 87 | { | - | ||||||||||||||||||||||||
| 88 | QAbstractItemView * const q = q_func(); | - | ||||||||||||||||||||||||
| 89 | if (hover == index
| 0 | ||||||||||||||||||||||||
| 90 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 91 | - | |||||||||||||||||||||||||
| 92 | if (selectionBehavior != QAbstractItemView::SelectRows
| 0 | ||||||||||||||||||||||||
| 93 | q->update(hover); | - | ||||||||||||||||||||||||
| 94 | q->update(index); | - | ||||||||||||||||||||||||
| 95 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 96 | QRect oldHoverRect = q->visualRect(hover); | - | ||||||||||||||||||||||||
| 97 | QRect newHoverRect = q->visualRect(index); | - | ||||||||||||||||||||||||
| 98 | viewport->update(QRect(0, newHoverRect.y(), viewport->width(), newHoverRect.height())); | - | ||||||||||||||||||||||||
| 99 | viewport->update(QRect(0, oldHoverRect.y(), viewport->width(), oldHoverRect.height())); | - | ||||||||||||||||||||||||
| 100 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 101 | hover = index; | - | ||||||||||||||||||||||||
| 102 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 103 | - | |||||||||||||||||||||||||
| 104 | void QAbstractItemViewPrivate::checkMouseMove(const QPersistentModelIndex &index) | - | ||||||||||||||||||||||||
| 105 | { | - | ||||||||||||||||||||||||
| 106 | - | |||||||||||||||||||||||||
| 107 | QAbstractItemView * const q = q_func(); | - | ||||||||||||||||||||||||
| 108 | setHoverIndex(index); | - | ||||||||||||||||||||||||
| 109 | if (viewportEnteredNeeded
| 0 | ||||||||||||||||||||||||
| 110 | viewportEnteredNeeded = false; | - | ||||||||||||||||||||||||
| 111 | - | |||||||||||||||||||||||||
| 112 | if (index.isValid()
| 0 | ||||||||||||||||||||||||
| 113 | q->entered(index); | - | ||||||||||||||||||||||||
| 114 | - | |||||||||||||||||||||||||
| 115 | QString statustip = model->data(index, Qt::StatusTipRole).toString(); | - | ||||||||||||||||||||||||
| 116 | if (parent
| 0 | ||||||||||||||||||||||||
| 117 | QStatusTipEvent tip(statustip); | - | ||||||||||||||||||||||||
| 118 | QApplication::sendEvent(parent, &tip); | - | ||||||||||||||||||||||||
| 119 | shouldClearStatusTip = !statustip.isEmpty(); | - | ||||||||||||||||||||||||
| 120 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 121 | - | |||||||||||||||||||||||||
| 122 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 123 | - | |||||||||||||||||||||||||
| 124 | if (parent
| 0 | ||||||||||||||||||||||||
| 125 | QString emptyString; | - | ||||||||||||||||||||||||
| 126 | QStatusTipEvent tip( emptyString ); | - | ||||||||||||||||||||||||
| 127 | QApplication::sendEvent(parent, &tip); | - | ||||||||||||||||||||||||
| 128 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 129 | - | |||||||||||||||||||||||||
| 130 | q->viewportEntered(); | - | ||||||||||||||||||||||||
| 131 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 132 | enteredIndex = index; | - | ||||||||||||||||||||||||
| 133 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 134 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 135 | - | |||||||||||||||||||||||||
| 136 | - | |||||||||||||||||||||||||
| 137 | - | |||||||||||||||||||||||||
| 138 | - | |||||||||||||||||||||||||
| 139 | void QAbstractItemViewPrivate::_q_scrollerStateChanged() | - | ||||||||||||||||||||||||
| 140 | { | - | ||||||||||||||||||||||||
| 141 | QAbstractItemView * const q = q_func(); | - | ||||||||||||||||||||||||
| 142 | - | |||||||||||||||||||||||||
| 143 | if (QScroller *scroller = QScroller::scroller(viewport)
| 0 | ||||||||||||||||||||||||
| 144 | switch (scroller->state()) { | - | ||||||||||||||||||||||||
| 145 | case never executed: QScroller::Pressed:case QScroller::Pressed:never executed: case QScroller::Pressed: | 0 | ||||||||||||||||||||||||
| 146 | - | |||||||||||||||||||||||||
| 147 | if (q->selectionModel()
| 0 | ||||||||||||||||||||||||
| 148 | oldSelection = q->selectionModel()->selection(); | - | ||||||||||||||||||||||||
| 149 | oldCurrent = q->selectionModel()->currentIndex(); | - | ||||||||||||||||||||||||
| 150 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 151 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 152 | - | |||||||||||||||||||||||||
| 153 | case never executed: QScroller::Dragging:case QScroller::Dragging:never executed: case QScroller::Dragging: | 0 | ||||||||||||||||||||||||
| 154 | - | |||||||||||||||||||||||||
| 155 | if (q->selectionModel()
| 0 | ||||||||||||||||||||||||
| 156 | q->selectionModel()->select(oldSelection, QItemSelectionModel::ClearAndSelect); | - | ||||||||||||||||||||||||
| 157 | q->selectionModel()->setCurrentIndex(oldCurrent, QItemSelectionModel::NoUpdate); | - | ||||||||||||||||||||||||
| 158 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 159 | - | |||||||||||||||||||||||||
| 160 | - | |||||||||||||||||||||||||
| 161 | default never executed: :default:never executed: default:code before this statement never executed: default: | 0 | ||||||||||||||||||||||||
| 162 | oldSelection = QItemSelection(); | - | ||||||||||||||||||||||||
| 163 | oldCurrent = QModelIndex(); | - | ||||||||||||||||||||||||
| 164 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 165 | } | - | ||||||||||||||||||||||||
| 166 | } | - | ||||||||||||||||||||||||
| 167 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 168 | QAbstractItemView::QAbstractItemView(QWidget *parent) | - | ||||||||||||||||||||||||
| 169 | : QAbstractScrollArea(*(new QAbstractItemViewPrivate), parent) | - | ||||||||||||||||||||||||
| 170 | { | - | ||||||||||||||||||||||||
| 171 | d_func()->init(); | - | ||||||||||||||||||||||||
| 172 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 173 | - | |||||||||||||||||||||||||
| 174 | - | |||||||||||||||||||||||||
| 175 | - | |||||||||||||||||||||||||
| 176 | - | |||||||||||||||||||||||||
| 177 | QAbstractItemView::QAbstractItemView(QAbstractItemViewPrivate &dd, QWidget *parent) | - | ||||||||||||||||||||||||
| 178 | : QAbstractScrollArea(dd, parent) | - | ||||||||||||||||||||||||
| 179 | { | - | ||||||||||||||||||||||||
| 180 | d_func()->init(); | - | ||||||||||||||||||||||||
| 181 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 182 | - | |||||||||||||||||||||||||
| 183 | - | |||||||||||||||||||||||||
| 184 | - | |||||||||||||||||||||||||
| 185 | - | |||||||||||||||||||||||||
| 186 | QAbstractItemView::~QAbstractItemView() | - | ||||||||||||||||||||||||
| 187 | { | - | ||||||||||||||||||||||||
| 188 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 189 | - | |||||||||||||||||||||||||
| 190 | d->delayedReset.stop(); | - | ||||||||||||||||||||||||
| 191 | d->updateTimer.stop(); | - | ||||||||||||||||||||||||
| 192 | d->delayedEditing.stop(); | - | ||||||||||||||||||||||||
| 193 | d->delayedAutoScroll.stop(); | - | ||||||||||||||||||||||||
| 194 | d->autoScrollTimer.stop(); | - | ||||||||||||||||||||||||
| 195 | d->delayedLayout.stop(); | - | ||||||||||||||||||||||||
| 196 | d->fetchMoreTimer.stop(); | - | ||||||||||||||||||||||||
| 197 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 198 | void QAbstractItemView::setModel(QAbstractItemModel *model) | - | ||||||||||||||||||||||||
| 199 | { | - | ||||||||||||||||||||||||
| 200 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 201 | if (model == d->model
| 0 | ||||||||||||||||||||||||
| 202 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 203 | if (d->model
| 0 | ||||||||||||||||||||||||
| 204 | disconnect(d->model, qFlagLocation("2""destroyed()" "\0" __FILE__ ":" "675"), | - | ||||||||||||||||||||||||
| 205 | this, qFlagLocation("1""_q_modelDestroyed()" "\0" __FILE__ ":" "676")); | - | ||||||||||||||||||||||||
| 206 | disconnect(d->model, qFlagLocation("2""dataChanged(QModelIndex,QModelIndex,QVector<int>)" "\0" __FILE__ ":" "677"), | - | ||||||||||||||||||||||||
| 207 | this, qFlagLocation("1""dataChanged(QModelIndex,QModelIndex,QVector<int>)" "\0" __FILE__ ":" "678")); | - | ||||||||||||||||||||||||
| 208 | disconnect(d->model, qFlagLocation("2""headerDataChanged(Qt::Orientation,int,int)" "\0" __FILE__ ":" "679"), | - | ||||||||||||||||||||||||
| 209 | this, qFlagLocation("1""_q_headerDataChanged()" "\0" __FILE__ ":" "680")); | - | ||||||||||||||||||||||||
| 210 | disconnect(d->model, qFlagLocation("2""rowsInserted(QModelIndex,int,int)" "\0" __FILE__ ":" "681"), | - | ||||||||||||||||||||||||
| 211 | this, qFlagLocation("1""rowsInserted(QModelIndex,int,int)" "\0" __FILE__ ":" "682")); | - | ||||||||||||||||||||||||
| 212 | disconnect(d->model, qFlagLocation("2""rowsAboutToBeRemoved(QModelIndex,int,int)" "\0" __FILE__ ":" "683"), | - | ||||||||||||||||||||||||
| 213 | this, qFlagLocation("1""rowsAboutToBeRemoved(QModelIndex,int,int)" "\0" __FILE__ ":" "684")); | - | ||||||||||||||||||||||||
| 214 | disconnect(d->model, qFlagLocation("2""rowsRemoved(QModelIndex,int,int)" "\0" __FILE__ ":" "685"), | - | ||||||||||||||||||||||||
| 215 | this, qFlagLocation("1""_q_rowsRemoved(QModelIndex,int,int)" "\0" __FILE__ ":" "686")); | - | ||||||||||||||||||||||||
| 216 | disconnect(d->model, qFlagLocation("2""rowsMoved(QModelIndex,int,int,QModelIndex,int)" "\0" __FILE__ ":" "687"), | - | ||||||||||||||||||||||||
| 217 | this, qFlagLocation("1""_q_rowsMoved(QModelIndex,int,int,QModelIndex,int)" "\0" __FILE__ ":" "688")); | - | ||||||||||||||||||||||||
| 218 | disconnect(d->model, qFlagLocation("2""rowsInserted(QModelIndex,int,int)" "\0" __FILE__ ":" "689"), | - | ||||||||||||||||||||||||
| 219 | this, qFlagLocation("1""_q_rowsInserted(QModelIndex,int,int)" "\0" __FILE__ ":" "690")); | - | ||||||||||||||||||||||||
| 220 | disconnect(d->model, qFlagLocation("2""columnsAboutToBeRemoved(QModelIndex,int,int)" "\0" __FILE__ ":" "691"), | - | ||||||||||||||||||||||||
| 221 | this, qFlagLocation("1""_q_columnsAboutToBeRemoved(QModelIndex,int,int)" "\0" __FILE__ ":" "692")); | - | ||||||||||||||||||||||||
| 222 | disconnect(d->model, qFlagLocation("2""columnsRemoved(QModelIndex,int,int)" "\0" __FILE__ ":" "693"), | - | ||||||||||||||||||||||||
| 223 | this, qFlagLocation("1""_q_columnsRemoved(QModelIndex,int,int)" "\0" __FILE__ ":" "694")); | - | ||||||||||||||||||||||||
| 224 | disconnect(d->model, qFlagLocation("2""columnsInserted(QModelIndex,int,int)" "\0" __FILE__ ":" "695"), | - | ||||||||||||||||||||||||
| 225 | this, qFlagLocation("1""_q_columnsInserted(QModelIndex,int,int)" "\0" __FILE__ ":" "696")); | - | ||||||||||||||||||||||||
| 226 | disconnect(d->model, qFlagLocation("2""columnsMoved(QModelIndex,int,int,QModelIndex,int)" "\0" __FILE__ ":" "697"), | - | ||||||||||||||||||||||||
| 227 | this, qFlagLocation("1""_q_columnsMoved(QModelIndex,int,int,QModelIndex,int)" "\0" __FILE__ ":" "698")); | - | ||||||||||||||||||||||||
| 228 | - | |||||||||||||||||||||||||
| 229 | disconnect(d->model, qFlagLocation("2""modelReset()" "\0" __FILE__ ":" "700"), this, qFlagLocation("1""reset()" "\0" __FILE__ ":" "700")); | - | ||||||||||||||||||||||||
| 230 | disconnect(d->model, qFlagLocation("2""layoutChanged()" "\0" __FILE__ ":" "701"), this, qFlagLocation("1""_q_layoutChanged()" "\0" __FILE__ ":" "701")); | - | ||||||||||||||||||||||||
| 231 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 232 | d->model = (model
| 0 | ||||||||||||||||||||||||
| 233 | - | |||||||||||||||||||||||||
| 234 | - | |||||||||||||||||||||||||
| 235 | ((!(d->model->index(0,0) == d->model->index(0,0))) ? qt_assert_x("QAbstractItemView::setModel", "A model should return the exact same index " "(including its internal id/pointer) when asked for it twice in a row.", | - | ||||||||||||||||||||||||
| 236 | - | |||||||||||||||||||||||||
| 237 | - | |||||||||||||||||||||||||
| 238 | __FILE__ | - | ||||||||||||||||||||||||
| 239 | , | - | ||||||||||||||||||||||||
| 240 | - | |||||||||||||||||||||||||
| 241 | - | |||||||||||||||||||||||||
| 242 | 709 | - | ||||||||||||||||||||||||
| 243 | ) : qt_noop()) | - | ||||||||||||||||||||||||
| 244 | - | |||||||||||||||||||||||||
| 245 | - | |||||||||||||||||||||||||
| 246 | ; | - | ||||||||||||||||||||||||
| 247 | ((!(!d->model->index(0,0).parent().isValid())) ? qt_assert_x("QAbstractItemView::setModel", "The parent of a top level index should be invalid", | - | ||||||||||||||||||||||||
| 248 | - | |||||||||||||||||||||||||
| 249 | __FILE__ | - | ||||||||||||||||||||||||
| 250 | , | - | ||||||||||||||||||||||||
| 251 | - | |||||||||||||||||||||||||
| 252 | 712 | - | ||||||||||||||||||||||||
| 253 | ) : qt_noop()) | - | ||||||||||||||||||||||||
| 254 | - | |||||||||||||||||||||||||
| 255 | ; | - | ||||||||||||||||||||||||
| 256 | - | |||||||||||||||||||||||||
| 257 | if (d->model != QAbstractItemModelPrivate::staticEmptyModel()
| 0 | ||||||||||||||||||||||||
| 258 | connect(d->model, qFlagLocation("2""destroyed()" "\0" __FILE__ ":" "715"), | - | ||||||||||||||||||||||||
| 259 | this, qFlagLocation("1""_q_modelDestroyed()" "\0" __FILE__ ":" "716")); | - | ||||||||||||||||||||||||
| 260 | connect(d->model, qFlagLocation("2""dataChanged(QModelIndex,QModelIndex,QVector<int>)" "\0" __FILE__ ":" "717"), | - | ||||||||||||||||||||||||
| 261 | this, qFlagLocation("1""dataChanged(QModelIndex,QModelIndex,QVector<int>)" "\0" __FILE__ ":" "718")); | - | ||||||||||||||||||||||||
| 262 | connect(d->model, qFlagLocation("2""headerDataChanged(Qt::Orientation,int,int)" "\0" __FILE__ ":" "719"), | - | ||||||||||||||||||||||||
| 263 | this, qFlagLocation("1""_q_headerDataChanged()" "\0" __FILE__ ":" "720")); | - | ||||||||||||||||||||||||
| 264 | connect(d->model, qFlagLocation("2""rowsInserted(QModelIndex,int,int)" "\0" __FILE__ ":" "721"), | - | ||||||||||||||||||||||||
| 265 | this, qFlagLocation("1""rowsInserted(QModelIndex,int,int)" "\0" __FILE__ ":" "722")); | - | ||||||||||||||||||||||||
| 266 | connect(d->model, qFlagLocation("2""rowsInserted(QModelIndex,int,int)" "\0" __FILE__ ":" "723"), | - | ||||||||||||||||||||||||
| 267 | this, qFlagLocation("1""_q_rowsInserted(QModelIndex,int,int)" "\0" __FILE__ ":" "724")); | - | ||||||||||||||||||||||||
| 268 | connect(d->model, qFlagLocation("2""rowsAboutToBeRemoved(QModelIndex,int,int)" "\0" __FILE__ ":" "725"), | - | ||||||||||||||||||||||||
| 269 | this, qFlagLocation("1""rowsAboutToBeRemoved(QModelIndex,int,int)" "\0" __FILE__ ":" "726")); | - | ||||||||||||||||||||||||
| 270 | connect(d->model, qFlagLocation("2""rowsRemoved(QModelIndex,int,int)" "\0" __FILE__ ":" "727"), | - | ||||||||||||||||||||||||
| 271 | this, qFlagLocation("1""_q_rowsRemoved(QModelIndex,int,int)" "\0" __FILE__ ":" "728")); | - | ||||||||||||||||||||||||
| 272 | connect(d->model, qFlagLocation("2""rowsMoved(QModelIndex,int,int,QModelIndex,int)" "\0" __FILE__ ":" "729"), | - | ||||||||||||||||||||||||
| 273 | this, qFlagLocation("1""_q_rowsMoved(QModelIndex,int,int,QModelIndex,int)" "\0" __FILE__ ":" "730")); | - | ||||||||||||||||||||||||
| 274 | connect(d->model, qFlagLocation("2""columnsAboutToBeRemoved(QModelIndex,int,int)" "\0" __FILE__ ":" "731"), | - | ||||||||||||||||||||||||
| 275 | this, qFlagLocation("1""_q_columnsAboutToBeRemoved(QModelIndex,int,int)" "\0" __FILE__ ":" "732")); | - | ||||||||||||||||||||||||
| 276 | connect(d->model, qFlagLocation("2""columnsRemoved(QModelIndex,int,int)" "\0" __FILE__ ":" "733"), | - | ||||||||||||||||||||||||
| 277 | this, qFlagLocation("1""_q_columnsRemoved(QModelIndex,int,int)" "\0" __FILE__ ":" "734")); | - | ||||||||||||||||||||||||
| 278 | connect(d->model, qFlagLocation("2""columnsInserted(QModelIndex,int,int)" "\0" __FILE__ ":" "735"), | - | ||||||||||||||||||||||||
| 279 | this, qFlagLocation("1""_q_columnsInserted(QModelIndex,int,int)" "\0" __FILE__ ":" "736")); | - | ||||||||||||||||||||||||
| 280 | connect(d->model, qFlagLocation("2""columnsMoved(QModelIndex,int,int,QModelIndex,int)" "\0" __FILE__ ":" "737"), | - | ||||||||||||||||||||||||
| 281 | this, qFlagLocation("1""_q_columnsMoved(QModelIndex,int,int,QModelIndex,int)" "\0" __FILE__ ":" "738")); | - | ||||||||||||||||||||||||
| 282 | - | |||||||||||||||||||||||||
| 283 | connect(d->model, qFlagLocation("2""modelReset()" "\0" __FILE__ ":" "740"), this, qFlagLocation("1""reset()" "\0" __FILE__ ":" "740")); | - | ||||||||||||||||||||||||
| 284 | connect(d->model, qFlagLocation("2""layoutChanged()" "\0" __FILE__ ":" "741"), this, qFlagLocation("1""_q_layoutChanged()" "\0" __FILE__ ":" "741")); | - | ||||||||||||||||||||||||
| 285 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 286 | - | |||||||||||||||||||||||||
| 287 | QItemSelectionModel *selection_model = new QItemSelectionModel(d->model, this); | - | ||||||||||||||||||||||||
| 288 | connect(d->model, qFlagLocation("2""destroyed()" "\0" __FILE__ ":" "745"), selection_model, qFlagLocation("1""deleteLater()" "\0" __FILE__ ":" "745")); | - | ||||||||||||||||||||||||
| 289 | setSelectionModel(selection_model); | - | ||||||||||||||||||||||||
| 290 | - | |||||||||||||||||||||||||
| 291 | reset(); | - | ||||||||||||||||||||||||
| 292 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 293 | - | |||||||||||||||||||||||||
| 294 | - | |||||||||||||||||||||||||
| 295 | - | |||||||||||||||||||||||||
| 296 | - | |||||||||||||||||||||||||
| 297 | QAbstractItemModel *QAbstractItemView::model() const | - | ||||||||||||||||||||||||
| 298 | { | - | ||||||||||||||||||||||||
| 299 | const QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 300 | return never executed: (d->model == QAbstractItemModelPrivate::staticEmptyModel() ? 0 : d->model);return (d->model == QAbstractItemModelPrivate::staticEmptyModel() ? 0 : d->model);never executed: return (d->model == QAbstractItemModelPrivate::staticEmptyModel() ? 0 : d->model); | 0 | ||||||||||||||||||||||||
| 301 | } | - | ||||||||||||||||||||||||
| 302 | void QAbstractItemView::setSelectionModel(QItemSelectionModel *selectionModel) | - | ||||||||||||||||||||||||
| 303 | { | - | ||||||||||||||||||||||||
| 304 | - | |||||||||||||||||||||||||
| 305 | ((!(selectionModel)) ? qt_assert("selectionModel",__FILE__,777) : qt_noop()); | - | ||||||||||||||||||||||||
| 306 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 307 | - | |||||||||||||||||||||||||
| 308 | if (__builtin_expect(!!(selectionModel->model() != d->model), false)
| 0 | ||||||||||||||||||||||||
| 309 | QMessageLogger(__FILE__, 781, __PRETTY_FUNCTION__).warning("QAbstractItemView::setSelectionModel() failed: " | - | ||||||||||||||||||||||||
| 310 | "Trying to set a selection model, which works on " | - | ||||||||||||||||||||||||
| 311 | "a different model than the view."); | - | ||||||||||||||||||||||||
| 312 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 313 | } | - | ||||||||||||||||||||||||
| 314 | - | |||||||||||||||||||||||||
| 315 | QItemSelection oldSelection; | - | ||||||||||||||||||||||||
| 316 | QModelIndex oldCurrentIndex; | - | ||||||||||||||||||||||||
| 317 | - | |||||||||||||||||||||||||
| 318 | if (d->selectionModel
| 0 | ||||||||||||||||||||||||
| 319 | if (d->selectionModel->model() == selectionModel->model()
| 0 | ||||||||||||||||||||||||
| 320 | oldSelection = d->selectionModel->selection(); | - | ||||||||||||||||||||||||
| 321 | oldCurrentIndex = d->selectionModel->currentIndex(); | - | ||||||||||||||||||||||||
| 322 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 323 | - | |||||||||||||||||||||||||
| 324 | disconnect(d->selectionModel, qFlagLocation("2""selectionChanged(QItemSelection,QItemSelection)" "\0" __FILE__ ":" "796"), | - | ||||||||||||||||||||||||
| 325 | this, qFlagLocation("1""selectionChanged(QItemSelection,QItemSelection)" "\0" __FILE__ ":" "797")); | - | ||||||||||||||||||||||||
| 326 | disconnect(d->selectionModel, qFlagLocation("2""currentChanged(QModelIndex,QModelIndex)" "\0" __FILE__ ":" "798"), | - | ||||||||||||||||||||||||
| 327 | this, qFlagLocation("1""currentChanged(QModelIndex,QModelIndex)" "\0" __FILE__ ":" "799")); | - | ||||||||||||||||||||||||
| 328 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 329 | - | |||||||||||||||||||||||||
| 330 | d->selectionModel = selectionModel; | - | ||||||||||||||||||||||||
| 331 | - | |||||||||||||||||||||||||
| 332 | if (d->selectionModel
| 0 | ||||||||||||||||||||||||
| 333 | connect(d->selectionModel, qFlagLocation("2""selectionChanged(QItemSelection,QItemSelection)" "\0" __FILE__ ":" "805"), | - | ||||||||||||||||||||||||
| 334 | this, qFlagLocation("1""selectionChanged(QItemSelection,QItemSelection)" "\0" __FILE__ ":" "806")); | - | ||||||||||||||||||||||||
| 335 | connect(d->selectionModel, qFlagLocation("2""currentChanged(QModelIndex,QModelIndex)" "\0" __FILE__ ":" "807"), | - | ||||||||||||||||||||||||
| 336 | this, qFlagLocation("1""currentChanged(QModelIndex,QModelIndex)" "\0" __FILE__ ":" "808")); | - | ||||||||||||||||||||||||
| 337 | - | |||||||||||||||||||||||||
| 338 | selectionChanged(d->selectionModel->selection(), oldSelection); | - | ||||||||||||||||||||||||
| 339 | currentChanged(d->selectionModel->currentIndex(), oldCurrentIndex); | - | ||||||||||||||||||||||||
| 340 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 341 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 342 | - | |||||||||||||||||||||||||
| 343 | - | |||||||||||||||||||||||||
| 344 | - | |||||||||||||||||||||||||
| 345 | - | |||||||||||||||||||||||||
| 346 | - | |||||||||||||||||||||||||
| 347 | - | |||||||||||||||||||||||||
| 348 | QItemSelectionModel* QAbstractItemView::selectionModel() const | - | ||||||||||||||||||||||||
| 349 | { | - | ||||||||||||||||||||||||
| 350 | const QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 351 | return never executed: d->selectionModel;return d->selectionModel;never executed: return d->selectionModel; | 0 | ||||||||||||||||||||||||
| 352 | } | - | ||||||||||||||||||||||||
| 353 | void QAbstractItemView::setItemDelegate(QAbstractItemDelegate *delegate) | - | ||||||||||||||||||||||||
| 354 | { | - | ||||||||||||||||||||||||
| 355 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 356 | if (delegate
| 0 | ||||||||||||||||||||||||
| 357 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 358 | - | |||||||||||||||||||||||||
| 359 | if (d->itemDelegate
| 0 | ||||||||||||||||||||||||
| 360 | if (d->delegateRefCount(d->itemDelegate) == 1
| 0 | ||||||||||||||||||||||||
| 361 | disconnect(d->itemDelegate, qFlagLocation("2""closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)" "\0" __FILE__ ":" "849"), | - | ||||||||||||||||||||||||
| 362 | this, qFlagLocation("1""closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)" "\0" __FILE__ ":" "850")); | - | ||||||||||||||||||||||||
| 363 | disconnect(d->itemDelegate, qFlagLocation("2""commitData(QWidget*)" "\0" __FILE__ ":" "851"), this, qFlagLocation("1""commitData(QWidget*)" "\0" __FILE__ ":" "851")); | - | ||||||||||||||||||||||||
| 364 | disconnect(d->itemDelegate, qFlagLocation("2""sizeHintChanged(QModelIndex)" "\0" __FILE__ ":" "852"), this, qFlagLocation("1""doItemsLayout()" "\0" __FILE__ ":" "852")); | - | ||||||||||||||||||||||||
| 365 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 366 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 367 | - | |||||||||||||||||||||||||
| 368 | if (delegate
| 0 | ||||||||||||||||||||||||
| 369 | if (d->delegateRefCount(delegate) == 0
| 0 | ||||||||||||||||||||||||
| 370 | connect(delegate, qFlagLocation("2""closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)" "\0" __FILE__ ":" "858"), | - | ||||||||||||||||||||||||
| 371 | this, qFlagLocation("1""closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)" "\0" __FILE__ ":" "859")); | - | ||||||||||||||||||||||||
| 372 | connect(delegate, qFlagLocation("2""commitData(QWidget*)" "\0" __FILE__ ":" "860"), this, qFlagLocation("1""commitData(QWidget*)" "\0" __FILE__ ":" "860")); | - | ||||||||||||||||||||||||
| 373 | connect(delegate, qFlagLocation("2""sizeHintChanged(QModelIndex)" "\0" __FILE__ ":" "861"), this, qFlagLocation("1""doItemsLayout()" "\0" __FILE__ ":" "861"), Qt::QueuedConnection); | - | ||||||||||||||||||||||||
| 374 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 375 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 376 | d->itemDelegate = delegate; | - | ||||||||||||||||||||||||
| 377 | viewport()->update(); | - | ||||||||||||||||||||||||
| 378 | d->doDelayedItemsLayout(); | - | ||||||||||||||||||||||||
| 379 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 380 | - | |||||||||||||||||||||||||
| 381 | - | |||||||||||||||||||||||||
| 382 | - | |||||||||||||||||||||||||
| 383 | - | |||||||||||||||||||||||||
| 384 | - | |||||||||||||||||||||||||
| 385 | - | |||||||||||||||||||||||||
| 386 | - | |||||||||||||||||||||||||
| 387 | QAbstractItemDelegate *QAbstractItemView::itemDelegate() const | - | ||||||||||||||||||||||||
| 388 | { | - | ||||||||||||||||||||||||
| 389 | return never executed: d_func()->itemDelegate;return d_func()->itemDelegate;never executed: return d_func()->itemDelegate; | 0 | ||||||||||||||||||||||||
| 390 | } | - | ||||||||||||||||||||||||
| 391 | - | |||||||||||||||||||||||||
| 392 | - | |||||||||||||||||||||||||
| 393 | - | |||||||||||||||||||||||||
| 394 | - | |||||||||||||||||||||||||
| 395 | QVariant QAbstractItemView::inputMethodQuery(Qt::InputMethodQuery query) const | - | ||||||||||||||||||||||||
| 396 | { | - | ||||||||||||||||||||||||
| 397 | const QModelIndex current = currentIndex(); | - | ||||||||||||||||||||||||
| 398 | if (!current.isValid()
| 0 | ||||||||||||||||||||||||
| 399 | return never executed: QAbstractScrollArea::inputMethodQuery(query);return QAbstractScrollArea::inputMethodQuery(query);never executed: return QAbstractScrollArea::inputMethodQuery(query); | 0 | ||||||||||||||||||||||||
| 400 | return never executed: visualRect(current);return visualRect(current);never executed: return visualRect(current); | 0 | ||||||||||||||||||||||||
| 401 | } | - | ||||||||||||||||||||||||
| 402 | void QAbstractItemView::setItemDelegateForRow(int row, QAbstractItemDelegate *delegate) | - | ||||||||||||||||||||||||
| 403 | { | - | ||||||||||||||||||||||||
| 404 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 405 | if (QAbstractItemDelegate *rowDelegate = d->rowDelegates.value(row, 0)
| 0 | ||||||||||||||||||||||||
| 406 | if (d->delegateRefCount(rowDelegate) == 1
| 0 | ||||||||||||||||||||||||
| 407 | disconnect(rowDelegate, qFlagLocation("2""closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)" "\0" __FILE__ ":" "917"), | - | ||||||||||||||||||||||||
| 408 | this, qFlagLocation("1""closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)" "\0" __FILE__ ":" "918")); | - | ||||||||||||||||||||||||
| 409 | disconnect(rowDelegate, qFlagLocation("2""commitData(QWidget*)" "\0" __FILE__ ":" "919"), this, qFlagLocation("1""commitData(QWidget*)" "\0" __FILE__ ":" "919")); | - | ||||||||||||||||||||||||
| 410 | disconnect(rowDelegate, qFlagLocation("2""sizeHintChanged(QModelIndex)" "\0" __FILE__ ":" "920"), this, qFlagLocation("1""doItemsLayout()" "\0" __FILE__ ":" "920")); | - | ||||||||||||||||||||||||
| 411 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 412 | d->rowDelegates.remove(row); | - | ||||||||||||||||||||||||
| 413 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 414 | if (delegate
| 0 | ||||||||||||||||||||||||
| 415 | if (d->delegateRefCount(delegate) == 0
| 0 | ||||||||||||||||||||||||
| 416 | connect(delegate, qFlagLocation("2""closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)" "\0" __FILE__ ":" "926"), | - | ||||||||||||||||||||||||
| 417 | this, qFlagLocation("1""closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)" "\0" __FILE__ ":" "927")); | - | ||||||||||||||||||||||||
| 418 | connect(delegate, qFlagLocation("2""commitData(QWidget*)" "\0" __FILE__ ":" "928"), this, qFlagLocation("1""commitData(QWidget*)" "\0" __FILE__ ":" "928")); | - | ||||||||||||||||||||||||
| 419 | connect(delegate, qFlagLocation("2""sizeHintChanged(QModelIndex)" "\0" __FILE__ ":" "929"), this, qFlagLocation("1""doItemsLayout()" "\0" __FILE__ ":" "929"), Qt::QueuedConnection); | - | ||||||||||||||||||||||||
| 420 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 421 | d->rowDelegates.insert(row, delegate); | - | ||||||||||||||||||||||||
| 422 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 423 | viewport()->update(); | - | ||||||||||||||||||||||||
| 424 | d->doDelayedItemsLayout(); | - | ||||||||||||||||||||||||
| 425 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 426 | QAbstractItemDelegate *QAbstractItemView::itemDelegateForRow(int row) const | - | ||||||||||||||||||||||||
| 427 | { | - | ||||||||||||||||||||||||
| 428 | const QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 429 | return never executed: d->rowDelegates.value(row, 0);return d->rowDelegates.value(row, 0);never executed: return d->rowDelegates.value(row, 0); | 0 | ||||||||||||||||||||||||
| 430 | } | - | ||||||||||||||||||||||||
| 431 | void QAbstractItemView::setItemDelegateForColumn(int column, QAbstractItemDelegate *delegate) | - | ||||||||||||||||||||||||
| 432 | { | - | ||||||||||||||||||||||||
| 433 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 434 | if (QAbstractItemDelegate *columnDelegate = d->columnDelegates.value(column, 0)
| 0 | ||||||||||||||||||||||||
| 435 | if (d->delegateRefCount(columnDelegate) == 1
| 0 | ||||||||||||||||||||||||
| 436 | disconnect(columnDelegate, qFlagLocation("2""closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)" "\0" __FILE__ ":" "977"), | - | ||||||||||||||||||||||||
| 437 | this, qFlagLocation("1""closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)" "\0" __FILE__ ":" "978")); | - | ||||||||||||||||||||||||
| 438 | disconnect(columnDelegate, qFlagLocation("2""commitData(QWidget*)" "\0" __FILE__ ":" "979"), this, qFlagLocation("1""commitData(QWidget*)" "\0" __FILE__ ":" "979")); | - | ||||||||||||||||||||||||
| 439 | disconnect(columnDelegate, qFlagLocation("2""sizeHintChanged(QModelIndex)" "\0" __FILE__ ":" "980"), this, qFlagLocation("1""doItemsLayout()" "\0" __FILE__ ":" "980")); | - | ||||||||||||||||||||||||
| 440 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 441 | d->columnDelegates.remove(column); | - | ||||||||||||||||||||||||
| 442 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 443 | if (delegate
| 0 | ||||||||||||||||||||||||
| 444 | if (d->delegateRefCount(delegate) == 0
| 0 | ||||||||||||||||||||||||
| 445 | connect(delegate, qFlagLocation("2""closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)" "\0" __FILE__ ":" "986"), | - | ||||||||||||||||||||||||
| 446 | this, qFlagLocation("1""closeEditor(QWidget*,QAbstractItemDelegate::EndEditHint)" "\0" __FILE__ ":" "987")); | - | ||||||||||||||||||||||||
| 447 | connect(delegate, qFlagLocation("2""commitData(QWidget*)" "\0" __FILE__ ":" "988"), this, qFlagLocation("1""commitData(QWidget*)" "\0" __FILE__ ":" "988")); | - | ||||||||||||||||||||||||
| 448 | connect(delegate, qFlagLocation("2""sizeHintChanged(QModelIndex)" "\0" __FILE__ ":" "989"), this, qFlagLocation("1""doItemsLayout()" "\0" __FILE__ ":" "989"), Qt::QueuedConnection); | - | ||||||||||||||||||||||||
| 449 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 450 | d->columnDelegates.insert(column, delegate); | - | ||||||||||||||||||||||||
| 451 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 452 | viewport()->update(); | - | ||||||||||||||||||||||||
| 453 | d->doDelayedItemsLayout(); | - | ||||||||||||||||||||||||
| 454 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 455 | QAbstractItemDelegate *QAbstractItemView::itemDelegateForColumn(int column) const | - | ||||||||||||||||||||||||
| 456 | { | - | ||||||||||||||||||||||||
| 457 | const QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 458 | return never executed: d->columnDelegates.value(column, 0);return d->columnDelegates.value(column, 0);never executed: return d->columnDelegates.value(column, 0); | 0 | ||||||||||||||||||||||||
| 459 | } | - | ||||||||||||||||||||||||
| 460 | - | |||||||||||||||||||||||||
| 461 | - | |||||||||||||||||||||||||
| 462 | - | |||||||||||||||||||||||||
| 463 | - | |||||||||||||||||||||||||
| 464 | - | |||||||||||||||||||||||||
| 465 | QAbstractItemDelegate *QAbstractItemView::itemDelegate(const QModelIndex &index) const | - | ||||||||||||||||||||||||
| 466 | { | - | ||||||||||||||||||||||||
| 467 | const QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 468 | return never executed: d->delegateForIndex(index);return d->delegateForIndex(index);never executed: return d->delegateForIndex(index); | 0 | ||||||||||||||||||||||||
| 469 | } | - | ||||||||||||||||||||||||
| 470 | void QAbstractItemView::setSelectionMode(SelectionMode mode) | - | ||||||||||||||||||||||||
| 471 | { | - | ||||||||||||||||||||||||
| 472 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 473 | d->selectionMode = mode; | - | ||||||||||||||||||||||||
| 474 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 475 | - | |||||||||||||||||||||||||
| 476 | QAbstractItemView::SelectionMode QAbstractItemView::selectionMode() const | - | ||||||||||||||||||||||||
| 477 | { | - | ||||||||||||||||||||||||
| 478 | const QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 479 | return never executed: d->selectionMode;return d->selectionMode;never executed: return d->selectionMode; | 0 | ||||||||||||||||||||||||
| 480 | } | - | ||||||||||||||||||||||||
| 481 | void QAbstractItemView::setSelectionBehavior(QAbstractItemView::SelectionBehavior behavior) | - | ||||||||||||||||||||||||
| 482 | { | - | ||||||||||||||||||||||||
| 483 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 484 | d->selectionBehavior = behavior; | - | ||||||||||||||||||||||||
| 485 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 486 | - | |||||||||||||||||||||||||
| 487 | QAbstractItemView::SelectionBehavior QAbstractItemView::selectionBehavior() const | - | ||||||||||||||||||||||||
| 488 | { | - | ||||||||||||||||||||||||
| 489 | const QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 490 | return never executed: d->selectionBehavior;return d->selectionBehavior;never executed: return d->selectionBehavior; | 0 | ||||||||||||||||||||||||
| 491 | } | - | ||||||||||||||||||||||||
| 492 | void QAbstractItemView::setCurrentIndex(const QModelIndex &index) | - | ||||||||||||||||||||||||
| 493 | { | - | ||||||||||||||||||||||||
| 494 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 495 | if (d->selectionModel
| 0 | ||||||||||||||||||||||||
| 496 | QItemSelectionModel::SelectionFlags command = selectionCommand(index, 0); | - | ||||||||||||||||||||||||
| 497 | d->selectionModel->setCurrentIndex(index, command); | - | ||||||||||||||||||||||||
| 498 | d->currentIndexSet = true; | - | ||||||||||||||||||||||||
| 499 | if ((
| 0 | ||||||||||||||||||||||||
| 500 | d->currentSelectionStartIndex = index; never executed: d->currentSelectionStartIndex = index; | 0 | ||||||||||||||||||||||||
| 501 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 502 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 503 | - | |||||||||||||||||||||||||
| 504 | - | |||||||||||||||||||||||||
| 505 | - | |||||||||||||||||||||||||
| 506 | - | |||||||||||||||||||||||||
| 507 | - | |||||||||||||||||||||||||
| 508 | - | |||||||||||||||||||||||||
| 509 | QModelIndex QAbstractItemView::currentIndex() const | - | ||||||||||||||||||||||||
| 510 | { | - | ||||||||||||||||||||||||
| 511 | const QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 512 | return never executed: d->selectionModel ? d->selectionModel->currentIndex() : QModelIndex();return d->selectionModel ? d->selectionModel->currentIndex() : QModelIndex();never executed: return d->selectionModel ? d->selectionModel->currentIndex() : QModelIndex(); | 0 | ||||||||||||||||||||||||
| 513 | } | - | ||||||||||||||||||||||||
| 514 | void QAbstractItemView::reset() | - | ||||||||||||||||||||||||
| 515 | { | - | ||||||||||||||||||||||||
| 516 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 517 | d->delayedReset.stop(); | - | ||||||||||||||||||||||||
| 518 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(d->indexEditorHash)>::type> _container_((d->indexEditorHash)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (const QEditorInfo &info = *_container_.i; _container_.control; _container_.control = 0) { | - | ||||||||||||||||||||||||
| 519 | if (info.widget
| 0 | ||||||||||||||||||||||||
| 520 | d->releaseEditor(info.widget.data(), d->indexForEditor(info.widget.data())); never executed: d->releaseEditor(info.widget.data(), d->indexForEditor(info.widget.data())); | 0 | ||||||||||||||||||||||||
| 521 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 522 | d->editorIndexHash.clear(); | - | ||||||||||||||||||||||||
| 523 | d->indexEditorHash.clear(); | - | ||||||||||||||||||||||||
| 524 | d->persistent.clear(); | - | ||||||||||||||||||||||||
| 525 | d->currentIndexSet = false; | - | ||||||||||||||||||||||||
| 526 | setState(NoState); | - | ||||||||||||||||||||||||
| 527 | setRootIndex(QModelIndex()); | - | ||||||||||||||||||||||||
| 528 | if (d->selectionModel
| 0 | ||||||||||||||||||||||||
| 529 | d->selectionModel->reset(); never executed: d->selectionModel->reset(); | 0 | ||||||||||||||||||||||||
| 530 | - | |||||||||||||||||||||||||
| 531 | if (QAccessible::isActive()
| 0 | ||||||||||||||||||||||||
| 532 | QAccessibleTableModelChangeEvent accessibleEvent(this, QAccessibleTableModelChangeEvent::ModelReset); | - | ||||||||||||||||||||||||
| 533 | QAccessible::updateAccessibility(&accessibleEvent); | - | ||||||||||||||||||||||||
| 534 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 535 | - | |||||||||||||||||||||||||
| 536 | d->updateGeometry(); | - | ||||||||||||||||||||||||
| 537 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 538 | - | |||||||||||||||||||||||||
| 539 | - | |||||||||||||||||||||||||
| 540 | - | |||||||||||||||||||||||||
| 541 | - | |||||||||||||||||||||||||
| 542 | - | |||||||||||||||||||||||||
| 543 | - | |||||||||||||||||||||||||
| 544 | void QAbstractItemView::setRootIndex(const QModelIndex &index) | - | ||||||||||||||||||||||||
| 545 | { | - | ||||||||||||||||||||||||
| 546 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 547 | if (__builtin_expect(!!(index.isValid() && index.model() != d->model), false)
| 0 | ||||||||||||||||||||||||
| 548 | QMessageLogger(__FILE__, 1147, __PRETTY_FUNCTION__).warning("QAbstractItemView::setRootIndex failed : index must be from the currently set model"); | - | ||||||||||||||||||||||||
| 549 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 550 | } | - | ||||||||||||||||||||||||
| 551 | d->root = index; | - | ||||||||||||||||||||||||
| 552 | d->doDelayedItemsLayout(); | - | ||||||||||||||||||||||||
| 553 | d->updateGeometry(); | - | ||||||||||||||||||||||||
| 554 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 555 | - | |||||||||||||||||||||||||
| 556 | - | |||||||||||||||||||||||||
| 557 | - | |||||||||||||||||||||||||
| 558 | - | |||||||||||||||||||||||||
| 559 | - | |||||||||||||||||||||||||
| 560 | - | |||||||||||||||||||||||||
| 561 | - | |||||||||||||||||||||||||
| 562 | QModelIndex QAbstractItemView::rootIndex() const | - | ||||||||||||||||||||||||
| 563 | { | - | ||||||||||||||||||||||||
| 564 | return never executed: QModelIndex(d_func()->root);return QModelIndex(d_func()->root);never executed: return QModelIndex(d_func()->root); | 0 | ||||||||||||||||||||||||
| 565 | } | - | ||||||||||||||||||||||||
| 566 | void QAbstractItemView::selectAll() | - | ||||||||||||||||||||||||
| 567 | { | - | ||||||||||||||||||||||||
| 568 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 569 | SelectionMode mode = d->selectionMode; | - | ||||||||||||||||||||||||
| 570 | if (mode == MultiSelection
| 0 | ||||||||||||||||||||||||
| 571 | d->selectAll(QItemSelectionModel::ClearAndSelect never executed: d->selectAll(QItemSelectionModel::ClearAndSelect |d->selectionBehaviorFlags()); | 0 | ||||||||||||||||||||||||
| 572 | |d->selectionBehaviorFlags()); never executed: d->selectAll(QItemSelectionModel::ClearAndSelect |d->selectionBehaviorFlags()); | 0 | ||||||||||||||||||||||||
| 573 | else if (mode != SingleSelection
| 0 | ||||||||||||||||||||||||
| 574 | d->selectAll(selectionCommand(d->model->index(0, 0, d->root))); never executed: d->selectAll(selectionCommand(d->model->index(0, 0, d->root))); | 0 | ||||||||||||||||||||||||
| 575 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 576 | void QAbstractItemView::edit(const QModelIndex &index) | - | ||||||||||||||||||||||||
| 577 | { | - | ||||||||||||||||||||||||
| 578 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 579 | if (__builtin_expect(!!(!d->isIndexValid(index)), false)
| 0 | ||||||||||||||||||||||||
| 580 | QMessageLogger(__FILE__, 1200, __PRETTY_FUNCTION__).warning("edit: index was invalid"); never executed: QMessageLogger(__FILE__, 1200, __PRETTY_FUNCTION__).warning("edit: index was invalid"); | 0 | ||||||||||||||||||||||||
| 581 | if (__builtin_expect(!!(!edit(index, AllEditTriggers, 0)), false)
| 0 | ||||||||||||||||||||||||
| 582 | QMessageLogger(__FILE__, 1202, __PRETTY_FUNCTION__).warning("edit: editing failed"); never executed: QMessageLogger(__FILE__, 1202, __PRETTY_FUNCTION__).warning("edit: editing failed"); | 0 | ||||||||||||||||||||||||
| 583 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 584 | - | |||||||||||||||||||||||||
| 585 | - | |||||||||||||||||||||||||
| 586 | - | |||||||||||||||||||||||||
| 587 | - | |||||||||||||||||||||||||
| 588 | - | |||||||||||||||||||||||||
| 589 | - | |||||||||||||||||||||||||
| 590 | void QAbstractItemView::clearSelection() | - | ||||||||||||||||||||||||
| 591 | { | - | ||||||||||||||||||||||||
| 592 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 593 | if (d->selectionModel
| 0 | ||||||||||||||||||||||||
| 594 | d->selectionModel->clearSelection(); never executed: d->selectionModel->clearSelection(); | 0 | ||||||||||||||||||||||||
| 595 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 596 | - | |||||||||||||||||||||||||
| 597 | - | |||||||||||||||||||||||||
| 598 | - | |||||||||||||||||||||||||
| 599 | - | |||||||||||||||||||||||||
| 600 | - | |||||||||||||||||||||||||
| 601 | - | |||||||||||||||||||||||||
| 602 | - | |||||||||||||||||||||||||
| 603 | void QAbstractItemView::doItemsLayout() | - | ||||||||||||||||||||||||
| 604 | { | - | ||||||||||||||||||||||||
| 605 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 606 | d->interruptDelayedItemsLayout(); | - | ||||||||||||||||||||||||
| 607 | updateGeometries(); | - | ||||||||||||||||||||||||
| 608 | d->viewport->update(); | - | ||||||||||||||||||||||||
| 609 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 610 | void QAbstractItemView::setEditTriggers(EditTriggers actions) | - | ||||||||||||||||||||||||
| 611 | { | - | ||||||||||||||||||||||||
| 612 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 613 | d->editTriggers = actions; | - | ||||||||||||||||||||||||
| 614 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 615 | - | |||||||||||||||||||||||||
| 616 | QAbstractItemView::EditTriggers QAbstractItemView::editTriggers() const | - | ||||||||||||||||||||||||
| 617 | { | - | ||||||||||||||||||||||||
| 618 | const QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 619 | return never executed: d->editTriggers;return d->editTriggers;never executed: return d->editTriggers; | 0 | ||||||||||||||||||||||||
| 620 | } | - | ||||||||||||||||||||||||
| 621 | void QAbstractItemView::setVerticalScrollMode(ScrollMode mode) | - | ||||||||||||||||||||||||
| 622 | { | - | ||||||||||||||||||||||||
| 623 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 624 | d->verticalScrollModeSet = true; | - | ||||||||||||||||||||||||
| 625 | if (mode == d->verticalScrollMode
| 0 | ||||||||||||||||||||||||
| 626 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 627 | QModelIndex topLeft = indexAt(QPoint(0, 0)); | - | ||||||||||||||||||||||||
| 628 | d->verticalScrollMode = mode; | - | ||||||||||||||||||||||||
| 629 | if (mode == ScrollPerItem
| 0 | ||||||||||||||||||||||||
| 630 | verticalScrollBar()->d_func()->itemviewChangeSingleStep(1); never executed: verticalScrollBar()->d_func()->itemviewChangeSingleStep(1); | 0 | ||||||||||||||||||||||||
| 631 | else | - | ||||||||||||||||||||||||
| 632 | verticalScrollBar()->setSingleStep(-1); never executed: verticalScrollBar()->setSingleStep(-1); | 0 | ||||||||||||||||||||||||
| 633 | updateGeometries(); | - | ||||||||||||||||||||||||
| 634 | scrollTo(topLeft, QAbstractItemView::PositionAtTop); | - | ||||||||||||||||||||||||
| 635 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 636 | - | |||||||||||||||||||||||||
| 637 | QAbstractItemView::ScrollMode QAbstractItemView::verticalScrollMode() const | - | ||||||||||||||||||||||||
| 638 | { | - | ||||||||||||||||||||||||
| 639 | const QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 640 | return never executed: d->verticalScrollMode;return d->verticalScrollMode;never executed: return d->verticalScrollMode; | 0 | ||||||||||||||||||||||||
| 641 | } | - | ||||||||||||||||||||||||
| 642 | - | |||||||||||||||||||||||||
| 643 | void QAbstractItemView::resetVerticalScrollMode() | - | ||||||||||||||||||||||||
| 644 | { | - | ||||||||||||||||||||||||
| 645 | auto sm = static_cast<ScrollMode>(style()->styleHint(QStyle::SH_ItemView_ScrollMode, 0, this, 0)); | - | ||||||||||||||||||||||||
| 646 | setVerticalScrollMode(sm); | - | ||||||||||||||||||||||||
| 647 | d_func()->verticalScrollModeSet = false; | - | ||||||||||||||||||||||||
| 648 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 649 | void QAbstractItemView::setHorizontalScrollMode(ScrollMode mode) | - | ||||||||||||||||||||||||
| 650 | { | - | ||||||||||||||||||||||||
| 651 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 652 | d->horizontalScrollModeSet = true; | - | ||||||||||||||||||||||||
| 653 | if (mode == d->horizontalScrollMode
| 0 | ||||||||||||||||||||||||
| 654 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 655 | d->horizontalScrollMode = mode; | - | ||||||||||||||||||||||||
| 656 | if (mode == ScrollPerItem
| 0 | ||||||||||||||||||||||||
| 657 | horizontalScrollBar()->d_func()->itemviewChangeSingleStep(1); never executed: horizontalScrollBar()->d_func()->itemviewChangeSingleStep(1); | 0 | ||||||||||||||||||||||||
| 658 | else | - | ||||||||||||||||||||||||
| 659 | horizontalScrollBar()->setSingleStep(-1); never executed: horizontalScrollBar()->setSingleStep(-1); | 0 | ||||||||||||||||||||||||
| 660 | updateGeometries(); | - | ||||||||||||||||||||||||
| 661 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 662 | - | |||||||||||||||||||||||||
| 663 | QAbstractItemView::ScrollMode QAbstractItemView::horizontalScrollMode() const | - | ||||||||||||||||||||||||
| 664 | { | - | ||||||||||||||||||||||||
| 665 | const QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 666 | return never executed: d->horizontalScrollMode;return d->horizontalScrollMode;never executed: return d->horizontalScrollMode; | 0 | ||||||||||||||||||||||||
| 667 | } | - | ||||||||||||||||||||||||
| 668 | - | |||||||||||||||||||||||||
| 669 | void QAbstractItemView::resetHorizontalScrollMode() | - | ||||||||||||||||||||||||
| 670 | { | - | ||||||||||||||||||||||||
| 671 | auto sm = static_cast<ScrollMode>(style()->styleHint(QStyle::SH_ItemView_ScrollMode, 0, this, 0)); | - | ||||||||||||||||||||||||
| 672 | setHorizontalScrollMode(sm); | - | ||||||||||||||||||||||||
| 673 | d_func()->horizontalScrollModeSet = false; | - | ||||||||||||||||||||||||
| 674 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 675 | void QAbstractItemView::setDragDropOverwriteMode(bool overwrite) | - | ||||||||||||||||||||||||
| 676 | { | - | ||||||||||||||||||||||||
| 677 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 678 | d->overwrite = overwrite; | - | ||||||||||||||||||||||||
| 679 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 680 | - | |||||||||||||||||||||||||
| 681 | bool QAbstractItemView::dragDropOverwriteMode() const | - | ||||||||||||||||||||||||
| 682 | { | - | ||||||||||||||||||||||||
| 683 | const QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 684 | return never executed: d->overwrite;return d->overwrite;never executed: return d->overwrite; | 0 | ||||||||||||||||||||||||
| 685 | } | - | ||||||||||||||||||||||||
| 686 | void QAbstractItemView::setAutoScroll(bool enable) | - | ||||||||||||||||||||||||
| 687 | { | - | ||||||||||||||||||||||||
| 688 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 689 | d->autoScroll = enable; | - | ||||||||||||||||||||||||
| 690 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 691 | - | |||||||||||||||||||||||||
| 692 | bool QAbstractItemView::hasAutoScroll() const | - | ||||||||||||||||||||||||
| 693 | { | - | ||||||||||||||||||||||||
| 694 | const QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 695 | return never executed: d->autoScroll;return d->autoScroll;never executed: return d->autoScroll; | 0 | ||||||||||||||||||||||||
| 696 | } | - | ||||||||||||||||||||||||
| 697 | void QAbstractItemView::setAutoScrollMargin(int margin) | - | ||||||||||||||||||||||||
| 698 | { | - | ||||||||||||||||||||||||
| 699 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 700 | d->autoScrollMargin = margin; | - | ||||||||||||||||||||||||
| 701 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 702 | - | |||||||||||||||||||||||||
| 703 | int QAbstractItemView::autoScrollMargin() const | - | ||||||||||||||||||||||||
| 704 | { | - | ||||||||||||||||||||||||
| 705 | const QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 706 | return never executed: d->autoScrollMargin;return d->autoScrollMargin;never executed: return d->autoScrollMargin; | 0 | ||||||||||||||||||||||||
| 707 | } | - | ||||||||||||||||||||||||
| 708 | - | |||||||||||||||||||||||||
| 709 | - | |||||||||||||||||||||||||
| 710 | - | |||||||||||||||||||||||||
| 711 | - | |||||||||||||||||||||||||
| 712 | - | |||||||||||||||||||||||||
| 713 | - | |||||||||||||||||||||||||
| 714 | void QAbstractItemView::setTabKeyNavigation(bool enable) | - | ||||||||||||||||||||||||
| 715 | { | - | ||||||||||||||||||||||||
| 716 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 717 | d->tabKeyNavigation = enable; | - | ||||||||||||||||||||||||
| 718 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 719 | - | |||||||||||||||||||||||||
| 720 | bool QAbstractItemView::tabKeyNavigation() const | - | ||||||||||||||||||||||||
| 721 | { | - | ||||||||||||||||||||||||
| 722 | const QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 723 | return never executed: d->tabKeyNavigation;return d->tabKeyNavigation;never executed: return d->tabKeyNavigation; | 0 | ||||||||||||||||||||||||
| 724 | } | - | ||||||||||||||||||||||||
| 725 | - | |||||||||||||||||||||||||
| 726 | - | |||||||||||||||||||||||||
| 727 | - | |||||||||||||||||||||||||
| 728 | - | |||||||||||||||||||||||||
| 729 | - | |||||||||||||||||||||||||
| 730 | QSize QAbstractItemView::viewportSizeHint() const | - | ||||||||||||||||||||||||
| 731 | { | - | ||||||||||||||||||||||||
| 732 | return never executed: QAbstractScrollArea::viewportSizeHint();return QAbstractScrollArea::viewportSizeHint();never executed: return QAbstractScrollArea::viewportSizeHint(); | 0 | ||||||||||||||||||||||||
| 733 | } | - | ||||||||||||||||||||||||
| 734 | void QAbstractItemView::setDropIndicatorShown(bool enable) | - | ||||||||||||||||||||||||
| 735 | { | - | ||||||||||||||||||||||||
| 736 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 737 | d->showDropIndicator = enable; | - | ||||||||||||||||||||||||
| 738 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 739 | - | |||||||||||||||||||||||||
| 740 | bool QAbstractItemView::showDropIndicator() const | - | ||||||||||||||||||||||||
| 741 | { | - | ||||||||||||||||||||||||
| 742 | const QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 743 | return never executed: d->showDropIndicator;return d->showDropIndicator;never executed: return d->showDropIndicator; | 0 | ||||||||||||||||||||||||
| 744 | } | - | ||||||||||||||||||||||||
| 745 | void QAbstractItemView::setDragEnabled(bool enable) | - | ||||||||||||||||||||||||
| 746 | { | - | ||||||||||||||||||||||||
| 747 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 748 | d->dragEnabled = enable; | - | ||||||||||||||||||||||||
| 749 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 750 | - | |||||||||||||||||||||||||
| 751 | bool QAbstractItemView::dragEnabled() const | - | ||||||||||||||||||||||||
| 752 | { | - | ||||||||||||||||||||||||
| 753 | const QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 754 | return never executed: d->dragEnabled;return d->dragEnabled;never executed: return d->dragEnabled; | 0 | ||||||||||||||||||||||||
| 755 | } | - | ||||||||||||||||||||||||
| 756 | void QAbstractItemView::setDragDropMode(DragDropMode behavior) | - | ||||||||||||||||||||||||
| 757 | { | - | ||||||||||||||||||||||||
| 758 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 759 | d->dragDropMode = behavior; | - | ||||||||||||||||||||||||
| 760 | setDragEnabled(behavior == DragOnly || behavior == DragDrop || behavior == InternalMove); | - | ||||||||||||||||||||||||
| 761 | setAcceptDrops(behavior == DropOnly || behavior == DragDrop || behavior == InternalMove); | - | ||||||||||||||||||||||||
| 762 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 763 | - | |||||||||||||||||||||||||
| 764 | QAbstractItemView::DragDropMode QAbstractItemView::dragDropMode() const | - | ||||||||||||||||||||||||
| 765 | { | - | ||||||||||||||||||||||||
| 766 | const QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 767 | DragDropMode setBehavior = d->dragDropMode; | - | ||||||||||||||||||||||||
| 768 | if (!dragEnabled()
| 0 | ||||||||||||||||||||||||
| 769 | return never executed: NoDragDrop;return NoDragDrop;never executed: return NoDragDrop; | 0 | ||||||||||||||||||||||||
| 770 | - | |||||||||||||||||||||||||
| 771 | if (dragEnabled()
| 0 | ||||||||||||||||||||||||
| 772 | return never executed: DragOnly;return DragOnly;never executed: return DragOnly; | 0 | ||||||||||||||||||||||||
| 773 | - | |||||||||||||||||||||||||
| 774 | if (!dragEnabled()
| 0 | ||||||||||||||||||||||||
| 775 | return never executed: DropOnly;return DropOnly;never executed: return DropOnly; | 0 | ||||||||||||||||||||||||
| 776 | - | |||||||||||||||||||||||||
| 777 | if (dragEnabled()
| 0 | ||||||||||||||||||||||||
| 778 | if (setBehavior == InternalMove
| 0 | ||||||||||||||||||||||||
| 779 | return never executed: setBehavior;return setBehavior;never executed: return setBehavior; | 0 | ||||||||||||||||||||||||
| 780 | else | - | ||||||||||||||||||||||||
| 781 | return never executed: DragDrop;return DragDrop;never executed: return DragDrop; | 0 | ||||||||||||||||||||||||
| 782 | } | - | ||||||||||||||||||||||||
| 783 | - | |||||||||||||||||||||||||
| 784 | return never executed: NoDragDrop;return NoDragDrop;never executed: return NoDragDrop; | 0 | ||||||||||||||||||||||||
| 785 | } | - | ||||||||||||||||||||||||
| 786 | void QAbstractItemView::setDefaultDropAction(Qt::DropAction dropAction) | - | ||||||||||||||||||||||||
| 787 | { | - | ||||||||||||||||||||||||
| 788 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 789 | d->defaultDropAction = dropAction; | - | ||||||||||||||||||||||||
| 790 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 791 | - | |||||||||||||||||||||||||
| 792 | Qt::DropAction QAbstractItemView::defaultDropAction() const | - | ||||||||||||||||||||||||
| 793 | { | - | ||||||||||||||||||||||||
| 794 | const QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 795 | return never executed: d->defaultDropAction;return d->defaultDropAction;never executed: return d->defaultDropAction; | 0 | ||||||||||||||||||||||||
| 796 | } | - | ||||||||||||||||||||||||
| 797 | void QAbstractItemView::setAlternatingRowColors(bool enable) | - | ||||||||||||||||||||||||
| 798 | { | - | ||||||||||||||||||||||||
| 799 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 800 | d->alternatingColors = enable; | - | ||||||||||||||||||||||||
| 801 | if (isVisible()
| 0 | ||||||||||||||||||||||||
| 802 | d->viewport->update(); never executed: d->viewport->update(); | 0 | ||||||||||||||||||||||||
| 803 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 804 | - | |||||||||||||||||||||||||
| 805 | bool QAbstractItemView::alternatingRowColors() const | - | ||||||||||||||||||||||||
| 806 | { | - | ||||||||||||||||||||||||
| 807 | const QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 808 | return never executed: d->alternatingColors;return d->alternatingColors;never executed: return d->alternatingColors; | 0 | ||||||||||||||||||||||||
| 809 | } | - | ||||||||||||||||||||||||
| 810 | void QAbstractItemView::setIconSize(const QSize &size) | - | ||||||||||||||||||||||||
| 811 | { | - | ||||||||||||||||||||||||
| 812 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 813 | if (size == d->iconSize
| 0 | ||||||||||||||||||||||||
| 814 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 815 | d->iconSize = size; | - | ||||||||||||||||||||||||
| 816 | d->doDelayedItemsLayout(); | - | ||||||||||||||||||||||||
| 817 | iconSizeChanged(size); | - | ||||||||||||||||||||||||
| 818 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 819 | - | |||||||||||||||||||||||||
| 820 | QSize QAbstractItemView::iconSize() const | - | ||||||||||||||||||||||||
| 821 | { | - | ||||||||||||||||||||||||
| 822 | const QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 823 | return never executed: d->iconSize;return d->iconSize;never executed: return d->iconSize; | 0 | ||||||||||||||||||||||||
| 824 | } | - | ||||||||||||||||||||||||
| 825 | void QAbstractItemView::setTextElideMode(Qt::TextElideMode mode) | - | ||||||||||||||||||||||||
| 826 | { | - | ||||||||||||||||||||||||
| 827 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 828 | d->textElideMode = mode; | - | ||||||||||||||||||||||||
| 829 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 830 | - | |||||||||||||||||||||||||
| 831 | Qt::TextElideMode QAbstractItemView::textElideMode() const | - | ||||||||||||||||||||||||
| 832 | { | - | ||||||||||||||||||||||||
| 833 | return never executed: d_func()->textElideMode;return d_func()->textElideMode;never executed: return d_func()->textElideMode; | 0 | ||||||||||||||||||||||||
| 834 | } | - | ||||||||||||||||||||||||
| 835 | - | |||||||||||||||||||||||||
| 836 | - | |||||||||||||||||||||||||
| 837 | - | |||||||||||||||||||||||||
| 838 | - | |||||||||||||||||||||||||
| 839 | bool QAbstractItemView::focusNextPrevChild(bool next) | - | ||||||||||||||||||||||||
| 840 | { | - | ||||||||||||||||||||||||
| 841 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 842 | if (d->tabKeyNavigation
| 0 | ||||||||||||||||||||||||
| 843 | QKeyEvent event(QEvent::KeyPress, next ? Qt::Key_Tab : Qt::Key_Backtab, Qt::NoModifier); | - | ||||||||||||||||||||||||
| 844 | keyPressEvent(&event); | - | ||||||||||||||||||||||||
| 845 | if (event.isAccepted()
| 0 | ||||||||||||||||||||||||
| 846 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||
| 847 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 848 | return never executed: QAbstractScrollArea::focusNextPrevChild(next);return QAbstractScrollArea::focusNextPrevChild(next);never executed: return QAbstractScrollArea::focusNextPrevChild(next); | 0 | ||||||||||||||||||||||||
| 849 | } | - | ||||||||||||||||||||||||
| 850 | - | |||||||||||||||||||||||||
| 851 | - | |||||||||||||||||||||||||
| 852 | - | |||||||||||||||||||||||||
| 853 | - | |||||||||||||||||||||||||
| 854 | bool QAbstractItemView::event(QEvent *event) | - | ||||||||||||||||||||||||
| 855 | { | - | ||||||||||||||||||||||||
| 856 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 857 | switch (event->type()) { | - | ||||||||||||||||||||||||
| 858 | case never executed: QEvent::Paint:case QEvent::Paint:never executed: case QEvent::Paint: | 0 | ||||||||||||||||||||||||
| 859 | - | |||||||||||||||||||||||||
| 860 | - | |||||||||||||||||||||||||
| 861 | d->executePostedLayout(); | - | ||||||||||||||||||||||||
| 862 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 863 | case never executed: QEvent::Show:case QEvent::Show:never executed: case QEvent::Show: | 0 | ||||||||||||||||||||||||
| 864 | d->executePostedLayout(); | - | ||||||||||||||||||||||||
| 865 | if (d->shouldScrollToCurrentOnShow
| 0 | ||||||||||||||||||||||||
| 866 | d->shouldScrollToCurrentOnShow = false; | - | ||||||||||||||||||||||||
| 867 | const QModelIndex current = currentIndex(); | - | ||||||||||||||||||||||||
| 868 | if (current.isValid()
| 0 | ||||||||||||||||||||||||
| 869 | scrollTo(current); never executed: scrollTo(current); | 0 | ||||||||||||||||||||||||
| 870 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 871 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 872 | case never executed: QEvent::LocaleChange:case QEvent::LocaleChange:never executed: case QEvent::LocaleChange: | 0 | ||||||||||||||||||||||||
| 873 | viewport()->update(); | - | ||||||||||||||||||||||||
| 874 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 875 | case never executed: QEvent::LayoutDirectionChange:case QEvent::LayoutDirectionChange:never executed: case QEvent::LayoutDirectionChange: | 0 | ||||||||||||||||||||||||
| 876 | case never executed: QEvent::ApplicationLayoutDirectionChange:case QEvent::ApplicationLayoutDirectionChange:never executed: case QEvent::ApplicationLayoutDirectionChange: | 0 | ||||||||||||||||||||||||
| 877 | updateGeometries(); | - | ||||||||||||||||||||||||
| 878 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 879 | case never executed: QEvent::StyleChange:case QEvent::StyleChange:never executed: case QEvent::StyleChange: | 0 | ||||||||||||||||||||||||
| 880 | doItemsLayout(); | - | ||||||||||||||||||||||||
| 881 | if (!d->verticalScrollModeSet
| 0 | ||||||||||||||||||||||||
| 882 | resetVerticalScrollMode(); never executed: resetVerticalScrollMode(); | 0 | ||||||||||||||||||||||||
| 883 | if (!d->horizontalScrollModeSet
| 0 | ||||||||||||||||||||||||
| 884 | resetHorizontalScrollMode(); never executed: resetHorizontalScrollMode(); | 0 | ||||||||||||||||||||||||
| 885 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 886 | case never executed: QEvent::FocusOut:case QEvent::FocusOut:never executed: case QEvent::FocusOut: | 0 | ||||||||||||||||||||||||
| 887 | d->checkPersistentEditorFocus(); | - | ||||||||||||||||||||||||
| 888 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 889 | case never executed: QEvent::FontChange:case QEvent::FontChange:never executed: case QEvent::FontChange: | 0 | ||||||||||||||||||||||||
| 890 | d->doDelayedItemsLayout(); | - | ||||||||||||||||||||||||
| 891 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 892 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||
| 893 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 894 | } | - | ||||||||||||||||||||||||
| 895 | return never executed: QAbstractScrollArea::event(event);return QAbstractScrollArea::event(event);never executed: return QAbstractScrollArea::event(event); | 0 | ||||||||||||||||||||||||
| 896 | } | - | ||||||||||||||||||||||||
| 897 | bool QAbstractItemView::viewportEvent(QEvent *event) | - | ||||||||||||||||||||||||
| 898 | { | - | ||||||||||||||||||||||||
| 899 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 900 | switch (event->type()) { | - | ||||||||||||||||||||||||
| 901 | case never executed: QEvent::HoverMove:case QEvent::HoverMove:never executed: case QEvent::HoverMove: | 0 | ||||||||||||||||||||||||
| 902 | case never executed: QEvent::HoverEnter:case QEvent::HoverEnter:never executed: case QEvent::HoverEnter: | 0 | ||||||||||||||||||||||||
| 903 | d->setHoverIndex(indexAt(static_cast<QHoverEvent*>(event)->pos())); | - | ||||||||||||||||||||||||
| 904 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 905 | case never executed: QEvent::HoverLeave:case QEvent::HoverLeave:never executed: case QEvent::HoverLeave: | 0 | ||||||||||||||||||||||||
| 906 | d->setHoverIndex(QModelIndex()); | - | ||||||||||||||||||||||||
| 907 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 908 | case never executed: QEvent::Enter:case QEvent::Enter:never executed: case QEvent::Enter: | 0 | ||||||||||||||||||||||||
| 909 | d->viewportEnteredNeeded = true; | - | ||||||||||||||||||||||||
| 910 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 911 | case never executed: QEvent::Leave:case QEvent::Leave:never executed: case QEvent::Leave: | 0 | ||||||||||||||||||||||||
| 912 | - | |||||||||||||||||||||||||
| 913 | if (d->shouldClearStatusTip
| 0 | ||||||||||||||||||||||||
| 914 | QString empty; | - | ||||||||||||||||||||||||
| 915 | QStatusTipEvent tip(empty); | - | ||||||||||||||||||||||||
| 916 | QApplication::sendEvent(d->parent, &tip); | - | ||||||||||||||||||||||||
| 917 | d->shouldClearStatusTip = false; | - | ||||||||||||||||||||||||
| 918 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 919 | - | |||||||||||||||||||||||||
| 920 | d->enteredIndex = QModelIndex(); | - | ||||||||||||||||||||||||
| 921 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 922 | case never executed: QEvent::ToolTip:case QEvent::ToolTip:never executed: case QEvent::ToolTip: | 0 | ||||||||||||||||||||||||
| 923 | case never executed: QEvent::QueryWhatsThis:case QEvent::QueryWhatsThis:never executed: case QEvent::QueryWhatsThis: | 0 | ||||||||||||||||||||||||
| 924 | case never executed: QEvent::WhatsThis:case QEvent::WhatsThis:never executed: {case QEvent::WhatsThis: | 0 | ||||||||||||||||||||||||
| 925 | QHelpEvent *he = static_cast<QHelpEvent*>(event); | - | ||||||||||||||||||||||||
| 926 | const QModelIndex index = indexAt(he->pos()); | - | ||||||||||||||||||||||||
| 927 | QStyleOptionViewItem option = d->viewOptionsV1(); | - | ||||||||||||||||||||||||
| 928 | option.rect = visualRect(index); | - | ||||||||||||||||||||||||
| 929 | option.state |= (index == currentIndex()
| 0 | ||||||||||||||||||||||||
| 930 | - | |||||||||||||||||||||||||
| 931 | QAbstractItemDelegate *delegate = d->delegateForIndex(index); | - | ||||||||||||||||||||||||
| 932 | if (!delegate
| 0 | ||||||||||||||||||||||||
| 933 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 934 | return never executed: delegate->helpEvent(he, this, option, index);return delegate->helpEvent(he, this, option, index);never executed: return delegate->helpEvent(he, this, option, index); | 0 | ||||||||||||||||||||||||
| 935 | } | - | ||||||||||||||||||||||||
| 936 | case never executed: QEvent::FontChange:case QEvent::FontChange:never executed: case QEvent::FontChange: | 0 | ||||||||||||||||||||||||
| 937 | d->doDelayedItemsLayout(); | - | ||||||||||||||||||||||||
| 938 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 939 | case never executed: QEvent::WindowActivate:case QEvent::WindowActivate:never executed: case QEvent::WindowActivate: | 0 | ||||||||||||||||||||||||
| 940 | case never executed: QEvent::WindowDeactivate:case QEvent::WindowDeactivate:never executed: case QEvent::WindowDeactivate: | 0 | ||||||||||||||||||||||||
| 941 | d->viewport->update(); | - | ||||||||||||||||||||||||
| 942 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 943 | case never executed: QEvent::ScrollPrepare:case QEvent::ScrollPrepare:never executed: case QEvent::ScrollPrepare: | 0 | ||||||||||||||||||||||||
| 944 | executeDelayedItemsLayout(); | - | ||||||||||||||||||||||||
| 945 | - | |||||||||||||||||||||||||
| 946 | connect(QScroller::scroller(d->viewport), qFlagLocation("2""stateChanged(QScroller::State)" "\0" __FILE__ ":" "1740"), this, qFlagLocation("1""_q_scrollerStateChanged()" "\0" __FILE__ ":" "1740"), Qt::UniqueConnection); | - | ||||||||||||||||||||||||
| 947 | - | |||||||||||||||||||||||||
| 948 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 949 | - | |||||||||||||||||||||||||
| 950 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||
| 951 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 952 | } | - | ||||||||||||||||||||||||
| 953 | return never executed: QAbstractScrollArea::viewportEvent(event);return QAbstractScrollArea::viewportEvent(event);never executed: return QAbstractScrollArea::viewportEvent(event); | 0 | ||||||||||||||||||||||||
| 954 | } | - | ||||||||||||||||||||||||
| 955 | - | |||||||||||||||||||||||||
| 956 | - | |||||||||||||||||||||||||
| 957 | - | |||||||||||||||||||||||||
| 958 | - | |||||||||||||||||||||||||
| 959 | - | |||||||||||||||||||||||||
| 960 | - | |||||||||||||||||||||||||
| 961 | void QAbstractItemView::mousePressEvent(QMouseEvent *event) | - | ||||||||||||||||||||||||
| 962 | { | - | ||||||||||||||||||||||||
| 963 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 964 | d->delayedAutoScroll.stop(); | - | ||||||||||||||||||||||||
| 965 | QPoint pos = event->pos(); | - | ||||||||||||||||||||||||
| 966 | QPersistentModelIndex index = indexAt(pos); | - | ||||||||||||||||||||||||
| 967 | - | |||||||||||||||||||||||||
| 968 | if (!d->selectionModel
| 0 | ||||||||||||||||||||||||
| 969 | || (d->state == EditingState
| 0 | ||||||||||||||||||||||||
| 970 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 971 | - | |||||||||||||||||||||||||
| 972 | d->pressedAlreadySelected = d->selectionModel->isSelected(index); | - | ||||||||||||||||||||||||
| 973 | d->pressedIndex = index; | - | ||||||||||||||||||||||||
| 974 | d->pressedModifiers = event->modifiers(); | - | ||||||||||||||||||||||||
| 975 | QItemSelectionModel::SelectionFlags command = selectionCommand(index, event); | - | ||||||||||||||||||||||||
| 976 | d->noSelectionOnMousePress = command == QItemSelectionModel::NoUpdate
| 0 | ||||||||||||||||||||||||
| 977 | QPoint offset = d->offset(); | - | ||||||||||||||||||||||||
| 978 | if ((
| 0 | ||||||||||||||||||||||||
| 979 | d->pressedPosition = pos + offset; | - | ||||||||||||||||||||||||
| 980 | d->currentSelectionStartIndex = index; | - | ||||||||||||||||||||||||
| 981 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 982 | else if (!d->currentSelectionStartIndex.isValid()
| 0 | ||||||||||||||||||||||||
| 983 | d->currentSelectionStartIndex = currentIndex(); never executed: d->currentSelectionStartIndex = currentIndex(); | 0 | ||||||||||||||||||||||||
| 984 | - | |||||||||||||||||||||||||
| 985 | if (edit(index, NoEditTriggers, event)
| 0 | ||||||||||||||||||||||||
| 986 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 987 | - | |||||||||||||||||||||||||
| 988 | if (index.isValid()
| 0 | ||||||||||||||||||||||||
| 989 | - | |||||||||||||||||||||||||
| 990 | - | |||||||||||||||||||||||||
| 991 | bool autoScroll = d->autoScroll; | - | ||||||||||||||||||||||||
| 992 | d->autoScroll = false; | - | ||||||||||||||||||||||||
| 993 | d->selectionModel->setCurrentIndex(index, QItemSelectionModel::NoUpdate); | - | ||||||||||||||||||||||||
| 994 | d->autoScroll = autoScroll; | - | ||||||||||||||||||||||||
| 995 | if (command.testFlag(QItemSelectionModel::Toggle)
| 0 | ||||||||||||||||||||||||
| 996 | command &= ~QItemSelectionModel::Toggle; | - | ||||||||||||||||||||||||
| 997 | d->ctrlDragSelectionFlag = d->selectionModel->isSelected(index)
| 0 | ||||||||||||||||||||||||
| 998 | command |= d->ctrlDragSelectionFlag; | - | ||||||||||||||||||||||||
| 999 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1000 | - | |||||||||||||||||||||||||
| 1001 | if ((
| 0 | ||||||||||||||||||||||||
| 1002 | setSelection(QRect(pos, QSize(1, 1)), command); | - | ||||||||||||||||||||||||
| 1003 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 1004 | QRect rect(visualRect(d->currentSelectionStartIndex).center(), pos); | - | ||||||||||||||||||||||||
| 1005 | setSelection(rect, command); | - | ||||||||||||||||||||||||
| 1006 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1007 | - | |||||||||||||||||||||||||
| 1008 | - | |||||||||||||||||||||||||
| 1009 | pressed(index); | - | ||||||||||||||||||||||||
| 1010 | if (d->autoScroll
| 0 | ||||||||||||||||||||||||
| 1011 | - | |||||||||||||||||||||||||
| 1012 | - | |||||||||||||||||||||||||
| 1013 | d->delayedAutoScroll.start(QApplication::doubleClickInterval()+100, this); | - | ||||||||||||||||||||||||
| 1014 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1015 | - | |||||||||||||||||||||||||
| 1016 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 1017 | - | |||||||||||||||||||||||||
| 1018 | d->selectionModel->select(QModelIndex(), QItemSelectionModel::Select); | - | ||||||||||||||||||||||||
| 1019 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1020 | } | - | ||||||||||||||||||||||||
| 1021 | - | |||||||||||||||||||||||||
| 1022 | - | |||||||||||||||||||||||||
| 1023 | - | |||||||||||||||||||||||||
| 1024 | - | |||||||||||||||||||||||||
| 1025 | - | |||||||||||||||||||||||||
| 1026 | - | |||||||||||||||||||||||||
| 1027 | void QAbstractItemView::mouseMoveEvent(QMouseEvent *event) | - | ||||||||||||||||||||||||
| 1028 | { | - | ||||||||||||||||||||||||
| 1029 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1030 | QPoint topLeft; | - | ||||||||||||||||||||||||
| 1031 | QPoint bottomRight = event->pos(); | - | ||||||||||||||||||||||||
| 1032 | - | |||||||||||||||||||||||||
| 1033 | if (state() == ExpandingState
| 0 | ||||||||||||||||||||||||
| 1034 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1035 | - | |||||||||||||||||||||||||
| 1036 | - | |||||||||||||||||||||||||
| 1037 | if (state() == DraggingState
| 0 | ||||||||||||||||||||||||
| 1038 | topLeft = d->pressedPosition - d->offset(); | - | ||||||||||||||||||||||||
| 1039 | if ((
| 0 | ||||||||||||||||||||||||
| 1040 | d->pressedIndex = QModelIndex(); | - | ||||||||||||||||||||||||
| 1041 | startDrag(d->model->supportedDragActions()); | - | ||||||||||||||||||||||||
| 1042 | setState(NoState); | - | ||||||||||||||||||||||||
| 1043 | stopAutoScroll(); | - | ||||||||||||||||||||||||
| 1044 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1045 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1046 | } | - | ||||||||||||||||||||||||
| 1047 | - | |||||||||||||||||||||||||
| 1048 | - | |||||||||||||||||||||||||
| 1049 | QPersistentModelIndex index = indexAt(bottomRight); | - | ||||||||||||||||||||||||
| 1050 | QModelIndex buddy = d->model->buddy(d->pressedIndex); | - | ||||||||||||||||||||||||
| 1051 | if ((state() == EditingState
| 0 | ||||||||||||||||||||||||
| 1052 | || edit(index, NoEditTriggers, event)
| 0 | ||||||||||||||||||||||||
| 1053 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1054 | - | |||||||||||||||||||||||||
| 1055 | if (d->selectionMode != SingleSelection
| 0 | ||||||||||||||||||||||||
| 1056 | topLeft = d->pressedPosition - d->offset(); never executed: topLeft = d->pressedPosition - d->offset(); | 0 | ||||||||||||||||||||||||
| 1057 | else | - | ||||||||||||||||||||||||
| 1058 | topLeft = bottomRight; never executed: topLeft = bottomRight; | 0 | ||||||||||||||||||||||||
| 1059 | - | |||||||||||||||||||||||||
| 1060 | d->checkMouseMove(index); | - | ||||||||||||||||||||||||
| 1061 | - | |||||||||||||||||||||||||
| 1062 | - | |||||||||||||||||||||||||
| 1063 | if (d->pressedIndex.isValid()
| 0 | ||||||||||||||||||||||||
| 1064 | && d->dragEnabled
| 0 | ||||||||||||||||||||||||
| 1065 | && (
| 0 | ||||||||||||||||||||||||
| 1066 | && (
| 0 | ||||||||||||||||||||||||
| 1067 | && !d->selectedDraggableIndexes().isEmpty()
| 0 | ||||||||||||||||||||||||
| 1068 | setState(DraggingState); | - | ||||||||||||||||||||||||
| 1069 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1070 | } | - | ||||||||||||||||||||||||
| 1071 | - | |||||||||||||||||||||||||
| 1072 | - | |||||||||||||||||||||||||
| 1073 | if ((
| 0 | ||||||||||||||||||||||||
| 1074 | setState(DragSelectingState); | - | ||||||||||||||||||||||||
| 1075 | QItemSelectionModel::SelectionFlags command = selectionCommand(index, event); | - | ||||||||||||||||||||||||
| 1076 | if (d->ctrlDragSelectionFlag != QItemSelectionModel::NoUpdate
| 0 | ||||||||||||||||||||||||
| 1077 | command &= ~QItemSelectionModel::Toggle; | - | ||||||||||||||||||||||||
| 1078 | command |= d->ctrlDragSelectionFlag; | - | ||||||||||||||||||||||||
| 1079 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1080 | - | |||||||||||||||||||||||||
| 1081 | - | |||||||||||||||||||||||||
| 1082 | QRect selectionRect = QRect(topLeft, bottomRight); | - | ||||||||||||||||||||||||
| 1083 | setSelection(selectionRect, command); | - | ||||||||||||||||||||||||
| 1084 | - | |||||||||||||||||||||||||
| 1085 | - | |||||||||||||||||||||||||
| 1086 | if (index.isValid()
| 0 | ||||||||||||||||||||||||
| 1087 | && (
| 0 | ||||||||||||||||||||||||
| 1088 | && d->isIndexEnabled(index)
| 0 | ||||||||||||||||||||||||
| 1089 | d->selectionModel->setCurrentIndex(index, QItemSelectionModel::NoUpdate); never executed: d->selectionModel->setCurrentIndex(index, QItemSelectionModel::NoUpdate); | 0 | ||||||||||||||||||||||||
| 1090 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1091 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1092 | void QAbstractItemView::mouseReleaseEvent(QMouseEvent *event) | - | ||||||||||||||||||||||||
| 1093 | { | - | ||||||||||||||||||||||||
| 1094 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1095 | - | |||||||||||||||||||||||||
| 1096 | QPoint pos = event->pos(); | - | ||||||||||||||||||||||||
| 1097 | QPersistentModelIndex index = indexAt(pos); | - | ||||||||||||||||||||||||
| 1098 | - | |||||||||||||||||||||||||
| 1099 | if (state() == EditingState
| 0 | ||||||||||||||||||||||||
| 1100 | if (d->isIndexValid(index)
| 0 | ||||||||||||||||||||||||
| 1101 | && d->isIndexEnabled(index)
| 0 | ||||||||||||||||||||||||
| 1102 | && d->sendDelegateEvent(index, event)
| 0 | ||||||||||||||||||||||||
| 1103 | update(index); never executed: update(index); | 0 | ||||||||||||||||||||||||
| 1104 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1105 | } | - | ||||||||||||||||||||||||
| 1106 | - | |||||||||||||||||||||||||
| 1107 | bool click = (index == d->pressedIndex
| 0 | ||||||||||||||||||||||||
| 1108 | bool selectedClicked = click
| 0 | ||||||||||||||||||||||||
| 1109 | EditTrigger trigger = (selectedClicked
| 0 | ||||||||||||||||||||||||
| 1110 | bool edited = edit(index, trigger, event); | - | ||||||||||||||||||||||||
| 1111 | - | |||||||||||||||||||||||||
| 1112 | d->ctrlDragSelectionFlag = QItemSelectionModel::NoUpdate; | - | ||||||||||||||||||||||||
| 1113 | - | |||||||||||||||||||||||||
| 1114 | if (d->selectionModel
| 0 | ||||||||||||||||||||||||
| 1115 | d->noSelectionOnMousePress = false; | - | ||||||||||||||||||||||||
| 1116 | d->selectionModel->select(index, selectionCommand(index, event)); | - | ||||||||||||||||||||||||
| 1117 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1118 | - | |||||||||||||||||||||||||
| 1119 | setState(NoState); | - | ||||||||||||||||||||||||
| 1120 | - | |||||||||||||||||||||||||
| 1121 | if (click
| 0 | ||||||||||||||||||||||||
| 1122 | if (event->button() == Qt::LeftButton
| 0 | ||||||||||||||||||||||||
| 1123 | clicked(index); never executed: clicked(index); | 0 | ||||||||||||||||||||||||
| 1124 | if (edited
| 0 | ||||||||||||||||||||||||
| 1125 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1126 | QStyleOptionViewItem option = d->viewOptionsV1(); | - | ||||||||||||||||||||||||
| 1127 | if (d->pressedAlreadySelected
| 0 | ||||||||||||||||||||||||
| 1128 | option.state |= QStyle::State_Selected; never executed: option.state |= QStyle::State_Selected; | 0 | ||||||||||||||||||||||||
| 1129 | if ((
| 0 | ||||||||||||||||||||||||
| 1130 | && style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, &option, this)
| 0 | ||||||||||||||||||||||||
| 1131 | activated(index); never executed: activated(index); | 0 | ||||||||||||||||||||||||
| 1132 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1133 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1134 | - | |||||||||||||||||||||||||
| 1135 | - | |||||||||||||||||||||||||
| 1136 | - | |||||||||||||||||||||||||
| 1137 | - | |||||||||||||||||||||||||
| 1138 | - | |||||||||||||||||||||||||
| 1139 | - | |||||||||||||||||||||||||
| 1140 | void QAbstractItemView::mouseDoubleClickEvent(QMouseEvent *event) | - | ||||||||||||||||||||||||
| 1141 | { | - | ||||||||||||||||||||||||
| 1142 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1143 | - | |||||||||||||||||||||||||
| 1144 | QModelIndex index = indexAt(event->pos()); | - | ||||||||||||||||||||||||
| 1145 | if (!index.isValid()
| 0 | ||||||||||||||||||||||||
| 1146 | || !d->isIndexEnabled(index)
| 0 | ||||||||||||||||||||||||
| 1147 | || (
| 0 | ||||||||||||||||||||||||
| 1148 | QMouseEvent me(QEvent::MouseButtonPress, | - | ||||||||||||||||||||||||
| 1149 | event->localPos(), event->windowPos(), event->screenPos(), | - | ||||||||||||||||||||||||
| 1150 | event->button(), event->buttons(), event->modifiers(), event->source()); | - | ||||||||||||||||||||||||
| 1151 | mousePressEvent(&me); | - | ||||||||||||||||||||||||
| 1152 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1153 | } | - | ||||||||||||||||||||||||
| 1154 | - | |||||||||||||||||||||||||
| 1155 | QPersistentModelIndex persistent = index; | - | ||||||||||||||||||||||||
| 1156 | doubleClicked(persistent); | - | ||||||||||||||||||||||||
| 1157 | if ((
| 0 | ||||||||||||||||||||||||
| 1158 | && !style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, 0, this)
| 0 | ||||||||||||||||||||||||
| 1159 | activated(persistent); never executed: activated(persistent); | 0 | ||||||||||||||||||||||||
| 1160 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1161 | void QAbstractItemView::dragEnterEvent(QDragEnterEvent *event) | - | ||||||||||||||||||||||||
| 1162 | { | - | ||||||||||||||||||||||||
| 1163 | if (dragDropMode() == InternalMove
| 0 | ||||||||||||||||||||||||
| 1164 | && (event->source() != this
| 0 | ||||||||||||||||||||||||
| 1165 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1166 | - | |||||||||||||||||||||||||
| 1167 | if (d_func()->canDrop(event)
| 0 | ||||||||||||||||||||||||
| 1168 | event->accept(); | - | ||||||||||||||||||||||||
| 1169 | setState(DraggingState); | - | ||||||||||||||||||||||||
| 1170 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 1171 | event->ignore(); | - | ||||||||||||||||||||||||
| 1172 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1173 | } | - | ||||||||||||||||||||||||
| 1174 | void QAbstractItemView::dragMoveEvent(QDragMoveEvent *event) | - | ||||||||||||||||||||||||
| 1175 | { | - | ||||||||||||||||||||||||
| 1176 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1177 | if (dragDropMode() == InternalMove
| 0 | ||||||||||||||||||||||||
| 1178 | && (event->source() != this
| 0 | ||||||||||||||||||||||||
| 1179 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1180 | - | |||||||||||||||||||||||||
| 1181 | - | |||||||||||||||||||||||||
| 1182 | event->ignore(); | - | ||||||||||||||||||||||||
| 1183 | - | |||||||||||||||||||||||||
| 1184 | QModelIndex index = indexAt(event->pos()); | - | ||||||||||||||||||||||||
| 1185 | d->hover = index; | - | ||||||||||||||||||||||||
| 1186 | if (!d->droppingOnItself(event, index)
| 0 | ||||||||||||||||||||||||
| 1187 | && d->canDrop(event)
| 0 | ||||||||||||||||||||||||
| 1188 | - | |||||||||||||||||||||||||
| 1189 | if (index.isValid()
| 0 | ||||||||||||||||||||||||
| 1190 | QRect rect = visualRect(index); | - | ||||||||||||||||||||||||
| 1191 | d->dropIndicatorPosition = d->position(event->pos(), rect, index); | - | ||||||||||||||||||||||||
| 1192 | switch (d->dropIndicatorPosition) { | - | ||||||||||||||||||||||||
| 1193 | case never executed: AboveItem:case AboveItem:never executed: case AboveItem: | 0 | ||||||||||||||||||||||||
| 1194 | if (d->isIndexDropEnabled(index.parent())
| 0 | ||||||||||||||||||||||||
| 1195 | d->dropIndicatorRect = QRect(rect.left(), rect.top(), rect.width(), 0); | - | ||||||||||||||||||||||||
| 1196 | event->acceptProposedAction(); | - | ||||||||||||||||||||||||
| 1197 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 1198 | d->dropIndicatorRect = QRect(); | - | ||||||||||||||||||||||||
| 1199 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1200 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1201 | case never executed: BelowItem:case BelowItem:never executed: case BelowItem: | 0 | ||||||||||||||||||||||||
| 1202 | if (d->isIndexDropEnabled(index.parent())
| 0 | ||||||||||||||||||||||||
| 1203 | d->dropIndicatorRect = QRect(rect.left(), rect.bottom(), rect.width(), 0); | - | ||||||||||||||||||||||||
| 1204 | event->acceptProposedAction(); | - | ||||||||||||||||||||||||
| 1205 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 1206 | d->dropIndicatorRect = QRect(); | - | ||||||||||||||||||||||||
| 1207 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1208 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1209 | case never executed: OnItem:case OnItem:never executed: case OnItem: | 0 | ||||||||||||||||||||||||
| 1210 | if (d->isIndexDropEnabled(index)
| 0 | ||||||||||||||||||||||||
| 1211 | d->dropIndicatorRect = rect; | - | ||||||||||||||||||||||||
| 1212 | event->acceptProposedAction(); | - | ||||||||||||||||||||||||
| 1213 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 1214 | d->dropIndicatorRect = QRect(); | - | ||||||||||||||||||||||||
| 1215 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1216 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1217 | case never executed: OnViewport:case OnViewport:never executed: case OnViewport: | 0 | ||||||||||||||||||||||||
| 1218 | d->dropIndicatorRect = QRect(); | - | ||||||||||||||||||||||||
| 1219 | if (d->isIndexDropEnabled(rootIndex())
| 0 | ||||||||||||||||||||||||
| 1220 | event->acceptProposedAction(); | - | ||||||||||||||||||||||||
| 1221 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1222 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1223 | } | - | ||||||||||||||||||||||||
| 1224 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 1225 | d->dropIndicatorRect = QRect(); | - | ||||||||||||||||||||||||
| 1226 | d->dropIndicatorPosition = OnViewport; | - | ||||||||||||||||||||||||
| 1227 | if (d->isIndexDropEnabled(rootIndex())
| 0 | ||||||||||||||||||||||||
| 1228 | event->acceptProposedAction(); | - | ||||||||||||||||||||||||
| 1229 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1230 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1231 | d->viewport->update(); | - | ||||||||||||||||||||||||
| 1232 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1233 | - | |||||||||||||||||||||||||
| 1234 | if (d->shouldAutoScroll(event->pos())
| 0 | ||||||||||||||||||||||||
| 1235 | startAutoScroll(); never executed: startAutoScroll(); | 0 | ||||||||||||||||||||||||
| 1236 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1237 | - | |||||||||||||||||||||||||
| 1238 | - | |||||||||||||||||||||||||
| 1239 | - | |||||||||||||||||||||||||
| 1240 | - | |||||||||||||||||||||||||
| 1241 | - | |||||||||||||||||||||||||
| 1242 | - | |||||||||||||||||||||||||
| 1243 | bool QAbstractItemViewPrivate::droppingOnItself(QDropEvent *event, const QModelIndex &index) | - | ||||||||||||||||||||||||
| 1244 | { | - | ||||||||||||||||||||||||
| 1245 | QAbstractItemView * const q = q_func(); | - | ||||||||||||||||||||||||
| 1246 | Qt::DropAction dropAction = event->dropAction(); | - | ||||||||||||||||||||||||
| 1247 | if (q->dragDropMode() == QAbstractItemView::InternalMove
| 0 | ||||||||||||||||||||||||
| 1248 | dropAction = Qt::MoveAction; never executed: dropAction = Qt::MoveAction; | 0 | ||||||||||||||||||||||||
| 1249 | if (event->source() == q
| 0 | ||||||||||||||||||||||||
| 1250 | && event->possibleActions() & Qt::MoveAction
| 0 | ||||||||||||||||||||||||
| 1251 | && dropAction == Qt::MoveAction
| 0 | ||||||||||||||||||||||||
| 1252 | QModelIndexList selectedIndexes = q->selectedIndexes(); | - | ||||||||||||||||||||||||
| 1253 | QModelIndex child = index; | - | ||||||||||||||||||||||||
| 1254 | while (child.isValid()
| 0 | ||||||||||||||||||||||||
| 1255 | if (selectedIndexes.contains(child)
| 0 | ||||||||||||||||||||||||
| 1256 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||
| 1257 | child = child.parent(); | - | ||||||||||||||||||||||||
| 1258 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1259 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1260 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 1261 | } | - | ||||||||||||||||||||||||
| 1262 | - | |||||||||||||||||||||||||
| 1263 | - | |||||||||||||||||||||||||
| 1264 | - | |||||||||||||||||||||||||
| 1265 | - | |||||||||||||||||||||||||
| 1266 | - | |||||||||||||||||||||||||
| 1267 | - | |||||||||||||||||||||||||
| 1268 | - | |||||||||||||||||||||||||
| 1269 | void QAbstractItemView::dragLeaveEvent(QDragLeaveEvent *) | - | ||||||||||||||||||||||||
| 1270 | { | - | ||||||||||||||||||||||||
| 1271 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1272 | stopAutoScroll(); | - | ||||||||||||||||||||||||
| 1273 | setState(NoState); | - | ||||||||||||||||||||||||
| 1274 | d->hover = QModelIndex(); | - | ||||||||||||||||||||||||
| 1275 | d->viewport->update(); | - | ||||||||||||||||||||||||
| 1276 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1277 | void QAbstractItemView::dropEvent(QDropEvent *event) | - | ||||||||||||||||||||||||
| 1278 | { | - | ||||||||||||||||||||||||
| 1279 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1280 | if (dragDropMode() == InternalMove
| 0 | ||||||||||||||||||||||||
| 1281 | if (event->source() != this
| 0 | ||||||||||||||||||||||||
| 1282 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1283 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1284 | - | |||||||||||||||||||||||||
| 1285 | QModelIndex index; | - | ||||||||||||||||||||||||
| 1286 | int col = -1; | - | ||||||||||||||||||||||||
| 1287 | int row = -1; | - | ||||||||||||||||||||||||
| 1288 | if (d->dropOn(event, &row, &col, &index)
| 0 | ||||||||||||||||||||||||
| 1289 | const Qt::DropAction action = dragDropMode() == InternalMove
| 0 | ||||||||||||||||||||||||
| 1290 | if (d->model->dropMimeData(event->mimeData(), action, row, col, index)
| 0 | ||||||||||||||||||||||||
| 1291 | if (action != event->dropAction()
| 0 | ||||||||||||||||||||||||
| 1292 | event->setDropAction(action); | - | ||||||||||||||||||||||||
| 1293 | event->accept(); | - | ||||||||||||||||||||||||
| 1294 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 1295 | event->acceptProposedAction(); | - | ||||||||||||||||||||||||
| 1296 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1297 | } | - | ||||||||||||||||||||||||
| 1298 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1299 | stopAutoScroll(); | - | ||||||||||||||||||||||||
| 1300 | setState(NoState); | - | ||||||||||||||||||||||||
| 1301 | d->viewport->update(); | - | ||||||||||||||||||||||||
| 1302 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1303 | bool QAbstractItemViewPrivate::dropOn(QDropEvent *event, int *dropRow, int *dropCol, QModelIndex *dropIndex) | - | ||||||||||||||||||||||||
| 1304 | { | - | ||||||||||||||||||||||||
| 1305 | QAbstractItemView * const q = q_func(); | - | ||||||||||||||||||||||||
| 1306 | if (event->isAccepted()
| 0 | ||||||||||||||||||||||||
| 1307 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 1308 | - | |||||||||||||||||||||||||
| 1309 | QModelIndex index; | - | ||||||||||||||||||||||||
| 1310 | - | |||||||||||||||||||||||||
| 1311 | if (viewport->rect().contains(event->pos())
| 0 | ||||||||||||||||||||||||
| 1312 | index = q->indexAt(event->pos()); | - | ||||||||||||||||||||||||
| 1313 | if (!index.isValid()
| 0 | ||||||||||||||||||||||||
| 1314 | index = root; never executed: index = root; | 0 | ||||||||||||||||||||||||
| 1315 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1316 | - | |||||||||||||||||||||||||
| 1317 | - | |||||||||||||||||||||||||
| 1318 | if (model->supportedDropActions() & event->dropAction()
| 0 | ||||||||||||||||||||||||
| 1319 | int row = -1; | - | ||||||||||||||||||||||||
| 1320 | int col = -1; | - | ||||||||||||||||||||||||
| 1321 | if (index != root
| 0 | ||||||||||||||||||||||||
| 1322 | dropIndicatorPosition = position(event->pos(), q->visualRect(index), index); | - | ||||||||||||||||||||||||
| 1323 | switch (dropIndicatorPosition) { | - | ||||||||||||||||||||||||
| 1324 | case never executed: QAbstractItemView::AboveItem:case QAbstractItemView::AboveItem:never executed: case QAbstractItemView::AboveItem: | 0 | ||||||||||||||||||||||||
| 1325 | row = index.row(); | - | ||||||||||||||||||||||||
| 1326 | col = index.column(); | - | ||||||||||||||||||||||||
| 1327 | index = index.parent(); | - | ||||||||||||||||||||||||
| 1328 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1329 | case never executed: QAbstractItemView::BelowItem:case QAbstractItemView::BelowItem:never executed: case QAbstractItemView::BelowItem: | 0 | ||||||||||||||||||||||||
| 1330 | row = index.row() + 1; | - | ||||||||||||||||||||||||
| 1331 | col = index.column(); | - | ||||||||||||||||||||||||
| 1332 | index = index.parent(); | - | ||||||||||||||||||||||||
| 1333 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1334 | case never executed: QAbstractItemView::OnItem:case QAbstractItemView::OnItem:never executed: case QAbstractItemView::OnItem: | 0 | ||||||||||||||||||||||||
| 1335 | case never executed: QAbstractItemView::OnViewport:case QAbstractItemView::OnViewport:never executed: case QAbstractItemView::OnViewport: | 0 | ||||||||||||||||||||||||
| 1336 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1337 | } | - | ||||||||||||||||||||||||
| 1338 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 1339 | dropIndicatorPosition = QAbstractItemView::OnViewport; | - | ||||||||||||||||||||||||
| 1340 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1341 | *dropIndex = index; | - | ||||||||||||||||||||||||
| 1342 | *dropRow = row; | - | ||||||||||||||||||||||||
| 1343 | *dropCol = col; | - | ||||||||||||||||||||||||
| 1344 | if (!droppingOnItself(event, index)
| 0 | ||||||||||||||||||||||||
| 1345 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||
| 1346 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1347 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 1348 | } | - | ||||||||||||||||||||||||
| 1349 | - | |||||||||||||||||||||||||
| 1350 | QAbstractItemView::DropIndicatorPosition | - | ||||||||||||||||||||||||
| 1351 | QAbstractItemViewPrivate::position(const QPoint &pos, const QRect &rect, const QModelIndex &index) const | - | ||||||||||||||||||||||||
| 1352 | { | - | ||||||||||||||||||||||||
| 1353 | QAbstractItemView::DropIndicatorPosition r = QAbstractItemView::OnViewport; | - | ||||||||||||||||||||||||
| 1354 | if (!overwrite
| 0 | ||||||||||||||||||||||||
| 1355 | const int margin = 2; | - | ||||||||||||||||||||||||
| 1356 | if (pos.y() - rect.top() < margin
| 0 | ||||||||||||||||||||||||
| 1357 | r = QAbstractItemView::AboveItem; | - | ||||||||||||||||||||||||
| 1358 | } never executed: else if (rect.bottom() - pos.y() < marginend of block
| 0 | ||||||||||||||||||||||||
| 1359 | r = QAbstractItemView::BelowItem; | - | ||||||||||||||||||||||||
| 1360 | } never executed: else if (rect.contains(pos, true)end of block
| 0 | ||||||||||||||||||||||||
| 1361 | r = QAbstractItemView::OnItem; | - | ||||||||||||||||||||||||
| 1362 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1363 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 1364 | QRect touchingRect = rect; | - | ||||||||||||||||||||||||
| 1365 | touchingRect.adjust(-1, -1, 1, 1); | - | ||||||||||||||||||||||||
| 1366 | if (touchingRect.contains(pos, false)
| 0 | ||||||||||||||||||||||||
| 1367 | r = QAbstractItemView::OnItem; | - | ||||||||||||||||||||||||
| 1368 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1369 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1370 | - | |||||||||||||||||||||||||
| 1371 | if (r == QAbstractItemView::OnItem
| 0 | ||||||||||||||||||||||||
| 1372 | r = pos.y() < rect.center().y()
never executed: r = pos.y() < rect.center().y() ? QAbstractItemView::AboveItem : QAbstractItemView::BelowItem; | 0 | ||||||||||||||||||||||||
| 1373 | - | |||||||||||||||||||||||||
| 1374 | return never executed: r;return r;never executed: return r; | 0 | ||||||||||||||||||||||||
| 1375 | } | - | ||||||||||||||||||||||||
| 1376 | void QAbstractItemView::focusInEvent(QFocusEvent *event) | - | ||||||||||||||||||||||||
| 1377 | { | - | ||||||||||||||||||||||||
| 1378 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1379 | QAbstractScrollArea::focusInEvent(event); | - | ||||||||||||||||||||||||
| 1380 | - | |||||||||||||||||||||||||
| 1381 | const QItemSelectionModel* model = selectionModel(); | - | ||||||||||||||||||||||||
| 1382 | const bool currentIndexValid = currentIndex().isValid(); | - | ||||||||||||||||||||||||
| 1383 | - | |||||||||||||||||||||||||
| 1384 | if (model
| 0 | ||||||||||||||||||||||||
| 1385 | && !d->currentIndexSet
| 0 | ||||||||||||||||||||||||
| 1386 | && !currentIndexValid
| 0 | ||||||||||||||||||||||||
| 1387 | bool autoScroll = d->autoScroll; | - | ||||||||||||||||||||||||
| 1388 | d->autoScroll = false; | - | ||||||||||||||||||||||||
| 1389 | QModelIndex index = moveCursor(MoveNext, Qt::NoModifier); | - | ||||||||||||||||||||||||
| 1390 | if (index.isValid()
| 0 | ||||||||||||||||||||||||
| 1391 | selectionModel()->setCurrentIndex(index, QItemSelectionModel::NoUpdate); never executed: selectionModel()->setCurrentIndex(index, QItemSelectionModel::NoUpdate); | 0 | ||||||||||||||||||||||||
| 1392 | d->autoScroll = autoScroll; | - | ||||||||||||||||||||||||
| 1393 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1394 | - | |||||||||||||||||||||||||
| 1395 | if (model
| 0 | ||||||||||||||||||||||||
| 1396 | if (currentIndex().flags() != Qt::ItemIsEditable
| 0 | ||||||||||||||||||||||||
| 1397 | setAttribute(Qt::WA_InputMethodEnabled, false); never executed: setAttribute(Qt::WA_InputMethodEnabled, false); | 0 | ||||||||||||||||||||||||
| 1398 | else | - | ||||||||||||||||||||||||
| 1399 | setAttribute(Qt::WA_InputMethodEnabled); never executed: setAttribute(Qt::WA_InputMethodEnabled); | 0 | ||||||||||||||||||||||||
| 1400 | } | - | ||||||||||||||||||||||||
| 1401 | - | |||||||||||||||||||||||||
| 1402 | if (!currentIndexValid
| 0 | ||||||||||||||||||||||||
| 1403 | setAttribute(Qt::WA_InputMethodEnabled, false); never executed: setAttribute(Qt::WA_InputMethodEnabled, false); | 0 | ||||||||||||||||||||||||
| 1404 | - | |||||||||||||||||||||||||
| 1405 | d->viewport->update(); | - | ||||||||||||||||||||||||
| 1406 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1407 | - | |||||||||||||||||||||||||
| 1408 | - | |||||||||||||||||||||||||
| 1409 | - | |||||||||||||||||||||||||
| 1410 | - | |||||||||||||||||||||||||
| 1411 | - | |||||||||||||||||||||||||
| 1412 | - | |||||||||||||||||||||||||
| 1413 | - | |||||||||||||||||||||||||
| 1414 | void QAbstractItemView::focusOutEvent(QFocusEvent *event) | - | ||||||||||||||||||||||||
| 1415 | { | - | ||||||||||||||||||||||||
| 1416 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1417 | QAbstractScrollArea::focusOutEvent(event); | - | ||||||||||||||||||||||||
| 1418 | d->viewport->update(); | - | ||||||||||||||||||||||||
| 1419 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1420 | void QAbstractItemView::keyPressEvent(QKeyEvent *event) | - | ||||||||||||||||||||||||
| 1421 | { | - | ||||||||||||||||||||||||
| 1422 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1423 | d->delayedAutoScroll.stop(); | - | ||||||||||||||||||||||||
| 1424 | if (event == QKeySequence::Copy
| 0 | ||||||||||||||||||||||||
| 1425 | QVariant variant; | - | ||||||||||||||||||||||||
| 1426 | if (d->model
| 0 | ||||||||||||||||||||||||
| 1427 | variant = d->model->data(currentIndex(), Qt::DisplayRole); never executed: variant = d->model->data(currentIndex(), Qt::DisplayRole); | 0 | ||||||||||||||||||||||||
| 1428 | if (variant.type() == QVariant::String
| 0 | ||||||||||||||||||||||||
| 1429 | QApplication::clipboard()->setText(variant.toString()); never executed: QApplication::clipboard()->setText(variant.toString()); | 0 | ||||||||||||||||||||||||
| 1430 | event->accept(); | - | ||||||||||||||||||||||||
| 1431 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1432 | - | |||||||||||||||||||||||||
| 1433 | - | |||||||||||||||||||||||||
| 1434 | QPersistentModelIndex newCurrent; | - | ||||||||||||||||||||||||
| 1435 | d->moveCursorUpdatedView = false; | - | ||||||||||||||||||||||||
| 1436 | switch (event->key()) { | - | ||||||||||||||||||||||||
| 1437 | case never executed: Qt::Key_Down:case Qt::Key_Down:never executed: case Qt::Key_Down: | 0 | ||||||||||||||||||||||||
| 1438 | newCurrent = moveCursor(MoveDown, event->modifiers()); | - | ||||||||||||||||||||||||
| 1439 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1440 | case never executed: Qt::Key_Up:case Qt::Key_Up:never executed: case Qt::Key_Up: | 0 | ||||||||||||||||||||||||
| 1441 | newCurrent = moveCursor(MoveUp, event->modifiers()); | - | ||||||||||||||||||||||||
| 1442 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1443 | case never executed: Qt::Key_Left:case Qt::Key_Left:never executed: case Qt::Key_Left: | 0 | ||||||||||||||||||||||||
| 1444 | newCurrent = moveCursor(MoveLeft, event->modifiers()); | - | ||||||||||||||||||||||||
| 1445 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1446 | case never executed: Qt::Key_Right:case Qt::Key_Right:never executed: case Qt::Key_Right: | 0 | ||||||||||||||||||||||||
| 1447 | newCurrent = moveCursor(MoveRight, event->modifiers()); | - | ||||||||||||||||||||||||
| 1448 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1449 | case never executed: Qt::Key_Home:case Qt::Key_Home:never executed: case Qt::Key_Home: | 0 | ||||||||||||||||||||||||
| 1450 | newCurrent = moveCursor(MoveHome, event->modifiers()); | - | ||||||||||||||||||||||||
| 1451 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1452 | case never executed: Qt::Key_End:case Qt::Key_End:never executed: case Qt::Key_End: | 0 | ||||||||||||||||||||||||
| 1453 | newCurrent = moveCursor(MoveEnd, event->modifiers()); | - | ||||||||||||||||||||||||
| 1454 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1455 | case never executed: Qt::Key_PageUp:case Qt::Key_PageUp:never executed: case Qt::Key_PageUp: | 0 | ||||||||||||||||||||||||
| 1456 | newCurrent = moveCursor(MovePageUp, event->modifiers()); | - | ||||||||||||||||||||||||
| 1457 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1458 | case never executed: Qt::Key_PageDown:case Qt::Key_PageDown:never executed: case Qt::Key_PageDown: | 0 | ||||||||||||||||||||||||
| 1459 | newCurrent = moveCursor(MovePageDown, event->modifiers()); | - | ||||||||||||||||||||||||
| 1460 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1461 | case never executed: Qt::Key_Tab:case Qt::Key_Tab:never executed: case Qt::Key_Tab: | 0 | ||||||||||||||||||||||||
| 1462 | if (d->tabKeyNavigation
| 0 | ||||||||||||||||||||||||
| 1463 | newCurrent = moveCursor(MoveNext, event->modifiers()); never executed: newCurrent = moveCursor(MoveNext, event->modifiers()); | 0 | ||||||||||||||||||||||||
| 1464 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1465 | case never executed: Qt::Key_Backtab:case Qt::Key_Backtab:never executed: case Qt::Key_Backtab: | 0 | ||||||||||||||||||||||||
| 1466 | if (d->tabKeyNavigation
| 0 | ||||||||||||||||||||||||
| 1467 | newCurrent = moveCursor(MovePrevious, event->modifiers()); never executed: newCurrent = moveCursor(MovePrevious, event->modifiers()); | 0 | ||||||||||||||||||||||||
| 1468 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1469 | } | - | ||||||||||||||||||||||||
| 1470 | - | |||||||||||||||||||||||||
| 1471 | QPersistentModelIndex oldCurrent = currentIndex(); | - | ||||||||||||||||||||||||
| 1472 | if (newCurrent != oldCurrent
| 0 | ||||||||||||||||||||||||
| 1473 | if (!hasFocus()
| 0 | ||||||||||||||||||||||||
| 1474 | setFocus(); never executed: setFocus(); | 0 | ||||||||||||||||||||||||
| 1475 | QItemSelectionModel::SelectionFlags command = selectionCommand(newCurrent, event); | - | ||||||||||||||||||||||||
| 1476 | if (command != QItemSelectionModel::NoUpdate
| 0 | ||||||||||||||||||||||||
| 1477 | || style()->styleHint(QStyle::SH_ItemView_MovementWithoutUpdatingSelection, 0, this)
| 0 | ||||||||||||||||||||||||
| 1478 | - | |||||||||||||||||||||||||
| 1479 | if (command & QItemSelectionModel::Current
| 0 | ||||||||||||||||||||||||
| 1480 | d->selectionModel->setCurrentIndex(newCurrent, QItemSelectionModel::NoUpdate); | - | ||||||||||||||||||||||||
| 1481 | if (!d->currentSelectionStartIndex.isValid()
| 0 | ||||||||||||||||||||||||
| 1482 | d->currentSelectionStartIndex = oldCurrent; never executed: d->currentSelectionStartIndex = oldCurrent; | 0 | ||||||||||||||||||||||||
| 1483 | QRect rect(visualRect(d->currentSelectionStartIndex).center(), visualRect(newCurrent).center()); | - | ||||||||||||||||||||||||
| 1484 | setSelection(rect, command); | - | ||||||||||||||||||||||||
| 1485 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 1486 | d->selectionModel->setCurrentIndex(newCurrent, command); | - | ||||||||||||||||||||||||
| 1487 | d->currentSelectionStartIndex = newCurrent; | - | ||||||||||||||||||||||||
| 1488 | if (newCurrent.isValid()
| 0 | ||||||||||||||||||||||||
| 1489 | - | |||||||||||||||||||||||||
| 1490 | QRect rect(visualRect(newCurrent).center(), QSize(1, 1)); | - | ||||||||||||||||||||||||
| 1491 | setSelection(rect, command); | - | ||||||||||||||||||||||||
| 1492 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1493 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1494 | event->accept(); | - | ||||||||||||||||||||||||
| 1495 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1496 | } | - | ||||||||||||||||||||||||
| 1497 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1498 | - | |||||||||||||||||||||||||
| 1499 | switch (event->key()) { | - | ||||||||||||||||||||||||
| 1500 | - | |||||||||||||||||||||||||
| 1501 | case never executed: Qt::Key_Down:case Qt::Key_Down:never executed: case Qt::Key_Down: | 0 | ||||||||||||||||||||||||
| 1502 | case never executed: Qt::Key_Up:case Qt::Key_Up:never executed: case Qt::Key_Up: | 0 | ||||||||||||||||||||||||
| 1503 | - | |||||||||||||||||||||||||
| 1504 | - | |||||||||||||||||||||||||
| 1505 | - | |||||||||||||||||||||||||
| 1506 | - | |||||||||||||||||||||||||
| 1507 | - | |||||||||||||||||||||||||
| 1508 | - | |||||||||||||||||||||||||
| 1509 | case never executed: Qt::Key_Left:case Qt::Key_Left:never executed: case Qt::Key_Left: | 0 | ||||||||||||||||||||||||
| 1510 | case never executed: Qt::Key_Right:case Qt::Key_Right:never executed: case Qt::Key_Right: | 0 | ||||||||||||||||||||||||
| 1511 | case never executed: Qt::Key_Home:case Qt::Key_Home:never executed: case Qt::Key_Home: | 0 | ||||||||||||||||||||||||
| 1512 | case never executed: Qt::Key_End:case Qt::Key_End:never executed: case Qt::Key_End: | 0 | ||||||||||||||||||||||||
| 1513 | case never executed: Qt::Key_PageUp:case Qt::Key_PageUp:never executed: case Qt::Key_PageUp: | 0 | ||||||||||||||||||||||||
| 1514 | case never executed: Qt::Key_PageDown:case Qt::Key_PageDown:never executed: case Qt::Key_PageDown: | 0 | ||||||||||||||||||||||||
| 1515 | case never executed: Qt::Key_Escape:case Qt::Key_Escape:never executed: case Qt::Key_Escape: | 0 | ||||||||||||||||||||||||
| 1516 | case never executed: Qt::Key_Shift:case Qt::Key_Shift:never executed: case Qt::Key_Shift: | 0 | ||||||||||||||||||||||||
| 1517 | case never executed: Qt::Key_Control:case Qt::Key_Control:never executed: case Qt::Key_Control: | 0 | ||||||||||||||||||||||||
| 1518 | case never executed: Qt::Key_Delete:case Qt::Key_Delete:never executed: case Qt::Key_Delete: | 0 | ||||||||||||||||||||||||
| 1519 | case never executed: Qt::Key_Backspace:case Qt::Key_Backspace:never executed: case Qt::Key_Backspace: | 0 | ||||||||||||||||||||||||
| 1520 | event->ignore(); | - | ||||||||||||||||||||||||
| 1521 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1522 | case never executed: Qt::Key_Space:case Qt::Key_Space:never executed: case Qt::Key_Space: | 0 | ||||||||||||||||||||||||
| 1523 | case never executed: Qt::Key_Select:case Qt::Key_Select:never executed: case Qt::Key_Select: | 0 | ||||||||||||||||||||||||
| 1524 | if (!edit(currentIndex(), AnyKeyPressed, event)
| 0 | ||||||||||||||||||||||||
| 1525 | d->selectionModel->select(currentIndex(), selectionCommand(currentIndex(), event)); never executed: d->selectionModel->select(currentIndex(), selectionCommand(currentIndex(), event)); | 0 | ||||||||||||||||||||||||
| 1526 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1527 | case never executed: Qt::Key_F2:case Qt::Key_F2:never executed: case Qt::Key_F2: | 0 | ||||||||||||||||||||||||
| 1528 | if (!edit(currentIndex(), EditKeyPressed, event)
| 0 | ||||||||||||||||||||||||
| 1529 | event->ignore(); never executed: event->ignore(); | 0 | ||||||||||||||||||||||||
| 1530 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1531 | case never executed: Qt::Key_Enter:case Qt::Key_Enter:never executed: case Qt::Key_Enter: | 0 | ||||||||||||||||||||||||
| 1532 | case never executed: Qt::Key_Return:case Qt::Key_Return:never executed: case Qt::Key_Return: | 0 | ||||||||||||||||||||||||
| 1533 | - | |||||||||||||||||||||||||
| 1534 | - | |||||||||||||||||||||||||
| 1535 | - | |||||||||||||||||||||||||
| 1536 | if (state() != EditingState
| 0 | ||||||||||||||||||||||||
| 1537 | if (currentIndex().isValid()
| 0 | ||||||||||||||||||||||||
| 1538 | activated(currentIndex()); never executed: activated(currentIndex()); | 0 | ||||||||||||||||||||||||
| 1539 | event->ignore(); | - | ||||||||||||||||||||||||
| 1540 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1541 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1542 | - | |||||||||||||||||||||||||
| 1543 | default never executed: :default:never executed: {default: | 0 | ||||||||||||||||||||||||
| 1544 | if (event == QKeySequence::SelectAll
| 0 | ||||||||||||||||||||||||
| 1545 | selectAll(); | - | ||||||||||||||||||||||||
| 1546 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1547 | } | - | ||||||||||||||||||||||||
| 1548 | - | |||||||||||||||||||||||||
| 1549 | - | |||||||||||||||||||||||||
| 1550 | - | |||||||||||||||||||||||||
| 1551 | - | |||||||||||||||||||||||||
| 1552 | - | |||||||||||||||||||||||||
| 1553 | - | |||||||||||||||||||||||||
| 1554 | bool modified = (event->modifiers() & (Qt::ControlModifier | Qt::AltModifier | Qt::MetaModifier)); | - | ||||||||||||||||||||||||
| 1555 | if (!event->text().isEmpty()
| 0 | ||||||||||||||||||||||||
| 1556 | keyboardSearch(event->text()); | - | ||||||||||||||||||||||||
| 1557 | event->accept(); | - | ||||||||||||||||||||||||
| 1558 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 1559 | event->ignore(); | - | ||||||||||||||||||||||||
| 1560 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1561 | break; never executed: }break; | 0 | ||||||||||||||||||||||||
| 1562 | } | - | ||||||||||||||||||||||||
| 1563 | if (d->moveCursorUpdatedView
| 0 | ||||||||||||||||||||||||
| 1564 | event->accept(); never executed: event->accept(); | 0 | ||||||||||||||||||||||||
| 1565 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1566 | - | |||||||||||||||||||||||||
| 1567 | - | |||||||||||||||||||||||||
| 1568 | - | |||||||||||||||||||||||||
| 1569 | - | |||||||||||||||||||||||||
| 1570 | - | |||||||||||||||||||||||||
| 1571 | - | |||||||||||||||||||||||||
| 1572 | - | |||||||||||||||||||||||||
| 1573 | void QAbstractItemView::resizeEvent(QResizeEvent *event) | - | ||||||||||||||||||||||||
| 1574 | { | - | ||||||||||||||||||||||||
| 1575 | QAbstractScrollArea::resizeEvent(event); | - | ||||||||||||||||||||||||
| 1576 | updateGeometries(); | - | ||||||||||||||||||||||||
| 1577 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1578 | - | |||||||||||||||||||||||||
| 1579 | - | |||||||||||||||||||||||||
| 1580 | - | |||||||||||||||||||||||||
| 1581 | - | |||||||||||||||||||||||||
| 1582 | - | |||||||||||||||||||||||||
| 1583 | - | |||||||||||||||||||||||||
| 1584 | - | |||||||||||||||||||||||||
| 1585 | void QAbstractItemView::timerEvent(QTimerEvent *event) | - | ||||||||||||||||||||||||
| 1586 | { | - | ||||||||||||||||||||||||
| 1587 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1588 | if (event->timerId() == d->fetchMoreTimer.timerId()
| 0 | ||||||||||||||||||||||||
| 1589 | d->fetchMore(); never executed: d->fetchMore(); | 0 | ||||||||||||||||||||||||
| 1590 | else if (event->timerId() == d->delayedReset.timerId()
| 0 | ||||||||||||||||||||||||
| 1591 | reset(); never executed: reset(); | 0 | ||||||||||||||||||||||||
| 1592 | else if (event->timerId() == d->autoScrollTimer.timerId()
| 0 | ||||||||||||||||||||||||
| 1593 | doAutoScroll(); never executed: doAutoScroll(); | 0 | ||||||||||||||||||||||||
| 1594 | else if (event->timerId() == d->updateTimer.timerId()
| 0 | ||||||||||||||||||||||||
| 1595 | d->updateDirtyRegion(); never executed: d->updateDirtyRegion(); | 0 | ||||||||||||||||||||||||
| 1596 | else if (event->timerId() == d->delayedEditing.timerId()
| 0 | ||||||||||||||||||||||||
| 1597 | d->delayedEditing.stop(); | - | ||||||||||||||||||||||||
| 1598 | edit(currentIndex()); | - | ||||||||||||||||||||||||
| 1599 | } never executed: else if (event->timerId() == d->delayedLayout.timerId()end of block
| 0 | ||||||||||||||||||||||||
| 1600 | d->delayedLayout.stop(); | - | ||||||||||||||||||||||||
| 1601 | if (isVisible()
| 0 | ||||||||||||||||||||||||
| 1602 | d->interruptDelayedItemsLayout(); | - | ||||||||||||||||||||||||
| 1603 | doItemsLayout(); | - | ||||||||||||||||||||||||
| 1604 | const QModelIndex current = currentIndex(); | - | ||||||||||||||||||||||||
| 1605 | if (current.isValid()
| 0 | ||||||||||||||||||||||||
| 1606 | scrollTo(current); never executed: scrollTo(current); | 0 | ||||||||||||||||||||||||
| 1607 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1608 | } never executed: else if (event->timerId() == d->delayedAutoScroll.timerId()end of block
| 0 | ||||||||||||||||||||||||
| 1609 | d->delayedAutoScroll.stop(); | - | ||||||||||||||||||||||||
| 1610 | - | |||||||||||||||||||||||||
| 1611 | - | |||||||||||||||||||||||||
| 1612 | if (d->pressedIndex.isValid()
| 0 | ||||||||||||||||||||||||
| 1613 | scrollTo(d->pressedIndex); never executed: scrollTo(d->pressedIndex); | 0 | ||||||||||||||||||||||||
| 1614 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1615 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1616 | - | |||||||||||||||||||||||||
| 1617 | - | |||||||||||||||||||||||||
| 1618 | - | |||||||||||||||||||||||||
| 1619 | - | |||||||||||||||||||||||||
| 1620 | void QAbstractItemView::inputMethodEvent(QInputMethodEvent *event) | - | ||||||||||||||||||||||||
| 1621 | { | - | ||||||||||||||||||||||||
| 1622 | if (event->commitString().isEmpty()
| 0 | ||||||||||||||||||||||||
| 1623 | event->ignore(); | - | ||||||||||||||||||||||||
| 1624 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1625 | } | - | ||||||||||||||||||||||||
| 1626 | if (!edit(currentIndex(), AnyKeyPressed, event)
| 0 | ||||||||||||||||||||||||
| 1627 | if (!event->commitString().isEmpty()
| 0 | ||||||||||||||||||||||||
| 1628 | keyboardSearch(event->commitString()); never executed: keyboardSearch(event->commitString()); | 0 | ||||||||||||||||||||||||
| 1629 | event->ignore(); | - | ||||||||||||||||||||||||
| 1630 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1631 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1632 | QAbstractItemView::DropIndicatorPosition QAbstractItemView::dropIndicatorPosition() const | - | ||||||||||||||||||||||||
| 1633 | { | - | ||||||||||||||||||||||||
| 1634 | const QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1635 | return never executed: d->dropIndicatorPosition;return d->dropIndicatorPosition;never executed: return d->dropIndicatorPosition; | 0 | ||||||||||||||||||||||||
| 1636 | } | - | ||||||||||||||||||||||||
| 1637 | QModelIndexList QAbstractItemView::selectedIndexes() const | - | ||||||||||||||||||||||||
| 1638 | { | - | ||||||||||||||||||||||||
| 1639 | const QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1640 | QModelIndexList indexes; | - | ||||||||||||||||||||||||
| 1641 | if (d->selectionModel
| 0 | ||||||||||||||||||||||||
| 1642 | indexes = d->selectionModel->selectedIndexes(); | - | ||||||||||||||||||||||||
| 1643 | auto isHidden = [this](const QModelIndex &idx) { | - | ||||||||||||||||||||||||
| 1644 | return never executed: isIndexHidden(idx);return isIndexHidden(idx);never executed: return isIndexHidden(idx); | 0 | ||||||||||||||||||||||||
| 1645 | }; | - | ||||||||||||||||||||||||
| 1646 | const auto end = indexes.end(); | - | ||||||||||||||||||||||||
| 1647 | indexes.erase(std::remove_if(indexes.begin(), end, isHidden), end); | - | ||||||||||||||||||||||||
| 1648 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1649 | return never executed: indexes;return indexes;never executed: return indexes; | 0 | ||||||||||||||||||||||||
| 1650 | } | - | ||||||||||||||||||||||||
| 1651 | bool QAbstractItemView::edit(const QModelIndex &index, EditTrigger trigger, QEvent *event) | - | ||||||||||||||||||||||||
| 1652 | { | - | ||||||||||||||||||||||||
| 1653 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1654 | - | |||||||||||||||||||||||||
| 1655 | if (!d->isIndexValid(index)
| 0 | ||||||||||||||||||||||||
| 1656 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 1657 | - | |||||||||||||||||||||||||
| 1658 | if (QWidget *w = (d->persistent.isEmpty()
| 0 | ||||||||||||||||||||||||
| 1659 | if (w->focusPolicy() == Qt::NoFocus
| 0 | ||||||||||||||||||||||||
| 1660 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 1661 | w->setFocus(); | - | ||||||||||||||||||||||||
| 1662 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||
| 1663 | } | - | ||||||||||||||||||||||||
| 1664 | - | |||||||||||||||||||||||||
| 1665 | if (trigger == DoubleClicked
| 0 | ||||||||||||||||||||||||
| 1666 | d->delayedEditing.stop(); | - | ||||||||||||||||||||||||
| 1667 | d->delayedAutoScroll.stop(); | - | ||||||||||||||||||||||||
| 1668 | } never executed: else if (trigger == CurrentChangedend of block
| 0 | ||||||||||||||||||||||||
| 1669 | d->delayedEditing.stop(); | - | ||||||||||||||||||||||||
| 1670 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1671 | - | |||||||||||||||||||||||||
| 1672 | if (d->sendDelegateEvent(index, event)
| 0 | ||||||||||||||||||||||||
| 1673 | update(index); | - | ||||||||||||||||||||||||
| 1674 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||
| 1675 | } | - | ||||||||||||||||||||||||
| 1676 | - | |||||||||||||||||||||||||
| 1677 | - | |||||||||||||||||||||||||
| 1678 | EditTriggers lastTrigger = d->lastTrigger; | - | ||||||||||||||||||||||||
| 1679 | d->lastTrigger = trigger; | - | ||||||||||||||||||||||||
| 1680 | - | |||||||||||||||||||||||||
| 1681 | if (!d->shouldEdit(trigger, d->model->buddy(index))
| 0 | ||||||||||||||||||||||||
| 1682 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 1683 | - | |||||||||||||||||||||||||
| 1684 | if (d->delayedEditing.isActive()
| 0 | ||||||||||||||||||||||||
| 1685 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 1686 | - | |||||||||||||||||||||||||
| 1687 | - | |||||||||||||||||||||||||
| 1688 | - | |||||||||||||||||||||||||
| 1689 | if (lastTrigger == DoubleClicked
| 0 | ||||||||||||||||||||||||
| 1690 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 1691 | - | |||||||||||||||||||||||||
| 1692 | - | |||||||||||||||||||||||||
| 1693 | if (trigger == SelectedClicked
| 0 | ||||||||||||||||||||||||
| 1694 | d->delayedEditing.start(QApplication::doubleClickInterval(), this); never executed: d->delayedEditing.start(QApplication::doubleClickInterval(), this); | 0 | ||||||||||||||||||||||||
| 1695 | else | - | ||||||||||||||||||||||||
| 1696 | d->openEditor(index, d->shouldForwardEvent(trigger, event) ? event : 0); never executed: d->openEditor(index, d->shouldForwardEvent(trigger, event) ? event : 0); | 0 | ||||||||||||||||||||||||
| 1697 | - | |||||||||||||||||||||||||
| 1698 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||
| 1699 | } | - | ||||||||||||||||||||||||
| 1700 | - | |||||||||||||||||||||||||
| 1701 | - | |||||||||||||||||||||||||
| 1702 | - | |||||||||||||||||||||||||
| 1703 | - | |||||||||||||||||||||||||
| 1704 | - | |||||||||||||||||||||||||
| 1705 | void QAbstractItemView::updateEditorData() | - | ||||||||||||||||||||||||
| 1706 | { | - | ||||||||||||||||||||||||
| 1707 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1708 | d->updateEditorData(QModelIndex(), QModelIndex()); | - | ||||||||||||||||||||||||
| 1709 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1710 | - | |||||||||||||||||||||||||
| 1711 | - | |||||||||||||||||||||||||
| 1712 | - | |||||||||||||||||||||||||
| 1713 | - | |||||||||||||||||||||||||
| 1714 | - | |||||||||||||||||||||||||
| 1715 | void QAbstractItemView::updateEditorGeometries() | - | ||||||||||||||||||||||||
| 1716 | { | - | ||||||||||||||||||||||||
| 1717 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1718 | if(d->editorIndexHash.isEmpty()
| 0 | ||||||||||||||||||||||||
| 1719 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1720 | if (d->delayedPendingLayout
| 0 | ||||||||||||||||||||||||
| 1721 | - | |||||||||||||||||||||||||
| 1722 | d->executePostedLayout(); | - | ||||||||||||||||||||||||
| 1723 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1724 | } | - | ||||||||||||||||||||||||
| 1725 | QStyleOptionViewItem option = d->viewOptionsV1(); | - | ||||||||||||||||||||||||
| 1726 | QEditorIndexHash::iterator it = d->editorIndexHash.begin(); | - | ||||||||||||||||||||||||
| 1727 | QWidgetList editorsToRelease; | - | ||||||||||||||||||||||||
| 1728 | QWidgetList editorsToHide; | - | ||||||||||||||||||||||||
| 1729 | while (it != d->editorIndexHash.end()
| 0 | ||||||||||||||||||||||||
| 1730 | QModelIndex index = it.value(); | - | ||||||||||||||||||||||||
| 1731 | QWidget *editor = it.key(); | - | ||||||||||||||||||||||||
| 1732 | if (index.isValid()
| 0 | ||||||||||||||||||||||||
| 1733 | option.rect = visualRect(index); | - | ||||||||||||||||||||||||
| 1734 | if (option.rect.isValid()
| 0 | ||||||||||||||||||||||||
| 1735 | editor->show(); | - | ||||||||||||||||||||||||
| 1736 | QAbstractItemDelegate *delegate = d->delegateForIndex(index); | - | ||||||||||||||||||||||||
| 1737 | if (delegate
| 0 | ||||||||||||||||||||||||
| 1738 | delegate-> never executed: updateEditorGeometry(editor, option, index);delegate->updateEditorGeometry(editor, option, index);never executed: delegate->updateEditorGeometry(editor, option, index); | 0 | ||||||||||||||||||||||||
| 1739 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 1740 | editorsToHide << editor; | - | ||||||||||||||||||||||||
| 1741 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1742 | ++it; | - | ||||||||||||||||||||||||
| 1743 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 1744 | d->indexEditorHash.remove(it.value()); | - | ||||||||||||||||||||||||
| 1745 | it = d->editorIndexHash.erase(it); | - | ||||||||||||||||||||||||
| 1746 | editorsToRelease << editor; | - | ||||||||||||||||||||||||
| 1747 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1748 | } | - | ||||||||||||||||||||||||
| 1749 | - | |||||||||||||||||||||||||
| 1750 | - | |||||||||||||||||||||||||
| 1751 | - | |||||||||||||||||||||||||
| 1752 | for (int i = 0; i < editorsToHide.count()
| 0 | ||||||||||||||||||||||||
| 1753 | editorsToHide.at(i)->hide(); | - | ||||||||||||||||||||||||
| 1754 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1755 | for (int i = 0; i < editorsToRelease.count()
| 0 | ||||||||||||||||||||||||
| 1756 | d->releaseEditor(editorsToRelease.at(i)); | - | ||||||||||||||||||||||||
| 1757 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1758 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1759 | - | |||||||||||||||||||||||||
| 1760 | - | |||||||||||||||||||||||||
| 1761 | - | |||||||||||||||||||||||||
| 1762 | - | |||||||||||||||||||||||||
| 1763 | - | |||||||||||||||||||||||||
| 1764 | - | |||||||||||||||||||||||||
| 1765 | void QAbstractItemView::updateGeometries() | - | ||||||||||||||||||||||||
| 1766 | { | - | ||||||||||||||||||||||||
| 1767 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1768 | updateEditorGeometries(); | - | ||||||||||||||||||||||||
| 1769 | d->fetchMoreTimer.start(0, this); | - | ||||||||||||||||||||||||
| 1770 | d->updateGeometry(); | - | ||||||||||||||||||||||||
| 1771 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1772 | - | |||||||||||||||||||||||||
| 1773 | - | |||||||||||||||||||||||||
| 1774 | - | |||||||||||||||||||||||||
| 1775 | - | |||||||||||||||||||||||||
| 1776 | void QAbstractItemView::verticalScrollbarValueChanged(int value) | - | ||||||||||||||||||||||||
| 1777 | { | - | ||||||||||||||||||||||||
| 1778 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1779 | if (verticalScrollBar()->maximum() == value
| 0 | ||||||||||||||||||||||||
| 1780 | d->model->fetchMore(d->root); never executed: d->model->fetchMore(d->root); | 0 | ||||||||||||||||||||||||
| 1781 | QPoint posInVp = viewport()->mapFromGlobal(QCursor::pos()); | - | ||||||||||||||||||||||||
| 1782 | if (viewport()->rect().contains(posInVp)
| 0 | ||||||||||||||||||||||||
| 1783 | d->checkMouseMove(posInVp); never executed: d->checkMouseMove(posInVp); | 0 | ||||||||||||||||||||||||
| 1784 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1785 | - | |||||||||||||||||||||||||
| 1786 | - | |||||||||||||||||||||||||
| 1787 | - | |||||||||||||||||||||||||
| 1788 | - | |||||||||||||||||||||||||
| 1789 | void QAbstractItemView::horizontalScrollbarValueChanged(int value) | - | ||||||||||||||||||||||||
| 1790 | { | - | ||||||||||||||||||||||||
| 1791 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1792 | if (horizontalScrollBar()->maximum() == value
| 0 | ||||||||||||||||||||||||
| 1793 | d->model->fetchMore(d->root); never executed: d->model->fetchMore(d->root); | 0 | ||||||||||||||||||||||||
| 1794 | QPoint posInVp = viewport()->mapFromGlobal(QCursor::pos()); | - | ||||||||||||||||||||||||
| 1795 | if (viewport()->rect().contains(posInVp)
| 0 | ||||||||||||||||||||||||
| 1796 | d->checkMouseMove(posInVp); never executed: d->checkMouseMove(posInVp); | 0 | ||||||||||||||||||||||||
| 1797 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1798 | - | |||||||||||||||||||||||||
| 1799 | - | |||||||||||||||||||||||||
| 1800 | - | |||||||||||||||||||||||||
| 1801 | - | |||||||||||||||||||||||||
| 1802 | void QAbstractItemView::verticalScrollbarAction(int) | - | ||||||||||||||||||||||||
| 1803 | { | - | ||||||||||||||||||||||||
| 1804 | - | |||||||||||||||||||||||||
| 1805 | } | - | ||||||||||||||||||||||||
| 1806 | - | |||||||||||||||||||||||||
| 1807 | - | |||||||||||||||||||||||||
| 1808 | - | |||||||||||||||||||||||||
| 1809 | - | |||||||||||||||||||||||||
| 1810 | void QAbstractItemView::horizontalScrollbarAction(int) | - | ||||||||||||||||||||||||
| 1811 | { | - | ||||||||||||||||||||||||
| 1812 | - | |||||||||||||||||||||||||
| 1813 | } | - | ||||||||||||||||||||||||
| 1814 | void QAbstractItemView::closeEditor(QWidget *editor, QAbstractItemDelegate::EndEditHint hint) | - | ||||||||||||||||||||||||
| 1815 | { | - | ||||||||||||||||||||||||
| 1816 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1817 | - | |||||||||||||||||||||||||
| 1818 | - | |||||||||||||||||||||||||
| 1819 | if (editor
| 0 | ||||||||||||||||||||||||
| 1820 | bool isPersistent = d->persistent.contains(editor); | - | ||||||||||||||||||||||||
| 1821 | bool hadFocus = editor->hasFocus(); | - | ||||||||||||||||||||||||
| 1822 | QModelIndex index = d->indexForEditor(editor); | - | ||||||||||||||||||||||||
| 1823 | if (!index.isValid()
| 0 | ||||||||||||||||||||||||
| 1824 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1825 | - | |||||||||||||||||||||||||
| 1826 | if (!isPersistent
| 0 | ||||||||||||||||||||||||
| 1827 | setState(NoState); | - | ||||||||||||||||||||||||
| 1828 | QModelIndex index = d->indexForEditor(editor); | - | ||||||||||||||||||||||||
| 1829 | editor->removeEventFilter(d->delegateForIndex(index)); | - | ||||||||||||||||||||||||
| 1830 | d->removeEditor(editor); | - | ||||||||||||||||||||||||
| 1831 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1832 | if (hadFocus
| 0 | ||||||||||||||||||||||||
| 1833 | if (focusPolicy() != Qt::NoFocus
| 0 | ||||||||||||||||||||||||
| 1834 | setFocus(); never executed: setFocus(); | 0 | ||||||||||||||||||||||||
| 1835 | else | - | ||||||||||||||||||||||||
| 1836 | editor->clearFocus(); never executed: editor->clearFocus(); | 0 | ||||||||||||||||||||||||
| 1837 | } else { | - | ||||||||||||||||||||||||
| 1838 | d->checkPersistentEditorFocus(); | - | ||||||||||||||||||||||||
| 1839 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1840 | - | |||||||||||||||||||||||||
| 1841 | QPointer<QWidget> ed = editor; | - | ||||||||||||||||||||||||
| 1842 | QApplication::sendPostedEvents(editor, 0); | - | ||||||||||||||||||||||||
| 1843 | editor = ed; | - | ||||||||||||||||||||||||
| 1844 | - | |||||||||||||||||||||||||
| 1845 | if (!isPersistent
| 0 | ||||||||||||||||||||||||
| 1846 | d->releaseEditor(editor, index); never executed: d->releaseEditor(editor, index); | 0 | ||||||||||||||||||||||||
| 1847 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1848 | - | |||||||||||||||||||||||||
| 1849 | - | |||||||||||||||||||||||||
| 1850 | QItemSelectionModel::SelectionFlags flags = QItemSelectionModel::NoUpdate; | - | ||||||||||||||||||||||||
| 1851 | if (d->selectionMode != NoSelection
| 0 | ||||||||||||||||||||||||
| 1852 | flags = QItemSelectionModel::ClearAndSelect | d->selectionBehaviorFlags(); never executed: flags = QItemSelectionModel::ClearAndSelect | d->selectionBehaviorFlags(); | 0 | ||||||||||||||||||||||||
| 1853 | switch (hint) { | - | ||||||||||||||||||||||||
| 1854 | case never executed: QAbstractItemDelegate::EditNextItem:case QAbstractItemDelegate::EditNextItem:never executed: {case QAbstractItemDelegate::EditNextItem: | 0 | ||||||||||||||||||||||||
| 1855 | QModelIndex index = moveCursor(MoveNext, Qt::NoModifier); | - | ||||||||||||||||||||||||
| 1856 | if (index.isValid()
| 0 | ||||||||||||||||||||||||
| 1857 | QPersistentModelIndex persistent(index); | - | ||||||||||||||||||||||||
| 1858 | d->selectionModel->setCurrentIndex(persistent, flags); | - | ||||||||||||||||||||||||
| 1859 | - | |||||||||||||||||||||||||
| 1860 | if (index.flags() & Qt::ItemIsEditable
| 0 | ||||||||||||||||||||||||
| 1861 | && (
| 0 | ||||||||||||||||||||||||
| 1862 | edit(persistent); never executed: edit(persistent); | 0 | ||||||||||||||||||||||||
| 1863 | } never executed: break;end of blocknever executed: }break; | 0 | ||||||||||||||||||||||||
| 1864 | case never executed: QAbstractItemDelegate::EditPreviousItem:case QAbstractItemDelegate::EditPreviousItem:never executed: {case QAbstractItemDelegate::EditPreviousItem: | 0 | ||||||||||||||||||||||||
| 1865 | QModelIndex index = moveCursor(MovePrevious, Qt::NoModifier); | - | ||||||||||||||||||||||||
| 1866 | if (index.isValid()
| 0 | ||||||||||||||||||||||||
| 1867 | QPersistentModelIndex persistent(index); | - | ||||||||||||||||||||||||
| 1868 | d->selectionModel->setCurrentIndex(persistent, flags); | - | ||||||||||||||||||||||||
| 1869 | - | |||||||||||||||||||||||||
| 1870 | if (index.flags() & Qt::ItemIsEditable
| 0 | ||||||||||||||||||||||||
| 1871 | && (
| 0 | ||||||||||||||||||||||||
| 1872 | edit(persistent); never executed: edit(persistent); | 0 | ||||||||||||||||||||||||
| 1873 | } never executed: break;end of blocknever executed: }break; | 0 | ||||||||||||||||||||||||
| 1874 | case never executed: QAbstractItemDelegate::SubmitModelCache:case QAbstractItemDelegate::SubmitModelCache:never executed: case QAbstractItemDelegate::SubmitModelCache: | 0 | ||||||||||||||||||||||||
| 1875 | d->model->submit(); | - | ||||||||||||||||||||||||
| 1876 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1877 | case never executed: QAbstractItemDelegate::RevertModelCache:case QAbstractItemDelegate::RevertModelCache:never executed: case QAbstractItemDelegate::RevertModelCache: | 0 | ||||||||||||||||||||||||
| 1878 | d->model->revert(); | - | ||||||||||||||||||||||||
| 1879 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1880 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||
| 1881 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1882 | } | - | ||||||||||||||||||||||||
| 1883 | } | - | ||||||||||||||||||||||||
| 1884 | - | |||||||||||||||||||||||||
| 1885 | - | |||||||||||||||||||||||||
| 1886 | - | |||||||||||||||||||||||||
| 1887 | - | |||||||||||||||||||||||||
| 1888 | - | |||||||||||||||||||||||||
| 1889 | - | |||||||||||||||||||||||||
| 1890 | void QAbstractItemView::commitData(QWidget *editor) | - | ||||||||||||||||||||||||
| 1891 | { | - | ||||||||||||||||||||||||
| 1892 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1893 | if (!editor
| 0 | ||||||||||||||||||||||||
| 1894 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1895 | QModelIndex index = d->indexForEditor(editor); | - | ||||||||||||||||||||||||
| 1896 | if (!index.isValid()
| 0 | ||||||||||||||||||||||||
| 1897 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1898 | d->currentlyCommittingEditor = editor; | - | ||||||||||||||||||||||||
| 1899 | QAbstractItemDelegate *delegate = d->delegateForIndex(index); | - | ||||||||||||||||||||||||
| 1900 | editor->removeEventFilter(delegate); | - | ||||||||||||||||||||||||
| 1901 | delegate->setModelData(editor, d->model, index); | - | ||||||||||||||||||||||||
| 1902 | editor->installEventFilter(delegate); | - | ||||||||||||||||||||||||
| 1903 | d->currentlyCommittingEditor = 0; | - | ||||||||||||||||||||||||
| 1904 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1905 | - | |||||||||||||||||||||||||
| 1906 | - | |||||||||||||||||||||||||
| 1907 | - | |||||||||||||||||||||||||
| 1908 | - | |||||||||||||||||||||||||
| 1909 | - | |||||||||||||||||||||||||
| 1910 | - | |||||||||||||||||||||||||
| 1911 | void QAbstractItemView::editorDestroyed(QObject *editor) | - | ||||||||||||||||||||||||
| 1912 | { | - | ||||||||||||||||||||||||
| 1913 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1914 | QWidget *w = qobject_cast<QWidget*>(editor); | - | ||||||||||||||||||||||||
| 1915 | d->removeEditor(w); | - | ||||||||||||||||||||||||
| 1916 | d->persistent.remove(w); | - | ||||||||||||||||||||||||
| 1917 | if (state() == EditingState
| 0 | ||||||||||||||||||||||||
| 1918 | setState(NoState); never executed: setState(NoState); | 0 | ||||||||||||||||||||||||
| 1919 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1920 | void QAbstractItemView::setHorizontalStepsPerItem(int steps) | - | ||||||||||||||||||||||||
| 1921 | { | - | ||||||||||||||||||||||||
| 1922 | (void)steps; | - | ||||||||||||||||||||||||
| 1923 | - | |||||||||||||||||||||||||
| 1924 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1925 | - | |||||||||||||||||||||||||
| 1926 | - | |||||||||||||||||||||||||
| 1927 | - | |||||||||||||||||||||||||
| 1928 | - | |||||||||||||||||||||||||
| 1929 | - | |||||||||||||||||||||||||
| 1930 | - | |||||||||||||||||||||||||
| 1931 | - | |||||||||||||||||||||||||
| 1932 | int QAbstractItemView::horizontalStepsPerItem() const | - | ||||||||||||||||||||||||
| 1933 | { | - | ||||||||||||||||||||||||
| 1934 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||||||||||||||
| 1935 | } | - | ||||||||||||||||||||||||
| 1936 | void QAbstractItemView::setVerticalStepsPerItem(int steps) | - | ||||||||||||||||||||||||
| 1937 | { | - | ||||||||||||||||||||||||
| 1938 | (void)steps; | - | ||||||||||||||||||||||||
| 1939 | - | |||||||||||||||||||||||||
| 1940 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1941 | - | |||||||||||||||||||||||||
| 1942 | - | |||||||||||||||||||||||||
| 1943 | - | |||||||||||||||||||||||||
| 1944 | - | |||||||||||||||||||||||||
| 1945 | - | |||||||||||||||||||||||||
| 1946 | - | |||||||||||||||||||||||||
| 1947 | - | |||||||||||||||||||||||||
| 1948 | int QAbstractItemView::verticalStepsPerItem() const | - | ||||||||||||||||||||||||
| 1949 | { | - | ||||||||||||||||||||||||
| 1950 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||||||||||||||
| 1951 | } | - | ||||||||||||||||||||||||
| 1952 | void QAbstractItemView::keyboardSearch(const QString &search) | - | ||||||||||||||||||||||||
| 1953 | { | - | ||||||||||||||||||||||||
| 1954 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1955 | if (!d->model->rowCount(d->root)
| 0 | ||||||||||||||||||||||||
| 1956 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 1957 | - | |||||||||||||||||||||||||
| 1958 | QModelIndex start = currentIndex().isValid()
| 0 | ||||||||||||||||||||||||
| 1959 | : d->model->index(0, 0, d->root); | - | ||||||||||||||||||||||||
| 1960 | bool skipRow = false; | - | ||||||||||||||||||||||||
| 1961 | bool keyboardTimeWasValid = d->keyboardInputTime.isValid(); | - | ||||||||||||||||||||||||
| 1962 | qint64 keyboardInputTimeElapsed; | - | ||||||||||||||||||||||||
| 1963 | if (keyboardTimeWasValid
| 0 | ||||||||||||||||||||||||
| 1964 | keyboardInputTimeElapsed = d->keyboardInputTime.restart(); never executed: keyboardInputTimeElapsed = d->keyboardInputTime.restart(); | 0 | ||||||||||||||||||||||||
| 1965 | else | - | ||||||||||||||||||||||||
| 1966 | d->keyboardInputTime.start(); never executed: d->keyboardInputTime.start(); | 0 | ||||||||||||||||||||||||
| 1967 | if (search.isEmpty()
| 0 | ||||||||||||||||||||||||
| 1968 | || keyboardInputTimeElapsed > QApplication::keyboardInputInterval()
| 0 | ||||||||||||||||||||||||
| 1969 | d->keyboardInput = search; | - | ||||||||||||||||||||||||
| 1970 | skipRow = currentIndex().isValid(); | - | ||||||||||||||||||||||||
| 1971 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 1972 | d->keyboardInput += search; | - | ||||||||||||||||||||||||
| 1973 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1974 | - | |||||||||||||||||||||||||
| 1975 | - | |||||||||||||||||||||||||
| 1976 | bool sameKey = false; | - | ||||||||||||||||||||||||
| 1977 | if (d->keyboardInput.length() > 1
| 0 | ||||||||||||||||||||||||
| 1978 | int c = d->keyboardInput.count(d->keyboardInput.at(d->keyboardInput.length() - 1)); | - | ||||||||||||||||||||||||
| 1979 | sameKey = (c == d->keyboardInput.length()); | - | ||||||||||||||||||||||||
| 1980 | if (sameKey
| 0 | ||||||||||||||||||||||||
| 1981 | skipRow = true; never executed: skipRow = true; | 0 | ||||||||||||||||||||||||
| 1982 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1983 | - | |||||||||||||||||||||||||
| 1984 | - | |||||||||||||||||||||||||
| 1985 | if (skipRow
| 0 | ||||||||||||||||||||||||
| 1986 | QModelIndex parent = start.parent(); | - | ||||||||||||||||||||||||
| 1987 | int newRow = (
| 0 | ||||||||||||||||||||||||
| 1988 | start = d->model->index(newRow, start.column(), parent); | - | ||||||||||||||||||||||||
| 1989 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1990 | - | |||||||||||||||||||||||||
| 1991 | - | |||||||||||||||||||||||||
| 1992 | QModelIndex current = start; | - | ||||||||||||||||||||||||
| 1993 | QModelIndexList match; | - | ||||||||||||||||||||||||
| 1994 | QModelIndex firstMatch; | - | ||||||||||||||||||||||||
| 1995 | QModelIndex startMatch; | - | ||||||||||||||||||||||||
| 1996 | QModelIndexList previous; | - | ||||||||||||||||||||||||
| 1997 | do { | - | ||||||||||||||||||||||||
| 1998 | match = d->model->match(current, Qt::DisplayRole, d->keyboardInput); | - | ||||||||||||||||||||||||
| 1999 | if (match == previous
| 0 | ||||||||||||||||||||||||
| 2000 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2001 | firstMatch = match.value(0); | - | ||||||||||||||||||||||||
| 2002 | previous = match; | - | ||||||||||||||||||||||||
| 2003 | if (firstMatch.isValid()
| 0 | ||||||||||||||||||||||||
| 2004 | if (d->isIndexEnabled(firstMatch)
| 0 | ||||||||||||||||||||||||
| 2005 | setCurrentIndex(firstMatch); | - | ||||||||||||||||||||||||
| 2006 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2007 | } | - | ||||||||||||||||||||||||
| 2008 | int row = firstMatch.row() + 1; | - | ||||||||||||||||||||||||
| 2009 | if (row >= d->model->rowCount(firstMatch.parent())
| 0 | ||||||||||||||||||||||||
| 2010 | row = 0; never executed: row = 0; | 0 | ||||||||||||||||||||||||
| 2011 | current = firstMatch.sibling(row, firstMatch.column()); | - | ||||||||||||||||||||||||
| 2012 | - | |||||||||||||||||||||||||
| 2013 | - | |||||||||||||||||||||||||
| 2014 | if (!startMatch.isValid()
| 0 | ||||||||||||||||||||||||
| 2015 | startMatch = firstMatch; never executed: startMatch = firstMatch; | 0 | ||||||||||||||||||||||||
| 2016 | else if (startMatch == firstMatch
| 0 | ||||||||||||||||||||||||
| 2017 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2018 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2019 | } never executed: while (current != startend of block
| 0 | ||||||||||||||||||||||||
| 2020 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2021 | - | |||||||||||||||||||||||||
| 2022 | - | |||||||||||||||||||||||||
| 2023 | - | |||||||||||||||||||||||||
| 2024 | - | |||||||||||||||||||||||||
| 2025 | - | |||||||||||||||||||||||||
| 2026 | - | |||||||||||||||||||||||||
| 2027 | - | |||||||||||||||||||||||||
| 2028 | QSize QAbstractItemView::sizeHintForIndex(const QModelIndex &index) const | - | ||||||||||||||||||||||||
| 2029 | { | - | ||||||||||||||||||||||||
| 2030 | const QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2031 | if (!d->isIndexValid(index)
| 0 | ||||||||||||||||||||||||
| 2032 | return never executed: QSize();return QSize();never executed: return QSize(); | 0 | ||||||||||||||||||||||||
| 2033 | return never executed: d->delegateForIndex(index)->sizeHint(d->viewOptionsV1(), index);return d->delegateForIndex(index)->sizeHint(d->viewOptionsV1(), index);never executed: return d->delegateForIndex(index)->sizeHint(d->viewOptionsV1(), index); | 0 | ||||||||||||||||||||||||
| 2034 | } | - | ||||||||||||||||||||||||
| 2035 | int QAbstractItemView::sizeHintForRow(int row) const | - | ||||||||||||||||||||||||
| 2036 | { | - | ||||||||||||||||||||||||
| 2037 | const QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2038 | - | |||||||||||||||||||||||||
| 2039 | if (row < 0
| 0 | ||||||||||||||||||||||||
| 2040 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||||||||
| 2041 | - | |||||||||||||||||||||||||
| 2042 | ensurePolished(); | - | ||||||||||||||||||||||||
| 2043 | - | |||||||||||||||||||||||||
| 2044 | QStyleOptionViewItem option = d->viewOptionsV1(); | - | ||||||||||||||||||||||||
| 2045 | int height = 0; | - | ||||||||||||||||||||||||
| 2046 | int colCount = d->model->columnCount(d->root); | - | ||||||||||||||||||||||||
| 2047 | for (int c = 0; c < colCount
| 0 | ||||||||||||||||||||||||
| 2048 | const QModelIndex index = d->model->index(row, c, d->root); | - | ||||||||||||||||||||||||
| 2049 | if (QWidget *editor = d->editorForIndex(index).widget.data()
| 0 | ||||||||||||||||||||||||
| 2050 | height = qMax(height, editor->height()); never executed: height = qMax(height, editor->height()); | 0 | ||||||||||||||||||||||||
| 2051 | if (const
| 0 | ||||||||||||||||||||||||
| 2052 | height = qMax(height, delegate->sizeHint(option, index).height()); never executed: height = qMax(height, delegate->sizeHint(option, index).height()); | 0 | ||||||||||||||||||||||||
| 2053 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2054 | return never executed: height;return height;never executed: return height; | 0 | ||||||||||||||||||||||||
| 2055 | } | - | ||||||||||||||||||||||||
| 2056 | int QAbstractItemView::sizeHintForColumn(int column) const | - | ||||||||||||||||||||||||
| 2057 | { | - | ||||||||||||||||||||||||
| 2058 | const QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2059 | - | |||||||||||||||||||||||||
| 2060 | if (column < 0
| 0 | ||||||||||||||||||||||||
| 2061 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||||||||
| 2062 | - | |||||||||||||||||||||||||
| 2063 | ensurePolished(); | - | ||||||||||||||||||||||||
| 2064 | - | |||||||||||||||||||||||||
| 2065 | QStyleOptionViewItem option = d->viewOptionsV1(); | - | ||||||||||||||||||||||||
| 2066 | int width = 0; | - | ||||||||||||||||||||||||
| 2067 | int rows = d->model->rowCount(d->root); | - | ||||||||||||||||||||||||
| 2068 | for (int r = 0; r < rows
| 0 | ||||||||||||||||||||||||
| 2069 | const QModelIndex index = d->model->index(r, column, d->root); | - | ||||||||||||||||||||||||
| 2070 | if (QWidget *editor = d->editorForIndex(index).widget.data()
| 0 | ||||||||||||||||||||||||
| 2071 | width = qMax(width, editor->sizeHint().width()); never executed: width = qMax(width, editor->sizeHint().width()); | 0 | ||||||||||||||||||||||||
| 2072 | if (const
| 0 | ||||||||||||||||||||||||
| 2073 | width = qMax(width, delegate->sizeHint(option, index).width()); never executed: width = qMax(width, delegate->sizeHint(option, index).width()); | 0 | ||||||||||||||||||||||||
| 2074 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2075 | return never executed: width;return width;never executed: return width; | 0 | ||||||||||||||||||||||||
| 2076 | } | - | ||||||||||||||||||||||||
| 2077 | - | |||||||||||||||||||||||||
| 2078 | - | |||||||||||||||||||||||||
| 2079 | - | |||||||||||||||||||||||||
| 2080 | - | |||||||||||||||||||||||||
| 2081 | - | |||||||||||||||||||||||||
| 2082 | - | |||||||||||||||||||||||||
| 2083 | - | |||||||||||||||||||||||||
| 2084 | void QAbstractItemView::openPersistentEditor(const QModelIndex &index) | - | ||||||||||||||||||||||||
| 2085 | { | - | ||||||||||||||||||||||||
| 2086 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2087 | QStyleOptionViewItem options = d->viewOptionsV1(); | - | ||||||||||||||||||||||||
| 2088 | options.rect = visualRect(index); | - | ||||||||||||||||||||||||
| 2089 | options.state |= (index == currentIndex()
| 0 | ||||||||||||||||||||||||
| 2090 | - | |||||||||||||||||||||||||
| 2091 | QWidget *editor = d->editor(index, options); | - | ||||||||||||||||||||||||
| 2092 | if (editor
| 0 | ||||||||||||||||||||||||
| 2093 | editor->show(); | - | ||||||||||||||||||||||||
| 2094 | d->persistent.insert(editor); | - | ||||||||||||||||||||||||
| 2095 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2096 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2097 | - | |||||||||||||||||||||||||
| 2098 | - | |||||||||||||||||||||||||
| 2099 | - | |||||||||||||||||||||||||
| 2100 | - | |||||||||||||||||||||||||
| 2101 | - | |||||||||||||||||||||||||
| 2102 | - | |||||||||||||||||||||||||
| 2103 | void QAbstractItemView::closePersistentEditor(const QModelIndex &index) | - | ||||||||||||||||||||||||
| 2104 | { | - | ||||||||||||||||||||||||
| 2105 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2106 | if (QWidget *editor = d->editorForIndex(index).widget.data()
| 0 | ||||||||||||||||||||||||
| 2107 | if (index == selectionModel()->currentIndex()
| 0 | ||||||||||||||||||||||||
| 2108 | closeEditor(editor, QAbstractItemDelegate::RevertModelCache); never executed: closeEditor(editor, QAbstractItemDelegate::RevertModelCache); | 0 | ||||||||||||||||||||||||
| 2109 | d->persistent.remove(editor); | - | ||||||||||||||||||||||||
| 2110 | d->removeEditor(editor); | - | ||||||||||||||||||||||||
| 2111 | d->releaseEditor(editor, index); | - | ||||||||||||||||||||||||
| 2112 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2113 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2114 | void QAbstractItemView::setIndexWidget(const QModelIndex &index, QWidget *widget) | - | ||||||||||||||||||||||||
| 2115 | { | - | ||||||||||||||||||||||||
| 2116 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2117 | if (!d->isIndexValid(index)
| 0 | ||||||||||||||||||||||||
| 2118 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2119 | if (indexWidget(index) == widget
| 0 | ||||||||||||||||||||||||
| 2120 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2121 | if (QWidget *oldWidget = indexWidget(index)
| 0 | ||||||||||||||||||||||||
| 2122 | d->persistent.remove(oldWidget); | - | ||||||||||||||||||||||||
| 2123 | d->removeEditor(oldWidget); | - | ||||||||||||||||||||||||
| 2124 | oldWidget->deleteLater(); | - | ||||||||||||||||||||||||
| 2125 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2126 | if (widget
| 0 | ||||||||||||||||||||||||
| 2127 | widget->setParent(viewport()); | - | ||||||||||||||||||||||||
| 2128 | d->persistent.insert(widget); | - | ||||||||||||||||||||||||
| 2129 | d->addEditor(index, widget, true); | - | ||||||||||||||||||||||||
| 2130 | widget->show(); | - | ||||||||||||||||||||||||
| 2131 | dataChanged(index, index); | - | ||||||||||||||||||||||||
| 2132 | if (!d->delayedPendingLayout
| 0 | ||||||||||||||||||||||||
| 2133 | widget->setGeometry(visualRect(index)); never executed: widget->setGeometry(visualRect(index)); | 0 | ||||||||||||||||||||||||
| 2134 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2135 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2136 | - | |||||||||||||||||||||||||
| 2137 | - | |||||||||||||||||||||||||
| 2138 | - | |||||||||||||||||||||||||
| 2139 | - | |||||||||||||||||||||||||
| 2140 | - | |||||||||||||||||||||||||
| 2141 | - | |||||||||||||||||||||||||
| 2142 | QWidget* QAbstractItemView::indexWidget(const QModelIndex &index) const | - | ||||||||||||||||||||||||
| 2143 | { | - | ||||||||||||||||||||||||
| 2144 | const QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2145 | if (d->isIndexValid(index)
| 0 | ||||||||||||||||||||||||
| 2146 | if (QWidget *editor = d->editorForIndex(index).widget.data()
| 0 | ||||||||||||||||||||||||
| 2147 | return never executed: editor;return editor;never executed: return editor; | 0 | ||||||||||||||||||||||||
| 2148 | - | |||||||||||||||||||||||||
| 2149 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 2150 | } | - | ||||||||||||||||||||||||
| 2151 | void QAbstractItemView::scrollToTop() | - | ||||||||||||||||||||||||
| 2152 | { | - | ||||||||||||||||||||||||
| 2153 | verticalScrollBar()->setValue(verticalScrollBar()->minimum()); | - | ||||||||||||||||||||||||
| 2154 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2155 | void QAbstractItemView::scrollToBottom() | - | ||||||||||||||||||||||||
| 2156 | { | - | ||||||||||||||||||||||||
| 2157 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2158 | if (d->delayedPendingLayout
| 0 | ||||||||||||||||||||||||
| 2159 | d->executePostedLayout(); | - | ||||||||||||||||||||||||
| 2160 | updateGeometries(); | - | ||||||||||||||||||||||||
| 2161 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2162 | verticalScrollBar()->setValue(verticalScrollBar()->maximum()); | - | ||||||||||||||||||||||||
| 2163 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2164 | - | |||||||||||||||||||||||||
| 2165 | - | |||||||||||||||||||||||||
| 2166 | - | |||||||||||||||||||||||||
| 2167 | - | |||||||||||||||||||||||||
| 2168 | - | |||||||||||||||||||||||||
| 2169 | - | |||||||||||||||||||||||||
| 2170 | - | |||||||||||||||||||||||||
| 2171 | void QAbstractItemView::update(const QModelIndex &index) | - | ||||||||||||||||||||||||
| 2172 | { | - | ||||||||||||||||||||||||
| 2173 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2174 | if (index.isValid()
| 0 | ||||||||||||||||||||||||
| 2175 | const QRect rect = visualRect(index); | - | ||||||||||||||||||||||||
| 2176 | - | |||||||||||||||||||||||||
| 2177 | - | |||||||||||||||||||||||||
| 2178 | - | |||||||||||||||||||||||||
| 2179 | if (d->viewport->rect().intersects(rect)
| 0 | ||||||||||||||||||||||||
| 2180 | d->viewport->update(rect); never executed: d->viewport->update(rect); | 0 | ||||||||||||||||||||||||
| 2181 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2182 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2183 | void QAbstractItemView::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles) | - | ||||||||||||||||||||||||
| 2184 | { | - | ||||||||||||||||||||||||
| 2185 | (void)roles;; | - | ||||||||||||||||||||||||
| 2186 | - | |||||||||||||||||||||||||
| 2187 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2188 | if (topLeft == bottomRight
| 0 | ||||||||||||||||||||||||
| 2189 | const QEditorInfo &editorInfo = d->editorForIndex(topLeft); | - | ||||||||||||||||||||||||
| 2190 | - | |||||||||||||||||||||||||
| 2191 | if (!editorInfo.isStatic
| 0 | ||||||||||||||||||||||||
| 2192 | QAbstractItemDelegate *delegate = d->delegateForIndex(topLeft); | - | ||||||||||||||||||||||||
| 2193 | if (delegate
| 0 | ||||||||||||||||||||||||
| 2194 | delegate->setEditorData(editorInfo.widget.data(), topLeft); | - | ||||||||||||||||||||||||
| 2195 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2196 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2197 | if (isVisible()
| 0 | ||||||||||||||||||||||||
| 2198 | - | |||||||||||||||||||||||||
| 2199 | update(topLeft); | - | ||||||||||||||||||||||||
| 2200 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2201 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 2202 | d->updateEditorData(topLeft, bottomRight); | - | ||||||||||||||||||||||||
| 2203 | if (isVisible()
| 0 | ||||||||||||||||||||||||
| 2204 | d->viewport->update(); never executed: d->viewport->update(); | 0 | ||||||||||||||||||||||||
| 2205 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2206 | - | |||||||||||||||||||||||||
| 2207 | - | |||||||||||||||||||||||||
| 2208 | if (QAccessible::isActive()
| 0 | ||||||||||||||||||||||||
| 2209 | QAccessibleTableModelChangeEvent accessibleEvent(this, QAccessibleTableModelChangeEvent::DataChanged); | - | ||||||||||||||||||||||||
| 2210 | accessibleEvent.setFirstRow(topLeft.row()); | - | ||||||||||||||||||||||||
| 2211 | accessibleEvent.setFirstColumn(topLeft.column()); | - | ||||||||||||||||||||||||
| 2212 | accessibleEvent.setLastRow(bottomRight.row()); | - | ||||||||||||||||||||||||
| 2213 | accessibleEvent.setLastColumn(bottomRight.column()); | - | ||||||||||||||||||||||||
| 2214 | QAccessible::updateAccessibility(&accessibleEvent); | - | ||||||||||||||||||||||||
| 2215 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2216 | - | |||||||||||||||||||||||||
| 2217 | d->updateGeometry(); | - | ||||||||||||||||||||||||
| 2218 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2219 | void QAbstractItemView::rowsInserted(const QModelIndex &, int, int) | - | ||||||||||||||||||||||||
| 2220 | { | - | ||||||||||||||||||||||||
| 2221 | if (!isVisible()
| 0 | ||||||||||||||||||||||||
| 2222 | d_func()->fetchMoreTimer.start(0, this); never executed: d_func()->fetchMoreTimer.start(0, this); | 0 | ||||||||||||||||||||||||
| 2223 | else | - | ||||||||||||||||||||||||
| 2224 | updateEditorGeometries(); never executed: updateEditorGeometries(); | 0 | ||||||||||||||||||||||||
| 2225 | } | - | ||||||||||||||||||||||||
| 2226 | - | |||||||||||||||||||||||||
| 2227 | - | |||||||||||||||||||||||||
| 2228 | - | |||||||||||||||||||||||||
| 2229 | - | |||||||||||||||||||||||||
| 2230 | - | |||||||||||||||||||||||||
| 2231 | - | |||||||||||||||||||||||||
| 2232 | - | |||||||||||||||||||||||||
| 2233 | void QAbstractItemView::rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end) | - | ||||||||||||||||||||||||
| 2234 | { | - | ||||||||||||||||||||||||
| 2235 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2236 | - | |||||||||||||||||||||||||
| 2237 | setState(CollapsingState); | - | ||||||||||||||||||||||||
| 2238 | - | |||||||||||||||||||||||||
| 2239 | - | |||||||||||||||||||||||||
| 2240 | QModelIndex current = currentIndex(); | - | ||||||||||||||||||||||||
| 2241 | if (d->selectionMode == SingleSelection
| 0 | ||||||||||||||||||||||||
| 2242 | && current.isValid()
| 0 | ||||||||||||||||||||||||
| 2243 | && current.row() >= start
| 0 | ||||||||||||||||||||||||
| 2244 | && current.row() <= end
| 0 | ||||||||||||||||||||||||
| 2245 | && current.parent() == parent
| 0 | ||||||||||||||||||||||||
| 2246 | int totalToRemove = end - start + 1; | - | ||||||||||||||||||||||||
| 2247 | if (d->model->rowCount(parent) <= totalToRemove
| 0 | ||||||||||||||||||||||||
| 2248 | QModelIndex index = parent; | - | ||||||||||||||||||||||||
| 2249 | while (index != d->root
| 0 | ||||||||||||||||||||||||
| 2250 | index = index.parent(); never executed: index = index.parent(); | 0 | ||||||||||||||||||||||||
| 2251 | if (index != d->root
| 0 | ||||||||||||||||||||||||
| 2252 | setCurrentIndex(index); never executed: setCurrentIndex(index); | 0 | ||||||||||||||||||||||||
| 2253 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 2254 | int row = end + 1; | - | ||||||||||||||||||||||||
| 2255 | QModelIndex next; | - | ||||||||||||||||||||||||
| 2256 | do { | - | ||||||||||||||||||||||||
| 2257 | next = d->model->index(row++, current.column(), current.parent()); | - | ||||||||||||||||||||||||
| 2258 | } never executed: while (next.isValid()end of block
| 0 | ||||||||||||||||||||||||
| 2259 | if (row > d->model->rowCount(parent)
| 0 | ||||||||||||||||||||||||
| 2260 | row = start - 1; | - | ||||||||||||||||||||||||
| 2261 | do { | - | ||||||||||||||||||||||||
| 2262 | next = d->model->index(row--, current.column(), current.parent()); | - | ||||||||||||||||||||||||
| 2263 | } never executed: while (next.isValid()end of block
| 0 | ||||||||||||||||||||||||
| 2264 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2265 | setCurrentIndex(next); | - | ||||||||||||||||||||||||
| 2266 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2267 | } | - | ||||||||||||||||||||||||
| 2268 | - | |||||||||||||||||||||||||
| 2269 | - | |||||||||||||||||||||||||
| 2270 | QEditorIndexHash::iterator i = d->editorIndexHash.begin(); | - | ||||||||||||||||||||||||
| 2271 | while (i != d->editorIndexHash.end()
| 0 | ||||||||||||||||||||||||
| 2272 | const QModelIndex index = i.value(); | - | ||||||||||||||||||||||||
| 2273 | if (index.row() >= start
| 0 | ||||||||||||||||||||||||
| 2274 | QWidget *editor = i.key(); | - | ||||||||||||||||||||||||
| 2275 | QEditorInfo info = d->indexEditorHash.take(index); | - | ||||||||||||||||||||||||
| 2276 | i = d->editorIndexHash.erase(i); | - | ||||||||||||||||||||||||
| 2277 | if (info.widget
| 0 | ||||||||||||||||||||||||
| 2278 | d->releaseEditor(editor, index); never executed: d->releaseEditor(editor, index); | 0 | ||||||||||||||||||||||||
| 2279 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 2280 | ++i; | - | ||||||||||||||||||||||||
| 2281 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2282 | } | - | ||||||||||||||||||||||||
| 2283 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2284 | void QAbstractItemViewPrivate::_q_rowsRemoved(const QModelIndex &index, int start, int end) | - | ||||||||||||||||||||||||
| 2285 | { | - | ||||||||||||||||||||||||
| 2286 | (void)index; | - | ||||||||||||||||||||||||
| 2287 | (void)start; | - | ||||||||||||||||||||||||
| 2288 | (void)end; | - | ||||||||||||||||||||||||
| 2289 | - | |||||||||||||||||||||||||
| 2290 | QAbstractItemView * const q = q_func(); | - | ||||||||||||||||||||||||
| 2291 | if (q->isVisible()
| 0 | ||||||||||||||||||||||||
| 2292 | q->updateEditorGeometries(); never executed: q->updateEditorGeometries(); | 0 | ||||||||||||||||||||||||
| 2293 | q->setState(QAbstractItemView::NoState); | - | ||||||||||||||||||||||||
| 2294 | - | |||||||||||||||||||||||||
| 2295 | if (QAccessible::isActive()
| 0 | ||||||||||||||||||||||||
| 2296 | QAccessibleTableModelChangeEvent accessibleEvent(q, QAccessibleTableModelChangeEvent::RowsRemoved); | - | ||||||||||||||||||||||||
| 2297 | accessibleEvent.setFirstRow(start); | - | ||||||||||||||||||||||||
| 2298 | accessibleEvent.setLastRow(end); | - | ||||||||||||||||||||||||
| 2299 | QAccessible::updateAccessibility(&accessibleEvent); | - | ||||||||||||||||||||||||
| 2300 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2301 | - | |||||||||||||||||||||||||
| 2302 | updateGeometry(); | - | ||||||||||||||||||||||||
| 2303 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2304 | void QAbstractItemViewPrivate::_q_columnsAboutToBeRemoved(const QModelIndex &parent, int start, int end) | - | ||||||||||||||||||||||||
| 2305 | { | - | ||||||||||||||||||||||||
| 2306 | QAbstractItemView * const q = q_func(); | - | ||||||||||||||||||||||||
| 2307 | - | |||||||||||||||||||||||||
| 2308 | q->setState(QAbstractItemView::CollapsingState); | - | ||||||||||||||||||||||||
| 2309 | - | |||||||||||||||||||||||||
| 2310 | - | |||||||||||||||||||||||||
| 2311 | QModelIndex current = q->currentIndex(); | - | ||||||||||||||||||||||||
| 2312 | if (current.isValid()
| 0 | ||||||||||||||||||||||||
| 2313 | && selectionMode == QAbstractItemView::SingleSelection
| 0 | ||||||||||||||||||||||||
| 2314 | && current.column() >= start
| 0 | ||||||||||||||||||||||||
| 2315 | && current.column() <= end
| 0 | ||||||||||||||||||||||||
| 2316 | int totalToRemove = end - start + 1; | - | ||||||||||||||||||||||||
| 2317 | if (model->columnCount(parent) < totalToRemove
| 0 | ||||||||||||||||||||||||
| 2318 | QModelIndex index = parent; | - | ||||||||||||||||||||||||
| 2319 | while (index.isValid()
| 0 | ||||||||||||||||||||||||
| 2320 | index = index.parent(); never executed: index = index.parent(); | 0 | ||||||||||||||||||||||||
| 2321 | if (index.isValid()
| 0 | ||||||||||||||||||||||||
| 2322 | q->setCurrentIndex(index); never executed: q->setCurrentIndex(index); | 0 | ||||||||||||||||||||||||
| 2323 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 2324 | int column = end; | - | ||||||||||||||||||||||||
| 2325 | QModelIndex next; | - | ||||||||||||||||||||||||
| 2326 | do { | - | ||||||||||||||||||||||||
| 2327 | next = model->index(current.row(), column++, current.parent()); | - | ||||||||||||||||||||||||
| 2328 | } never executed: while (next.isValid()end of block
| 0 | ||||||||||||||||||||||||
| 2329 | q->setCurrentIndex(next); | - | ||||||||||||||||||||||||
| 2330 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2331 | } | - | ||||||||||||||||||||||||
| 2332 | - | |||||||||||||||||||||||||
| 2333 | - | |||||||||||||||||||||||||
| 2334 | QEditorIndexHash::iterator it = editorIndexHash.begin(); | - | ||||||||||||||||||||||||
| 2335 | while (it != editorIndexHash.end()
| 0 | ||||||||||||||||||||||||
| 2336 | QModelIndex index = it.value(); | - | ||||||||||||||||||||||||
| 2337 | if (index.column() <= start
| 0 | ||||||||||||||||||||||||
| 2338 | QWidget *editor = it.key(); | - | ||||||||||||||||||||||||
| 2339 | QEditorInfo info = indexEditorHash.take(it.value()); | - | ||||||||||||||||||||||||
| 2340 | it = editorIndexHash.erase(it); | - | ||||||||||||||||||||||||
| 2341 | if (info.widget
| 0 | ||||||||||||||||||||||||
| 2342 | releaseEditor(editor, index); never executed: releaseEditor(editor, index); | 0 | ||||||||||||||||||||||||
| 2343 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 2344 | ++it; | - | ||||||||||||||||||||||||
| 2345 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2346 | } | - | ||||||||||||||||||||||||
| 2347 | - | |||||||||||||||||||||||||
| 2348 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2349 | void QAbstractItemViewPrivate::_q_columnsRemoved(const QModelIndex &index, int start, int end) | - | ||||||||||||||||||||||||
| 2350 | { | - | ||||||||||||||||||||||||
| 2351 | (void)index; | - | ||||||||||||||||||||||||
| 2352 | (void)start; | - | ||||||||||||||||||||||||
| 2353 | (void)end; | - | ||||||||||||||||||||||||
| 2354 | - | |||||||||||||||||||||||||
| 2355 | QAbstractItemView * const q = q_func(); | - | ||||||||||||||||||||||||
| 2356 | if (q->isVisible()
| 0 | ||||||||||||||||||||||||
| 2357 | q->updateEditorGeometries(); never executed: q->updateEditorGeometries(); | 0 | ||||||||||||||||||||||||
| 2358 | q->setState(QAbstractItemView::NoState); | - | ||||||||||||||||||||||||
| 2359 | - | |||||||||||||||||||||||||
| 2360 | if (QAccessible::isActive()
| 0 | ||||||||||||||||||||||||
| 2361 | QAccessibleTableModelChangeEvent accessibleEvent(q, QAccessibleTableModelChangeEvent::ColumnsRemoved); | - | ||||||||||||||||||||||||
| 2362 | accessibleEvent.setFirstColumn(start); | - | ||||||||||||||||||||||||
| 2363 | accessibleEvent.setLastColumn(end); | - | ||||||||||||||||||||||||
| 2364 | QAccessible::updateAccessibility(&accessibleEvent); | - | ||||||||||||||||||||||||
| 2365 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2366 | - | |||||||||||||||||||||||||
| 2367 | updateGeometry(); | - | ||||||||||||||||||||||||
| 2368 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2369 | - | |||||||||||||||||||||||||
| 2370 | - | |||||||||||||||||||||||||
| 2371 | - | |||||||||||||||||||||||||
| 2372 | - | |||||||||||||||||||||||||
| 2373 | - | |||||||||||||||||||||||||
| 2374 | - | |||||||||||||||||||||||||
| 2375 | - | |||||||||||||||||||||||||
| 2376 | void QAbstractItemViewPrivate::_q_rowsInserted(const QModelIndex &index, int start, int end) | - | ||||||||||||||||||||||||
| 2377 | { | - | ||||||||||||||||||||||||
| 2378 | (void)index; | - | ||||||||||||||||||||||||
| 2379 | (void)start; | - | ||||||||||||||||||||||||
| 2380 | (void)end; | - | ||||||||||||||||||||||||
| 2381 | - | |||||||||||||||||||||||||
| 2382 | - | |||||||||||||||||||||||||
| 2383 | QAbstractItemView * const q = q_func(); | - | ||||||||||||||||||||||||
| 2384 | if (QAccessible::isActive()
| 0 | ||||||||||||||||||||||||
| 2385 | QAccessibleTableModelChangeEvent accessibleEvent(q, QAccessibleTableModelChangeEvent::RowsInserted); | - | ||||||||||||||||||||||||
| 2386 | accessibleEvent.setFirstRow(start); | - | ||||||||||||||||||||||||
| 2387 | accessibleEvent.setLastRow(end); | - | ||||||||||||||||||||||||
| 2388 | QAccessible::updateAccessibility(&accessibleEvent); | - | ||||||||||||||||||||||||
| 2389 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2390 | - | |||||||||||||||||||||||||
| 2391 | updateGeometry(); | - | ||||||||||||||||||||||||
| 2392 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2393 | - | |||||||||||||||||||||||||
| 2394 | - | |||||||||||||||||||||||||
| 2395 | - | |||||||||||||||||||||||||
| 2396 | - | |||||||||||||||||||||||||
| 2397 | - | |||||||||||||||||||||||||
| 2398 | - | |||||||||||||||||||||||||
| 2399 | void QAbstractItemViewPrivate::_q_columnsInserted(const QModelIndex &index, int start, int end) | - | ||||||||||||||||||||||||
| 2400 | { | - | ||||||||||||||||||||||||
| 2401 | (void)index; | - | ||||||||||||||||||||||||
| 2402 | (void)start; | - | ||||||||||||||||||||||||
| 2403 | (void)end; | - | ||||||||||||||||||||||||
| 2404 | - | |||||||||||||||||||||||||
| 2405 | QAbstractItemView * const q = q_func(); | - | ||||||||||||||||||||||||
| 2406 | if (q->isVisible()
| 0 | ||||||||||||||||||||||||
| 2407 | q->updateEditorGeometries(); never executed: q->updateEditorGeometries(); | 0 | ||||||||||||||||||||||||
| 2408 | - | |||||||||||||||||||||||||
| 2409 | if (QAccessible::isActive()
| 0 | ||||||||||||||||||||||||
| 2410 | QAccessibleTableModelChangeEvent accessibleEvent(q, QAccessibleTableModelChangeEvent::ColumnsInserted); | - | ||||||||||||||||||||||||
| 2411 | accessibleEvent.setFirstColumn(start); | - | ||||||||||||||||||||||||
| 2412 | accessibleEvent.setLastColumn(end); | - | ||||||||||||||||||||||||
| 2413 | QAccessible::updateAccessibility(&accessibleEvent); | - | ||||||||||||||||||||||||
| 2414 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2415 | - | |||||||||||||||||||||||||
| 2416 | updateGeometry(); | - | ||||||||||||||||||||||||
| 2417 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2418 | - | |||||||||||||||||||||||||
| 2419 | - | |||||||||||||||||||||||||
| 2420 | - | |||||||||||||||||||||||||
| 2421 | - | |||||||||||||||||||||||||
| 2422 | void QAbstractItemViewPrivate::_q_modelDestroyed() | - | ||||||||||||||||||||||||
| 2423 | { | - | ||||||||||||||||||||||||
| 2424 | model = QAbstractItemModelPrivate::staticEmptyModel(); | - | ||||||||||||||||||||||||
| 2425 | doDelayedReset(); | - | ||||||||||||||||||||||||
| 2426 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2427 | - | |||||||||||||||||||||||||
| 2428 | - | |||||||||||||||||||||||||
| 2429 | - | |||||||||||||||||||||||||
| 2430 | - | |||||||||||||||||||||||||
| 2431 | - | |||||||||||||||||||||||||
| 2432 | - | |||||||||||||||||||||||||
| 2433 | void QAbstractItemViewPrivate::_q_layoutChanged() | - | ||||||||||||||||||||||||
| 2434 | { | - | ||||||||||||||||||||||||
| 2435 | doDelayedItemsLayout(); | - | ||||||||||||||||||||||||
| 2436 | - | |||||||||||||||||||||||||
| 2437 | QAbstractItemView * const q = q_func(); | - | ||||||||||||||||||||||||
| 2438 | if (QAccessible::isActive()
| 0 | ||||||||||||||||||||||||
| 2439 | QAccessibleTableModelChangeEvent accessibleEvent(q, QAccessibleTableModelChangeEvent::ModelReset); | - | ||||||||||||||||||||||||
| 2440 | QAccessible::updateAccessibility(&accessibleEvent); | - | ||||||||||||||||||||||||
| 2441 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2442 | - | |||||||||||||||||||||||||
| 2443 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2444 | - | |||||||||||||||||||||||||
| 2445 | void QAbstractItemViewPrivate::_q_rowsMoved(const QModelIndex &, int, int, const QModelIndex &, int) | - | ||||||||||||||||||||||||
| 2446 | { | - | ||||||||||||||||||||||||
| 2447 | _q_layoutChanged(); | - | ||||||||||||||||||||||||
| 2448 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2449 | - | |||||||||||||||||||||||||
| 2450 | void QAbstractItemViewPrivate::_q_columnsMoved(const QModelIndex &, int, int, const QModelIndex &, int) | - | ||||||||||||||||||||||||
| 2451 | { | - | ||||||||||||||||||||||||
| 2452 | _q_layoutChanged(); | - | ||||||||||||||||||||||||
| 2453 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2454 | void QAbstractItemView::selectionChanged(const QItemSelection &selected, | - | ||||||||||||||||||||||||
| 2455 | const QItemSelection &deselected) | - | ||||||||||||||||||||||||
| 2456 | { | - | ||||||||||||||||||||||||
| 2457 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2458 | if (isVisible()
| 0 | ||||||||||||||||||||||||
| 2459 | d->viewport->update(visualRegionForSelection(deselected) | visualRegionForSelection(selected)); | - | ||||||||||||||||||||||||
| 2460 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2461 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2462 | void QAbstractItemView::currentChanged(const QModelIndex ¤t, const QModelIndex &previous) | - | ||||||||||||||||||||||||
| 2463 | { | - | ||||||||||||||||||||||||
| 2464 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2465 | ((!(d->model)) ? qt_assert("d->model",__FILE__,3623) : qt_noop()); | - | ||||||||||||||||||||||||
| 2466 | - | |||||||||||||||||||||||||
| 2467 | if (previous.isValid()
| 0 | ||||||||||||||||||||||||
| 2468 | QModelIndex buddy = d->model->buddy(previous); | - | ||||||||||||||||||||||||
| 2469 | QWidget *editor = d->editorForIndex(buddy).widget.data(); | - | ||||||||||||||||||||||||
| 2470 | if (editor
| 0 | ||||||||||||||||||||||||
| 2471 | commitData(editor); | - | ||||||||||||||||||||||||
| 2472 | if (current.row() != previous.row()
| 0 | ||||||||||||||||||||||||
| 2473 | closeEditor(editor, QAbstractItemDelegate::SubmitModelCache); never executed: closeEditor(editor, QAbstractItemDelegate::SubmitModelCache); | 0 | ||||||||||||||||||||||||
| 2474 | else | - | ||||||||||||||||||||||||
| 2475 | closeEditor(editor, QAbstractItemDelegate::NoHint); never executed: closeEditor(editor, QAbstractItemDelegate::NoHint); | 0 | ||||||||||||||||||||||||
| 2476 | } | - | ||||||||||||||||||||||||
| 2477 | if (isVisible()
| 0 | ||||||||||||||||||||||||
| 2478 | update(previous); | - | ||||||||||||||||||||||||
| 2479 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2480 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2481 | - | |||||||||||||||||||||||||
| 2482 | if (current.isValid()
| 0 | ||||||||||||||||||||||||
| 2483 | if (isVisible()
| 0 | ||||||||||||||||||||||||
| 2484 | if (d->autoScroll
| 0 | ||||||||||||||||||||||||
| 2485 | scrollTo(current); never executed: scrollTo(current); | 0 | ||||||||||||||||||||||||
| 2486 | update(current); | - | ||||||||||||||||||||||||
| 2487 | edit(current, CurrentChanged, 0); | - | ||||||||||||||||||||||||
| 2488 | if (current.row() == (d->model->rowCount(d->root) - 1)
| 0 | ||||||||||||||||||||||||
| 2489 | d->fetchMore(); never executed: d->fetchMore(); | 0 | ||||||||||||||||||||||||
| 2490 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 2491 | d->shouldScrollToCurrentOnShow = d->autoScroll; | - | ||||||||||||||||||||||||
| 2492 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2493 | } | - | ||||||||||||||||||||||||
| 2494 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2495 | - | |||||||||||||||||||||||||
| 2496 | - | |||||||||||||||||||||||||
| 2497 | - | |||||||||||||||||||||||||
| 2498 | - | |||||||||||||||||||||||||
| 2499 | - | |||||||||||||||||||||||||
| 2500 | void QAbstractItemView::startDrag(Qt::DropActions supportedActions) | - | ||||||||||||||||||||||||
| 2501 | { | - | ||||||||||||||||||||||||
| 2502 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2503 | QModelIndexList indexes = d->selectedDraggableIndexes(); | - | ||||||||||||||||||||||||
| 2504 | if (indexes.count() > 0
| 0 | ||||||||||||||||||||||||
| 2505 | QMimeData *data = d->model->mimeData(indexes); | - | ||||||||||||||||||||||||
| 2506 | if (!data
| 0 | ||||||||||||||||||||||||
| 2507 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2508 | QRect rect; | - | ||||||||||||||||||||||||
| 2509 | QPixmap pixmap = d->renderToPixmap(indexes, &rect); | - | ||||||||||||||||||||||||
| 2510 | rect.adjust(horizontalOffset(), verticalOffset(), 0, 0); | - | ||||||||||||||||||||||||
| 2511 | QDrag *drag = new QDrag(this); | - | ||||||||||||||||||||||||
| 2512 | drag->setPixmap(pixmap); | - | ||||||||||||||||||||||||
| 2513 | drag->setMimeData(data); | - | ||||||||||||||||||||||||
| 2514 | drag->setHotSpot(d->pressedPosition - rect.topLeft()); | - | ||||||||||||||||||||||||
| 2515 | Qt::DropAction defaultDropAction = Qt::IgnoreAction; | - | ||||||||||||||||||||||||
| 2516 | if (d->defaultDropAction != Qt::IgnoreAction
| 0 | ||||||||||||||||||||||||
| 2517 | defaultDropAction = d->defaultDropAction; never executed: defaultDropAction = d->defaultDropAction; | 0 | ||||||||||||||||||||||||
| 2518 | else if (supportedActions & Qt::CopyAction
| 0 | ||||||||||||||||||||||||
| 2519 | defaultDropAction = Qt::CopyAction; never executed: defaultDropAction = Qt::CopyAction; | 0 | ||||||||||||||||||||||||
| 2520 | if (drag->exec(supportedActions, defaultDropAction) == Qt::MoveAction
| 0 | ||||||||||||||||||||||||
| 2521 | d->clearOrRemove(); never executed: d->clearOrRemove(); | 0 | ||||||||||||||||||||||||
| 2522 | - | |||||||||||||||||||||||||
| 2523 | d->dropIndicatorRect = QRect(); | - | ||||||||||||||||||||||||
| 2524 | d->dropIndicatorPosition = OnItem; | - | ||||||||||||||||||||||||
| 2525 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2526 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2527 | - | |||||||||||||||||||||||||
| 2528 | - | |||||||||||||||||||||||||
| 2529 | - | |||||||||||||||||||||||||
| 2530 | - | |||||||||||||||||||||||||
| 2531 | - | |||||||||||||||||||||||||
| 2532 | - | |||||||||||||||||||||||||
| 2533 | QStyleOptionViewItem QAbstractItemView::viewOptions() const | - | ||||||||||||||||||||||||
| 2534 | { | - | ||||||||||||||||||||||||
| 2535 | const QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2536 | QStyleOptionViewItem option; | - | ||||||||||||||||||||||||
| 2537 | option.init(this); | - | ||||||||||||||||||||||||
| 2538 | option.state &= ~QStyle::State_MouseOver; | - | ||||||||||||||||||||||||
| 2539 | option.font = font(); | - | ||||||||||||||||||||||||
| 2540 | - | |||||||||||||||||||||||||
| 2541 | - | |||||||||||||||||||||||||
| 2542 | - | |||||||||||||||||||||||||
| 2543 | - | |||||||||||||||||||||||||
| 2544 | if (!hasFocus()
| 0 | ||||||||||||||||||||||||
| 2545 | option.state &= ~QStyle::State_Active; never executed: option.state &= ~QStyle::State_Active; | 0 | ||||||||||||||||||||||||
| 2546 | - | |||||||||||||||||||||||||
| 2547 | - | |||||||||||||||||||||||||
| 2548 | option.state &= ~QStyle::State_HasFocus; | - | ||||||||||||||||||||||||
| 2549 | if (d->iconSize.isValid()
| 0 | ||||||||||||||||||||||||
| 2550 | option.decorationSize = d->iconSize; | - | ||||||||||||||||||||||||
| 2551 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 2552 | int pm = style()->pixelMetric(QStyle::PM_SmallIconSize, 0, this); | - | ||||||||||||||||||||||||
| 2553 | option.decorationSize = QSize(pm, pm); | - | ||||||||||||||||||||||||
| 2554 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2555 | option.decorationPosition = QStyleOptionViewItem::Left; | - | ||||||||||||||||||||||||
| 2556 | option.decorationAlignment = Qt::AlignCenter; | - | ||||||||||||||||||||||||
| 2557 | option.displayAlignment = Qt::AlignLeft|Qt::AlignVCenter; | - | ||||||||||||||||||||||||
| 2558 | option.textElideMode = d->textElideMode; | - | ||||||||||||||||||||||||
| 2559 | option.rect = QRect(); | - | ||||||||||||||||||||||||
| 2560 | option.showDecorationSelected = style()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected, 0, this); | - | ||||||||||||||||||||||||
| 2561 | if (d->wrapItemText
| 0 | ||||||||||||||||||||||||
| 2562 | option.features = QStyleOptionViewItem::WrapText; never executed: option.features = QStyleOptionViewItem::WrapText; | 0 | ||||||||||||||||||||||||
| 2563 | option.locale = locale(); | - | ||||||||||||||||||||||||
| 2564 | option.locale.setNumberOptions(QLocale::OmitGroupSeparator); | - | ||||||||||||||||||||||||
| 2565 | option.widget = this; | - | ||||||||||||||||||||||||
| 2566 | return never executed: option;return option;never executed: return option; | 0 | ||||||||||||||||||||||||
| 2567 | } | - | ||||||||||||||||||||||||
| 2568 | - | |||||||||||||||||||||||||
| 2569 | QStyleOptionViewItem QAbstractItemViewPrivate::viewOptionsV1() const | - | ||||||||||||||||||||||||
| 2570 | { | - | ||||||||||||||||||||||||
| 2571 | const QAbstractItemView * const q = q_func(); | - | ||||||||||||||||||||||||
| 2572 | return never executed: q->viewOptions();return q->viewOptions();never executed: return q->viewOptions(); | 0 | ||||||||||||||||||||||||
| 2573 | } | - | ||||||||||||||||||||||||
| 2574 | - | |||||||||||||||||||||||||
| 2575 | - | |||||||||||||||||||||||||
| 2576 | - | |||||||||||||||||||||||||
| 2577 | - | |||||||||||||||||||||||||
| 2578 | - | |||||||||||||||||||||||||
| 2579 | - | |||||||||||||||||||||||||
| 2580 | QAbstractItemView::State QAbstractItemView::state() const | - | ||||||||||||||||||||||||
| 2581 | { | - | ||||||||||||||||||||||||
| 2582 | const QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2583 | return never executed: d->state;return d->state;never executed: return d->state; | 0 | ||||||||||||||||||||||||
| 2584 | } | - | ||||||||||||||||||||||||
| 2585 | - | |||||||||||||||||||||||||
| 2586 | - | |||||||||||||||||||||||||
| 2587 | - | |||||||||||||||||||||||||
| 2588 | - | |||||||||||||||||||||||||
| 2589 | - | |||||||||||||||||||||||||
| 2590 | - | |||||||||||||||||||||||||
| 2591 | void QAbstractItemView::setState(State state) | - | ||||||||||||||||||||||||
| 2592 | { | - | ||||||||||||||||||||||||
| 2593 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2594 | d->state = state; | - | ||||||||||||||||||||||||
| 2595 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2596 | void QAbstractItemView::scheduleDelayedItemsLayout() | - | ||||||||||||||||||||||||
| 2597 | { | - | ||||||||||||||||||||||||
| 2598 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2599 | d->doDelayedItemsLayout(); | - | ||||||||||||||||||||||||
| 2600 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2601 | - | |||||||||||||||||||||||||
| 2602 | - | |||||||||||||||||||||||||
| 2603 | - | |||||||||||||||||||||||||
| 2604 | - | |||||||||||||||||||||||||
| 2605 | - | |||||||||||||||||||||||||
| 2606 | - | |||||||||||||||||||||||||
| 2607 | - | |||||||||||||||||||||||||
| 2608 | void QAbstractItemView::executeDelayedItemsLayout() | - | ||||||||||||||||||||||||
| 2609 | { | - | ||||||||||||||||||||||||
| 2610 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2611 | d->executePostedLayout(); | - | ||||||||||||||||||||||||
| 2612 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2613 | void QAbstractItemView::setDirtyRegion(const QRegion ®ion) | - | ||||||||||||||||||||||||
| 2614 | { | - | ||||||||||||||||||||||||
| 2615 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2616 | d->setDirtyRegion(region); | - | ||||||||||||||||||||||||
| 2617 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2618 | void QAbstractItemView::scrollDirtyRegion(int dx, int dy) | - | ||||||||||||||||||||||||
| 2619 | { | - | ||||||||||||||||||||||||
| 2620 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2621 | d->scrollDirtyRegion(dx, dy); | - | ||||||||||||||||||||||||
| 2622 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2623 | QPoint QAbstractItemView::dirtyRegionOffset() const | - | ||||||||||||||||||||||||
| 2624 | { | - | ||||||||||||||||||||||||
| 2625 | const QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2626 | return never executed: d->scrollDelayOffset;return d->scrollDelayOffset;never executed: return d->scrollDelayOffset; | 0 | ||||||||||||||||||||||||
| 2627 | } | - | ||||||||||||||||||||||||
| 2628 | - | |||||||||||||||||||||||||
| 2629 | - | |||||||||||||||||||||||||
| 2630 | - | |||||||||||||||||||||||||
| 2631 | - | |||||||||||||||||||||||||
| 2632 | void QAbstractItemView::startAutoScroll() | - | ||||||||||||||||||||||||
| 2633 | { | - | ||||||||||||||||||||||||
| 2634 | d_func()->startAutoScroll(); | - | ||||||||||||||||||||||||
| 2635 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2636 | - | |||||||||||||||||||||||||
| 2637 | - | |||||||||||||||||||||||||
| 2638 | - | |||||||||||||||||||||||||
| 2639 | - | |||||||||||||||||||||||||
| 2640 | void QAbstractItemView::stopAutoScroll() | - | ||||||||||||||||||||||||
| 2641 | { | - | ||||||||||||||||||||||||
| 2642 | d_func()->stopAutoScroll(); | - | ||||||||||||||||||||||||
| 2643 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2644 | - | |||||||||||||||||||||||||
| 2645 | - | |||||||||||||||||||||||||
| 2646 | - | |||||||||||||||||||||||||
| 2647 | - | |||||||||||||||||||||||||
| 2648 | void QAbstractItemView::doAutoScroll() | - | ||||||||||||||||||||||||
| 2649 | { | - | ||||||||||||||||||||||||
| 2650 | - | |||||||||||||||||||||||||
| 2651 | QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2652 | QScrollBar *verticalScroll = verticalScrollBar(); | - | ||||||||||||||||||||||||
| 2653 | QScrollBar *horizontalScroll = horizontalScrollBar(); | - | ||||||||||||||||||||||||
| 2654 | - | |||||||||||||||||||||||||
| 2655 | - | |||||||||||||||||||||||||
| 2656 | - | |||||||||||||||||||||||||
| 2657 | QHeaderView *hv = qobject_cast<QHeaderView*>(this); | - | ||||||||||||||||||||||||
| 2658 | if (hv
| 0 | ||||||||||||||||||||||||
| 2659 | QAbstractScrollArea *parent = qobject_cast<QAbstractScrollArea*>(parentWidget()); | - | ||||||||||||||||||||||||
| 2660 | if (parent
| 0 | ||||||||||||||||||||||||
| 2661 | if (hv->orientation() == Qt::Horizontal
| 0 | ||||||||||||||||||||||||
| 2662 | if (!hv->horizontalScrollBar()
| 0 | ||||||||||||||||||||||||
| 2663 | horizontalScroll = parent->horizontalScrollBar(); never executed: horizontalScroll = parent->horizontalScrollBar(); | 0 | ||||||||||||||||||||||||
| 2664 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 2665 | if (!hv->verticalScrollBar()
| 0 | ||||||||||||||||||||||||
| 2666 | verticalScroll = parent->verticalScrollBar(); never executed: verticalScroll = parent->verticalScrollBar(); | 0 | ||||||||||||||||||||||||
| 2667 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2668 | } | - | ||||||||||||||||||||||||
| 2669 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2670 | - | |||||||||||||||||||||||||
| 2671 | int verticalStep = verticalScroll->pageStep(); | - | ||||||||||||||||||||||||
| 2672 | int horizontalStep = horizontalScroll->pageStep(); | - | ||||||||||||||||||||||||
| 2673 | if (d->autoScrollCount < qMax(verticalStep, horizontalStep)
| 0 | ||||||||||||||||||||||||
| 2674 | ++ never executed: d->autoScrollCount;++d->autoScrollCount;never executed: ++d->autoScrollCount; | 0 | ||||||||||||||||||||||||
| 2675 | - | |||||||||||||||||||||||||
| 2676 | int margin = d->autoScrollMargin; | - | ||||||||||||||||||||||||
| 2677 | int verticalValue = verticalScroll->value(); | - | ||||||||||||||||||||||||
| 2678 | int horizontalValue = horizontalScroll->value(); | - | ||||||||||||||||||||||||
| 2679 | - | |||||||||||||||||||||||||
| 2680 | QPoint pos = d->viewport->mapFromGlobal(QCursor::pos()); | - | ||||||||||||||||||||||||
| 2681 | QRect area = QWidgetPrivate::get(d->viewport)->clipRect(); | - | ||||||||||||||||||||||||
| 2682 | - | |||||||||||||||||||||||||
| 2683 | - | |||||||||||||||||||||||||
| 2684 | if (pos.y() - area.top() < margin
| 0 | ||||||||||||||||||||||||
| 2685 | verticalScroll->setValue(verticalValue - d->autoScrollCount); never executed: verticalScroll->setValue(verticalValue - d->autoScrollCount); | 0 | ||||||||||||||||||||||||
| 2686 | else if (area.bottom() - pos.y() < margin
| 0 | ||||||||||||||||||||||||
| 2687 | verticalScroll->setValue(verticalValue + d->autoScrollCount); never executed: verticalScroll->setValue(verticalValue + d->autoScrollCount); | 0 | ||||||||||||||||||||||||
| 2688 | if (pos.x() - area.left() < margin
| 0 | ||||||||||||||||||||||||
| 2689 | horizontalScroll->setValue(horizontalValue - d->autoScrollCount); never executed: horizontalScroll->setValue(horizontalValue - d->autoScrollCount); | 0 | ||||||||||||||||||||||||
| 2690 | else if (area.right() - pos.x() < margin
| 0 | ||||||||||||||||||||||||
| 2691 | horizontalScroll->setValue(horizontalValue + d->autoScrollCount); never executed: horizontalScroll->setValue(horizontalValue + d->autoScrollCount); | 0 | ||||||||||||||||||||||||
| 2692 | - | |||||||||||||||||||||||||
| 2693 | bool verticalUnchanged = (verticalValue == verticalScroll->value()); | - | ||||||||||||||||||||||||
| 2694 | bool horizontalUnchanged = (horizontalValue == horizontalScroll->value()); | - | ||||||||||||||||||||||||
| 2695 | if (verticalUnchanged
| 0 | ||||||||||||||||||||||||
| 2696 | stopAutoScroll(); | - | ||||||||||||||||||||||||
| 2697 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 2698 | - | |||||||||||||||||||||||||
| 2699 | d->dropIndicatorRect = QRect(); | - | ||||||||||||||||||||||||
| 2700 | d->dropIndicatorPosition = QAbstractItemView::OnViewport; | - | ||||||||||||||||||||||||
| 2701 | - | |||||||||||||||||||||||||
| 2702 | d->viewport->update(); | - | ||||||||||||||||||||||||
| 2703 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2704 | } | - | ||||||||||||||||||||||||
| 2705 | QItemSelectionModel::SelectionFlags QAbstractItemView::selectionCommand(const QModelIndex &index, | - | ||||||||||||||||||||||||
| 2706 | const QEvent *event) const | - | ||||||||||||||||||||||||
| 2707 | { | - | ||||||||||||||||||||||||
| 2708 | const QAbstractItemViewPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 2709 | Qt::KeyboardModifiers keyModifiers = Qt::NoModifier; | - | ||||||||||||||||||||||||
| 2710 | if (event
| 0 | ||||||||||||||||||||||||
| 2711 | switch (event->type()) { | - | ||||||||||||||||||||||||
| 2712 | case never executed: QEvent::MouseButtonDblClick:case QEvent::MouseButtonDblClick:never executed: case QEvent::MouseButtonDblClick: | 0 | ||||||||||||||||||||||||
| 2713 | case never executed: QEvent::MouseButtonPress:case QEvent::MouseButtonPress:never executed: case QEvent::MouseButtonPress: | 0 | ||||||||||||||||||||||||
| 2714 | case never executed: QEvent::MouseButtonRelease:case QEvent::MouseButtonRelease:never executed: case QEvent::MouseButtonRelease: | 0 | ||||||||||||||||||||||||
| 2715 | case never executed: QEvent::MouseMove:case QEvent::MouseMove:never executed: case QEvent::MouseMove: | 0 | ||||||||||||||||||||||||
| 2716 | case never executed: QEvent::KeyPress:case QEvent::KeyPress:never executed: case QEvent::KeyPress: | 0 | ||||||||||||||||||||||||
| 2717 | case never executed: QEvent::KeyRelease:case QEvent::KeyRelease:never executed: case QEvent::KeyRelease: | 0 | ||||||||||||||||||||||||
| 2718 | keyModifiers = (static_cast<const QInputEvent*>(event))->modifiers(); | - | ||||||||||||||||||||||||
| 2719 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2720 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||
| 2721 | keyModifiers = QApplication::keyboardModifiers(); | - | ||||||||||||||||||||||||
| 2722 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2723 | } | - | ||||||||||||||||||||||||
| 2724 | switch (d->selectionMode) { | - | ||||||||||||||||||||||||
| 2725 | case never executed: NoSelection:case NoSelection:never executed: case NoSelection: | 0 | ||||||||||||||||||||||||
| 2726 | return never executed: QItemSelectionModel::NoUpdate;return QItemSelectionModel::NoUpdate;never executed: return QItemSelectionModel::NoUpdate; | 0 | ||||||||||||||||||||||||
| 2727 | case never executed: SingleSelection:case SingleSelection:never executed: case SingleSelection: | 0 | ||||||||||||||||||||||||
| 2728 | if (event
| 0 | ||||||||||||||||||||||||
| 2729 | return never executed: QItemSelectionModel::NoUpdate;return QItemSelectionModel::NoUpdate;never executed: return QItemSelectionModel::NoUpdate; | 0 | ||||||||||||||||||||||||
| 2730 | if ((
| 0 | ||||||||||||||||||||||||
| 2731 | return never executed: QItemSelectionModel::Deselect | d->selectionBehaviorFlags();return QItemSelectionModel::Deselect | d->selectionBehaviorFlags();never executed: return QItemSelectionModel::Deselect | d->selectionBehaviorFlags(); | 0 | ||||||||||||||||||||||||
| 2732 | else | - | ||||||||||||||||||||||||
| 2733 | return never executed: QItemSelectionModel::ClearAndSelect | d->selectionBehaviorFlags();return QItemSelectionModel::ClearAndSelect | d->selectionBehaviorFlags();never executed: return QItemSelectionModel::ClearAndSelect | d->selectionBehaviorFlags(); | 0 | ||||||||||||||||||||||||
| 2734 | case never executed: MultiSelection:case MultiSelection:never executed: case MultiSelection: | 0 | ||||||||||||||||||||||||
| 2735 | return never executed: d->multiSelectionCommand(index, event);return d->multiSelectionCommand(index, event);never executed: return d->multiSelectionCommand(index, event); | 0 | ||||||||||||||||||||||||
| 2736 | case never executed: ExtendedSelection:case ExtendedSelection:never executed: case ExtendedSelection: | 0 | ||||||||||||||||||||||||
| 2737 | return never executed: d->extendedSelectionCommand(index, event);return d->extendedSelectionCommand(index, event);never executed: return d->extendedSelectionCommand(index, event); | 0 | ||||||||||||||||||||||||
| 2738 | case never executed: ContiguousSelection:case ContiguousSelection:never executed: case ContiguousSelection: | 0 | ||||||||||||||||||||||||
| 2739 | return never executed: d->contiguousSelectionCommand(index, event);return d->contiguousSelectionCommand(index, event);never executed: return d->contiguousSelectionCommand(index, event); | 0 | ||||||||||||||||||||||||
| 2740 | } | - | ||||||||||||||||||||||||
| 2741 | return never executed: QItemSelectionModel::NoUpdate;return QItemSelectionModel::NoUpdate;never executed: return QItemSelectionModel::NoUpdate; | 0 | ||||||||||||||||||||||||
| 2742 | } | - | ||||||||||||||||||||||||
| 2743 | - | |||||||||||||||||||||||||
| 2744 | QItemSelectionModel::SelectionFlags QAbstractItemViewPrivate::multiSelectionCommand( | - | ||||||||||||||||||||||||
| 2745 | const QModelIndex &index, const QEvent *event) const | - | ||||||||||||||||||||||||
| 2746 | { | - | ||||||||||||||||||||||||
| 2747 | (void)index; | - | ||||||||||||||||||||||||
| 2748 | - | |||||||||||||||||||||||||
| 2749 | if (event
| 0 | ||||||||||||||||||||||||
| 2750 | switch (event->type()) { | - | ||||||||||||||||||||||||
| 2751 | case never executed: QEvent::KeyPress:case QEvent::KeyPress:never executed: case QEvent::KeyPress: | 0 | ||||||||||||||||||||||||
| 2752 | if (static_cast<const
| 0 | ||||||||||||||||||||||||
| 2753 | || static_cast<const
| 0 | ||||||||||||||||||||||||
| 2754 | return never executed: QItemSelectionModel::Toggle|selectionBehaviorFlags();return QItemSelectionModel::Toggle|selectionBehaviorFlags();never executed: return QItemSelectionModel::Toggle|selectionBehaviorFlags(); | 0 | ||||||||||||||||||||||||
| 2755 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2756 | case never executed: QEvent::MouseButtonPress:case QEvent::MouseButtonPress:never executed: case QEvent::MouseButtonPress: | 0 | ||||||||||||||||||||||||
| 2757 | if (static_cast<const
| 0 | ||||||||||||||||||||||||
| 2758 | return never executed: QItemSelectionModel::Toggle|selectionBehaviorFlags();return QItemSelectionModel::Toggle|selectionBehaviorFlags();never executed: return QItemSelectionModel::Toggle|selectionBehaviorFlags(); | 0 | ||||||||||||||||||||||||
| 2759 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2760 | case never executed: QEvent::MouseButtonRelease:case QEvent::MouseButtonRelease:never executed: case QEvent::MouseButtonRelease: | 0 | ||||||||||||||||||||||||
| 2761 | if (static_cast<const
| 0 | ||||||||||||||||||||||||
| 2762 | return never executed: QItemSelectionModel::NoUpdate|selectionBehaviorFlags();return QItemSelectionModel::NoUpdate|selectionBehaviorFlags();never executed: return QItemSelectionModel::NoUpdate|selectionBehaviorFlags(); | 0 | ||||||||||||||||||||||||
| 2763 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2764 | case never executed: QEvent::MouseMove:case QEvent::MouseMove:never executed: case QEvent::MouseMove: | 0 | ||||||||||||||||||||||||
| 2765 | if (static_cast<const
| 0 | ||||||||||||||||||||||||
| 2766 | return never executed: QItemSelectionModel::ToggleCurrent|selectionBehaviorFlags();return QItemSelectionModel::ToggleCurrent|selectionBehaviorFlags();never executed: return QItemSelectionModel::ToggleCurrent|selectionBehaviorFlags(); | 0 | ||||||||||||||||||||||||
| 2767 | default never executed: :default:never executed: default:code before this statement never executed: default: | 0 | ||||||||||||||||||||||||
| 2768 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2769 | } | - | ||||||||||||||||||||||||
| 2770 | return never executed: QItemSelectionModel::NoUpdate;return QItemSelectionModel::NoUpdate;never executed: return QItemSelectionModel::NoUpdate; | 0 | ||||||||||||||||||||||||
| 2771 | } | - | ||||||||||||||||||||||||
| 2772 | - | |||||||||||||||||||||||||
| 2773 | return never executed: QItemSelectionModel::Toggle|selectionBehaviorFlags();return QItemSelectionModel::Toggle|selectionBehaviorFlags();never executed: return QItemSelectionModel::Toggle|selectionBehaviorFlags(); | 0 | ||||||||||||||||||||||||
| 2774 | } | - | ||||||||||||||||||||||||
| 2775 | - | |||||||||||||||||||||||||
| 2776 | QItemSelectionModel::SelectionFlags QAbstractItemViewPrivate::extendedSelectionCommand( | - | ||||||||||||||||||||||||
| 2777 | const QModelIndex &index, const QEvent *event) const | - | ||||||||||||||||||||||||
| 2778 | { | - | ||||||||||||||||||||||||
| 2779 | Qt::KeyboardModifiers modifiers = QApplication::keyboardModifiers(); | - | ||||||||||||||||||||||||
| 2780 | if (event
| 0 | ||||||||||||||||||||||||
| 2781 | switch (event->type()) { | - | ||||||||||||||||||||||||
| 2782 | case never executed: QEvent::MouseMove:case QEvent::MouseMove:never executed: {case QEvent::MouseMove: | 0 | ||||||||||||||||||||||||
| 2783 | - | |||||||||||||||||||||||||
| 2784 | modifiers = static_cast<const QMouseEvent*>(event)->modifiers(); | - | ||||||||||||||||||||||||
| 2785 | if (modifiers & Qt::ControlModifier
| 0 | ||||||||||||||||||||||||
| 2786 | return never executed: QItemSelectionModel::ToggleCurrent|selectionBehaviorFlags();return QItemSelectionModel::ToggleCurrent|selectionBehaviorFlags();never executed: return QItemSelectionModel::ToggleCurrent|selectionBehaviorFlags(); | 0 | ||||||||||||||||||||||||
| 2787 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2788 | } | - | ||||||||||||||||||||||||
| 2789 | case never executed: QEvent::MouseButtonPress:case QEvent::MouseButtonPress:never executed: {case QEvent::MouseButtonPress: | 0 | ||||||||||||||||||||||||
| 2790 | modifiers = static_cast<const QMouseEvent*>(event)->modifiers(); | - | ||||||||||||||||||||||||
| 2791 | const Qt::MouseButton button = static_cast<const QMouseEvent*>(event)->button(); | - | ||||||||||||||||||||||||
| 2792 | const bool rightButtonPressed = button & Qt::RightButton; | - | ||||||||||||||||||||||||
| 2793 | const bool shiftKeyPressed = modifiers & Qt::ShiftModifier; | - | ||||||||||||||||||||||||
| 2794 | const bool controlKeyPressed = modifiers & Qt::ControlModifier; | - | ||||||||||||||||||||||||
| 2795 | const bool indexIsSelected = selectionModel->isSelected(index); | - | ||||||||||||||||||||||||
| 2796 | if ((shiftKeyPressed
| 0 | ||||||||||||||||||||||||
| 2797 | return never executed: QItemSelectionModel::NoUpdate;return QItemSelectionModel::NoUpdate;never executed: return QItemSelectionModel::NoUpdate; | 0 | ||||||||||||||||||||||||
| 2798 | if (!shiftKeyPressed
| 0 | ||||||||||||||||||||||||
| 2799 | return never executed: QItemSelectionModel::NoUpdate;return QItemSelectionModel::NoUpdate;never executed: return QItemSelectionModel::NoUpdate; | 0 | ||||||||||||||||||||||||
| 2800 | if (!index.isValid()
| 0 | ||||||||||||||||||||||||
| 2801 | return never executed: QItemSelectionModel::Clear;return QItemSelectionModel::Clear;never executed: return QItemSelectionModel::Clear; | 0 | ||||||||||||||||||||||||
| 2802 | if (!index.isValid()
| 0 | ||||||||||||||||||||||||
| 2803 | return never executed: QItemSelectionModel::NoUpdate;return QItemSelectionModel::NoUpdate;never executed: return QItemSelectionModel::NoUpdate; | 0 | ||||||||||||||||||||||||
| 2804 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2805 | } | - | ||||||||||||||||||||||||
| 2806 | case never executed: QEvent::MouseButtonRelease:case QEvent::MouseButtonRelease:never executed: {case QEvent::MouseButtonRelease: | 0 | ||||||||||||||||||||||||
| 2807 | - | |||||||||||||||||||||||||
| 2808 | modifiers = static_cast<const QMouseEvent*>(event)->modifiers(); | - | ||||||||||||||||||||||||
| 2809 | const Qt::MouseButton button = static_cast<const QMouseEvent*>(event)->button(); | - | ||||||||||||||||||||||||
| 2810 | const bool rightButtonPressed = button & Qt::RightButton; | - | ||||||||||||||||||||||||
| 2811 | const bool shiftKeyPressed = modifiers & Qt::ShiftModifier; | - | ||||||||||||||||||||||||
| 2812 | const bool controlKeyPressed = modifiers & Qt::ControlModifier; | - | ||||||||||||||||||||||||
| 2813 | if (((index == pressedIndex
| 0 | ||||||||||||||||||||||||
| 2814 | || !index.isValid()
| 0 | ||||||||||||||||||||||||
| 2815 | && !shiftKeyPressed
| 0 | ||||||||||||||||||||||||
| 2816 | return never executed: QItemSelectionModel::ClearAndSelect|selectionBehaviorFlags();return QItemSelectionModel::ClearAndSelect|selectionBehaviorFlags();never executed: return QItemSelectionModel::ClearAndSelect|selectionBehaviorFlags(); | 0 | ||||||||||||||||||||||||
| 2817 | return never executed: QItemSelectionModel::NoUpdate;return QItemSelectionModel::NoUpdate;never executed: return QItemSelectionModel::NoUpdate; | 0 | ||||||||||||||||||||||||
| 2818 | } | - | ||||||||||||||||||||||||
| 2819 | case never executed: QEvent::KeyPress:case QEvent::KeyPress:never executed: {case QEvent::KeyPress: | 0 | ||||||||||||||||||||||||
| 2820 | - | |||||||||||||||||||||||||
| 2821 | modifiers = static_cast<const QKeyEvent*>(event)->modifiers(); | - | ||||||||||||||||||||||||
| 2822 | switch (static_cast<const QKeyEvent*>(event)->key()) { | - | ||||||||||||||||||||||||
| 2823 | case never executed: Qt::Key_Backtab:case Qt::Key_Backtab:never executed: case Qt::Key_Backtab: | 0 | ||||||||||||||||||||||||
| 2824 | modifiers = modifiers & ~Qt::ShiftModifier; | - | ||||||||||||||||||||||||
| 2825 | case never executed: Qt::Key_Down:case Qt::Key_Down:never executed: case Qt::Key_Down:code before this statement never executed: case Qt::Key_Down: | 0 | ||||||||||||||||||||||||
| 2826 | case never executed: Qt::Key_Up:case Qt::Key_Up:never executed: case Qt::Key_Up: | 0 | ||||||||||||||||||||||||
| 2827 | case never executed: Qt::Key_Left:case Qt::Key_Left:never executed: case Qt::Key_Left: | 0 | ||||||||||||||||||||||||
| 2828 | case never executed: Qt::Key_Right:case Qt::Key_Right:never executed: case Qt::Key_Right: | 0 | ||||||||||||||||||||||||
| 2829 | case never executed: Qt::Key_Home:case Qt::Key_Home:never executed: case Qt::Key_Home: | 0 | ||||||||||||||||||||||||
| 2830 | case never executed: Qt::Key_End:case Qt::Key_End:never executed: case Qt::Key_End: | 0 | ||||||||||||||||||||||||
| 2831 | case never executed: Qt::Key_PageUp:case Qt::Key_PageUp:never executed: case Qt::Key_PageUp: | 0 | ||||||||||||||||||||||||
| 2832 | case never executed: Qt::Key_PageDown:case Qt::Key_PageDown:never executed: case Qt::Key_PageDown: | 0 | ||||||||||||||||||||||||
| 2833 | case never executed: Qt::Key_Tab:case Qt::Key_Tab:never executed: case Qt::Key_Tab: | 0 | ||||||||||||||||||||||||
| 2834 | if (modifiers & Qt::ControlModifier
| 0 | ||||||||||||||||||||||||
| 2835 | - | |||||||||||||||||||||||||
| 2836 | - | |||||||||||||||||||||||||
| 2837 | - | |||||||||||||||||||||||||
| 2838 | - | |||||||||||||||||||||||||
| 2839 | ) | - | ||||||||||||||||||||||||
| 2840 | return never executed: QItemSelectionModel::NoUpdate;return QItemSelectionModel::NoUpdate;never executed: return QItemSelectionModel::NoUpdate; | 0 | ||||||||||||||||||||||||
| 2841 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2842 | case never executed: Qt::Key_Select:case Qt::Key_Select:never executed: case Qt::Key_Select: | 0 | ||||||||||||||||||||||||
| 2843 | return never executed: QItemSelectionModel::Toggle|selectionBehaviorFlags();return QItemSelectionModel::Toggle|selectionBehaviorFlags();never executed: return QItemSelectionModel::Toggle|selectionBehaviorFlags(); | 0 | ||||||||||||||||||||||||
| 2844 | case never executed: Qt::Key_Space:case Qt::Key_Space:never executed: case Qt::Key_Space: | 0 | ||||||||||||||||||||||||
| 2845 | if (modifiers & Qt::ControlModifier
| 0 | ||||||||||||||||||||||||
| 2846 | return never executed: QItemSelectionModel::Toggle|selectionBehaviorFlags();return QItemSelectionModel::Toggle|selectionBehaviorFlags();never executed: return QItemSelectionModel::Toggle|selectionBehaviorFlags(); | 0 | ||||||||||||||||||||||||
| 2847 | return never executed: QItemSelectionModel::Select|selectionBehaviorFlags();return QItemSelectionModel::Select|selectionBehaviorFlags();never executed: return QItemSelectionModel::Select|selectionBehaviorFlags(); | 0 | ||||||||||||||||||||||||
| 2848 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||
| 2849 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2850 | } | - | ||||||||||||||||||||||||
| 2851 | } | - | ||||||||||||||||||||||||
| 2852 | default never executed: :default:never executed: default:code before this statement never executed: default: | 0 | ||||||||||||||||||||||||
| 2853 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2854 | } | - | ||||||||||||||||||||||||
| 2855 | } | - | ||||||||||||||||||||||||
| 2856 | - | |||||||||||||||||||||||||
| 2857 | if (modifiers & Qt::ShiftModifier
| 0 | ||||||||||||||||||||||||
| 2858 | return never executed: QItemSelectionModel::SelectCurrent|selectionBehaviorFlags();return QItemSelectionModel::SelectCurrent|selectionBehaviorFlags();never executed: return QItemSelectionModel::SelectCurrent|selectionBehaviorFlags(); | 0 | ||||||||||||||||||||||||
| 2859 | if (modifiers & Qt::ControlModifier
| 0 | ||||||||||||||||||||||||
| 2860 | return never executed: QItemSelectionModel::Toggle|selectionBehaviorFlags();return QItemSelectionModel::Toggle|selectionBehaviorFlags();never executed: return QItemSelectionModel::Toggle|selectionBehaviorFlags(); | 0 | ||||||||||||||||||||||||
| 2861 | if (state == QAbstractItemView::DragSelectingState
| 0 | ||||||||||||||||||||||||
| 2862 | - | |||||||||||||||||||||||||
| 2863 | return never executed: QItemSelectionModel::Clear|QItemSelectionModel::SelectCurrent|selectionBehaviorFlags();return QItemSelectionModel::Clear|QItemSelectionModel::SelectCurrent|selectionBehaviorFlags();never executed: return QItemSelectionModel::Clear|QItemSelectionModel::SelectCurrent|selectionBehaviorFlags(); | 0 | ||||||||||||||||||||||||
| 2864 | } | - | ||||||||||||||||||||||||
| 2865 | - | |||||||||||||||||||||||||
| 2866 | return never executed: QItemSelectionModel::ClearAndSelect|selectionBehaviorFlags();return QItemSelectionModel::ClearAndSelect|selectionBehaviorFlags();never executed: return QItemSelectionModel::ClearAndSelect|selectionBehaviorFlags(); | 0 | ||||||||||||||||||||||||
| 2867 | } | - | ||||||||||||||||||||||||
| 2868 | - | |||||||||||||||||||||||||
| 2869 | QItemSelectionModel::SelectionFlags | - | ||||||||||||||||||||||||
| 2870 | QAbstractItemViewPrivate::contiguousSelectionCommand(const QModelIndex &index, | - | ||||||||||||||||||||||||
| 2871 | const QEvent *event) const | - | ||||||||||||||||||||||||
| 2872 | { | - | ||||||||||||||||||||||||
| 2873 | QItemSelectionModel::SelectionFlags flags = extendedSelectionCommand(index, event); | - | ||||||||||||||||||||||||
| 2874 | const int Mask = QItemSelectionModel::Clear | QItemSelectionModel::Select | - | ||||||||||||||||||||||||
| 2875 | | QItemSelectionModel::Deselect | QItemSelectionModel::Toggle | - | ||||||||||||||||||||||||
| 2876 | | QItemSelectionModel::Current; | - | ||||||||||||||||||||||||
| 2877 | - | |||||||||||||||||||||||||
| 2878 | switch (flags & Mask) { | - | ||||||||||||||||||||||||
| 2879 | case never executed: QItemSelectionModel::Clear:case QItemSelectionModel::Clear:never executed: case QItemSelectionModel::Clear: | 0 | ||||||||||||||||||||||||
| 2880 | case never executed: QItemSelectionModel::ClearAndSelect:case QItemSelectionModel::ClearAndSelect:never executed: case QItemSelectionModel::ClearAndSelect: | 0 | ||||||||||||||||||||||||
| 2881 | case never executed: QItemSelectionModel::SelectCurrent:case QItemSelectionModel::SelectCurrent:never executed: case QItemSelectionModel::SelectCurrent: | 0 | ||||||||||||||||||||||||
| 2882 | return never executed: flags;return flags;never executed: return flags; | 0 | ||||||||||||||||||||||||
| 2883 | case never executed: QItemSelectionModel::NoUpdate:case QItemSelectionModel::NoUpdate:never executed: case QItemSelectionModel::NoUpdate: | 0 | ||||||||||||||||||||||||
| 2884 | if (event
| 0 | ||||||||||||||||||||||||
| 2885 | (event->type() == QEvent::MouseButtonPress
| 0 | ||||||||||||||||||||||||
| 2886 | || event->type() == QEvent::MouseButtonRelease
| 0 | ||||||||||||||||||||||||
| 2887 | return never executed: flags;return flags;never executed: return flags; | 0 | ||||||||||||||||||||||||
| 2888 | return never executed: QItemSelectionModel::ClearAndSelect|selectionBehaviorFlags();return QItemSelectionModel::ClearAndSelect|selectionBehaviorFlags();never executed: return QItemSelectionModel::ClearAndSelect|selectionBehaviorFlags(); | 0 | ||||||||||||||||||||||||
| 2889 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||
| 2890 | return never executed: QItemSelectionModel::SelectCurrent|selectionBehaviorFlags();return QItemSelectionModel::SelectCurrent|selectionBehaviorFlags();never executed: return QItemSelectionModel::SelectCurrent|selectionBehaviorFlags(); | 0 | ||||||||||||||||||||||||
| 2891 | } | - | ||||||||||||||||||||||||
| 2892 | } | - | ||||||||||||||||||||||||
| 2893 | - | |||||||||||||||||||||||||
| 2894 | void QAbstractItemViewPrivate::fetchMore() | - | ||||||||||||||||||||||||
| 2895 | { | - | ||||||||||||||||||||||||
| 2896 | fetchMoreTimer.stop(); | - | ||||||||||||||||||||||||
| 2897 | if (!model->canFetchMore(root)
| 0 | ||||||||||||||||||||||||
| 2898 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2899 | int last = model->rowCount(root) - 1; | - | ||||||||||||||||||||||||
| 2900 | if (last < 0
| 0 | ||||||||||||||||||||||||
| 2901 | model->fetchMore(root); | - | ||||||||||||||||||||||||
| 2902 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2903 | } | - | ||||||||||||||||||||||||
| 2904 | - | |||||||||||||||||||||||||
| 2905 | QModelIndex index = model->index(last, 0, root); | - | ||||||||||||||||||||||||
| 2906 | QRect rect = q_func()->visualRect(index); | - | ||||||||||||||||||||||||
| 2907 | if (viewport->rect().intersects(rect)
| 0 | ||||||||||||||||||||||||
| 2908 | model->fetchMore(root); never executed: model->fetchMore(root); | 0 | ||||||||||||||||||||||||
| 2909 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2910 | - | |||||||||||||||||||||||||
| 2911 | bool QAbstractItemViewPrivate::shouldEdit(QAbstractItemView::EditTrigger trigger, | - | ||||||||||||||||||||||||
| 2912 | const QModelIndex &index) const | - | ||||||||||||||||||||||||
| 2913 | { | - | ||||||||||||||||||||||||
| 2914 | if (!index.isValid()
| 0 | ||||||||||||||||||||||||
| 2915 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 2916 | Qt::ItemFlags flags = model->flags(index); | - | ||||||||||||||||||||||||
| 2917 | if (((
| 0 | ||||||||||||||||||||||||
| 2918 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 2919 | if (state == QAbstractItemView::EditingState
| 0 | ||||||||||||||||||||||||
| 2920 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 2921 | if (hasEditor(index)
| 0 | ||||||||||||||||||||||||
| 2922 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 2923 | if (trigger == QAbstractItemView::AllEditTriggers
| 0 | ||||||||||||||||||||||||
| 2924 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||
| 2925 | if ((
| 0 | ||||||||||||||||||||||||
| 2926 | && !selectionModel->isSelected(index)
| 0 | ||||||||||||||||||||||||
| 2927 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 2928 | return never executed: (trigger & editTriggers);return (trigger & editTriggers);never executed: return (trigger & editTriggers); | 0 | ||||||||||||||||||||||||
| 2929 | } | - | ||||||||||||||||||||||||
| 2930 | - | |||||||||||||||||||||||||
| 2931 | bool QAbstractItemViewPrivate::shouldForwardEvent(QAbstractItemView::EditTrigger trigger, | - | ||||||||||||||||||||||||
| 2932 | const QEvent *event) const | - | ||||||||||||||||||||||||
| 2933 | { | - | ||||||||||||||||||||||||
| 2934 | if (!event
| 0 | ||||||||||||||||||||||||
| 2935 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 2936 | - | |||||||||||||||||||||||||
| 2937 | switch (event->type()) { | - | ||||||||||||||||||||||||
| 2938 | case never executed: QEvent::KeyPress:case QEvent::KeyPress:never executed: case QEvent::KeyPress: | 0 | ||||||||||||||||||||||||
| 2939 | case never executed: QEvent::MouseButtonDblClick:case QEvent::MouseButtonDblClick:never executed: case QEvent::MouseButtonDblClick: | 0 | ||||||||||||||||||||||||
| 2940 | case never executed: QEvent::MouseButtonPress:case QEvent::MouseButtonPress:never executed: case QEvent::MouseButtonPress: | 0 | ||||||||||||||||||||||||
| 2941 | case never executed: QEvent::MouseButtonRelease:case QEvent::MouseButtonRelease:never executed: case QEvent::MouseButtonRelease: | 0 | ||||||||||||||||||||||||
| 2942 | case never executed: QEvent::MouseMove:case QEvent::MouseMove:never executed: case QEvent::MouseMove: | 0 | ||||||||||||||||||||||||
| 2943 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||
| 2944 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||
| 2945 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 2946 | }; | - | ||||||||||||||||||||||||
| 2947 | - | |||||||||||||||||||||||||
| 2948 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 2949 | } | - | ||||||||||||||||||||||||
| 2950 | - | |||||||||||||||||||||||||
| 2951 | bool QAbstractItemViewPrivate::shouldAutoScroll(const QPoint &pos) const | - | ||||||||||||||||||||||||
| 2952 | { | - | ||||||||||||||||||||||||
| 2953 | if (!autoScroll
| 0 | ||||||||||||||||||||||||
| 2954 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 2955 | QRect area = static_cast<QAbstractItemView*>(viewport)->d_func()->clipRect(); | - | ||||||||||||||||||||||||
| 2956 | return never executed: (pos.y() - area.top() < autoScrollMargin)return (pos.y() - area.top() < autoScrollMargin) || (area.bottom() - pos.y() < autoScrollMargin) || (pos.x() - area.left() < autoScrollMargin) || (area.right() - pos.x() < autoScrollMargin);never executed: return (pos.y() - area.top() < autoScrollMargin) || (area.bottom() - pos.y() < autoScrollMargin) || (pos.x() - area.left() < autoScrollMargin) || (area.right() - pos.x() < autoScrollMargin); | 0 | ||||||||||||||||||||||||
| 2957 | || (area.bottom() - pos.y() < autoScrollMargin) never executed: return (pos.y() - area.top() < autoScrollMargin) || (area.bottom() - pos.y() < autoScrollMargin) || (pos.x() - area.left() < autoScrollMargin) || (area.right() - pos.x() < autoScrollMargin); | 0 | ||||||||||||||||||||||||
| 2958 | || (pos.x() - area.left() < autoScrollMargin) never executed: return (pos.y() - area.top() < autoScrollMargin) || (area.bottom() - pos.y() < autoScrollMargin) || (pos.x() - area.left() < autoScrollMargin) || (area.right() - pos.x() < autoScrollMargin); | 0 | ||||||||||||||||||||||||
| 2959 | || (area.right() - pos.x() < autoScrollMargin); never executed: return (pos.y() - area.top() < autoScrollMargin) || (area.bottom() - pos.y() < autoScrollMargin) || (pos.x() - area.left() < autoScrollMargin) || (area.right() - pos.x() < autoScrollMargin); | 0 | ||||||||||||||||||||||||
| 2960 | } | - | ||||||||||||||||||||||||
| 2961 | - | |||||||||||||||||||||||||
| 2962 | void QAbstractItemViewPrivate::doDelayedItemsLayout(int delay) | - | ||||||||||||||||||||||||
| 2963 | { | - | ||||||||||||||||||||||||
| 2964 | if (!delayedPendingLayout
| 0 | ||||||||||||||||||||||||
| 2965 | delayedPendingLayout = true; | - | ||||||||||||||||||||||||
| 2966 | delayedLayout.start(delay, q_func()); | - | ||||||||||||||||||||||||
| 2967 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2968 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2969 | - | |||||||||||||||||||||||||
| 2970 | void QAbstractItemViewPrivate::interruptDelayedItemsLayout() const | - | ||||||||||||||||||||||||
| 2971 | { | - | ||||||||||||||||||||||||
| 2972 | delayedLayout.stop(); | - | ||||||||||||||||||||||||
| 2973 | delayedPendingLayout = false; | - | ||||||||||||||||||||||||
| 2974 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2975 | - | |||||||||||||||||||||||||
| 2976 | void QAbstractItemViewPrivate::updateGeometry() | - | ||||||||||||||||||||||||
| 2977 | { | - | ||||||||||||||||||||||||
| 2978 | QAbstractItemView * const q = q_func(); | - | ||||||||||||||||||||||||
| 2979 | if (sizeAdjustPolicy == QAbstractScrollArea::AdjustIgnored
| 0 | ||||||||||||||||||||||||
| 2980 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 2981 | if (sizeAdjustPolicy == QAbstractScrollArea::AdjustToContents
| 0 | ||||||||||||||||||||||||
| 2982 | q->updateGeometry(); never executed: q->updateGeometry(); | 0 | ||||||||||||||||||||||||
| 2983 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 2984 | - | |||||||||||||||||||||||||
| 2985 | QWidget *QAbstractItemViewPrivate::editor(const QModelIndex &index, | - | ||||||||||||||||||||||||
| 2986 | const QStyleOptionViewItem &options) | - | ||||||||||||||||||||||||
| 2987 | { | - | ||||||||||||||||||||||||
| 2988 | QAbstractItemView * const q = q_func(); | - | ||||||||||||||||||||||||
| 2989 | QWidget *w = editorForIndex(index).widget.data(); | - | ||||||||||||||||||||||||
| 2990 | if (!w
| 0 | ||||||||||||||||||||||||
| 2991 | QAbstractItemDelegate *delegate = delegateForIndex(index); | - | ||||||||||||||||||||||||
| 2992 | if (!delegate
| 0 | ||||||||||||||||||||||||
| 2993 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||
| 2994 | w = delegate->createEditor(viewport, options, index); | - | ||||||||||||||||||||||||
| 2995 | if (w
| 0 | ||||||||||||||||||||||||
| 2996 | w->installEventFilter(delegate); | - | ||||||||||||||||||||||||
| 2997 | QObject::connect(w, qFlagLocation("2""destroyed(QObject*)" "\0" __FILE__ ":" "4207"), q, qFlagLocation("1""editorDestroyed(QObject*)" "\0" __FILE__ ":" "4207")); | - | ||||||||||||||||||||||||
| 2998 | delegate->updateEditorGeometry(w, options, index); | - | ||||||||||||||||||||||||
| 2999 | delegate->setEditorData(w, index); | - | ||||||||||||||||||||||||
| 3000 | addEditor(index, w, false); | - | ||||||||||||||||||||||||
| 3001 | if (w->parent() == viewport
| 0 | ||||||||||||||||||||||||
| 3002 | QWidget::setTabOrder(q, w); never executed: QWidget::setTabOrder(q, w); | 0 | ||||||||||||||||||||||||
| 3003 | - | |||||||||||||||||||||||||
| 3004 | - | |||||||||||||||||||||||||
| 3005 | QWidget *focusWidget = w; | - | ||||||||||||||||||||||||
| 3006 | while (QWidget *fp = focusWidget->focusProxy()
| 0 | ||||||||||||||||||||||||
| 3007 | focusWidget = fp; never executed: focusWidget = fp; | 0 | ||||||||||||||||||||||||
| 3008 | - | |||||||||||||||||||||||||
| 3009 | if (QLineEdit *le = qobject_cast<QLineEdit*>(focusWidget)
| 0 | ||||||||||||||||||||||||
| 3010 | le->selectAll(); never executed: le->selectAll(); | 0 | ||||||||||||||||||||||||
| 3011 | - | |||||||||||||||||||||||||
| 3012 | - | |||||||||||||||||||||||||
| 3013 | if (QSpinBox *sb = qobject_cast<QSpinBox*>(focusWidget)
| 0 | ||||||||||||||||||||||||
| 3014 | sb->selectAll(); never executed: sb->selectAll(); | 0 | ||||||||||||||||||||||||
| 3015 | else if (QDoubleSpinBox *dsb = qobject_cast<QDoubleSpinBox*>(focusWidget)
| 0 | ||||||||||||||||||||||||
| 3016 | dsb->selectAll(); never executed: dsb->selectAll(); | 0 | ||||||||||||||||||||||||
| 3017 | - | |||||||||||||||||||||||||
| 3018 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3019 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3020 | - | |||||||||||||||||||||||||
| 3021 | return never executed: w;return w;never executed: return w; | 0 | ||||||||||||||||||||||||
| 3022 | } | - | ||||||||||||||||||||||||
| 3023 | - | |||||||||||||||||||||||||
| 3024 | void QAbstractItemViewPrivate::updateEditorData(const QModelIndex &tl, const QModelIndex &br) | - | ||||||||||||||||||||||||
| 3025 | { | - | ||||||||||||||||||||||||
| 3026 | - | |||||||||||||||||||||||||
| 3027 | const bool checkIndexes = tl.isValid()
| 0 | ||||||||||||||||||||||||
| 3028 | const QModelIndex parent = tl.parent(); | - | ||||||||||||||||||||||||
| 3029 | - | |||||||||||||||||||||||||
| 3030 | - | |||||||||||||||||||||||||
| 3031 | - | |||||||||||||||||||||||||
| 3032 | const QIndexEditorHash indexEditorHashCopy = indexEditorHash; | - | ||||||||||||||||||||||||
| 3033 | QIndexEditorHash::const_iterator it = indexEditorHashCopy.constBegin(); | - | ||||||||||||||||||||||||
| 3034 | for (; it != indexEditorHashCopy.constEnd()
| 0 | ||||||||||||||||||||||||
| 3035 | QWidget *editor = it.value().widget.data(); | - | ||||||||||||||||||||||||
| 3036 | const QModelIndex index = it.key(); | - | ||||||||||||||||||||||||
| 3037 | if (it.value().isStatic
| 0 | ||||||||||||||||||||||||
| 3038 | (checkIndexes
| 0 | ||||||||||||||||||||||||
| 3039 | && (index.row() < tl.row()
| 0 | ||||||||||||||||||||||||
| 3040 | || index.column() < tl.column()
| 0 | ||||||||||||||||||||||||
| 3041 | || index.parent() != parent
| 0 | ||||||||||||||||||||||||
| 3042 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||
| 3043 | - | |||||||||||||||||||||||||
| 3044 | QAbstractItemDelegate *delegate = delegateForIndex(index); | - | ||||||||||||||||||||||||
| 3045 | if (delegate
| 0 | ||||||||||||||||||||||||
| 3046 | delegate->setEditorData(editor, index); | - | ||||||||||||||||||||||||
| 3047 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3048 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3049 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3050 | void QAbstractItemViewPrivate::clearOrRemove() | - | ||||||||||||||||||||||||
| 3051 | { | - | ||||||||||||||||||||||||
| 3052 | - | |||||||||||||||||||||||||
| 3053 | const QItemSelection selection = selectionModel->selection(); | - | ||||||||||||||||||||||||
| 3054 | QList<QItemSelectionRange>::const_iterator it = selection.constBegin(); | - | ||||||||||||||||||||||||
| 3055 | - | |||||||||||||||||||||||||
| 3056 | if (!overwrite
| 0 | ||||||||||||||||||||||||
| 3057 | for (; it != selection.constEnd()
| 0 | ||||||||||||||||||||||||
| 3058 | QModelIndex parent = (*it).parent(); | - | ||||||||||||||||||||||||
| 3059 | if ((*
| 0 | ||||||||||||||||||||||||
| 3060 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||
| 3061 | if ((*
| 0 | ||||||||||||||||||||||||
| 3062 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||
| 3063 | int count = (*it).bottom() - (*it).top() + 1; | - | ||||||||||||||||||||||||
| 3064 | model->removeRows((*it).top(), count, parent); | - | ||||||||||||||||||||||||
| 3065 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3066 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 3067 | - | |||||||||||||||||||||||||
| 3068 | QModelIndexList list = selection.indexes(); | - | ||||||||||||||||||||||||
| 3069 | for (int i=0; i < list.size()
| 0 | ||||||||||||||||||||||||
| 3070 | QModelIndex index = list.at(i); | - | ||||||||||||||||||||||||
| 3071 | QMap<int, QVariant> roles = model->itemData(index); | - | ||||||||||||||||||||||||
| 3072 | for (QMap<int, QVariant>::Iterator it = roles.begin(); it != roles.end()
| 0 | ||||||||||||||||||||||||
| 3073 | it.value() = QVariant(); never executed: it.value() = QVariant(); | 0 | ||||||||||||||||||||||||
| 3074 | model->setItemData(index, roles); | - | ||||||||||||||||||||||||
| 3075 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3076 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3077 | - | |||||||||||||||||||||||||
| 3078 | } | - | ||||||||||||||||||||||||
| 3079 | - | |||||||||||||||||||||||||
| 3080 | - | |||||||||||||||||||||||||
| 3081 | - | |||||||||||||||||||||||||
| 3082 | - | |||||||||||||||||||||||||
| 3083 | - | |||||||||||||||||||||||||
| 3084 | - | |||||||||||||||||||||||||
| 3085 | - | |||||||||||||||||||||||||
| 3086 | void QAbstractItemViewPrivate::checkPersistentEditorFocus() | - | ||||||||||||||||||||||||
| 3087 | { | - | ||||||||||||||||||||||||
| 3088 | QAbstractItemView * const q = q_func(); | - | ||||||||||||||||||||||||
| 3089 | if (QWidget *widget = QApplication::focusWidget()
| 0 | ||||||||||||||||||||||||
| 3090 | if (persistent.contains(widget)
| 0 | ||||||||||||||||||||||||
| 3091 | - | |||||||||||||||||||||||||
| 3092 | QModelIndex index = indexForEditor(widget); | - | ||||||||||||||||||||||||
| 3093 | if (selectionModel->currentIndex() != index
| 0 | ||||||||||||||||||||||||
| 3094 | q->setCurrentIndex(index); never executed: q->setCurrentIndex(index); | 0 | ||||||||||||||||||||||||
| 3095 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3096 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3097 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3098 | - | |||||||||||||||||||||||||
| 3099 | - | |||||||||||||||||||||||||
| 3100 | const QEditorInfo & QAbstractItemViewPrivate::editorForIndex(const QModelIndex &index) const | - | ||||||||||||||||||||||||
| 3101 | { | - | ||||||||||||||||||||||||
| 3102 | static QEditorInfo nullInfo; | - | ||||||||||||||||||||||||
| 3103 | - | |||||||||||||||||||||||||
| 3104 | - | |||||||||||||||||||||||||
| 3105 | if (indexEditorHash.isEmpty()
| 0 | ||||||||||||||||||||||||
| 3106 | return never executed: nullInfo;return nullInfo;never executed: return nullInfo; | 0 | ||||||||||||||||||||||||
| 3107 | - | |||||||||||||||||||||||||
| 3108 | QIndexEditorHash::const_iterator it = indexEditorHash.find(index); | - | ||||||||||||||||||||||||
| 3109 | if (it == indexEditorHash.end()
| 0 | ||||||||||||||||||||||||
| 3110 | return never executed: nullInfo;return nullInfo;never executed: return nullInfo; | 0 | ||||||||||||||||||||||||
| 3111 | - | |||||||||||||||||||||||||
| 3112 | return never executed: it.value();return it.value();never executed: return it.value(); | 0 | ||||||||||||||||||||||||
| 3113 | } | - | ||||||||||||||||||||||||
| 3114 | - | |||||||||||||||||||||||||
| 3115 | bool QAbstractItemViewPrivate::hasEditor(const QModelIndex &index) const | - | ||||||||||||||||||||||||
| 3116 | { | - | ||||||||||||||||||||||||
| 3117 | - | |||||||||||||||||||||||||
| 3118 | return never executed: !indexEditorHash.isEmpty() && indexEditorHash.contains(index);return !indexEditorHash.isEmpty() && indexEditorHash.contains(index);never executed: return !indexEditorHash.isEmpty() && indexEditorHash.contains(index); | 0 | ||||||||||||||||||||||||
| 3119 | } | - | ||||||||||||||||||||||||
| 3120 | - | |||||||||||||||||||||||||
| 3121 | QModelIndex QAbstractItemViewPrivate::indexForEditor(QWidget *editor) const | - | ||||||||||||||||||||||||
| 3122 | { | - | ||||||||||||||||||||||||
| 3123 | - | |||||||||||||||||||||||||
| 3124 | if (indexEditorHash.isEmpty()
| 0 | ||||||||||||||||||||||||
| 3125 | return never executed: QModelIndex();return QModelIndex();never executed: return QModelIndex(); | 0 | ||||||||||||||||||||||||
| 3126 | - | |||||||||||||||||||||||||
| 3127 | QEditorIndexHash::const_iterator it = editorIndexHash.find(editor); | - | ||||||||||||||||||||||||
| 3128 | if (it == editorIndexHash.end()
| 0 | ||||||||||||||||||||||||
| 3129 | return never executed: QModelIndex();return QModelIndex();never executed: return QModelIndex(); | 0 | ||||||||||||||||||||||||
| 3130 | - | |||||||||||||||||||||||||
| 3131 | return never executed: it.value();return it.value();never executed: return it.value(); | 0 | ||||||||||||||||||||||||
| 3132 | } | - | ||||||||||||||||||||||||
| 3133 | - | |||||||||||||||||||||||||
| 3134 | void QAbstractItemViewPrivate::removeEditor(QWidget *editor) | - | ||||||||||||||||||||||||
| 3135 | { | - | ||||||||||||||||||||||||
| 3136 | const auto it = editorIndexHash.constFind(editor); | - | ||||||||||||||||||||||||
| 3137 | if (it != editorIndexHash.cend()
| 0 | ||||||||||||||||||||||||
| 3138 | indexEditorHash.remove(it.value()); | - | ||||||||||||||||||||||||
| 3139 | editorIndexHash.erase(it); | - | ||||||||||||||||||||||||
| 3140 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3141 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3142 | - | |||||||||||||||||||||||||
| 3143 | void QAbstractItemViewPrivate::addEditor(const QModelIndex &index, QWidget *editor, bool isStatic) | - | ||||||||||||||||||||||||
| 3144 | { | - | ||||||||||||||||||||||||
| 3145 | editorIndexHash.insert(editor, index); | - | ||||||||||||||||||||||||
| 3146 | indexEditorHash.insert(index, QEditorInfo(editor, isStatic)); | - | ||||||||||||||||||||||||
| 3147 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3148 | - | |||||||||||||||||||||||||
| 3149 | bool QAbstractItemViewPrivate::sendDelegateEvent(const QModelIndex &index, QEvent *event) const | - | ||||||||||||||||||||||||
| 3150 | { | - | ||||||||||||||||||||||||
| 3151 | const QAbstractItemView * const q = q_func(); | - | ||||||||||||||||||||||||
| 3152 | QModelIndex buddy = model->buddy(index); | - | ||||||||||||||||||||||||
| 3153 | QStyleOptionViewItem options = viewOptionsV1(); | - | ||||||||||||||||||||||||
| 3154 | options.rect = q->visualRect(buddy); | - | ||||||||||||||||||||||||
| 3155 | options.state |= (buddy == q->currentIndex()
| 0 | ||||||||||||||||||||||||
| 3156 | QAbstractItemDelegate *delegate = delegateForIndex(index); | - | ||||||||||||||||||||||||
| 3157 | return never executed: (event && delegate && delegate->editorEvent(event, model, options, buddy));return (event && delegate && delegate->editorEvent(event, model, options, buddy));never executed: return (event && delegate && delegate->editorEvent(event, model, options, buddy)); | 0 | ||||||||||||||||||||||||
| 3158 | } | - | ||||||||||||||||||||||||
| 3159 | - | |||||||||||||||||||||||||
| 3160 | bool QAbstractItemViewPrivate::openEditor(const QModelIndex &index, QEvent *event) | - | ||||||||||||||||||||||||
| 3161 | { | - | ||||||||||||||||||||||||
| 3162 | QAbstractItemView * const q = q_func(); | - | ||||||||||||||||||||||||
| 3163 | - | |||||||||||||||||||||||||
| 3164 | QModelIndex buddy = model->buddy(index); | - | ||||||||||||||||||||||||
| 3165 | QStyleOptionViewItem options = viewOptionsV1(); | - | ||||||||||||||||||||||||
| 3166 | options.rect = q->visualRect(buddy); | - | ||||||||||||||||||||||||
| 3167 | options.state |= (buddy == q->currentIndex()
| 0 | ||||||||||||||||||||||||
| 3168 | - | |||||||||||||||||||||||||
| 3169 | QWidget *w = editor(buddy, options); | - | ||||||||||||||||||||||||
| 3170 | if (!w
| 0 | ||||||||||||||||||||||||
| 3171 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||||||||
| 3172 | - | |||||||||||||||||||||||||
| 3173 | q->setState(QAbstractItemView::EditingState); | - | ||||||||||||||||||||||||
| 3174 | w->show(); | - | ||||||||||||||||||||||||
| 3175 | w->setFocus(); | - | ||||||||||||||||||||||||
| 3176 | - | |||||||||||||||||||||||||
| 3177 | if (event
| 0 | ||||||||||||||||||||||||
| 3178 | QApplication::sendEvent(w->focusProxy() ? w->focusProxy() : w, event); never executed: QApplication::sendEvent(w->focusProxy() ? w->focusProxy() : w, event); | 0 | ||||||||||||||||||||||||
| 3179 | - | |||||||||||||||||||||||||
| 3180 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||
| 3181 | } | - | ||||||||||||||||||||||||
| 3182 | - | |||||||||||||||||||||||||
| 3183 | - | |||||||||||||||||||||||||
| 3184 | - | |||||||||||||||||||||||||
| 3185 | - | |||||||||||||||||||||||||
| 3186 | - | |||||||||||||||||||||||||
| 3187 | - | |||||||||||||||||||||||||
| 3188 | - | |||||||||||||||||||||||||
| 3189 | QItemViewPaintPairs QAbstractItemViewPrivate::draggablePaintPairs(const QModelIndexList &indexes, QRect *r) const | - | ||||||||||||||||||||||||
| 3190 | { | - | ||||||||||||||||||||||||
| 3191 | ((!(r)) ? qt_assert("r",__FILE__,4411) : qt_noop()); | - | ||||||||||||||||||||||||
| 3192 | const QAbstractItemView * const q = q_func(); | - | ||||||||||||||||||||||||
| 3193 | QRect &rect = *r; | - | ||||||||||||||||||||||||
| 3194 | const QRect viewportRect = viewport->rect(); | - | ||||||||||||||||||||||||
| 3195 | QItemViewPaintPairs ret; | - | ||||||||||||||||||||||||
| 3196 | for (const auto &index : indexes) { | - | ||||||||||||||||||||||||
| 3197 | const QRect current = q->visualRect(index); | - | ||||||||||||||||||||||||
| 3198 | if (current.intersects(viewportRect)
| 0 | ||||||||||||||||||||||||
| 3199 | QItemViewPaintPair p = { current, index }; | - | ||||||||||||||||||||||||
| 3200 | ret += p; | - | ||||||||||||||||||||||||
| 3201 | rect |= current; | - | ||||||||||||||||||||||||
| 3202 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3203 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3204 | rect &= viewportRect; | - | ||||||||||||||||||||||||
| 3205 | return never executed: ret;return ret;never executed: return ret; | 0 | ||||||||||||||||||||||||
| 3206 | } | - | ||||||||||||||||||||||||
| 3207 | - | |||||||||||||||||||||||||
| 3208 | QPixmap QAbstractItemViewPrivate::renderToPixmap(const QModelIndexList &indexes, QRect *r) const | - | ||||||||||||||||||||||||
| 3209 | { | - | ||||||||||||||||||||||||
| 3210 | ((!(r)) ? qt_assert("r",__FILE__,4430) : qt_noop()); | - | ||||||||||||||||||||||||
| 3211 | QItemViewPaintPairs paintPairs = draggablePaintPairs(indexes, r); | - | ||||||||||||||||||||||||
| 3212 | if (paintPairs.isEmpty()
| 0 | ||||||||||||||||||||||||
| 3213 | return never executed: QPixmap();return QPixmap();never executed: return QPixmap(); | 0 | ||||||||||||||||||||||||
| 3214 | - | |||||||||||||||||||||||||
| 3215 | qreal scale = 1.0f; | - | ||||||||||||||||||||||||
| 3216 | - | |||||||||||||||||||||||||
| 3217 | const QAbstractItemView * const q = q_func(); | - | ||||||||||||||||||||||||
| 3218 | QWidget *window = q->window(); | - | ||||||||||||||||||||||||
| 3219 | if (window
| 0 | ||||||||||||||||||||||||
| 3220 | QWindow *windowHandle = window->windowHandle(); | - | ||||||||||||||||||||||||
| 3221 | if (windowHandle
| 0 | ||||||||||||||||||||||||
| 3222 | scale = windowHandle->devicePixelRatio(); never executed: scale = windowHandle->devicePixelRatio(); | 0 | ||||||||||||||||||||||||
| 3223 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3224 | - | |||||||||||||||||||||||||
| 3225 | QPixmap pixmap(r->size() * scale); | - | ||||||||||||||||||||||||
| 3226 | pixmap.setDevicePixelRatio(scale); | - | ||||||||||||||||||||||||
| 3227 | - | |||||||||||||||||||||||||
| 3228 | pixmap.fill(Qt::transparent); | - | ||||||||||||||||||||||||
| 3229 | QPainter painter(&pixmap); | - | ||||||||||||||||||||||||
| 3230 | QStyleOptionViewItem option = viewOptionsV1(); | - | ||||||||||||||||||||||||
| 3231 | option.state |= QStyle::State_Selected; | - | ||||||||||||||||||||||||
| 3232 | for (int j = 0; j < paintPairs.count()
| 0 | ||||||||||||||||||||||||
| 3233 | option.rect = paintPairs.at(j).rect.translated(-r->topLeft()); | - | ||||||||||||||||||||||||
| 3234 | const QModelIndex ¤t = paintPairs.at(j).index; | - | ||||||||||||||||||||||||
| 3235 | adjustViewOptionsForIndex(&option, current); | - | ||||||||||||||||||||||||
| 3236 | delegateForIndex(current)->paint(&painter, option, current); | - | ||||||||||||||||||||||||
| 3237 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3238 | return never executed: pixmap;return pixmap;never executed: return pixmap; | 0 | ||||||||||||||||||||||||
| 3239 | } | - | ||||||||||||||||||||||||
| 3240 | - | |||||||||||||||||||||||||
| 3241 | void QAbstractItemViewPrivate::selectAll(QItemSelectionModel::SelectionFlags command) | - | ||||||||||||||||||||||||
| 3242 | { | - | ||||||||||||||||||||||||
| 3243 | if (!selectionModel
| 0 | ||||||||||||||||||||||||
| 3244 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 3245 | - | |||||||||||||||||||||||||
| 3246 | QItemSelection selection; | - | ||||||||||||||||||||||||
| 3247 | QModelIndex tl = model->index(0, 0, root); | - | ||||||||||||||||||||||||
| 3248 | QModelIndex br = model->index(model->rowCount(root) - 1, | - | ||||||||||||||||||||||||
| 3249 | model->columnCount(root) - 1, | - | ||||||||||||||||||||||||
| 3250 | root); | - | ||||||||||||||||||||||||
| 3251 | selection.append(QItemSelectionRange(tl, br)); | - | ||||||||||||||||||||||||
| 3252 | selectionModel->select(selection, command); | - | ||||||||||||||||||||||||
| 3253 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 3254 | - | |||||||||||||||||||||||||
| 3255 | QModelIndexList QAbstractItemViewPrivate::selectedDraggableIndexes() const | - | ||||||||||||||||||||||||
| 3256 | { | - | ||||||||||||||||||||||||
| 3257 | const QAbstractItemView * const q = q_func(); | - | ||||||||||||||||||||||||
| 3258 | QModelIndexList indexes = q->selectedIndexes(); | - | ||||||||||||||||||||||||
| 3259 | auto isNotDragEnabled = [this](const QModelIndex &index) { | - | ||||||||||||||||||||||||
| 3260 | return never executed: !isIndexDragEnabled(index);return !isIndexDragEnabled(index);never executed: return !isIndexDragEnabled(index); | 0 | ||||||||||||||||||||||||
| 3261 | }; | - | ||||||||||||||||||||||||
| 3262 | indexes.erase(std::remove_if(indexes.begin(), indexes.end(), | - | ||||||||||||||||||||||||
| 3263 | isNotDragEnabled), | - | ||||||||||||||||||||||||
| 3264 | indexes.end()); | - | ||||||||||||||||||||||||
| 3265 | return never executed: indexes;return indexes;never executed: return indexes; | 0 | ||||||||||||||||||||||||
| 3266 | } | - | ||||||||||||||||||||||||
| 3267 | - | |||||||||||||||||||||||||
| 3268 | - | |||||||||||||||||||||||||
| 3269 | - | |||||||||||||||||||||||||
| 3270 | - | |||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |