HTextArea: prevent leaking left/right if readOnly

This commit is contained in:
miruka 2020-07-11 16:10:21 -04:00
parent 224e82f38c
commit c9843bb2ff

View File

@ -97,9 +97,11 @@ TextArea {
// Prevent leaking arrow presses to parent elements when the carret is at // Prevent leaking arrow presses to parent elements when the carret is at
// the beginning or end of the text // the beginning or end of the text
Keys.onLeftPressed: event.accepted = cursorPosition === 0 && ! selectedText Keys.onLeftPressed:
event.accepted = readOnly || (cursorPosition === 0 && ! selectedText)
Keys.onRightPressed: Keys.onRightPressed:
event.accepted = cursorPosition === length && ! selectedText event.accepted =
readOnly || (cursorPosition === length && ! selectedText)
KeyNavigation.priority: KeyNavigation.BeforeItem KeyNavigation.priority: KeyNavigation.BeforeItem
KeyNavigation.tab: focusItemOnTab KeyNavigation.tab: focusItemOnTab