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

Wrong QScreen geometry for non-primary screens when scaling factors above 1

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P1: Critical P1: Critical
    • None
    • 6.2.3, 6.3.0 Beta2
    • GUI: High-DPI
    • None
    • Dell XPS 15 9560, Windows 10 Pro Version 10.0.19044 Build 19044, MSVC 2019
    • Windows

      I have two screens with resolution 1920x1080.

      DISPLAY2 is the main screen, connected via HDMI directly to the laptop. DISPLAY1 is the laptop screen and it's on the right.

      When running this simple code

      #include <QGuiApplication>
      #include <QScreen>
      int main(int argc, char *argv[]) {
          QGuiApplication app(argc, argv);
          QList<QScreen *> screens = app.screens();
          for (QScreen *screen : screens)
              qDebug() << screen->name() << screen->geometry() << screen->devicePixelRatio();
          return 0;
      }
      

      I get wrong size for the screen geometry for the screen DISPLAY1 when the primary screen has scale 100%.  Here are the tests I have done

      • DISPLAY2 is scaled at 100%, DISPLAY1 is scaled at 125%
        • DISPLAY2" QRect(0,0 1920x1080) 1 -> Correct
        • DISPLAY1" QRect(1920,0 1920x1080) 1.25 -> expected result: QRect(1920,0 1536x864) 1.25
      • DISPLAY2 is scaled at 150%, DISPLAY1 is scaled at 125%
        • DISPLAY2" QRect(0,0 1280x720) 1.5 -> Correct
        • DISPLAY1" QRect(1920,0 1536x864) 1.25 -> Correct
      • DISPLAY2 is scaled at 100%, DISPLAY1 is scaled at 175%
        • DISPLAY2" QRect(0,0 1920x1080) 1 -> Correct
        • DISPLAY1" QRect(1920,0 1920x1080) 1.75 -> expected result: QRect(1920,0 1097x617) 1.75
      • DISPLAY2 is scaled at 150%, DISPLAY1 is scaled at 175%
        • DISPLAY2" QRect(0,0 1280x720) 1.5 -> correct
        • DISPLAY1" QRect(1920,0 1097x617) 1.75 -> correct
      • DISPLAY2 is scaled at 125%, DISPLAY1 is scaled at 100%
        • DISPLAY2" QRect(0,0 1536x864) 1.25 -> correct
        • DISPLAY1" QRect(1920,0 1920x1080) 1 -> correct

      Everything works fine with Qt 6.1.3

        For Gerrit Dashboard: QTBUG-101601
        # Subject Branch Project Status CR V

            sorvig Morten Sørvig
            lorenzolightsgdwarf Lorenzo Lucignano
            Votes:
            7 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes