[Development] Revisiting high-DPI configuration options

Morten Sorvig Morten.Sorvig at qt.io
Fri Jun 24 23:39:49 CEST 2016

> On 22 Jun 2016, at 15:30, Michael Zanetti <michael.zanetti at canonical.com> wrote:
> * floating point scaling
> * different scale factor per window
> * dynamically changing scale factor
> * some sort of language that allows developers to use virtual sizes,
> ideally we'd be able to register our grid unit stuff as that's what all
> our design has evolved around.

This may be in reach for a future version of Qt.

* Floating point scaling has already been discussed. Qt uses qreal to store
  and access the scale factor so support is mostly limited by rendering and
  style code.

* The main scale factor accessor is QWindow::devicePixelRatio(), which dynamically
  update on screen changes. There are currently some code paths that have to use
  QScreen::devicePixelRatio() or even QGuiApplication::devicePixelRatio(), but I
  would like us to gravitate towards the QWindow accessor as much as possible.

  (QWindow::devicePixelRatio() has aliases such as QPaintDevice::devicePixelRatioF()
   and QQuickWindow::effectiveDevicePixelRatio() higher up in the stack.)

  There are two approaches to detect devicePixelRatio changes: either a spesific
  dprChanged event, or use expose events where rendering code queries devicePixelRatio().
  We did have support for _setting_ a per-window scale factor from application
  code at one point during development, but it was removed since we were not sure
  we could make it work in all cases. (I don’t remember the exact reasoning)

* Grid units for QML: looks interesting, but I can’t really comment on the
  feasibility of implementing it in Qt. 


More information about the Development mailing list