-
Notifications
You must be signed in to change notification settings - Fork 745
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Qt: AA_EnableHighDpiScaling flags #4850
Conversation
d4e2c7a
to
a8e4520
Compare
Thanks @elgiano ! Without updated QT, 125% and 150% will be the same as 100%, and 175% will be the same as 200%; after updating QT to 5.14, the scale factors will be properly set for all values. Updating QT is probably something for another PR and I wouldn't want to suggest that before discussing with other devs first. EDIT: In addition to Windows, I tested this on macOS as well and it works fine - there are no regressions/side effects, as far as I can tell. |
@brianlheim I tested this and this works fine and I think it's ready to be merged. Since I have limited experience with C++ PRs I wanted to check if it's OK for me to approve this? |
@dyfer 'approve' also means the code looks good in your opinion, so if you have no issue with it go ahead! i gave it a quick look and it seems fine to me. our mac builds use qt 5.13.2 right now, and windows builds use qt 5.9 (32-bit builds) and qt 5.11 (64-bit builds). i can't update the 5.9 32-bit build because that was when Qt dropped a key component from distribution, but i can update the others! |
@elgiano what are the downsides of using this change on windows with qt < 5.14? it was difficult for me to tell from your OP. |
thanks @brianlheim
|
okay! thanks for the explanation. i've updated our CI builds to use qt 5.14 when possible in #4862 |
Purpose and Motivation
Maybe helps with #2442,
badly needs testing on Windows though.@dyfer tested it, and it works, with his addition (see below).Enables Qt's auto-detection for devicePixelRatio (HiDPI scaling), for both sclang and scide.
Qt provides ways to override this feature by setting environment variables, if the user prefers so.
For example:
it's possible to turn auto-detection off by setting QT_AUTO_SCREEN_SCALE_FACTOR or QT_ENABLE_HIGHDPI_SCALING to 0
it's possible to combine auto-detection with a user-supplied scale factor, for either GUIs, fonts or both, by setting QT_SCALE_FACTOR and QT_FONT_DPI
What I've found on my system, is that without any env var set, scide's and sclang's GUIs look very small, especially the help browser text and sclang-generated GUIs ( this resembles the situation in #2442 ). By setting the env vars, OR just by setting the flags I'm setting in this PR, the automatic scaling renders GUIs and text of a reasonable size.
After a commit from @dyfer we are also setting HighDpiScaleFactorRoundingPolicy to PassThrough, so that fractional scale factors are not rounded to the nearest integer. This flag is available and set only for Qt version >= 5.14.
Since in previous versions of Qt was not possible to change the default policy (Round), for fractional scaling to work out of the box on Windows it is required to build with at least Qt 5.14.
More general info at doc.qt.io
Types of changes
To-do list
meaning that we tried different scaling settings, and both UIs and text scale appropriately
(for QcCanvas based UIs, see HiDPI fractional scaling: remove rounding to int #4846)