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

QScreen availableGeometry is incorrect after unplugging then plugging in primary monitor on Windows 7

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 5.5.0
    • 5.4.0
    • QPA: Windows
    • None
    • Windows 7 64bit, Qt 5.4
    • 52f5e50f11a3ba82e32dc2efc656e4021a3fa4f5 (qtbase/5.5, 25.2.2015)

    Description

      I have a 2 monitor setup, a laptop with a screen res of 1366x768 on the left, and a main external monitor with a res of 1680x1050 on the right.

      In windows, the right monitor is setup as my main display.

      On app start, QDesktopWidget::availableGeometry(-1) reports the correct size, if I then unplug the main monitor, availableGeometry(-1) correctly reports the correct size of the laptop screen.

      If I then plug the external monitor back into the laptop, availableGeometry(-1) provides incorrect values.

      Here is a chunk of log from the attached sample program which simple logs on signals from QDesktopWidget:

      << initial load (main window is external monitor)
      Initial availableGeometry  QRect(0,0 1680x1010)
      
      << unplugging (main window is laptop)
      screenCountChanged availableGeometry  QRect(-1366,382 1366x768)
      resized availableGeometry  QRect(-1366,382 1366x768)
      resized availableGeometry  QRect(0,0 1366x768)
      workAreaResized availableGeometry  QRect(0,0 1366x768)
      workAreaResized availableGeometry  QRect(0,0 1366x728)
      
      << plugging back in (main window is external monitor)
      screenCountChanged availableGeometry  QRect(0,0 1366x728)
      resized availableGeometry  QRect(-1366,382 1366x768)
      workAreaResized availableGeometry  QRect(-1366,382 1366x768)
      workAreaResized availableGeometry  QRect(-1366,382 1366x768)
      

      I would expect, after plugging the external monitor back in that availableGeometry(-1) returns QRect(0,0 1680x1010)

      I see the same (incorrect) behavior when physically removing the laptop from a dock and re-attaching it.

      Attachments

        1. layout].jpg
          layout].jpg
          462 kB
        2. qtbug44213_log4.txt
          0.7 kB
        3. qtbug44213_log5.txt
          1.0 kB
        4. qtbug44213.zip
          2 kB
        5. WindowsGeometry.zip
          4 kB

        Issue Links

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

          Activity

            People

              Unassigned Unassigned
              neil Neil Williams
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes