Details
-
Task
-
Resolution: Won't Do
-
Not Evaluated
-
None
-
None
-
None
Description
Qt has API for querying physical DPI:
QPaintDevice::physicalDpiX() QPaintDevice::physicalDpiY() QScreen::physicalDotsPerInch() Quick: Screen.pixelDensity
Which are documented to return the number of physical pixels per inch/millimeter. This was simple, until the introduction of the logical pixels (device independent pixels). Now there are two behavior options:
1) The API returns a constant value: display physical dots per inch
This value does not change if/when the device pixel ratio changes. Physical dots per inch is, after all, a physical (constant) property of the display. It is reasonable that an API that previously returned a hardware characteristic continues to report the same value, independent of the software configuration.
2) The API returns a value suitable for creating physically sized UI: the number of logical pixels per mm (or inch)
The value is divided by the device pixel ratio internally. This enables writing code like this:
item.with = 2 * Screen.pixelDensity
The item will now be two mm across on all displays (provided the display provides accurate physical measurements). The above code works on dpr == 1 displays; it is reasonable to expect that it continues to do so on other displays.
Qt Currently implements option 2. A patch for changing it to option 1 is here: https://codereview.qt-project.org/#/c/161333/
Attachments
Issue Links
- relates to
-
QTBUG-50941 QScreen class does not support properly iPhone 6S Plus
-
- Closed
-