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

High DPI and multi-monitors: window appears offscreen.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Incomplete
    • Not Evaluated
    • None
    • 5.9.1, 5.9.2, 5.10.0 Beta 4
    • QPA: Windows
    • None

    Description

      In the following context, calling resize or move on a window before showing it results in an invisible window (see example below).

      • multi-monitor
      • Windows 10
      • Not the first window to appear
      • High DPI (at least 200%)
      • Mouse cursor is not on the primary screen. 
      #include "mainwindow.h"
      #include <QApplication>
      #include <QTimer>
      
      int main(int argc, char *argv[])
      {
      _wputenv_s(L"QT_AUTO_SCREEN_SCALE_FACTOR", L"1");
      
      QApplication a(argc, argv);
      //Timer gives time to move the cursor to another screen
      QWidget* f1 = new QWidget();
      QWidget* f2 = new QWidget();
      QTimer::singleShot(2000, [&]{
      f1->setWindowTitle("test f1");
      f1->show();
      f1->resize(100, 100);
      });
      
      QTimer::singleShot(5000, [&]{
      f2->setWindowTitle("test f2");
      f2->resize(100, 100);
      f2->show();
      });
      return a.exec();
      }
      
      

      Attachments

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

        Activity

          People

            kleint Friedemann Kleint
            schristin@druide.com Sébastien Christin
            Votes:
            3 Vote for this issue
            Watchers:
            11 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes