fix(StatusBaseInput): forward focus to the input component and send signals on Enter/Return pressed

This commit is contained in:
Alex Jbanca 2023-03-23 11:52:50 +02:00 committed by Alex Jbanca
parent 858b53979a
commit ad8ce70e09
1 changed files with 11 additions and 2 deletions

View File

@ -268,6 +268,9 @@ Item {
*/
signal editClicked()
onFocusChanged: {
if(focus) edit.forceActiveFocus()
}
Rectangle {
id: background
@ -356,8 +359,14 @@ Item {
font.family: Theme.palette.baseFont.name
color: root.enabled ? Theme.palette.directColor1 : Theme.palette.baseColor1
wrapMode: root.multiline ? Text.WrapAtWordBoundaryOrAnywhere : TextEdit.NoWrap
Keys.onReturnPressed: event.accepted = !multiline && !acceptReturn
Keys.onEnterPressed: event.accepted = !multiline && !acceptReturn
Keys.onReturnPressed: {
root.keyPressed(event)
event.accepted = !multiline && !acceptReturn
}
Keys.onEnterPressed: {
root.keyPressed(event)
event.accepted = !multiline && !acceptReturn
}
Keys.forwardTo: [root]
KeyNavigation.priority: !!root.tabNavItem ? KeyNavigation.BeforeItem : KeyNavigation.AfterItem
KeyNavigation.tab: root.tabNavItem