feat(StatusBasenput): add acceptReturn to Input to pass return events

This commit is contained in:
Jonathan Rainville 2022-05-04 15:53:31 -04:00
parent 148505ba6b
commit 32c5f7f8df
1 changed files with 9 additions and 2 deletions

View File

@ -44,6 +44,13 @@ Item {
This property indicates whether the StatusBaseInput allows multiline text. Default value is false.
*/
property bool multiline: false
/*!
\qmlproperty bool StatusBaseInput::acceptReturn
This property indicates whether the StatusBaseInput allows pressing Enter or Return.
This is used in case multiline is false and we still want to interact using Enter or Return. Default value is false.
*/
property bool acceptReturn: false
/*!
\qmlproperty bool StatusBaseInput::clearable
This property indicates whether the StatusBaseInput allows clearing all text. Default value is false.
@ -371,8 +378,8 @@ Item {
color: Theme.palette.directColor1
wrapMode: root.multiline ? Text.WrapAtWordBoundaryOrAnywhere : TextEdit.NoWrap
Keys.onReturnPressed: event.accepted = !multiline
Keys.onEnterPressed: event.accepted = !multiline
Keys.onReturnPressed: event.accepted = !multiline && !acceptReturn
Keys.onEnterPressed: event.accepted = !multiline && !acceptReturn
Keys.forwardTo: [root]
KeyNavigation.priority: !!root.tabNavItem ? KeyNavigation.BeforeItem : KeyNavigation.AfterItem
KeyNavigation.tab: root.tabNavItem