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.