From d1280af2e4c704147a36da510faa0a994d3159c7 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Wed, 27 Jan 2021 19:19:21 +0100 Subject: [PATCH] Autoclose completer when space is pressed and no suggestion available --- resources/qml/Completer.qml | 1 + resources/qml/MessageInput.qml | 3 +++ resources/qml/TimelineView.qml | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/resources/qml/Completer.qml b/resources/qml/Completer.qml index 7b71bd7f..750a0fdd 100644 --- a/resources/qml/Completer.qml +++ b/resources/qml/Completer.qml @@ -11,6 +11,7 @@ Popup { property string completerName property var completer property bool bottomToTop: true + property alias count: listView.count signal completionClicked(string completion) diff --git a/resources/qml/MessageInput.qml b/resources/qml/MessageInput.qml index 12362f57..138a9ab6 100644 --- a/resources/qml/MessageInput.qml +++ b/resources/qml/MessageInput.qml @@ -162,6 +162,9 @@ Rectangle { if (event.matches(StandardKey.Paste)) { TimelineManager.timeline.input.paste(false); event.accepted = true; + } else if (event.key == Qt.Key_Space) { + if (popup.opened && popup.count <= 0) + popup.close() } else if (event.modifiers == Qt.ControlModifier && event.key == Qt.Key_U) { messageInput.clear(); } else if (event.modifiers == Qt.ControlModifier && event.key == Qt.Key_P) { diff --git a/resources/qml/TimelineView.qml b/resources/qml/TimelineView.qml index 2eb0a7c5..a2b56b9a 100644 --- a/resources/qml/TimelineView.qml +++ b/resources/qml/TimelineView.qml @@ -35,7 +35,7 @@ Page { colors: palette model: EmojiProxyModel { - category: EmojiCategory.People + category: Emoji.Category.People sourceModel: EmojiModel { }