Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-60306

QScreen::devicePixelRatio returns wrong value on macOS system with multiple displays and scale factors

    XMLWordPrintable

Details

    • Bug
    • Resolution: Incomplete
    • P3: Somewhat important
    • None
    • 5.8.0
    • GUI: High-DPI, QPA
    • None
    • macOS 10.12.4, retina Macbook Pro 2015 13".
    • macOS

    Description

      I have a macbook pro w/retina display connected to an external non-retina display. If I launch my application on the retina display and run the following code:

       auto screenNumber = qApp->desktop()->screenNumber(this);
       auto scaleFactor = qApp->desktop()->screen(screenNumber)->devicePixelRatio();
      

      I get 0 for the screen number, and 2 for the scale factor as expected. If I drag the window over to the non-retina screen and run the code again, I get 1 for the screen number but still 2 for the scale factor which is incorrect. If i launch the application on the non-retina screen initially I get the opposite problem and the scale factor is always 1.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            sorvig Morten Sørvig
            eodabash eodabash
            Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes