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

Main widget with 'too big' size does not show on 2nd screen in two-monitor setup (Windows)

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 6.2.9, 6.4.3, 6.6.0 Beta4
    • Qt RHI
    • None
    • Windows 11 Version 22H2 [winnt version 10.0.22621]
      dual monitor setup (see qtdiag.log)
    • Windows

    Description

      Showing a window with a 'too big' size on a second monitor (where top-left virtual coordinates are not 0,0) leads to the window not being shown at all, as it is rendered with 'off-screen' coordinates. This is both for Qt Widgets and Qt Quick, and seems to affect all Qt 6 versions.

      Example code (probably only reproducible on a setup very similar to mine):

      #include <QApplication>
      #include <QWidget>
      #include <QScreen>
      #include <QWindow>
      
      int main(int argc, char *argv[])
      {
          QApplication a(argc, argv);
          QWidget w;
          for(auto screen: a.screens())
              qDebug() << "Screen" << screen->name() << "available size: " << screen->availableSize();
      
          //w.resize(1705, 915);
          w.resize(1706, 916);
          w.show();
      
          QWindow *window = w.windowHandle();
          qDebug() << "Window size: " << window->size() << "position" << window->position() << "on screen" << window->screen()->name();
          return a.exec();
      }
      

      Output:

      Screen "\\\\.\\DISPLAY1" available size:  QSize(1920, 1032)
      Screen "DELL P2415Q" available size:  QSize(1920, 1032)
      Window size:  QSize(1706, 916) position QPoint(-1920,0) on screen "\\\\.\\DISPLAY1"
      

      Anyhow, the window is not shown on screen 1 - it isn't shown at all, in fact, because of the -1920 coordinate.

      With w.resize(1705, 915), it is shown on the right screen:

      Screen "\\\\.\\DISPLAY1" available size:  QSize(1920, 1032)
      Screen "DELL P2415Q" available size:  QSize(1920, 1032)
      Window size:  QSize(1705, 915) position QPoint(3947,58) on screen "DELL P2415Q"
      

      Attachments

        Issue Links

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

          Activity

            People

              owolff Oliver Wolff
              kkohne Kai Köhne
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes