1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 01:22:10 +01:00

LocationCompleterView: Fix Shift+Tab handling

This commit is contained in:
David Rosca 2018-01-25 11:13:32 +01:00
parent 11e2ff168e
commit d443a69d8f
No known key found for this signature in database
GPG Key ID: EBC3FC294452C6D8

View File

@ -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;
}