[Development] Updated high-DPI support for Qt 5.14

Morten Sørvig Morten.Sorvig at qt.io
Fri Sep 27 12:56:44 CEST 2019

> On 26 Sep 2019, at 04:48, Thiago Macieira <thiago.macieira at intel.com> wrote:
> On Wednesday, 25 September 2019 05:54:20 PDT Morten Sørvig wrote:
>> I see two differences between setting the DPI vs a factor:
>> - You set one value per screen (DPI) instead of two (DPI & factor)
>> - Qt can compute the factor, according to policy set by the application (as
>> mentioned above)
> Assume no one will ever call that function. What's the outcome?

We use the default policy: RoundPreferFloor in Qt 5, PassThrough in Qt 6 (if/when
https://codereview.qt-project.org/c/qt/qtbase/+/273956 lands)

> Also, DPIs are a physical property of the monitor, but they don't account for 
> my distance to it. Previously, I only needed one parameter to toggle, which 
> was either 1 or 2. Now, in order to properly configure, I need to find out 
> what the current DPI is and then update it.

Some displays like projectors don’t have well-defined physical DPI though. In
some cases like macOS configured for “more/less space” the relationship between
frame buffer pixels and display pixels is not 1:1, which makes physical DPI less

The DPI we are using in Qt is the logical DPI; it need not correspond to any
physical measurement of the monitor.

Configuring Windows is a good example here: you set the slider to one of 100% -
125% - 150% - 175% - 200% depending on monitor pixel density and viewing distance.
There’s then a single value to configure.

> Moreover, I can have two different monitors connected to the same output (at 
> different times, of course). Since they have different DPI, the multiplicative 
> factor allows me to set it once for both, but if I set a DPI setting, it'll 
> likely be wrong for at least one of them.

Yes, we need per-monitor settings (DPI or scale).

>>> Anyway, what's the correct way to specify now that one of my external
>>> monitors  is highdpi but the other isn’t?
>> The correct way would be to configure the windowing system. Qt would then
>> pick up the configuration via the platform plugin.
> Agreed, but for those of us still on X11, that's not na option.
>> In practice, the environment variables you are currently using may be your
>> best option on X11. 
> Ok, thanks. This becomes the recommendation for KDE Plasma Shell configuration 
> for X11 then: continue using the variables as they are.
>> If possible, I’d like us to move away from relying on setting environment
>> variables, and/or switch to specifying per-screen DPI instead of a scale
>> factor.
> Sure, but where, on X11?

I don’t know. That’s the $1M question.


More information about the Development mailing list