在视网膜显示器上优化 Python QT 应用程序 [英] Optimising Python QT apps on retina displays

查看:66
本文介绍了在视网膜显示器上优化 Python QT 应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Qt 接口目前在视网膜显示器上看起来很糟糕,因为它们按比例放大.可以将 Info.Plist 用于编译的应用程序,但是有人有动态 Python 的解决方案,例如在 PySide 中创建的接口吗?

Qt interfaces currently look horrible on a retina display as they scale up.Its possible to use an Info.Plist for a complied application but does anyone have a solution for dynamic python such as interfaces created in PySide?

推荐答案

您没有说明您使用的是哪个 Qt 版本.Retina 支持在最新版本 Qt v5.1 中是最好的.但是v5.0的也不错.如果您仍在使用 Qt v4.8,则必须手动应用 补丁 启用高 DPI.

You didn't say what Qt version you're working with. Retina support is best in the latest release, Qt v5.1. but v5.0's is also pretty good. If you're still on Qt v4.8, you'll have to manually apply patches to enable high DPI.

高 DPI 模式由 Info.Plist 文件中的以下键控制:

High DPI mode is controlled by the following keys in the Info.Plist file:

<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSHighResolutionCapable</key>
<string>True</string>

Qt 5 使用光栅绘制引擎并通过缩放绘制变换来实现高 dpi 矢量图形.如果 NSHighResolutionCapable 未设置,应用程序将以正常"分辨率呈现,该分辨率将被简单地放大.这在高分辨率显示器上看起来很糟糕.另一方面,高分辨率模式完全向后兼容,并且在较低分辨率的显示器上可以很好地呈现.我会一直启用它.

Qt 5 uses the raster paint engine and implements high-dpi vector graphics by scaling the painter transform. If NSHighResolutionCapable is not set, the application will be rendered at the "normal" resolution which will simply be scaled up. This looks horrible on high resolution displays. On the other hand the high resolution mode is fully backwards compatible and is rendered nicely on lower resolution displays. I would leave it enabled all the time.

启用高 DPI 后,您仍然必须确保所有光栅内容(图像资源)具有足够高的分辨率才能很好地显示.请参阅 QT 博客文章 Mac OS、iOS 和 X11 的 Retina 显示支持 了解完整详情.

Once high DPI is enabled you still have to make sure that all your raster content (image resources) has a high-enough resolution to be displayed nicely. See the QT Blog post Retina display support for Mac OS, iOS and X11 for the full details.

这篇关于在视网膜显示器上优化 Python QT 应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