dpi_scaling_round2: a bit of research on Qt6's hiDPI support #49
Loading…
Reference in New Issue
There is no content yet.
Delete Branch "dpi_scaling_round2"
Deleting a branch is permanent. Although the deleted branch may exist for a short time before cleaning up, in most cases it CANNOT be undone. Continue?
hey @momo here’s a couple tweaks i made while testing your #48 B)
Namely,
.ui.style.DpiAwareFont.configure_to_dpi()’s log msg to use.info()level (again) and dump more, and better formatted, screen info by default.snippets/dumper script based on a bit of research i did onQt6’s hiDPI docs:piker.uisomewherelmk wutchu think!
@ -46,0 +47,4 @@# https://doc.qt.io/qt-6/highdpi.html#environment-variable-referenceos.environ['QT_USE_PHYSICAL_DPI'] = '1'FWIW, i think we might want to add this setting by default since it seems (at least on sway/wayland) the “logical DPI” has very little value and is often plain deceiving since almost all compositor’s are going to pre-scale yet always report a 96..
at least this way (and try it urself via the updated script to verify) the “logical DPI” will be a rounded version, at least it seems, of the physical value; this at least discards ever using the “always 96 and not correct” default XD
@ -61,1 +69,4 @@app = QtWidgets.QApplication([])## ^TODO? various global DPI settings?# [ ] DPI rounding policy,Not sure if this helps us more as well but figured i’d include it for further investigation.
@ -81,0 +97,4 @@# https://doc.qt.io/qt-6/highdpi.htmlpxr: float = screen.devicePixelRatio()unscaled_size: QSize = pxr * sizeNote this should actually be per-screen and the correct abs resolution dimensions (in pxs obvi).
A further gotcha here on
waylandis that onlyintvalues ofpxrare able to be read.. which means anyone doing fancyfloatreso-scaling (like i was in myswayconfig) will get a wrong calculation for this..I’m not exactly sure how to guard against this yet but at the least we can document that it’s unsupported for now, possibly a warning in the
.configure_to_dpi()message; it would be best if we can actually detect that case but i found no immediately obvious cross-platform way other then somethinggeminirecommended,main issue is that the
screeninfolib doesn’t natively supportwaylandexcept throughxwayland.. so we need another wayland nodding approach as well.a couple options on this front might be
pywaylandandpywlrootsand i also was already sniffing at python-wayland for use inmoddenas an eventual gesture daemon approach (for mobile / touch screens that is). Anyway, this is more of a me only problem i’d imagine since i seem be one of the few usingpikeronwaylandBpOH RIGHT XD
i forgot
geminialso reco-edtnkinterwhich is in the stdlib,but i don’t think we can get the “physical dimensions” (like in cm/inches) from this? needs some tinkering if you feel up for it @momo ;)
created #50 to track all my recent research on this and help drive the longer term desired feature.