Skip to content

fix: Adjust sidebar icon size and set text format for title label#274

Merged
lzwind merged 1 commit into
linuxdeepin:develop/snipefrom
re2zero:bugfix
Sep 24, 2025
Merged

fix: Adjust sidebar icon size and set text format for title label#274
lzwind merged 1 commit into
linuxdeepin:develop/snipefrom
re2zero:bugfix

Conversation

@re2zero
Copy link
Copy Markdown
Contributor

@re2zero re2zero commented Sep 24, 2025

  • Increased sidebar icon size from 15 to 19 pixels for better visibility.
  • Set text format of the title label to plain text for consistent display.

Log: UI improvements for sidebar and title widget.
Bug: https://pms.uniontech.com/bug-view-319073.html
https://pms.uniontech.com/bug-view-335231.html

Summary by Sourcery

Adjust UI elements in the calendar client for improved consistency and readability

Bug Fixes:

  • Increase sidebar icon size from 19×15 to 19×19 pixels for better visibility
  • Enforce plain text formatting on title labels to ensure consistent display

- Increased sidebar icon size from 15 to 19 pixels for better visibility.
- Set text format of the title label to plain text for consistent display.

Log: UI improvements for sidebar and title widget.
Bug: https://pms.uniontech.com/bug-view-319073.html
https://pms.uniontech.com/bug-view-335231.html
@deepin-ci-robot
Copy link
Copy Markdown

deepin pr auto review

根据提供的git diff,我发现以下需要改进的地方:

  1. CTitleWidget.cpp 中的图标尺寸修改:
- m_sidebarIcon->setIconSize(QSize(19, 15));
+ m_sidebarIcon->setIconSize(QSize(19, 19));
  • 改进意见:将图标尺寸从不规则的19x15修改为规则的19x19是合理的,这样可以保持图标比例一致,避免变形。建议在代码中添加注释说明这个修改的原因,比如为了保持图标比例一致。
  1. SidebarTypeItemWidget.cpp 中的文本格式设置:
+ m_titleLabel->setTextFormat(Qt::PlainText);
  • 改进意见:添加setTextFormat(Qt::PlainText)是一个好的改进,可以防止富文本格式可能带来的安全问题(如XSS攻击)和显示问题。建议:
    1. 如果这个文本可能包含富文本内容,应该考虑使用Qt::RichText并确保对输入进行适当的转义
    2. 可以添加注释说明为什么需要设置为纯文本格式
    3. 考虑将这个设置移到初始化函数中,与其他UI初始化放在一起,提高代码组织性
  1. 代码质量建议:
  • initView()函数中,m_titleLabel的多个设置(字体、对齐方式、文本格式等)应该放在一起,这样可以提高代码的可读性和维护性
  • 建议为这些UI设置创建一个单独的初始化函数,比如initLabelStyle(),使代码结构更清晰
  1. 性能建议:
  • 如果m_titleLabel的文本内容不会频繁变化,可以考虑在构造函数中设置文本格式,而不是在initView()
  • 如果m_scheduleType->displayName()可能会返回大量文本,可以考虑添加文本长度检查,避免显示过长的文本影响UI布局
  1. 安全性建议:
  • 确保从m_scheduleType->displayName()获取的文本内容已经过适当的清理,特别是如果这个文本可能来自外部输入
  • 考虑为文本长度设置最大限制,防止过长的文本影响UI布局和用户体验

这些改进建议旨在提高代码的可维护性、安全性和性能。

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Sep 24, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Updated the sidebar icon dimensions for better visibility and enforced a plain text format on the title label for consistent rendering.

File-Level Changes

Change Details Files
Increased sidebar icon size for visibility
  • Updated DIconButton fixed icon size from (19×15) to (19×19)
calendar-client/src/customWidget/ctitlewidget.cpp
Enforced plain text formatting on title label
  • Inserted setTextFormat(Qt::PlainText) for m_titleLabel
calendar-client/src/widget/sidebarWidget/sidebaritemwidget.cpp

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
Copy Markdown

@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 there - 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
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: lzwind, re2zero

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

@lzwind lzwind merged commit e006084 into linuxdeepin:develop/snipe Sep 24, 2025
21 checks passed
@re2zero re2zero deleted the bugfix branch September 25, 2025 00:47
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