From b5af1d81df9525ae035a71dd35d94993f75a3a69 Mon Sep 17 00:00:00 2001 From: resolritter Date: Sun, 22 Aug 2021 13:02:26 -0300 Subject: [PATCH] accept Backtab and Shift-Tab for hovering selection backwards --- resources/qml/ForwardCompleter.qml | 13 +++++++------ resources/qml/MessageInput.qml | 8 ++++++-- resources/qml/QuickSwitcher.qml | 13 +++++++------ 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/resources/qml/ForwardCompleter.qml b/resources/qml/ForwardCompleter.qml index 26752f92..fdfcec6f 100644 --- a/resources/qml/ForwardCompleter.qml +++ b/resources/qml/ForwardCompleter.qml @@ -80,15 +80,16 @@ Popup { completerPopup.completer.searchString = text; } Keys.onPressed: { - if (event.key == Qt.Key_Up && completerPopup.opened) { + if ((event.key == Qt.Key_Up || event.key == Qt.Key_Backtab) && completerPopup.opened) { event.accepted = true; completerPopup.up(); - } else if (event.key == Qt.Key_Down && completerPopup.opened) { + } else if ((event.key == Qt.Key_Down || event.key == Qt.Key_Tab) && completerPopup.opened) { event.accepted = true; - completerPopup.down(); - } else if (event.key == Qt.Key_Tab && completerPopup.opened) { - event.accepted = true; - completerPopup.down(); + if (event.key == Qt.Key_Tab && (event.modifiers & Qt.ShiftModifier)) { + completerPopup.up(); + } else { + completerPopup.down(); + } } else if (event.matches(StandardKey.InsertParagraphSeparator)) { completerPopup.finishCompletion(); event.accepted = true; diff --git a/resources/qml/MessageInput.qml b/resources/qml/MessageInput.qml index 7599036e..36d8fbce 100644 --- a/resources/qml/MessageInput.qml +++ b/resources/qml/MessageInput.qml @@ -195,7 +195,11 @@ Rectangle { } else if (event.key == Qt.Key_Tab) { event.accepted = true; if (popup.opened) { - popup.up(); + if (event.modifiers & Qt.ShiftModifier) { + popup.down(); + } else { + popup.up(); + } } else { var pos = cursorPosition - 1; while (pos > -1) { @@ -219,7 +223,7 @@ Rectangle { } else if (event.key == Qt.Key_Up && popup.opened) { event.accepted = true; popup.up(); - } else if (event.key == Qt.Key_Down && popup.opened) { + } else if ((event.key == Qt.Key_Down || event.key == Qt.Key_Backtab) && popup.opened) { event.accepted = true; popup.down(); } else if (event.key == Qt.Key_Up && event.modifiers == Qt.NoModifier) { diff --git a/resources/qml/QuickSwitcher.qml b/resources/qml/QuickSwitcher.qml index defcc611..fe1936af 100644 --- a/resources/qml/QuickSwitcher.qml +++ b/resources/qml/QuickSwitcher.qml @@ -39,15 +39,16 @@ Popup { completerPopup.completer.searchString = text; } Keys.onPressed: { - if (event.key == Qt.Key_Up && completerPopup.opened) { + if ((event.key == Qt.Key_Up || event.key == Qt.Key_Backtab) && completerPopup.opened) { event.accepted = true; completerPopup.up(); - } else if (event.key == Qt.Key_Down && completerPopup.opened) { + } else if ((event.key == Qt.Key_Down || event.key == Qt.Key_Tab) && completerPopup.opened) { event.accepted = true; - completerPopup.down(); - } else if (event.key == Qt.Key_Tab && completerPopup.opened) { - event.accepted = true; - completerPopup.down(); + if (event.key == Qt.Key_Tab && (event.modifiers & Qt.ShiftModifier)) { + completerPopup.up(); + } else { + completerPopup.down(); + } } else if (event.matches(StandardKey.InsertParagraphSeparator)) { completerPopup.finishCompletion(); event.accepted = true;