diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2009-12-03 16:20:03 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-12-03 16:26:30 (GMT) |
commit | 2263a796ac6fc84002ff075eb6cbc67e0ec27802 (patch) | |
tree | 1a79679417b213e2528512b37ecb8c32a92371a1 /src/gui | |
parent | 5cab18e5e3946b0dc14d678c8a317522d25e3003 (diff) | |
download | Qt-2263a796ac6fc84002ff075eb6cbc67e0ec27802.zip Qt-2263a796ac6fc84002ff075eb6cbc67e0ec27802.tar.gz Qt-2263a796ac6fc84002ff075eb6cbc67e0ec27802.tar.bz2 |
Fixes broken selection with Shift and extended selection
ItemAt() is in viewport coordinate.
Pressed index is in coordinate relative to the whole view
(regression since Qt 4.5)
Reviewed-by: thierry
Task-number: QTBUG-6407
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/itemviews/qabstractitemview.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index acfeff8..de6e6cb 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -1625,7 +1625,7 @@ void QAbstractItemView::mousePressEvent(QMouseEvent *event) QPoint offset = d->offset(); if ((command & QItemSelectionModel::Current) == 0) d->pressedPosition = pos + offset; - else if (!indexAt(d->pressedPosition).isValid()) + else if (!indexAt(d->pressedPosition - offset).isValid()) d->pressedPosition = visualRect(currentIndex()).center() + offset; if (edit(index, NoEditTriggers, event)) @@ -2195,7 +2195,7 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event) // note that we don't check if the new current index is enabled because moveCursor() makes sure it is if (command & QItemSelectionModel::Current) { d->selectionModel->setCurrentIndex(newCurrent, QItemSelectionModel::NoUpdate); - if (!indexAt(d->pressedPosition).isValid()) + if (!indexAt(d->pressedPosition - d->offset()).isValid()) d->pressedPosition = visualRect(oldCurrent).center() + d->offset(); QRect rect(d->pressedPosition - d->offset(), visualRect(newCurrent).center()); setSelection(rect, command); |