Unsolved How to get true, accurate DPI values for monitor?
-
When I obtain the DPI values programmatically like so:
int dpiX = app->desktop()->logicalDpiX(); int dpiY = app->desktop()->logicalDpiY();
... I find that the values are simply the ones that I set in Xfce's Appearance settings. That is fine, except in order to accurately detect whether my code is running on a phone (e.g. PinePhone) versus a desktop/laptop, I need a hardware-based DPI value.
How can I get the true, accurate DPI values for monitor programmatically?
-
Try
physicalDotsPerInch()
if you are usingQScreen
https://doc.qt.io/qt-5/qscreen.html#physicalDotsPerInch-prop
-
look in your Xorg.0.log file for the EDID data. As far as consistently getting monitor DPI in all cases...you can't. in many cases its broken by design.
https://xorg.freedesktop.narkive.com/UkAoI71R/how-to-read-edid-xrandr