1 Star 0 Fork 18

xingwei-liu/qt5-qtbase

forked from src-anolis-os/qt5-qtbase 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
StyleSheetStyle-fix-distorted-hiDPI-pngs.patch 1.17 KB
一键复制 编辑 原始数据 按行查看 历史
xingwei-liu 提交于 2022-10-12 16:54 . feature: add patchs for DDE
diff -Naur a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp
--- a/src/widgets/styles/qstylesheetstyle.cpp 2021-08-11 11:36:05.811389639 +0800
+++ b/src/widgets/styles/qstylesheetstyle.cpp 2021-08-11 13:32:16.259120027 +0800
@@ -6133,11 +6133,19 @@
else
ratio = 1.0;
}
-
+
qreal sourceDevicePixelRatio = 1.0;
- QString resolvedFileName = qt_findAtNxFile(fileName, ratio, &sourceDevicePixelRatio);
+ qreal devicePixelRatio = qApp->devicePixelRatio();
+ QString resolvedFileName = qt_findAtNxFile(fileName, devicePixelRatio, &sourceDevicePixelRatio);
QPixmap pixmap(resolvedFileName);
- pixmap.setDevicePixelRatio(sourceDevicePixelRatio);
+ if (sourceDevicePixelRatio > 1.0) {
+ pixmap = pixmap.scaled(devicePixelRatio / sourceDevicePixelRatio * pixmap.width(),
+ devicePixelRatio / sourceDevicePixelRatio * pixmap.height(),
+ Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
+ pixmap.setDevicePixelRatio(devicePixelRatio);
+ } else {
+ pixmap.setDevicePixelRatio(sourceDevicePixelRatio);
+ }
return pixmap;
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/xingwei-liu/qt5-qtbase.git
git@gitee.com:xingwei-liu/qt5-qtbase.git
xingwei-liu
qt5-qtbase
qt5-qtbase
a8

搜索帮助

0d507c66 1850385 C8b1a773 1850385