Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/EasyApp/Gui/Elements/TextField.qml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,22 @@ T.TextField {
Behavior on border.color { EaAnimations.ThemeChange {} }
}

// Visual feedback for the user that editing finish was accepted
function _commit(event) {
if (!acceptableInput) {
warned = true
event.accepted = true
return
}
warned = false
accepted()
focus = false
event.accepted = true
}

Keys.onReturnPressed: (event) => _commit(event)
Keys.onEnterPressed: (event) => _commit(event)

//Mouse area to react on click events
MouseArea {
id: mouseArea
Expand Down
16 changes: 16 additions & 0 deletions src/EasyApp/Gui/Elements/TextInput.qml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,22 @@ T.TextField {
color: 'transparent'
}

// Visual feedback for the user that editing finish was accepted
function _commit(event) {
if (!acceptableInput) {
warned = true
event.accepted = true
return
}
warned = false
accepted()
focus = false
event.accepted = true
}

Keys.onReturnPressed: (event) => _commit(event)
Keys.onEnterPressed: (event) => _commit(event)

//Mouse area to react on click events
MouseArea {
id: mouseArea
Expand Down