[Development] Updated high-DPI support for Qt 5.14

Morten Sørvig Morten.Sorvig at qt.io
Wed Sep 25 14:54:20 CEST 2019

> On 24 Sep 2019, at 17:54, Thiago Macieira <thiago.macieira at intel.com> wrote:
> On Monday, 16 September 2019 06:00:27 PDT Morten Sørvig wrote:
>> Could KDE possibly set per-screen DPI instead of a scale factor?
>> Applications can now use the
>> QGuiApplication::setHighDpiScaleFactorRoundingPolicy() API to decide wether
>> or not they accept fractional devicePixelRatios (in the cases where Qt
>> implements the scaling), which does not match well with having a directly
>> set scale factor.
> How is setting the DPI different than setting the multiplicative factor that 
> was applied to the DPI before? Are you expecting a lot of applications having 
> called that function above? Assume there's less than 0.1% of them doing that.

To start with setHighDpiScaleFactorRoundingPolicy: this function is new in 5.14 so I don’t think it has many users right now. The corresponding QTBUG had a good number of votes and watchers though, so I expect it will be used.

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)

> 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.

In practice, the environment variables you are currently using may be your best option on X11. 

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.

- Morten

> -- 
> Thiago Macieira - thiago.macieira (AT) intel.com
>  Software Architect - Intel System Software Products
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> https://lists.qt-project.org/listinfo/development

More information about the Development mailing list