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

Issue with showNormal after moving window to a different screen in fullscreen

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.8.1
    • None
    • Windows 11
      2 screens: MSI G273Q (primary screen, 2560x1440 with 125% display scaling), LG SDQHD (2560x2880 with 150% display scaling)
    • Windows

    Description

      When running the code below, I end up with my window on the wrong screen and also out of bounds after calling showNormal. 

      From debugging, it seems like this is related to QWindowsWindow::m_savedFrameGeometry used in QWindowsWindow::setWindowState_sys. For some reason, when calling showNormal, m_savedFrameGeometry is still using the previous screen.

       

      Code to reproduce:

      QApplication application(argc, argv);	
      QMainWindow window;
      
      auto screens = application.screens();
      
      // Move to secondary screen, I think this needs to be a different screen than the one that the MainWindow was created on by default	
      window.setScreen(screens[1]);	
      window.setGeometry(window.screen()->geometry());	
      window.showFullScreen();
      
      // Move back to primary screen	
      window.setScreen(screens[0]);	
      window.setGeometry(window.screen()->geometry());	
      window.showFullScreen();
      
      // After this call, the window will show back on the secondary screen	
      window.showNormal();
      
      application.exec(); 

      Attachments

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

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            felixsoftdrive Félix Lamontagne
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes