tonquer / picacg-qt

哔咔漫画, PicACG comic PC client(Windows, Linux, MacOS)
GNU Lesser General Public License v3.0
3.52k stars 180 forks source link

关于高分屏DPI缩放 #160

Closed zhiyiYo closed 2 years ago

zhiyiYo commented 2 years ago

操作系统

WIndows 11

问题描述

  1. 试了一下自定义缩放比为 150%,发现标题栏图标不会变糊,是因为源代码里面用 qss 设置图标所致的吗?
  2. 如果缩放比太大,窗口大小会超出屏幕的尺寸,连标题栏都看不见了
tonquer commented 2 years ago

qss应该有dpi适应的把,如果是自己用Qpixmap的话,要自己设置setDevicePixelRatio,不然是会糊的

tonquer commented 2 years ago

如果分辨率低,缩放比太大的话,确实会超出屏幕,只能最大化使用

zhiyiYo commented 2 years ago

所以 main_view.py 的 44 行是不是应该除以缩放比🤔

self.resize(desktop.width() // 4 * 3, desktop.height() // 4 * 3)
self.move(self.width() // 8+desktop.x(), max(0, desktop.height()-self.height()) // 2+desktop.y())
tonquer commented 2 years ago

qt6里这些返回宽高,是已经除以过缩放比的了,是虚拟分辨率,不是物理的

zhiyiYo commented 2 years ago

哦哦,感谢解答

zhiyiYo commented 2 years ago

换成 qss 之后图标确实不会糊,今天又是学到新知识的一天🍻