From cc7aa59b9119064f9b61db5ca019307d5843ff6a Mon Sep 17 00:00:00 2001 From: zhanghongyuan Date: Fri, 6 Feb 2026 10:18:26 +0800 Subject: [PATCH] fix(time-range): improve hour input focus behavior When entering a single digit hour (3-9), automatically advance focus to the minute input field. This provides a more intuitive time entry experience by recognizing that hours 3-9 are single-digit values in 24-hour format. log: improve hour input focus behavior bug: PMS-349815 --- src/dde-control-center/plugin/DccTimeRange.qml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/dde-control-center/plugin/DccTimeRange.qml b/src/dde-control-center/plugin/DccTimeRange.qml index b408dd04b9..bbf07221fe 100644 --- a/src/dde-control-center/plugin/DccTimeRange.qml +++ b/src/dde-control-center/plugin/DccTimeRange.qml @@ -118,10 +118,20 @@ D.SpinBox { } } onTextChanged: { - if (text.length === 2 && focus && typingDigit) { - typingDigit = false - minuteInput.forceActiveFocus() - minuteInput.selectAll() + if (focus && typingDigit) { + if (text.length === 1) { + var firstDigit = parseInt(text, 10) + if (firstDigit >= 3) { + typingDigit = false + minuteInput.forceActiveFocus() + minuteInput.selectAll() + } + } + else if (text.length === 2) { + typingDigit = false + minuteInput.forceActiveFocus() + minuteInput.selectAll() + } } } Keys.onRightPressed: function(event) {