From d443a69d8f47fcf420e6a3e2c57a13eddcd8e925 Mon Sep 17 00:00:00 2001 From: David Rosca Date: Thu, 25 Jan 2018 11:13:32 +0100 Subject: [PATCH] LocationCompleterView: Fix Shift+Tab handling --- src/lib/navigation/completer/locationcompleterview.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/lib/navigation/completer/locationcompleterview.cpp b/src/lib/navigation/completer/locationcompleterview.cpp index b826d52d5..90f537f19 100644 --- a/src/lib/navigation/completer/locationcompleterview.cpp +++ b/src/lib/navigation/completer/locationcompleterview.cpp @@ -199,11 +199,15 @@ bool LocationCompleterView::eventFilter(QObject* object, QEvent* event) case Qt::Key_Tab: case Qt::Key_Backtab: { - if (keyEvent->modifiers() != Qt::NoModifier) { + const bool isShift = keyEvent->modifiers() == Qt::ShiftModifier; + if (keyEvent->modifiers() != Qt::NoModifier && !isShift) { return false; } - Qt::Key k = keyEvent->key() == Qt::Key_Tab ? Qt::Key_Down : Qt::Key_Up; - QKeyEvent ev(QKeyEvent::KeyPress, k, Qt::NoModifier); + bool isBack = keyEvent->key() == Qt::Key_Backtab; + if (keyEvent->key() == Qt::Key_Tab && isShift) { + isBack = true; + } + QKeyEvent ev(QKeyEvent::KeyPress, isBack ? Qt::Key_Up : Qt::Key_Down, Qt::NoModifier); QApplication::sendEvent(focusProxy(), &ev); return true; }