Repository navigation
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: iCancely The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Reviewer's GuidePasswordEdit now uses configurable 6px masked dots with 5px spacing and an 8px left margin, drawn in a cursor-anchored overlay that scrolls with long passwords while compensating font letter spacing to preserve cursor alignment; the implementation is mirrored for Qt5 and Qt6 and was verified by build, lint, and geometry checks. Sequence diagram for cursor-aligned password dot renderingsequenceDiagram
participant PasswordEdit
participant TextMetrics
participant Repeater
participant Cursor
PasswordEdit->>TextMetrics: _updateSpaceAdvance()
TextMetrics-->>PasswordEdit: advanceWidth
PasswordEdit->>PasswordEdit: Set font.letterSpacing
PasswordEdit->>Repeater: Create control.length dots
Repeater->>Cursor: Read cursorRectangle.x and cursorPosition
Cursor-->>Repeater: Cursor position and scroll offset
Repeater-->>PasswordEdit: Render dots at 6px size and 11px advance
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="qt6/src/qml/PasswordEdit.qml" line_range="74-76" />
<code_context>
+ y: (control.height - height) / 2
+
+ // Use the cursor as the visible anchor so long passwords
+ // scroll together with the dots.
+ x: DS.Style.passwordEdit.dotLeftMargin
+ + control.cursorRectangle.x - control.leftPadding
+ + (index - control.cursorPosition) * control._dotAdvance
+ }
</code_context>
<issue_to_address>
**Dots misalign with text**
When a caller uses centered or right-aligned text, or an RTL layout, the position formula assumes left-aligned LTR text: `cursorRectangle.x` can include an alignment offset, and the index offset always advances rightward. Dots therefore lose their margin or no longer align with their characters.
Position each dot using the text's actual alignment and direction as well as the cursor position.
Also at `src/qml/PasswordEdit.qml:75-77`, `qt6/src/qml/PasswordEdit.qml:77`.
</issue_to_address>|
对于qml文件的,只改qt6版本, |
f9f5cec to
2b158a2
Compare
|
已处理:QML 只保留 Qt6 版本修改,Qt5 文件已从 diff 中移除。字体绑定也已改为 D.DTK.fontManager.t6,圆点位置使用 positionToRectangle(index) 处理对齐、方向和滚动。已基于最新 v25-flowstyle 重建,PR 仍保持 1 个 commit。 |
1. Add password dot style properties for dot pitch and left padding 2. Use Qt's native password mask rendering instead of a custom overlay 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: 密码掩码符合设计几何且无需自绘
2b158a2 to
13742a1
Compare
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ✅评价: 语法正确,逻辑清晰 ✅ 通过 潜在问题: 建议: [] 2. 代码质量 ✅评价: 代码结构清晰,注释完整 ✅ 通过 潜在问题: 建议: [] 3. 代码性能 ✅评价: 性能良好,资源使用合理 ✅ 通过 潜在问题: 建议: [] 4. 代码安全 🔒评价: 存在0个安全漏洞 ✅ 通过
安全漏洞详情: 建议: [] 💡 改进建议代码示例本报告由 AI 代码审查工具自动生成 |
| } | ||
|
|
||
| echoMode: TextInput.Password | ||
| passwordCharacter: "●" |
There was a problem hiding this comment.
这个如果在平台主题里是否可以设置,
This is the character displayed when echoMode is set to Password or PasswordEchoOnEdit. By default it is the password character used by the platform theme.
|
感谢建议。关于
原因是:DTK t6 默认字体 Source Han Sans SC 中 因此当前方案需要三部分配合:
如果仅靠平台主题设置字符,只能改变用哪个字符,无法控制该字符在特定字体下的渲染大小。所以字体切换和间距计算仍然需要在 QML 层处理,否则圆点尺寸无法满足设计规范。 此外, |
结论 可以。QML TextInput.passwordCharacter 的默认值不是 Qt Quick 自己写死的,取值链路是: TextInput 构造 → QStyleHints::passwordMaskCharacter() → QPlatformTheme::PasswordMaskCharacter → QPlatformIntegration → 默认值 U+25CF 对应源码:
修改方式 在 deepin 平台主题里覆盖即可,不需要改 qt6-base 或 Qt Quick。当前 /home/work/qt5integration/platformthemeplugin/qdeepintheme.cpp:642 没有处理这个 hint,会一路回退到默认 U+25CF。增加一个 case: QVariant QDeepinTheme::themeHint(QPlatformTheme::ThemeHint hint) const } 如果想和 DTK Widget 风格保持一致,DTK 当前在 /home/work/dtkwidget/src/widgets/dstyle.cpp:2038 使用:
也可以在平台主题里做同样的字体判断: case QPlatformTheme::PasswordMaskCharacter: { 改完后重新编译安装平台主题插件,确认应用加载的是 deepin 主题,例如 QT_QPA_PLATFORMTHEME=deepin 或 -platformtheme deepin。 注意
|
English
Adjust the masked password rendering in
PasswordEditwhile keeping Qt's native text input behavior.Changes
dotSize,dotSpacing, anddotLeftMarginstyle properties to the Qt6FlowStylepasswordCharacterrendering instead of a custom overlayfontManager.t6for the visible text font and font size, so the control follows the system font sizeletterSpacingfromTextMetricsVerification
cmake --build build-dtk6-clean --target dtk6declarative -j8cmake --build build-dtk6-clean --target dtk6declarative_qmllint中文
调整
PasswordEdit密码隐藏时的显示样式,同时保留 Qt 原生文本输入行为。变更内容
FlowStyle中新增dotSize、dotSpacing和dotLeftMargin样式属性passwordCharacter绘制密码掩码,移除自定义覆盖层fontManager.t6的字体和字号,因此控件会跟随系统字号变化TextMetrics计算letterSpacing验证
cmake --build build-dtk6-clean --target dtk6declarative -j8编译通过cmake --build build-dtk6-clean --target dtk6declarative_qmllint完成 QML lint 检查