From 3b1ab59e70ca172c9cb1437390fd83c82e4097e4 Mon Sep 17 00:00:00 2001 From: David Redondo Date: Thu, 18 Feb 2021 15:33:42 +0100 Subject: [PATCH] Spinbox: Update value during editing By default QQuickSpinBox will only default its value when Return/Enter is pressed, it loses focus or the user uses the indicator buttons. This is a difference compared to the Widgets QSpinBox which updates during editing. BUG:433066 --- org.kde.desktop/SpinBox.qml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/org.kde.desktop/SpinBox.qml b/org.kde.desktop/SpinBox.qml index fb17e9b..40d7e9f 100644 --- a/org.kde.desktop/SpinBox.qml +++ b/org.kde.desktop/SpinBox.qml @@ -35,6 +35,17 @@ T.SpinBox { top: Math.max(controlRoot.from, controlRoot.to) } + // SpinBox does not update its value during editing, see QTBUG-91281 + Connections { + target: controlRoot.contentItem + function onTextEdited() { + if (controlRoot.contentItem.text) { + controlRoot.value = controlRoot.valueFromText(controlRoot.contentItem.text, controlRoot.locale) + controlRoot.valueModified() + } + } + } + contentItem: TextInput { z: 2 text: controlRoot.textFromValue(controlRoot.value, controlRoot.locale) -- GitLab