Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: missing antialiased for menuItem #253

Merged
merged 1 commit into from
Dec 30, 2024

Conversation

18202781743
Copy link
Contributor

Add antialiased for painter.
Fix MenuItem's HMargin implementation, Remove the margin of MenuItem's width instead of the margin of PM_MenuHMargin, otherwise, it caused incorrrect suMenu overlap.

pms: BUG-297003

Add antialiased for painter.
Fix MenuItem's HMargin implementation, Remove the margin of MenuItem's
width instead of the margin of PM_MenuHMargin, otherwise, it caused
incorrrect suMenu overlap.

pms: BUG-297003
deepin-ci-robot added a commit to linuxdeepin/qt6integration that referenced this pull request Dec 30, 2024
Synchronize source files from linuxdeepin/qt5integration.

Source-pull-request: linuxdeepin/qt5integration#253
@deepin-ci-robot
Copy link
Contributor

deepin pr auto review

代码审查意见:

  1. 代码重构

    • drawMenuItemBackground函数中,rect变量被多次使用,建议将其提取为一个局部变量,以避免重复计算。
    • constexpr int margin = 6;定义了一个常量,但在pixelMetric函数中,PM_MenuHMargin的返回值被修改为0。如果这是有意为之,建议在代码中添加注释说明原因。
  2. 代码可读性

    • drawMenuItemBackground函数中,colorSeparator的计算逻辑可以简化,使用三元运算符可以使代码更简洁。
    • drawMenuItemBackground函数中的注释可以更详细一些,说明每个步骤的目的和逻辑。
  3. 性能优化

    • drawMenuItemBackground函数中,painter->setRenderHint(QPainter::Antialiasing);被多次调用,建议将其移动到函数开始处,避免重复设置。
  4. 安全性

    • 没有发现明显的安全问题。
  5. 一致性

    • pixelMetric函数中,PM_MenuHMargin的返回值从6改为0,这可能会影响整个应用程序的布局。建议确认这一改动是否符合设计要求,并确保所有相关的UI组件都进行了相应的调整。
  6. 注释

    • constexpr int margin = 6;定义了一个常量,但没有注释说明其用途。建议添加注释,以便其他开发者理解这个常量的作用。

综上所述,代码在重构、可读性、性能优化和注释方面有一些改进空间,以确保代码的可维护性和可读性。同时,需要确认PM_MenuHMargin的改动是否符合设计要求。

@deepin-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

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

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

@18202781743 18202781743 merged commit 0b5935e into linuxdeepin:master Dec 30, 2024
15 of 16 checks passed
18202781743 pushed a commit to linuxdeepin/qt6integration that referenced this pull request Dec 30, 2024
Synchronize source files from linuxdeepin/qt5integration.

Source-pull-request: linuxdeepin/qt5integration#253
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