From 270bd5eef87451fc1536306724bbd7870c79b147 Mon Sep 17 00:00:00 2001 From: Ales Kutsepau Date: Mon, 16 Mar 2026 16:42:37 +0100 Subject: [PATCH 1/3] Changed the behviour of TableViewTextInput to loose focus on enter/return pressed --- src/EasyApp/Gui/Components/TableViewTextInput.qml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/EasyApp/Gui/Components/TableViewTextInput.qml b/src/EasyApp/Gui/Components/TableViewTextInput.qml index fecc3d9e..902aaa89 100644 --- a/src/EasyApp/Gui/Components/TableViewTextInput.qml +++ b/src/EasyApp/Gui/Components/TableViewTextInput.qml @@ -8,4 +8,13 @@ EaElements.TextInput { height: parent.height horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter + + Keys.onReturnPressed: { + accepted() + focus = false + } + Keys.onEnterPressed: { + accepted() + focus = false + } } From 0b5fec2cea5e425c1dfab79e74826060645cb2ec Mon Sep 17 00:00:00 2001 From: Ales Kutsepau Date: Tue, 17 Mar 2026 14:39:44 +0100 Subject: [PATCH 2/3] Moved the logic of toggling focus to TextField and TextInput --- src/EasyApp/Gui/Components/TableViewTextInput.qml | 9 --------- src/EasyApp/Gui/Elements/TextField.qml | 10 ++++++++++ src/EasyApp/Gui/Elements/TextInput.qml | 10 ++++++++++ 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/EasyApp/Gui/Components/TableViewTextInput.qml b/src/EasyApp/Gui/Components/TableViewTextInput.qml index 902aaa89..fecc3d9e 100644 --- a/src/EasyApp/Gui/Components/TableViewTextInput.qml +++ b/src/EasyApp/Gui/Components/TableViewTextInput.qml @@ -8,13 +8,4 @@ EaElements.TextInput { height: parent.height horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter - - Keys.onReturnPressed: { - accepted() - focus = false - } - Keys.onEnterPressed: { - accepted() - focus = false - } } diff --git a/src/EasyApp/Gui/Elements/TextField.qml b/src/EasyApp/Gui/Elements/TextField.qml index bebbb9ba..c4d3adab 100644 --- a/src/EasyApp/Gui/Elements/TextField.qml +++ b/src/EasyApp/Gui/Elements/TextField.qml @@ -80,6 +80,16 @@ T.TextField { Behavior on border.color { EaAnimations.ThemeChange {} } } + // Visual feedback for the user that editing finish was accepted + Keys.onReturnPressed: { + accepted() + focus = false + } + Keys.onEnterPressed: { + accepted() + focus = false + } + //Mouse area to react on click events MouseArea { id: mouseArea diff --git a/src/EasyApp/Gui/Elements/TextInput.qml b/src/EasyApp/Gui/Elements/TextInput.qml index 0d8314e0..320e2a96 100644 --- a/src/EasyApp/Gui/Elements/TextInput.qml +++ b/src/EasyApp/Gui/Elements/TextInput.qml @@ -66,6 +66,16 @@ T.TextField { color: 'transparent' } + // Visual feedback for the user that editing finish was accepted + Keys.onReturnPressed: { + accepted() + focus = false + } + Keys.onEnterPressed: { + accepted() + focus = false + } + //Mouse area to react on click events MouseArea { id: mouseArea From b114e1e0d346479dae797f62ebf6a0f2ae2562a3 Mon Sep 17 00:00:00 2001 From: Ales Kutsepau Date: Tue, 24 Mar 2026 12:05:03 +0100 Subject: [PATCH 3/3] fixes to include validation logic --- src/EasyApp/Gui/Elements/TextField.qml | 16 +++++++++++----- src/EasyApp/Gui/Elements/TextInput.qml | 16 +++++++++++----- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/EasyApp/Gui/Elements/TextField.qml b/src/EasyApp/Gui/Elements/TextField.qml index c4d3adab..9f62cbfc 100644 --- a/src/EasyApp/Gui/Elements/TextField.qml +++ b/src/EasyApp/Gui/Elements/TextField.qml @@ -81,15 +81,21 @@ T.TextField { } // Visual feedback for the user that editing finish was accepted - Keys.onReturnPressed: { - accepted() - focus = false - } - Keys.onEnterPressed: { + 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 diff --git a/src/EasyApp/Gui/Elements/TextInput.qml b/src/EasyApp/Gui/Elements/TextInput.qml index 320e2a96..64c54fac 100644 --- a/src/EasyApp/Gui/Elements/TextInput.qml +++ b/src/EasyApp/Gui/Elements/TextInput.qml @@ -67,15 +67,21 @@ T.TextField { } // Visual feedback for the user that editing finish was accepted - Keys.onReturnPressed: { - accepted() - focus = false - } - Keys.onEnterPressed: { + 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