Skip to content

fix(accounts): adjust password dialog layout spacing#3052

Merged
deepin-bot[bot] merged 1 commit intolinuxdeepin:masterfrom
add-uos:fix-BUG-342021
Mar 7, 2026
Merged

fix(accounts): adjust password dialog layout spacing#3052
deepin-bot[bot] merged 1 commit intolinuxdeepin:masterfrom
add-uos:fix-BUG-342021

Conversation

@add-uos
Copy link
Contributor

@add-uos add-uos commented Mar 6, 2026

Optimize the spacing and padding in password modification dialog to make the layout more compact and visually balanced.

优化密码修改对话框的间距和内边距,使布局更紧凑和视觉平衡。

Log: 优化密码修改对话框布局间距
PMS: BUG-342021
Influence: 密码修改对话框的布局更加紧凑,视觉效果更佳,用户体验得到改善。

Summary by Sourcery

Enhancements:

  • Refine spacing and padding within the password modification dialog to improve visual balance and compactness.

@sourcery-ai
Copy link

sourcery-ai bot commented Mar 6, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adjusts layout spacing and padding in the password modification dialog to create a more compact, visually balanced layout.

Flow diagram for layout structure of PasswordModifyDialog after spacing adjustments

flowchart TD
  DialogWindow[DialogWindow PasswordModifyDialog]
  ColumnLayout[ColumnLayout width: dialog.width - 10\nspacing: 0]
  TitleLabel[Label title\nfont.bold: true]
  TipsLabel[Label tips\nrightPadding: 10\nleftPadding: 10\nwrapMode: WordWrap\nLayout.rightMargin: 10]
  PasswordLayout[PasswordLayout]

  DialogWindow --> ColumnLayout
  ColumnLayout --> TitleLabel
  ColumnLayout --> TipsLabel
  ColumnLayout --> PasswordLayout
Loading

File-Level Changes

Change Details Files
Tighten vertical spacing in the dialog’s main column layout.
  • Set the ColumnLayout spacing to zero so items stack more tightly without extra gaps between components.
src/plugin-accounts/qml/PasswordModifyDialog.qml
Reduce excess padding and margins around the descriptive text to compact the dialog content area.
  • Decrease the Label rightPadding from 20 to 10 to reduce horizontal whitespace on the right side of the description text.
  • Remove the Label Layout.bottomMargin to bring the following PasswordLayout closer.
  • Keep leftPadding while maintaining alignment and preferred width calculations so text layout remains centered and readable.
src/plugin-accounts/qml/PasswordModifyDialog.qml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • With ColumnLayout.spacing set to 0, the title label and the following content may appear visually merged; consider adding an explicit Layout.topMargin or bottom margin on one of the items to preserve a clear visual separation.
  • You now use several hard-coded 10 pixel paddings/margins in this dialog; consider extracting a shared constant or using a theme variable so that future layout adjustments remain consistent and easier to maintain.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- With `ColumnLayout.spacing` set to 0, the title label and the following content may appear visually merged; consider adding an explicit `Layout.topMargin` or bottom margin on one of the items to preserve a clear visual separation.
- You now use several hard-coded `10` pixel paddings/margins in this dialog; consider extracting a shared constant or using a theme variable so that future layout adjustments remain consistent and easier to maintain.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@deepin-ci-robot
Copy link

deepin pr auto review

这段代码是对 PasswordModifyDialog.qml 文件中 ColumnLayout 及其子元素 Label 的样式调整。以下是对这段 diff 的详细审查,包括语法逻辑、代码质量、性能和安全性方面的分析:

1. 语法逻辑

  • spacing: 0:

    • ColumnLayout 中添加 spacing: 0 是合法的 QML 语法。这意味着垂直排列的子元素之间将没有默认间距。
    • 潜在问题:将间距设为 0 后,原本依靠 spacing 分隔的元素(如标题 Label 和下方的 PasswordLayout)可能会紧贴在一起。代码中移除了 Label 的 Layout.bottomMargin: 10,这进一步确认了开发者意图移除标题与输入框之间的垂直间隙。如果 UI 设计确实需要紧凑布局,逻辑是正确的;如果需要保留间隙,应通过其他方式(如给下方的 PasswordLayout 增加 Layout.topMargin)来实现。
  • Padding 和 Margin 调整:

    • rightPadding20 改为 10leftPadding 保持 10。这使得 Label 的文本左右内边距变小,文本可显示区域变宽。
    • 移除了 Layout.bottomMargin: 10。配合 spacing: 0,这将使 Label 的底部紧贴下一个元素。
    • 逻辑上,这些修改旨在压缩布局空间,使界面更紧凑。从语法上看没有问题。

