mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-27 16:59:21 +00:00
Fix the autorepeating to ignore keys on printable keys only
This commit is contained in:
parent
01c8f7ca00
commit
492796e8f2
1 changed files with 11 additions and 7 deletions
|
|
@ -80,16 +80,20 @@ Item {
|
|||
|
||||
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)
|
||||
}
|
||||
if( event.isAutoRepeat){// We begin or are currently repeating a key
|
||||
if(!isAutoRepeating){// We start repeat. Check if this is an "ignore" character
|
||||
if(event.key > Qt.Key_Any && event.key <= Qt.Key_ydiaeresis)// Remove the previous character if it is a printable character
|
||||
textArea.remove(cursorPosition-1, cursorPosition)
|
||||
}
|
||||
}else
|
||||
isAutoRepeating = false// We are no more repeating. Final decision is done on Releasing
|
||||
}
|
||||
Keys.onPressed: {
|
||||
if(event.isAutoRepeat){
|
||||
isAutoRepeating = true
|
||||
event.accepted = true
|
||||
isAutoRepeating = true// Where are repeating the key. Set the state.
|
||||
if(event.key > Qt.Key_Any && event.key <= Qt.Key_ydiaeresis){// Ignore character if it is repeating and printable character
|
||||
event.accepted = true
|
||||
}
|
||||
}else if (event.matches(StandardKey.InsertLineSeparator)) {
|
||||
insert(cursorPosition, '')
|
||||
} else if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue