diff options
author | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2018-12-15 20:42:18 +0100 |
---|---|---|
committer | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2018-12-25 10:15:32 +0000 |
commit | 4c1313197bc175d5dd38cb0e2904509f52254e2d (patch) | |
tree | 7929b2af47a83c1f12c81cf8ee3a1e3ce3b2b2bb /src/widgets/itemviews/qabstractitemview.cpp | |
parent | f568bfce641f52b4641b5d8281c99742f1ae6f40 (diff) |
QbstractItemView: Allow Key_Space for keyboardSearch()
The keyboard search in QAbstractItemView did not handled Key_Space
because this is also an edit trigger. It was also consumed if no edit
was started.
This patch changes this behavior and triggers the keybaord search when
the editing was not started.
Fixes: QTBUG-48505
Change-Id: I58e0d283f863c9b12ac5d2f6171f15522bd7c30a
Reviewed-by: David Faure <david.faure@kdab.com>
Diffstat (limited to 'src/widgets/itemviews/qabstractitemview.cpp')
-rw-r--r-- | src/widgets/itemviews/qabstractitemview.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp index 02eae33a12..638cee8289 100644 --- a/src/widgets/itemviews/qabstractitemview.cpp +++ b/src/widgets/itemviews/qabstractitemview.cpp @@ -2438,8 +2438,14 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event) break; case Qt::Key_Space: case Qt::Key_Select: - if (!edit(currentIndex(), AnyKeyPressed, event) && d->selectionModel) - d->selectionModel->select(currentIndex(), selectionCommand(currentIndex(), event)); + if (!edit(currentIndex(), AnyKeyPressed, event)) { + if (d->selectionModel) + d->selectionModel->select(currentIndex(), selectionCommand(currentIndex(), event)); + if (event->key() == Qt::Key_Space) { + keyboardSearch(event->text()); + event->accept(); + } + } #ifdef QT_KEYPAD_NAVIGATION if ( event->key()==Qt::Key_Select ) { // Also do Key_Enter action. |