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

Need clarification of QScreen::geometry() for High DPI screens

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P2: Important P2: Important
    • None
    • 5.7.0
    • QPA: X11/XCB
    • None
    • Arch Linux

      The current QScreen::geometry makes no note of the behavior regarding screens with different devicePixelRatio's set, so I assumes that the coordinates and sizes would be measured in device-independent pixels. It however turns out that the origin is in native pixels while the dimensions are measured in device-independent units.

      If this is the intended behavior, please document it. Similarly, a clarification for QCursor::pos() regarding the HiDPI situation would also be nice (currently it seems to add the origin (native pixels) to the relative offset in the current screen (in device-indep pixels)).

      The High DPI Displays page also makes no special mention of Linux, but apparently users can set the QT_AUTO_SCREEN_SCALE_FACTOR=1 and it reportedly seems to work.

      Background for this issue: I was trying to improve HiDPI support for the Spectacle screenshot program for KDE where information like external window dimensions are measured in native pixels and where a user takes a screenshot with a size measured in native pixels. The naive approach was to multiply/divide every x, y, width and height by the screen scaling factor but that failed. (It would also not work in presence of screens with different scaling ratios, but it illustrates the difficulties during development.)

      Example output (with QT_SCALE_FACTOR=2):

      "eDP-1" QRect(0,360 960x540)
      "DP-2" QRect(1920,0 1280x720)
      QPoint(3200,720)
      

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

            sorvig Morten Sørvig
            Lekensteyn Peter Wu
            Veli-Pekka Heinonen Veli-Pekka Heinonen
            Votes:
            3 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes