Add ext_qt patch for Windows to support fractional DPI scaling

Authored by alvinhochun on Apr 16 2019, 5:32 PM.


Group Reviewers

Move to gitlab:

This adds a series of patches related to for Windows to allow enabling experimental support for fractional DPI scaling.

In addition, a patch to fix (which is set to be in Qt 5.12.3) is included..

The exact list of patches is as follow:

These series of patches adds the option QGuiApplication::setHighDpiScaleFactorRoundingPolicy to control how the DPI scale factor is rounded (or not), which can also be overridden by the environment variable QT_SCALE_FACTOR_ROUNDING_POLICY. The options include:

  • Round: Round up for .5 and above.
  • Ceil: Always round up.
  • Floor: Always round down.
  • RoundPreferFloor: Round up for .75 and above.
  • PassThrough: Don't round.

Currently the default option is explicitly set to Round to obtain the old behaviour (where 1.5x is rounded to 2x). Though we can consider switching the behaviour to RoundPreferFloor (where 1.5x is rounded down to 1x), since users with 1.5x scaling will tend to complain that the UI gets too large and rounding down can be a more acceptable behaviour.

The actual config option for user to enable the PassThrough option is to be added in a separate change.

Test Plan

With the Windows display settings set to 150% scaling:

  1. By default, the scale factor is rounded up to 2x (causing overly huge UI elements), same as the old behaviour.
  2. With QT_SCALE_FACTOR_ROUNDING_POLICY=RoundPreferFloor, the scale factor is rounded down to 1x (causing UI elements to be smaller than expected).
  3. With QT_SCALE_FACTOR_ROUNDING_POLICY=PassThrough, the scale factor is set to 1.5x and the UI elements looks to be sized appropriately.

Diff Detail

R37 Krita
Lint Skipped
Unit Tests Skipped
alvinhochun requested review of this revision.Apr 16 2019, 5:32 PM
alvinhochun created this revision.

The question is: should we change the default behaviour to RoundPreferFloor instead of trying to keep the old behaviour by using Round? I feel like RoundPreferFloor would be more useful to users who doesn't want to enable fractional scaling (but that will probably be the minority if we can enable fractional scaling by default).

Updated patch for master

alvinhochun abandoned this revision.Apr 19 2019, 2:53 AM
alvinhochun edited the summary of this revision. (Show Details)