Over the past year-and-a-half we’ve implemented high-dpi scaling for Qt on Mac 
OS  X and iOS. Now we have an excellent opportunity to bring this support to 
other platforms.

A quick recap for those unfamiliar: This high-dpi mode is an alternative to the 
traditional DPI scaling. In the traditional approach the application is 
presented with an DPI value used to multiply font sizes, layouts etc. In the 
new mode the operating system provides Qt with a scale factor which is used to 
scale graphics output: allocate larger buffers and set a scaling transform.

The advantage of this approach is that that vector graphics and fonts scale 
automatically and existing applications tend to work unmodified. Raster content 
handling is a neutral point - the app author needs to provide high-resolution 
artwork but this is manageable. A typical disadvantage is confusion caused by 
the existence of two coordinate systems: “Are these style hints in device 
independent or device pixels?" 

Looking at other platforms:

- WinRT: Already uses high-dpi scaling as of change aeea02ff10 .

- Wayland: Version 1.2 added wl_output::scale, which we can use. This change 
implements high-dpi scaling for the backing store:

https:/codereview.qt-project.org/#change,63600

-  Platform independent support: We can bring high-dpi support to any platform 
by adding a coordinate translation layer to QWindow and QWindowSystemInterface 
and making minor modifications to the platform plugins.  See the following 
changes:

https://codereview.qt-project.org/#change,86107
https://codereview.qt-project.org/#change,86108

Some preliminary testing has been done with the XCB platform plugin:
 * KDE Frameworks 5: http://imgur.com/a/JhXSX#sUGYZmB
 * Qt Creator: http://i.imgur.com/EEwdPTD.png

This also allows testing any scale factor on any hardware by setting an 
environment variable.


Adding support to QtWayland looks like a win to me. Do we want to add 
platform-indepent support to Qt?

Morten







_______________________________________________
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to