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

QWidget::normalGeometry() is shifted on Windows if the taskbar is on the left side

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P4: Low
    • 5.4.2
    • 5.4.0
    • GUI: Window management
    • None
    • Windows
    • 0b62cd8da7d8ee078b799b95088a63626099caa4 (qtbase/5.4, 21.1.2015, 5.4.2?)

    Description

      Problem can be seen with the attached example which prints the result of this function on the console.

      If you move the dialog to the top left corner of the usable space, the x coordinate is about 0. After maximizing, it is (on my computer) something like 92.

      A practical consequence of this is that restoreGeometry() doesn't work reliably. If use use saveGeometry and restoreGeometry() in order to restore the old geometry, the restored position is wrong with the following steps:

      • Start your application non-maximized
      • Move the window to a certain position (e. g. upper left corner)
      • Maximize it
      • Exit
      • Start (=> will correctly show the window maximized)
      • Unmaximize (=> position will be outside of the desktop)

      I suspect the use of GetWindowPlacement() in qwindowswindow.cpp to be guilty here. This works differently from other APIs (like GetWindowRect) in that the rectangle in WINDOWPLACEMENT is in the workspace, not in the screen coordinate system. There are three usages of this function and one usage of SetWindowPlacement; I haven't checked if other Qt functions are affected.

      See e. g.:

      Attachments

        1. normalgeo.cpp
          0.8 kB
        2. normalgeo.pro
          0.3 kB
        3. qtbug43872.zip
          2 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            kleint Friedemann Kleint
            bgehrmann Bernd Gehrmann
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes