fix: align folder popup to physical pixels for sharp 1px borders#749
Conversation
Apply pixel snapping to FolderGridViewPopup's position (x, y) and dimensions (width, height) to ensure edges align with physical pixel boundaries. This fixes blurry/anti-aliased 1px borders at fractional scaling factors like 125% or 150%. 修复:应用组弹窗物理像素对齐以获得锐利的1px描边 对 FolderGridViewPopup 的位置 (x, y) 和尺寸 (width, height) 应用 物理像素对齐,确保边缘与物理像素边界对齐。这修复了在 125% 或 150% 等非整数缩放比例下 1px 描边模糊/抗锯齿的问题。 PMS: BUG-306847
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThis PR snaps the FolderGridViewPopup’s position and fixed dimensions to physical pixels by using the screen device pixel ratio, preventing blurry 1px borders at fractional display scaling factors. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- In
WindowedFrame.qml, overridingFolderGridViewPopup’sheightwith a hard-coded value means the existing logic that forces an even height to avoid the extra outer pixel is no longer used; consider either keeping that logic or incorporating the even-height constraint into the new DPR-aligned calculation. - The DPR-based rounding logic is duplicated (local
dprproperty inFolderGridViewPopupvs directScreen.devicePixelRatiousage inWindowedFrame); consider extracting a shared helper or using a consistent pattern to avoid divergence if the snapping logic needs to change later. - Using
Screen.devicePixelRatioassumes a single screen and may not reflect the actual window/screen the popup is on in multi-monitor setups; consider using the window’s screen DPR (or reacting to screen changes) if this component can be shown on different screens.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In `WindowedFrame.qml`, overriding `FolderGridViewPopup`’s `height` with a hard-coded value means the existing logic that forces an even height to avoid the extra outer pixel is no longer used; consider either keeping that logic or incorporating the even-height constraint into the new DPR-aligned calculation.
- The DPR-based rounding logic is duplicated (local `dpr` property in `FolderGridViewPopup` vs direct `Screen.devicePixelRatio` usage in `WindowedFrame`); consider extracting a shared helper or using a consistent pattern to avoid divergence if the snapping logic needs to change later.
- Using `Screen.devicePixelRatio` assumes a single screen and may not reflect the actual window/screen the popup is on in multi-monitor setups; consider using the window’s screen DPR (or reacting to screen changes) if this component can be shown on different screens.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
deepin pr auto review这段代码的修改主要是为了解决在高DPI(设备像素比)屏幕下,Qt Quick窗口或Popup显示模糊、边缘不对齐的问题。这是一个常见的图形界面适配问题。以下是对这段代码的审查意见: 1. 语法逻辑
2. 代码质量
3. 代码性能
4. 代码安全
总结与改进建议这段代码修改有效地解决了高DPI下的显示对齐问题,逻辑清晰,注释到位。 改进建议:
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 18202781743, BLumia, Ivy233 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 |
Apply pixel snapping to FolderGridViewPopup's position (x, y) and dimensions (width, height) to ensure edges align with physical pixel boundaries. This fixes blurry/anti-aliased 1px borders at fractional scaling factors like 125% or 150%.
修复:应用组弹窗物理像素对齐以获得锐利的1px描边
对 FolderGridViewPopup 的位置 (x, y) 和尺寸 (width, height) 应用 物理像素对齐,确保边缘与物理像素边界对齐。这修复了在 125% 或
150% 等非整数缩放比例下 1px 描边模糊/抗锯齿的问题。
PMS: BUG-306847
Summary by Sourcery
Bug Fixes: