Qt high DPI

Posted 庚武讲堂

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Qt high DPI相关的知识,希望对你有一定的参考价值。

http://doc.qt.io/qt-5/highdpi.html

Qt Support

  • Ability to provide pixmaps or artwork for high resolution: see Drawing High Resolution Versions of Pixmaps and Images.
  • Qt 5.4 introduces experimental support for scaling by by device pixel ratio similar to OS X to the platform plugins for Windows and Unix (XCB). This is controlled by the environment variable QT_DEVICE_PIXEL_RATIO. It can be set to a numerical value to be used as scale factor or "auto" which causes the scale factor to be determined by checking the monitor size.

    It is recommended to use the Fusion style.

Migration of Existing Applications

In order to get an application designed for low DPI values running on a high resolution monitors quickly, consider one of the scaling options (let the application run as DPI Unaware on Windows or set the environment variable QT_DEVICE_PIXEL_RATIO to "auto". These options may incur some scaling or painting artifacts, though.

In the longer term, the application should be adapted to run unmodified:

  • Always use the qreal versions of the QPainter drawing API.
  • Size windows and dialogs in relation to the screen size.
  • Replace hard-coded sizes in layouts and drawing code by values calculated from font metrics or screen size.

以上是关于Qt high DPI的主要内容,如果未能解决你的问题,请参考以下文章

winform 适配high dpi

CefSharp应用——High DPI问题

CefSharp High DPI问题的解决

当我在 Spyder 中运行它以及直接在终端中运行它时,HIGH DPI Tkinter 重新缩放

Qt之高DPI显示器 - 解决方案整理

Windows高DPI系列控件 - 柱状图