diff options
author | Gabriel de Dietrich <gabriel.dietrich-de@nokia.com> | 2010-08-13 16:12:30 (GMT) |
---|---|---|
committer | Gabriel de Dietrich <gabriel.dietrich-de@nokia.com> | 2010-08-16 15:48:24 (GMT) |
commit | 3e07671a2b043703bc51c2672f16c45ed0c31c42 (patch) | |
tree | f4f6f216a42a08a8e762f1042c20573c1f69d528 /src/gui/itemviews | |
parent | 0fb9e0fff4097bf0b84ff217526b0a9c33b69414 (diff) | |
download | Qt-3e07671a2b043703bc51c2672f16c45ed0c31c42.zip Qt-3e07671a2b043703bc51c2672f16c45ed0c31c42.tar.gz Qt-3e07671a2b043703bc51c2672f16c45ed0c31c42.tar.bz2 |
Keyboard navigation regression in QTreeView
Ammends commit 8da7252de0badb818302763cbe62c38ad699f1f3
Auto-test included.
Reviewed-by: Olivier
Task-number: QTBUG-11466
Diffstat (limited to 'src/gui/itemviews')
-rw-r--r-- | src/gui/itemviews/qabstractitemview.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index 97499f3..4ffd284 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -2270,9 +2270,11 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event) } else { d->selectionModel->setCurrentIndex(newCurrent, command); d->pressedPosition = visualRect(newCurrent).center() + d->offset(); - // We copy the same behaviour as for mousePressEvent(). - QRect rect(d->pressedPosition - d->offset(), QSize(1, 1)); - setSelection(rect, command); + if (newCurrent.isValid()) { + // We copy the same behaviour as for mousePressEvent(). + QRect rect(d->pressedPosition - d->offset(), QSize(1, 1)); + setSelection(rect, command); + } } event->accept(); return; |