From 0b82e9ef310784666fcc947c60f5b48c51f087ea Mon Sep 17 00:00:00 2001 From: "j.delarago" Date: Mon, 14 Mar 2022 14:29:11 +0100 Subject: [PATCH] Remove focus from TextField when incrementing/decrementing using buttons. This fixes the issue where the value that was in the textfield before typing would be incremented instead, if the textField had active focus. CURA-8890 --- resources/qml/SpinBox.qml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/resources/qml/SpinBox.qml b/resources/qml/SpinBox.qml index 3c5a4d95e2..5f809a434a 100644 --- a/resources/qml/SpinBox.qml +++ b/resources/qml/SpinBox.qml @@ -72,6 +72,18 @@ Item base.value = value * base.stepSize; } + // This forces TextField to commit typed values before incrementing with buttons. + // This fixes the typed value not being incremented when the textField has active focus. + up.onPressedChanged: + { + base.forceActiveFocus() + } + + down.onPressedChanged: + { + base.forceActiveFocus() + } + background: Item {} contentItem: Cura.TextField