Screen.pixelDensity is incorrect on all devices

Bug #1504293 reported by Olivier Tilloy on 2015-10-08
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Canonical System Image
kevin gunn
qtubuntu (Ubuntu)
Gerry Boland

Bug Description

I’m testing the Screen.pixelDensity attached property ( in a QML app on various devices (krillin, arale, flo), and the screen always reports the same incorrect value: 3.93701 px/mm.

I had a quick look at how this is implemented in QtQuick, and it calls into QScreen::physicalDotsPerInch(), which itself calls into QPlatformScreen::physicalSize(), which doesn’t appear to be reimplemented in QtUbuntu (UbuntuScreen).

For reference, I want to use that property to calculate the physical size of the screen, as a heuristic to determine the most suitable form factor.

Related branches

Gerry Boland (gerboland) on 2015-10-08
Changed in qtubuntu:
status: New → Triaged
Olivier Tilloy (osomon) on 2015-10-09
Changed in qtubuntu:
assignee: nobody → Olivier Tilloy (osomon)
status: Triaged → In Progress
Olivier Tilloy (osomon) wrote :

With the linked branch, I’m getting correct pixel density values for 3 devices:

  arale: 19.104950495049504 px/mm
  krillin: 9.48931735278791 px/mm
  flo: 12.673405367723944 px/mm

Bill Filler (bfiller) wrote :

@kgunn, grayback,
can we get a landing on this - looks like MR has been approved already
we need this fix for a browser bug we have

Changed in canonical-devices-system-image:
assignee: nobody → kevin gunn (kgunn72)
milestone: none → ww46-2015
importance: Undecided → High
status: New → In Progress
Changed in qtubuntu (Ubuntu):
assignee: nobody → kevin gunn (kgunn72)
importance: Undecided → High
status: New → In Progress
assignee: kevin gunn (kgunn72) → Gerry Boland (gerboland)
Changed in canonical-devices-system-image:
status: In Progress → Fix Committed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package qtubuntu - 0.62+16.04.20151105-0ubuntu1

qtubuntu (0.62+16.04.20151105-0ubuntu1) xenial; urgency=medium

  [ Nick Dedekind ]
  * Support server->client visibility change to stop rendering
    (lp:#1475678) (LP: #1475678)

  [ Olivier Tilloy ]
  * Re-implement QPlatformScreen::physicalSize(). (LP: #1504293)

 -- Michał Sawicz <email address hidden> Thu, 05 Nov 2015 16:56:48 +0000

Changed in qtubuntu (Ubuntu):
status: In Progress → Fix Released
Olivier Tilloy (osomon) on 2015-11-06
Changed in qtubuntu:
status: In Progress → Fix Released
Changed in canonical-devices-system-image:
status: Fix Committed → Fix Released
Michał Sawicz (saviq) on 2017-03-13
no longer affects: qtubuntu
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers