Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QScreen DPI Confusion
Forum Updated to NodeBB v4.3 + New Features

QScreen DPI Confusion

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 371 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Adam Crowe
    wrote on last edited by
    #1

    Hello!

    My app draws things in real-world millimetre dimensions. For that, I take:

    qreal oneMM = QScreen::logicalDotsPerInchX() * QScreen::devicePixelRatio() / 25.4f;
    

    On a MacBook Pro with a built-in Retina display this works perfectly. 10mm on the screen are actually 10mm in real life if you put a ruler up to the screen.

    However, on my Mac Pro with an external 4K Benq SW271 display in scaled 1:2 mode at 1920x1080 down from 3840 x 2160, the same formula looks like 18mm in real life even though it draws 10mm in the code.

    If I draw the same 10mm to a Printer device using the same exact code but with the printer's DPI settings, the code prints a perfect 10mm as expected.

    Now I don't think there's a bug with anything in particular, but there much be a way of accounting for that difference between the built-in and the external display that I'm completely missing.

    Can anyone advise please?

    1 Reply Last reply
    0
    • Kent-DorfmanK Offline
      Kent-DorfmanK Offline
      Kent-Dorfman
      wrote on last edited by
      #2

      At least in X11, displays have a concept called an EDID that informs the server about the modes, frequencies, and dimensions of the physical display. Unfortunately how that infomration is used between differing OS, desktop environments, and even APPS is not well defined. It gets a lot more complicated when you mirror displays that have different DPI values. Wish I did have a solution, but for me it's always trial-and-error with bunches of different settings and hoping they don't screwup things outside of the app I'm concerned about.

      I light my way forward with the fires of all the bridges I've burned behind me.

      1 Reply Last reply
      2
      • A Offline
        A Offline
        Adam Crowe
        wrote on last edited by
        #3

        Thank you very much Kent,

        I fear you are right. I've actually been debugging this issue with Qt support and it seems that the BenQ SW271 is either reporting incorrect information to the operating system or it is being recognised incorrectly by the operating system. In the "About My Mac" window, macOS thinks the screen is 61-inch (3840 x 2160)! And hence the incorrect DPI :-/ I've now written to BenQ's support. The ticket was escalated to the technical team and I'm waiting for reply.

        Luckily, the printing works perfectly so it's not stopping the app from working correctly at the end of the day.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved