Skip to content

fix: remove inner highlight from calendar selection box#341

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
wjyrich:fix-bug-317321
Jul 23, 2025
Merged

fix: remove inner highlight from calendar selection box#341
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
wjyrich:fix-bug-317321

Conversation

@wjyrich

@wjyrich wjyrich commented Jul 22, 2025

Copy link
Copy Markdown
Contributor
  1. Removed the inner white highlight effect from selected date boxes in the calendar widget
  2. The highlight was visually unnecessary and didn't match current design guidelines
  3. Simplified the painting logic by removing redundant pen color changes
  4. Maintains the outer selection indicator while removing the inner decoration

fix: 移除日历选择框的内层高光效果

  1. 移除了日历组件中日期选择框的内层白色高光效果
  2. 该高光效果视觉上不必要且不符合当前设计规范
  3. 通过移除多余的画笔颜色变化简化了绘制逻辑
  4. 保留外层选择指示器同时移除了内部装饰效果

Pms: BUG-317321

Summary by Sourcery

Remove unnecessary inner decoration from calendar selection boxes while preserving the outer selection indicator

Bug Fixes:

  • Remove inner white highlight effect from calendar date selection boxes

Enhancements:

  • Simplify painting logic by removing redundant pen color changes

1. Removed the inner white highlight effect from selected date boxes in
the calendar widget
2. The highlight was visually unnecessary and didn't match current
design guidelines
3. Simplified the painting logic by removing redundant pen color changes
4. Maintains the outer selection indicator while removing the inner
decoration

fix: 移除日历选择框的内层高光效果

1. 移除了日历组件中日期选择框的内层白色高光效果
2. 该高光效果视觉上不必要且不符合当前设计规范
3. 通过移除多余的画笔颜色变化简化了绘制逻辑
4. 保留外层选择指示器同时移除了内部装饰效果

Pms: BUG-317321
@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 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

@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 @wjyrich - 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.

@sourcery-ai

sourcery-ai Bot commented Jul 22, 2025

Copy link
Copy Markdown

Reviewer's Guide

This PR refines the calendar widget's paintEvent by removing the inner white highlight around selected date boxes and associated redundant pen color changes, while preserving the outer selection indicator.

Class diagram for SidebarCalendarKeyButton paintEvent changes

classDiagram
    class SidebarCalendarKeyButton {
        +void paintEvent(QPaintEvent* event)
    }
    SidebarCalendarKeyButton : - Removed inner white highlight drawing logic
    SidebarCalendarKeyButton : - Removed redundant pen color changes
    SidebarCalendarKeyButton : + Maintains outer selection indicator drawing
Loading

File-Level Changes

Change Details Files
Removed inner white highlight and redundant pen assignments in calendar selection rendering
  • Deleted the code block that sets pen color to white and draws the inner rounded rectangle highlight
  • Removed pen.setColor(Qt::white) and pen.setWidth(1) calls
  • Eliminated resetting pen color back to windowText after inner highlight
plugins/dde-dock/datetime/calendar/sidebarcalendarwidget.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

@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

代码审查意见如下:

  1. 代码重复:在paintEvent函数中,pen对象被多次设置颜色,可以考虑将颜色设置提取出来,减少代码重复。

  2. 逻辑简化:在绘制选中框内圈白色高光的部分,可以通过调整rectf的调整参数来简化代码,避免重复计算。

  3. 性能优化:如果paintEvent函数被频繁调用,可以考虑减少不必要的绘制操作,比如在不需要绘制选中框内圈白色高光时,直接跳过相关代码。

  4. 代码可读性:在注释中,RECT_PENWIDTHRECT_MARGINS的值没有明确说明,建议在代码中添加注释说明这些常量的用途和值。

  5. 逻辑错误:在else if (!m_isThisMonth)分支中,painter.setOpacity(0.3);这行代码可能会影响其他绘制操作,需要确认这是否是预期的行为。

  6. 代码风格:代码缩进和格式需要保持一致,例如在调整rectf时,调整参数的顺序和格式需要统一。

根据以上意见,代码可以修改为:

void SidebarCalendarKeyButton::paintEvent(QPaintEvent* event)
{
    // ... 其他代码 ...

    if (m_isSelected) {
        // 绘制选中框外圈
        pen.setColor(Qt::black);
        pen.setWidth(RECT_PENWIDTH);
        painter.setPen(pen);
        painter.drawRoundedRect(rectf.adjusted(-RECT_PENWIDTH, -RECT_PENWIDTH, RECT_PENWIDTH, RECT_PENWIDTH), ROUND_CORNER, ROUND_CORNER);

        // 绘制选中框内圈白色高光
        pen.setColor(Qt::white);
        pen.setWidth(1);
        painter.setPen(pen);
        painter.drawRoundedRect(rectf.adjusted(RECT_PENWIDTH + RECT_MARGINS + 1, RECT_PENWIDTH + RECT_MARGINS + 1, -RECT_PENWIDTH - RECT_MARGINS - 1, -RECT_PENWIDTH - RECT_MARGINS - 1), ROUND_CORNER - RECT_PENWIDTH, ROUND_CORNER - RECT_PENWIDTH);

        pen.setColor(pa.windowText().color());
        painter.setPen(pen);
    } else if (!m_isThisMonth) {
        // 设置正常显示状态下的字体颜色
        painter.setOpacity(0.3);
        // ... 其他代码 ...
    }
}

以上修改旨在提高代码的可读性、可维护性和性能。

@wjyrich

wjyrich commented Jul 23, 2025

Copy link
Copy Markdown
Contributor Author

/forcemerge

@deepin-bot deepin-bot Bot merged commit 0c22d5b into linuxdeepin:master Jul 23, 2025
9 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