From afdbc7a9dca7ad2bec8f0a35df68547058a578f4 Mon Sep 17 00:00:00 2001 From: dss Date: Wed, 21 Oct 2026 14:38:19 +0800 Subject: [PATCH] fix(PasswordEdit): set hidden dot metrics MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Add password dot style properties for dot pitch and left padding 2. Use Qt's native password mask rendering, character from platform theme 3. Keep the DTK t6 font size and use font metrics to set mask advance 4. Use Noto Mono only for the compact hidden password glyph Log: Keep hidden password dots compact with consistent spacing Influence: Password masking follows the design geometry without custom drawing fix(PasswordEdit): 设置隐藏圆点规格 1. 增加密码圆点间距和左侧边距样式属性 2. 使用 Qt 原生密码掩码绘制,字符由平台主题提供 3. 保留 DTK t6 字号,并通过字体度量设置掩码步进 4. 仅在隐藏密码时使用 Noto Mono 的紧凑圆点字形 Log: 保持密码隐藏圆点紧凑且间距一致 Influence: 密码掩码符合设计几何且无需自绘 --- qt6/src/qml/FlowStyle.qml | 3 +++ qt6/src/qml/PasswordEdit.qml | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/qt6/src/qml/FlowStyle.qml b/qt6/src/qml/FlowStyle.qml index 5d3cbeb4..35021e07 100644 --- a/qt6/src/qml/FlowStyle.qml +++ b/qt6/src/qml/FlowStyle.qml @@ -667,6 +667,9 @@ QtObject { property QtObject passwordEdit: QtObject { property int echoActionSpacing: 8 + property int dotSize: 6 + property int dotSpacing: 5 + property int dotLeftMargin: 8 } property QtObject keySequenceEdit: QtObject { diff --git a/qt6/src/qml/PasswordEdit.qml b/qt6/src/qml/PasswordEdit.qml index 990d4837..7e6a69a5 100644 --- a/qt6/src/qml/PasswordEdit.qml +++ b/qt6/src/qml/PasswordEdit.qml @@ -22,9 +22,27 @@ LineEdit { } echoMode: TextInput.Password + + font.family: control.isEchoMode ? D.DTK.fontManager.t6.family : "Noto Mono" + font.pixelSize: D.DTK.fontManager.t6.pixelSize + font.letterSpacing: control.isEchoMode ? 0 + : control._dotAdvance - passwordDotMetrics.advanceWidth + + leftPadding: DS.Style.passwordEdit.dotLeftMargin + clearButton.anchors.rightMargin: echoButton.visible ? DS.Style.passwordEdit.echoActionSpacing + echoButton.width : 0 + readonly property int _dotAdvance: DS.Style.passwordEdit.dotSize + + DS.Style.passwordEdit.dotSpacing + + TextMetrics { + id: passwordDotMetrics + text: control.passwordCharacter + font.family: "Noto Mono" + font.pixelSize: D.DTK.fontManager.t6.pixelSize + } + ActionButton { id: echoButton