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

Retina: QGraphicsView with a GLWidget renders at 2x scale if the display is set to "More Space"

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 5.1.0 Beta 1
    • 5.0.1
    • GUI: Painting
    • None
    • MacOSX Mountain Lion on MBP 15" Retina
    • cea58f4b77e1639e5671cf424544d4948fb8e9ef

    Description

      I don't know that this is limited to QGraphicsView, but that was where it hit us. To reproduce:

      • On a Retina MBP, open the Display settings
      • Choose "Scaled" then "More Space"
      • Run the attached "retina" application
      • Note the result: retina-more-space.png. Everything draws scaled 2x.

      I've tracked this down to a call to QPainterPrivate::hidpiScaleTransform(). On OSX, the logical DPI is hardcoded to 72 pixels in qcocoaintegration.mm. When the display is set to "More Space", CGDisplayScreenSize() returns (330.631, 207.347), while the screen's resolution returns (1920, 1200). This means the physical DPI, calculated by QScreen::physicalDotsPerInchX:

      return size().width() / physicalSize().width() * qreal(25.4);
      

      Comes out to 147.5. Divided by the logical DPI which is hardcoded to 72, QPainterPrivate gets a scaling factor of 2.

      It seems like QPainterPrivate::hidpiScaleTransform() should be using a devicePixelRatio() function instead of doing this calculation on its own, but none exists in QPaintDevice. Since that doesn't seem to be an option, my inclination was to remove the hard-coding of the logical DPI, but then I found http://qt.gitorious.org/qt/qtbase/commit/b2189acfc142397e8f3f547b0affdfc0b233fbb2

      Attachments

        1. retina.tar.gz
          10 kB
          Josh Faust
        2. retina-best.png
          20 kB
          Josh Faust
        3. retina-more-space.png
          18 kB
          Josh Faust
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            sorvig Morten Sørvig
            jfaust Josh Faust
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes