[Development] High-DPI 5.6 beta update

Sorvig Morten Morten.Sorvig at theqtcompany.com
Tue Dec 15 12:03:05 CET 2015


Hi,

I’d like to provide short update on the changes in this space, an also lay out
some plans and possibilities for the future. Thanks to everyone who has helped
out! New changes:

* @3x support landed, both for Qt Widgets and Qt Quick. Implemented as @Nx
  support, with @9x as a maximum value.

* The internal documentation for scaling in Qt has been updated:
  github.com/qtproject/qtbase/blob/dev/src/gui/kernel/qhighdpiscaling.cpp.

* Added C++ API for enabling/disabling high-dpi scaling:
    Qt::AA_EnableHighDpiScaling
    Qt::AA_DisableHighDpiScaling

  Together with the environment variable (QT_AUTO_SCREEN_SCALE_FACTOR=1 or 0)
  these provide comprehensive support for controlling whether scaling in Qt 
  should be enabled or not. Several use cases are supported:

  * User wants to enable scaling (perhaps for “legacy” Qt apps):
      QT_AUTO_SCREEN_SCALE_FACTOR=1
  * User wants disable scaling (there may be a hardware config issue):
      QT_AUTO_SCREEN_SCALE_FACTOR=0
  * Developer wants to enable scaling:
      Qt::AA_EnableHighDpiScaling
  * Developer wants application to work in device pixels and disable scaling:
      Qt::AA_DisableHighDpiScaling

  In case of conflicts between the environment and C++ side the logic is ‘veto’.

  The actual scale factor applied is controlled by the platform plugin, which
  provides it by overriding QPlatformScreen::pixelDensity() The default 
  implementation returns 1. pixelDensity() is currently implemented by the
  android, eglfs, windows, and xcb platform plugins.

What’s next?

5.6 series:

* Public overview documentation update.

* Misc fixing in Widgets and Quick. In particular I would like to land a series of
  GraphicsView fixes: https://codereview.qt-project.org/#/c/142920

dev:

* Improve support for fractional scale factors for QtWidgets (render at 2x and then
  downscale). Will require OpenGL for the scaling. Prototype at
  https://codereview.qt-project.org/143819 (OS X only).

* Refactor qhighdpiscaling_h API and implementation:
  https://codereview.qt-project.org/#/c/140176

* Improve pixmap versioning support, replacing/extending @Nx and QIcon: QTBUG-49820

* Figure out auto-testing: We can run entire tests at a given scale factor, or
  individual test functions can test at a range of scale factors. Or we can do both.
  We’ve so far relied on manual tests on actual high-dpi hardware. The cross-platform
  scaling layer in Qt Gui now gives us the ability to auto test on any hardware 
  (including CI virtual hardware).

If anyone is interested or has input on the above, drop me a note or comment on the 
mentioned task/changes.

Thanks,
Morten



More information about the Development mailing list