Autoclose completer when space is pressed and no suggestion available

This commit is contained in:
Nicolas Werner 2021-01-27 19:19:21 +01:00
parent 498bfb89b3
commit d1280af2e4
3 changed files with 5 additions and 1 deletions

View file

@ -11,6 +11,7 @@ Popup {
property string completerName property string completerName
property var completer property var completer
property bool bottomToTop: true property bool bottomToTop: true
property alias count: listView.count
signal completionClicked(string completion) signal completionClicked(string completion)

View file

@ -162,6 +162,9 @@ Rectangle {
if (event.matches(StandardKey.Paste)) { if (event.matches(StandardKey.Paste)) {
TimelineManager.timeline.input.paste(false); TimelineManager.timeline.input.paste(false);
event.accepted = true; 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) { } else if (event.modifiers == Qt.ControlModifier && event.key == Qt.Key_U) {
messageInput.clear(); messageInput.clear();
} else if (event.modifiers == Qt.ControlModifier && event.key == Qt.Key_P) { } else if (event.modifiers == Qt.ControlModifier && event.key == Qt.Key_P) {

View file

@ -35,7 +35,7 @@ Page {
colors: palette colors: palette
model: EmojiProxyModel { model: EmojiProxyModel {
category: EmojiCategory.People category: Emoji.Category.People
sourceModel: EmojiModel { sourceModel: EmojiModel {
} }