Skip to content

fix(vnote): fix Tibetan text overflow in notebook list headers#399

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:develop/snipefrom
dengzhongyuan365-dev:bug-fix-7-10
Jul 7, 2026
Merged

fix(vnote): fix Tibetan text overflow in notebook list headers#399
deepin-bot[bot] merged 1 commit into
linuxdeepin:develop/snipefrom
dengzhongyuan365-dev:bug-fix-7-10

Conversation

@dengzhongyuan365-dev

@dengzhongyuan365-dev dengzhongyuan365-dev commented Jul 7, 2026

Copy link
Copy Markdown
Member

Keep original font sizes and design specs, and make list section header height adapt to actual glyph metrics to prevent clipping of Tibetan text in "Sticky Notes" and notebook header rendering.

保持原有字号与设计规格不变,通过字体度量驱动分组头高度自适应,
修复藏语环境下“已置顶”和记事本标题出现重叠、裁切和出格问题。

Log: 修复藏语下置顶分组与记事本标题显示异常
PMS: BUG-290741
Influence: 藏语切换后列表标题与置顶分组显示恢复正常,且不影响
中文场景下的既有字号和30px设计基线。

Summary by Sourcery

Adapt list headers and folder list items to font metrics to prevent Tibetan text clipping while preserving existing design baselines.

Bug Fixes:

  • Prevent clipping and overlap of Tibetan text in folder list headers and sticky notes section headers by making their heights depend on font metrics.

Enhancements:

  • Align folder and sticky notes labels vertically within their containers and enable clipping on folder list item backgrounds to improve visual consistency across locales.

@sourcery-ai

sourcery-ai Bot commented Jul 7, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adjusts list header heights and layout based on font metrics to prevent Tibetan text clipping in folder and sticky-note headers while preserving original design baselines.

File-Level Changes

Change Details Files
Make folder list item heights derive from font metrics instead of a fixed 30px, and vertically center label content while clipping overflow within the item background.
  • Import Deepin style module and compute vertical padding from DS.Style.control properties.
  • Introduce a FontMetrics object for folder items and bind itemHeight to the max of 30px and the font metrics height plus vertical padding.
  • Enable clipping on the folder item background rectangle to prevent text from drawing outside the rounded rect.
  • Make folder name and count labels fill the row height and vertically center their content using layout alignment.
src/gui/mainwindow/FolderListView.qml
Make the "Sticky Notes" top section header height adapt to actual glyph metrics and vertically center its content to avoid Tibetan clipping.
  • Replace fixed 18px top section header height with a metric-based height using FontMetrics for the 12px header font and a small padding, while keeping the non-top section height at 16px.
  • Add a FontMetrics helper for the sticky-note section header with pixelSize 12 to match existing typography.
  • Change the section row layout to vertically center within the header rectangle instead of anchoring to the top, and vertically center the sticky header Text.
src/gui/mainwindow/ItemListView.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

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

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:

  • In FolderListView.qml, folderItemFontMetrics is using the default font while folderNameLabel may have its own font configuration; consider binding the FontMetrics.font to folderNameLabel.font so itemHeight truly reflects the label’s actual glyph metrics.
  • In ItemListView.qml, the FontMetrics object is declared inside the delegate for each section header; if this list can be large, consider moving a shared FontMetrics instance outside the delegate and reusing it to avoid creating many metric objects.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In FolderListView.qml, `folderItemFontMetrics` is using the default font while `folderNameLabel` may have its own font configuration; consider binding the `FontMetrics.font` to `folderNameLabel.font` so `itemHeight` truly reflects the label’s actual glyph metrics.
- In ItemListView.qml, the `FontMetrics` object is declared inside the `delegate` for each section header; if this list can be large, consider moving a shared `FontMetrics` instance outside the delegate and reusing it to avoid creating many metric objects.

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.

Keep original font sizes and design specs, and make list section
header height adapt to actual glyph metrics to prevent clipping of
Tibetan text in "Sticky Notes" and notebook header rendering.

 保持原有字号与设计规格不变,通过字体度量驱动分组头高度自适应,
修复藏语环境下“已置顶”和记事本标题出现重叠、裁切和出格问题。

Log: 修复藏语下置顶分组与记事本标题显示异常
PMS: BUG-290741
Influence: 藏语切换后列表标题与置顶分组显示恢复正常,且不影响
中文场景下的既有字号和30px设计基线。
@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

★ 总体评分:100分

■ 【总体评价】

代码实现了列表项高度和布局的自适应优化,质量优秀且无安全隐患
逻辑完全正确且消除了硬编码,符合满分标准

■ 【详细分析】

  • 1.语法逻辑(完全正确)✓

在 FolderListView.qml 和 ItemListView.qml 中,新增的 DS.Style 属性访问、FontMetrics 组件声明、Math.max 函数调用以及 Layout 属性的绑定均符合 QML 语法规范,无编译或运行时错误风险
建议:保持当前的属性绑定写法

  • 2.代码质量(优秀)✓

将原先硬编码的高度值(如 30、18)替换为基于 FontMetrics 的动态计算,显著提升了代码在不同 DPI 缩放比例和不同字体配置下的界面适配能力,同时通过 Layout.alignment 优化了垂直居中效果,完全符合 DTK 界面开发规范
建议:继续保持这种消除硬编码的自适应布局编码习惯

  • 3.代码性能(高效)✓

引入的 FontMetrics 属于轻量级只读组件,计算开销极低,Math.max 运算仅在字体或样式属性变更时触发。FolderListView.qml 中添加的 clip: true 带来的 GPU 裁剪开销在常规列表项渲染场景下可忽略不计
建议:无需额外性能优化

  • 4.代码安全(存在0个安全漏洞)✓

漏洞对比统计:新增漏洞 0 个,减少漏洞 0 个,持平 0 个
本次修改仅涉及前端 UI 布局和样式调整,未引入任何文件读写、网络请求、命令执行或动态用户输入处理逻辑,不存在安全攻击面
建议:继续保持纯视图层代码与业务逻辑及数据层的隔离

■ 【改进建议代码示例】

// 示例:展示当前正确的自适应高度与垂直居中实现模式
import org.deepin.dtk.style 1.0 as DS

Item {
    id: root

    // 使用 readonly 防止外部意外修改,基于样式系统计算内边距
    readonly property int itemVerticalPadding: (DS.Style.control.padding - DS.Style.control.borderWidth) * 2

    // 使用 FontMetrics 获取真实字体高度,结合 Math.max 确保最小可用高度
    property int itemHeight: Math.max(30, folderItemFontMetrics.height + itemVerticalPadding)

    FontMetrics {
        id: folderItemFontMetrics
    }

    Rectangle {
        height: root.itemHeight
        clip: true // 防止内容溢出圆角边界

        RowLayout {
            anchors.fill: parent

            Label {
                Layout.fillWidth: true
                Layout.fillHeight: true
                Layout.alignment: Qt.AlignVCenter
                text: "自适应文本"
            }

            Label {
                Layout.alignment: Qt.AlignVCenter
                text: "右侧内容"
            }
        }
    }
}

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: dengzhongyuan365-dev, lzwind

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

@dengzhongyuan365-dev

Copy link
Copy Markdown
Member Author

/forcemerge

@deepin-bot

deepin-bot Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

This pr force merged! (status: unstable)

@deepin-bot
deepin-bot Bot merged commit 1efe47d into linuxdeepin:develop/snipe Jul 7, 2026
22 of 23 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