Skip to content

fix: change notification title elide mode to right#1506

Merged
deepin-bot[bot] merged 1 commit intolinuxdeepin:masterfrom
wjyrich:fix-bug-353223
Mar 17, 2026
Merged

fix: change notification title elide mode to right#1506
deepin-bot[bot] merged 1 commit intolinuxdeepin:masterfrom
wjyrich:fix-bug-353223

Conversation

@wjyrich
Copy link
Contributor

@wjyrich wjyrich commented Mar 17, 2026

Changed the elide property of the notification title text from ElideMiddle to ElideRight. This modification ensures that when notification titles are too long to fit within the available space, the text will be truncated from the end (right side) rather than the middle. This provides better readability and user experience as users typically expect to see the beginning of titles which often contain the most important information.

Log: Notification titles now truncate from the end instead of the middle for better readability

Influence:

  1. Test notifications with long titles to verify truncation occurs at the end
  2. Verify that short titles display completely without truncation
  3. Check that the layout remains stable with various title lengths
  4. Test with different system font sizes to ensure proper text rendering
  5. Verify that mouse hover tooltips (if present) still show full titles

fix: 修改通知标题省略模式为右侧省略

将通知标题文本的省略属性从 ElideMiddle 更改为 ElideRight。此修改确保当
通知标题过长无法在可用空间内显示时,文本将从末尾(右侧)截断,而不是从中
间截断。这提供了更好的可读性和用户体验,因为用户通常期望看到标题的开头部
分,这部分通常包含最重要的信息。

Log: 通知标题现在从末尾截断而不是从中间截断,以提高可读性

Influence:

  1. 测试带有长标题的通知,验证截断发生在末尾
  2. 验证短标题能够完整显示而不被截断
  3. 检查不同标题长度下布局是否保持稳定
  4. 使用不同的系统字体大小测试,确保文本渲染正确
  5. 验证鼠标悬停提示(如果存在)仍能显示完整标题

PMS: BUG-353223

Summary by Sourcery

Bug Fixes:

  • Ensure long notification titles truncate at the end to improve readability while preserving the beginning of the text.

Changed the elide property of the notification title text from
ElideMiddle to ElideRight. This modification ensures that when
notification titles are too long to fit within the available space, the
text will be truncated from the end (right side) rather than the middle.
This provides better readability and user experience as users typically
expect to see the beginning of titles which often contain the most
important information.

Log: Notification titles now truncate from the end instead of the middle
for better readability

Influence:
1. Test notifications with long titles to verify truncation occurs at
the end
2. Verify that short titles display completely without truncation
3. Check that the layout remains stable with various title lengths
4. Test with different system font sizes to ensure proper text rendering
5. Verify that mouse hover tooltips (if present) still show full titles

fix: 修改通知标题省略模式为右侧省略

将通知标题文本的省略属性从 ElideMiddle 更改为 ElideRight。此修改确保当
通知标题过长无法在可用空间内显示时,文本将从末尾(右侧)截断,而不是从中
间截断。这提供了更好的可读性和用户体验,因为用户通常期望看到标题的开头部
分,这部分通常包含最重要的信息。

Log: 通知标题现在从末尾截断而不是从中间截断,以提高可读性

Influence:
1. 测试带有长标题的通知,验证截断发生在末尾
2. 验证短标题能够完整显示而不被截断
3. 检查不同标题长度下布局是否保持稳定
4. 使用不同的系统字体大小测试,确保文本渲染正确
5. 验证鼠标悬停提示(如果存在)仍能显示完整标题

PMS: BUG-353223
@sourcery-ai
Copy link

sourcery-ai bot commented Mar 17, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Updates notification title text truncation to elide from the right instead of the middle to improve readability of long titles.

Flow diagram for notification title elide mode decision

flowchart TD
    A[NotificationTitleText] --> B{TitleWidth > AvailableWidth?}
    B -- No --> C[Display full title text]
    B -- Yes --> D[Apply ElideRight mode]
    D --> E[Render title with right-side truncation]
Loading

File-Level Changes

Change Details Files
Adjust notification title text truncation behavior to elide from the right edge instead of the middle.
  • Change the text elide mode constant from middle truncation to right-side truncation for the notification title label.
  • Keep all other text properties (color, rendering, wrapping, layout) unchanged to preserve existing layout and styling.
panels/notification/plugin/NotifyItemContent.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 reviewed your changes and they look great!


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

代码审查意见

针对提供的 git diff 内容,以下是关于 NotifyItemContent.qml 文件中 Text 属性修改的详细审查意见:

1. 语法逻辑

  • 审查结果通过
  • 分析:修改将 elide: Text.ElideMiddle 改为 elide: Text.ElideRight。在 QML 中,Text.ElideRightText 枚举中的有效值,语法完全正确。该属性用于指定当文本宽度超过容器宽度时的省略方式。

2. 代码质量

  • 审查结果建议确认
  • 分析
    • Text.ElideMiddle:通常用于显示文件路径、URL 或具有固定前缀/后缀的标识符。它保留文本的开头和结尾,中间用省略号代替(例如:/path/to/.../filename),便于用户识别首尾关键信息。
    • Text.ElideRight:这是通用的文本截断方式,保留文本的开头,末尾用省略号代替(例如:这是一段很长的文...)。
    • 改进意见:需要确认该 Text 组件具体显示的内容类型。
      • 如果显示的是标题普通消息内容,改为 ElideRight 是合理的,符合用户从左到右的阅读习惯。
      • 如果显示的是来源应用名称时间等关键信息在末尾的内容,ElideMiddle 可能更合适,以免丢失末尾的区分信息。
      • 鉴于代码中存在 Layout.fillWidth: true,说明该文本区域会占据剩余空间。如果通知列表中强调内容的开头部分(如“谁发来的消息”),ElideRight 是更好的选择。

3. 代码性能

  • 审查结果无影响
  • 分析ElideMiddleElideRight 的计算开销在现代设备上差异极小,几乎可以忽略不计。此修改不会对渲染性能产生负面影响。

4. 代码安全

  • 审查结果安全
  • 分析:此修改仅涉及 UI 渲染逻辑,不涉及数据处理、权限控制或网络交互,因此不存在安全漏洞风险。

总结建议

该修改将文本截断方式从中间截断改为右侧截断。如果该文本组件主要用于显示通知的标题或正文,这是一个正向的改进,能提供更好的阅读体验。

建议:在合并代码前,请务必在 UI 上进行视觉回归测试,确保在文本过长时,右侧截断的显示效果符合设计预期,且没有与其他文本(如时间戳)发生重叠或布局错乱。

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: mhduiy, wjyrich

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

@wjyrich
Copy link
Contributor Author

wjyrich commented Mar 17, 2026

/forcemerge

@deepin-bot
Copy link

deepin-bot bot commented Mar 17, 2026

This pr force merged! (status: blocked)

@deepin-bot deepin-bot bot merged commit 1127204 into linuxdeepin:master Mar 17, 2026
9 of 12 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