2. 代码质量

  • 布局一致性:
    • Layout.rightMargin 设置为 10,而 rightPadding 也改为了 10。这种一致性(Padding 和 Margin 相同)在视觉上通常比较协调,符合设计规范。
  • 可维护性:
    • 直接修改数值(如 10, 20)是 QML 中常见的做法,但为了更好的可维护性,建议将这类布局常量(如标准的间距值)定义在顶层的 QtObject 或单独的配置文件中,通过属性绑定来使用。这样如果全局设计规范改变(例如标准间距从 10px 变为 12px),只需修改一处即可。
    • 建议:定义 property int controlSpacing: 10,然后使用 rightPadding: controlSpacing

3. 代码性能

  • 性能影响:
    • 这些修改仅涉及布局属性的数值变更,不会引入复杂的绑定循环或重绘开销。对性能几乎没有影响。

4. 代码安全

  • 安全性:
    • 这是一段纯 UI 布局代码,不涉及数据处理、网络请求或系统调用,因此没有明显的安全隐患。

改进建议

  1. 布局间距的显式管理
    既然将 ColumnLayoutspacing 设为 0,且移除了 Label 的底部边距,请务必检查 PasswordLayout(即下一个元素)是否正确处理了顶部边距。如果 PasswordLayout 也没有 Layout.topMargin,UI 可能会显得过于拥挤,导致文本与输入框重叠或紧贴,影响用户体验。

    建议代码片段

    ColumnLayout {
        width: dialog.width - 10
        spacing: 0 // 明确间距由子元素的 margin 控制
    
        Label {
            // ... Label 属性 ...
            Layout.bottomMargin: 10 // 如果需要与下方保持距离,建议保留或在此处显式控制
        }
    
        PasswordLayout {
            Layout.topMargin: 10 // 或者在这里控制间距,保持逻辑清晰
            // ...
        }
    }
  2. 使用常量管理布局数值
    为了提高代码的可维护性,建议提取硬编码的数值。

    建议代码片段

    // 在 DialogWindow 或根组件中定义
    QtObject {
        id: theme
        readonly property int hSpacing: 10
        readonly property int vSpacing: 10
    }
    
    // 在具体控件中使用
    Label {
        rightPadding: theme.hSpacing
        leftPadding: theme.hSpacing
        Layout.bottomMargin: theme.vSpacing
        // ...
    }
  3. 文本对齐与宽度
    当前设置了 Layout.preferredWidth: pwdLayout.minWidth(font, text, dialog.width - 12)horizontalAlignment: Text.AlignHCenter

    • 注意检查 pwdLayout.minWidth 的计算逻辑是否与新的 Padding(10px)相匹配。原 Padding 是 20px,现在是 10px,左右共减少了 20px 的空间。如果 minWidth 的计算逻辑依赖于 Padding,可能需要同步调整该计算函数或传入的参数,以避免文本换行异常或留白过多。

总结

这段 diff 的主要目的是压缩 UI 布局空间,减小内边距和间距。

  • 语法:正确。
  • 逻辑:符合紧凑布局的意图,但需注意移除间距后相邻元素的视觉关系。
  • 质量:建议使用属性常量代替硬编码数字。
  • 性能:无影响。
  • 安全:无风险。

最终建议:确认 UI 设计图确实要求移除标题与输入框之间的间距,或者确认 PasswordLayout 内部是否有足够的顶部留白,否则建议保留 Layout.bottomMargin 或在 PasswordLayout 中添加 Layout.topMargin

Optimize the spacing and padding in password modification dialog
to make the layout more compact and visually balanced.

优化密码修改对话框的间距和内边距,使布局更紧凑和视觉平衡。

Log: 优化密码修改对话框布局间距
PMS: BUG-342021
Influence: 密码修改对话框的布局更加紧凑,视觉效果更佳,用户体验得到改善。
@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: add-uos, mhduiy

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@add-uos
Copy link
Contributor Author

add-uos commented Mar 7, 2026

/merge

1 similar comment
@add-uos
Copy link
Contributor Author

add-uos commented Mar 7, 2026

/merge

@deepin-bot deepin-bot bot merged commit a392184 into linuxdeepin:master Mar 7, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants