Repository navigation
fix: render titlebar icons with fractional DPR to fix aliasing (PMS 193447) - #103
Draft
tianming-1996 wants to merge 1 commit into
Draft
tianming-1996 wants to merge 1 commit into
tianming-1996 wants to merge 1 commit into
Conversation
tianming-1996
marked this pull request as draft
November 6, 2026 16:48
Reviewer's GuideConfigurationEnable Qt high-DPI scaling and pixmaps before application construction so icons render at the display’s actual device-pixel ratio.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
tianming-1996
force-pushed
the
fix/titlebar-icon-fractional-dpr-193447
branch
2 times, most recently
from
November 9, 2026 03:38
acfac38 to
91f4d67
Compare
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: tianming-1996 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 |
Under Wayland fractional scaling the window reports a device pixel ratio of 1.5, but Qt's icon painting path ignores it unless Qt::AA_UseHighDpiPixmaps is enabled. The SVG titlebar icon was therefore rasterized at 32x32 and scaled up to the 48x48 device pixels of its slot, which made it look aliased. Enable Qt::AA_EnableHighDpiScaling and Qt::AA_UseHighDpiPixmaps before constructing the application, so QIcon requests and rasterizes icons at the real device pixel ratio. Bug: https://pms.uniontech.com/bug-view-193447.html
tianming-1996
force-pushed
the
fix/titlebar-icon-fractional-dpr-193447
branch
from
November 9, 2026 09:59
91f4d67 to
c7f4c2c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
修复说明
问题
2560×1600 1.5倍缩放(Wayland 分数缩放)下,截图进入OCR后左上角标题栏图标锯齿模糊严重。
根因
deepin-ocr
src/mainwidget.cpp中MainWidget::setIcons()使用QIcon(svg)设置标题栏图标。该 QIcon 经 DTKDStyle::PE_Icon的SI_QIcon分支绘制时,不传devicePixelRatioF()(仅SI_DciIcon分支显式传分数 DPR)。Wayland 1.5x 分数缩放下devicePixelRatio()返回整数 1,图标按 1× 光栅化后合成器上采样至 1.5×,产生锯齿。修复方案(方案 A)
标题栏图标(行 692/695/746/749):将
QIcon(svg)改为使用QIcon::pixmap(QSize(32, 32), devicePixelRatioF())按devicePixelRatioF()预光栅化 SVG 为高分辨率 QPixmap,再包成 QIcon 传入setWindowIcon()/titlebar()->setIcon()。预渲染的 pixmap 携带正确的分数 DPR,DTKSI_QIcon分支绘制时直接使用该高分辨率 pixmap,消除锯齿。提示图标(行 688/742):现有
DDciIcon::pixmap()调用从devicePixelRatio()改为devicePixelRatioF(),消除同类分数 DPR 隐患。改动范围
仅
src/mainwidget.cppMainWidget::setIcons(),不涉及 DTK 全局渲染路径。验证
devicePixelRatioF()替换devicePixelRatio()正确QIcon::pixmap(QSize, qreal dpr)为 Qt 5.1+ 标准 APIdevicePixelRatioF()==devicePixelRatio())PMS: 193447
Summary by Sourcery
Enable high-DPI rendering support to improve application visuals on fractional-scale displays.
Bug Fixes:
Chores: