[Interest] Qt high-DPI configuration patches for testing
Michael Tims
mtims at esri.com
Wed Oct 5 20:55:41 CEST 2016
- 1.5x (150% on Windows) is now rounded down to 1x: The visual effect of this
is that content appears visually small on such systems instead of visually
large. This arguably more acceptable. The rounding policy controls this as well:
This is still the number one reason why my apps cannot yet take advantage of all the hard work being put in to high-dpi support. Our customers want to see UI rendered at the exact floating scale factor - not rounded. It's a bummer that this is still the only thing holding us up. Any idea on when this will be fixed to work with the non-rounded fractional scale factor?
Thanks.
-Michael Tims
Esri
-----Original Message-----
From: Interest [mailto:interest-bounces+mtims=esri.com at qt-project.org] On Behalf Of Morten Sorvig
Sent: Monday, October 3, 2016 5:18 AM
To: interest <interest at qt-project.org>
Subject: [Interest] Qt high-DPI configuration patches for testing
Hi all,
Lately I’ve spent some time on high-DPI configuration options for Qt. This is
a somewhat complex area, with many different setups in the field. I’d like to
expose the patches to a wider audience to make sure we implement something that
works as well as possible. Please feel free to provide any feedback, either
privately or on this list.
The patches are based on Qt 5.6 and are available at:
https://urldefense.proofpoint.com/v2/url?u=https-3A__codereview.qt-2Dproject.org_157175&d=DQIGaQ&c=n6-cguzQvX_tUIrZOS_4Og&r=KhEhoiXTE1wTwtxCJdnUbw&m=_RzG4RlR0v41qHjgF78LoIb2tQbaod3EYFsAORKpreA&s=4yIAi0vOw5rrr89o3zGS8AJbPFjeTW932eCU6J2-1D8&e=
(Use the “checkout” option to get the entire patch series)
Documentation patch is at:
https://urldefense.proofpoint.com/v2/url?u=https-3A__codereview.qt-2Dproject.org_172125&d=DQIGaQ&c=n6-cguzQvX_tUIrZOS_4Og&r=KhEhoiXTE1wTwtxCJdnUbw&m=_RzG4RlR0v41qHjgF78LoIb2tQbaod3EYFsAORKpreA&s=TFX753YoGkRdp73kStaxha8gYX2a62Ih9OwrjkL4GLg&e=
The scope of the changes is improving the Qt::HighDpiScaling mode, with a focus on
configuration. I’ve tested on Windows and X11, with macOS as a dev platform. The result
of the work is some behavior changes and several new config options.
Should I test/How to I use this?
1) Set QT_AUTO_SCREEN_SCALE_FACTOR=1 or Qt::HighDpiScaling.
2) If not happy then
- Try setting QT_FONT_DPI and/or QT_SCALE_FACTOR to see how the application
reacts. Is it an application or QtWidgets/QtQuick issue?
- Set QT_USE_PHYSICAL_DPI=1 (if you know the values are correct)
- Set QT_SCREEN_SCALE_FACTORS=a;b;c to hardcode scale factors. (Known issue:
QT_AUTO_SCREEN_SCALE_FACTOR needs to be set as well for this)
3) Report findings to patch author; include "tests/manual/highdpi --metrics” outpu
and screenshots (if possible).
Some platform specific notes:
- X11: If you’ve had problems with mismatched text/ui sizes this should
now be better (if not solved). Qt now uses the global logical DPI by
default.
- Windows: Use fractional scale factors (like 150%) directly:
QT_SCALE_FACTOR_ROUNDING_POLICY=PassThrough
(See below for disclaimer and caveats)
Changes in detail:
- qtbase/tests/manual/highdpi --metrics prints the current configuration. Example:
screen name: Virtual1
widget devicePixelRatio: 1
widget logicalDpi: 96
platform screen logicalDpi: 96
platform screen logicalBaseDpi: 96
platform screen devicePixelRatio: 1
platform screen physicalDpi: 96.1115
QT_FONT_DPI:
QT_SCALE_FACTOR:
QT_AUTO_SCREEN_SCALE_FACTOR:
QT_SCREEN_SCALE_FACTORS:
QT_USE_PHYSICAL_DPI:
QT_SCALE_FACTOR_ROUNDING_POLICY:
QT_DPI_ADJUSTMENT_POLICY:
Here, the “widget” section are the values the application sees, the “platform”
section are the values returned by the OS/WS via the Qt platform plugin, and
finally QT_ sections shows the currently set environment variables.
- The screen logical DPI is now used for configuring the devicePixelRatio value.
This has been the case for Windows for some time; now all relevant platforms get
the same behavior. Set QT_USE_PHYSICAL_DPI to use physical DPI.
- In relation ot the above Qt now uses _either_ the logical or physical DPI,
which should reduce chance of getting inconsistent text and UI sizes.
- Qt may now optionally use non-integer factors (like 150% on windows):
QT_SCALE_FACTOR_ROUNDING_POLICY=PassThrough
We know that this may cause painting artifacts, in particularly with native
styles. On the other hand there are rapports that custom-styled apps work
fine.
- 1.5x (150% on Windows) is now rounded down to 1x: The visual effect of this
is that content appears visually small on such systems instead of visually
large. This arguably more acceptable. The rounding policy controls this as well:
QT_SCALE_FACTOR_ROUNDING_POLICY=Round|Ceil|Floor|RoundPreferFloor (default)
- QT_FONT_DPI now works on all platforms (mostly for testing purposes)
- QT_SCREEN_SCALE_FACTORS now correctly overrides the screen factors.
- QScreen::physicalDotsPerInch() is now a more physical value, independent of
Qt or OS scale factors, but not independent of scaling not detectable by Qt
such as the macOS “More Space” setting.
Thanks for reading this far :)
- Morten
_______________________________________________
Interest mailing list
Interest at qt-project.org
https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.qt-2Dproject.org_mailman_listinfo_interest&d=DQIGaQ&c=n6-cguzQvX_tUIrZOS_4Og&r=KhEhoiXTE1wTwtxCJdnUbw&m=_RzG4RlR0v41qHjgF78LoIb2tQbaod3EYFsAORKpreA&s=0PAQgELG6cb3yG4KrOnXzNPYx__A1o02LxLmgqQLHPo&e=
More information about the Interest
mailing list