From b378ac59d30e67fa5323cf5f39326f4dd517a548 Mon Sep 17 00:00:00 2001 From: Julien Wadel Date: Thu, 22 Oct 2020 21:10:57 +0200 Subject: [PATCH] Fix/Feature : allow accent menu to appear (on Mac) by removing the repeating key when holding it --- .../modules/Common/Form/DroppableTextArea.qml | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/linphone-app/ui/modules/Common/Form/DroppableTextArea.qml b/linphone-app/ui/modules/Common/Form/DroppableTextArea.qml index 173e5a5d6..99d397d0d 100644 --- a/linphone-app/ui/modules/Common/Form/DroppableTextArea.qml +++ b/linphone-app/ui/modules/Common/Form/DroppableTextArea.qml @@ -77,13 +77,24 @@ Item { Component.onCompleted: forceActiveFocus() + property var isAutoRepeating : false // shutdown repeating key feature to let optional menu appears and do normal stuff (like accents menu) + Keys.onReleased: { + if(isAutoRepeating){// In a repeat session, we don't print the key + isAutoRepeating = false + if(event.text !== '')// Remove the previous character + textArea.remove(textArea.text.length-1, textArea.text.length) + } + } Keys.onPressed: { - if (event.matches(StandardKey.InsertLineSeparator)) { - insert(cursorPosition, '') - } else if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) { - handleValidation() - event.accepted = true - } + if(event.isAutoRepeat){ + isAutoRepeating = true + event.accepted = true + }else if (event.matches(StandardKey.InsertLineSeparator)) { + insert(cursorPosition, '') + } else if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) { + handleValidation() + event.accepted = true + } } } }