-
Notifications
You must be signed in to change notification settings - Fork 55
fix: Ensure the show desktop line is always 1 physical pixel regardle… #1284
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
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideEnsure the show desktop line remains exactly one physical pixel thick under any system scaling by introducing Screen.devicePixelRatio and updating the line’s implicit dimensions accordingly. Class diagram for updated Rectangle in showdesktop.qmlclassDiagram
class Rectangle {
D.Palette lineColor
real devicePixelRatio
implicitWidth
implicitHeight
color
}
Rectangle : devicePixelRatio = Screen.devicePixelRatio
Rectangle : implicitWidth = showdesktop.useColumnLayout ? showdesktop.implicitWidth : (1 / devicePixelRatio)
Rectangle : implicitHeight = showdesktop.useColumnLayout ? (1 / devicePixelRatio) : showdesktop.implicitHeight
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this 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!
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `panels/dock/showdesktop/package/showdesktop.qml:38-39` </location>
<code_context>
- implicitHeight: useColumnLayout ? 1 : showdesktop.implicitHeight
+ // Use device pixel ratio to ensure the line is always 1 physical pixel regardless of system scaling
+ property real devicePixelRatio: Screen.devicePixelRatio
+ implicitWidth: showdesktop.useColumnLayout ? showdesktop.implicitWidth : (1 / devicePixelRatio)
+ implicitHeight: showdesktop.useColumnLayout ? (1 / devicePixelRatio) : showdesktop.implicitHeight
color: D.ColorSelector.lineColor
</code_context>
<issue_to_address>
**suggestion (bug_risk):** Division by devicePixelRatio could result in non-integer sizes, which may cause rendering artifacts.
Rounding the calculated size or using Math.max(1, Math.round(1 / devicePixelRatio)) can help prevent blurry or inconsistent rendering due to subpixel values.
```suggestion
implicitWidth: showdesktop.useColumnLayout ? showdesktop.implicitWidth : Math.max(1, Math.round(1 / devicePixelRatio))
implicitHeight: showdesktop.useColumnLayout ? Math.max(1, Math.round(1 / devicePixelRatio)) : showdesktop.implicitHeight
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
311f611 to
9c31205
Compare
deepin pr auto review这段代码是一个QML文件中的Rectangle组件的修改,主要涉及线条宽度的计算。我来分析一下代码的变更和潜在问题: 代码变更分析
潜在问题和改进建议
总结建议这个修改本身是一个很好的改进,解决了高DPI显示器上的显示问题。建议添加一些保护措施来防止潜在的除零错误,并考虑代码的可读性和可维护性。如果项目中还有其他类似的UI元素,应该采用相同的处理方式来保持一致性。 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 18202781743, yixinshark The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
…ss of system scaling as title Log: as title Pms: BUG-302035
|
/forcemerge |
|
This pr force merged! (status: blocked) |
…ss of system scaling
as title
Log: as title
Pms: BUG-302035
Summary by Sourcery
Ensure the show desktop indicator line remains one physical pixel regardless of system scaling by using the device pixel ratio to compute its dimensions.
Bug Fixes:
Enhancements: