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

[macOS]: 5.12.0 QScreen::grabWindow returns skewed image on multi-screen system

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.12.1
    • 5.12.0
    • Other
    • None
    • Mac Pro (Late 2013), AMD FirePro D700 6144 MB, 2 27" non-Retina Thunderbolt displays, running macOS High Sierra 10.13.6
    • macOS

    Description

      Using the screenshot example,

      http://doc.qt.io/qt-5/qtwidgets-desktop-screenshot-example.html

      I did a screen capture on my two monitor system and saved the screen shot and noticed that the captured QPixmap is stretched horizontally.

      It seems that even though the Qt example uses

      screen->grabWindow(0);
      

      the returned QPixmap to grab then given screen has the width of the entire two monitor desktop.

      If I unplug my second monitor the screen is captured with the correct aspect ratio.

      The same code works fine on my Windows 10 system.

       

      To get the correct screenshot on Mac I needed to modify the example to explicitly use the screen area

      QRect r = screen->geometry();
      originalPixmap = screen->grabWindow(0, r.x(), r.y(), r.width(), r.height()); 
      

      This works correctly on my system where both screens have the same DevicePixelRatio.

       

      May be related to another grabWindow issue, QTBUG-71802.

      Attachments

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

        Activity

          People

            sorvig Morten Sørvig
            tom.ransdell Tom Ransdell
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes