diff options
Diffstat (limited to 'src/corelib/itemmodels/qitemselectionmodel.cpp')
-rw-r--r-- | src/corelib/itemmodels/qitemselectionmodel.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/corelib/itemmodels/qitemselectionmodel.cpp b/src/corelib/itemmodels/qitemselectionmodel.cpp index de28953fb5..51c670f79e 100644 --- a/src/corelib/itemmodels/qitemselectionmodel.cpp +++ b/src/corelib/itemmodels/qitemselectionmodel.cpp @@ -104,6 +104,14 @@ QT_BEGIN_NAMESPACE */ /*! + \fn QItemSelectionRange::swap(QItemSelectionRange &other) + \since 5.6 + + Swaps this selection range's contents with \a other. + This function is very fast and never fails. +*/ + +/*! \fn int QItemSelectionRange::top() const Returns the row index corresponding to the uppermost selected row in the @@ -721,11 +729,11 @@ void QItemSelectionModelPrivate::_q_rowsAboutToBeRemoved(const QModelIndex &pare deselected.append(*it); it = ranges.erase(it); } else if (start <= it->top() && it->top() <= end) { // Top intersection - deselected.append(QItemSelectionRange(it->topLeft(), model->index(end, it->left(), it->parent()))); + deselected.append(QItemSelectionRange(it->topLeft(), model->index(end, it->right(), it->parent()))); *it = QItemSelectionRange(model->index(end + 1, it->left(), it->parent()), it->bottomRight()); ++it; } else if (start <= it->bottom() && it->bottom() <= end) { // Bottom intersection - deselected.append(QItemSelectionRange(model->index(start, it->right(), it->parent()), it->bottomRight())); + deselected.append(QItemSelectionRange(model->index(start, it->left(), it->parent()), it->bottomRight())); *it = QItemSelectionRange(it->topLeft(), model->index(start - 1, it->right(), it->parent())); ++it; } else if (it->top() < start && end < it->bottom()) { // Middle intersection @@ -733,8 +741,8 @@ void QItemSelectionModelPrivate::_q_rowsAboutToBeRemoved(const QModelIndex &pare // and [4, 5] is removed, we need to split [3, 4, 5, 6] into [3], [4, 5] and [6]. // [4, 5] is appended to deselected, and [3] and [6] remain part of the selection // in ranges. - const QItemSelectionRange removedRange(model->index(start, it->right(), it->parent()), - model->index(end, it->left(), it->parent())); + const QItemSelectionRange removedRange(model->index(start, it->left(), it->parent()), + model->index(end, it->right(), it->parent())); deselected.append(removedRange); QItemSelection::split(*it, removedRange, &newParts); it = ranges.erase(it); @@ -1770,7 +1778,7 @@ const QAbstractItemModel *QItemSelectionModel::model() const /*! \since 5.5 - Sets the model. The modelChanged() signal will be emitted. + Sets the model to \a model. The modelChanged() signal will be emitted. \sa model(), modelChanged() */ |