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

Fixed size Widgets do not resize correctly on DPI change

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.5
    • GUI: High-DPI
    • None
    • Windows

    Description

      Reproducible on Windows 11

      Version 10.0.22621 Build 22621

       

      Setup:

      Display 1 (Primary): 100% Scale - 1920 x 1080

      Display 2 : 150% Scale - 3840 x 2160

       

      Steps:

      Move a fixed QWidget with no parent to Secondary Display

      Change scale on Display 2 to 100%

      (I don't think multiple monitors matter, simply switching DPI causes it)

       

      Expectation:

      Widget resizes correctly to the lower DPI

       

      Actual:

      Does not resize correctly.

      Fails in both directions 100% -> 150% and vice versa.

       

      EDIT: Sorry this might not be the the exact root cause, but without a resize the widget doesn't render correctly

      Root cause:

      On a geometry change event following a DPI change, isResize will never be true for fixed size windows.

      QGuiApplicationPrivate::processGeometryChangeEvent(QWindowSystemInterfacePrivate::GeometryChangeEvent *e)

      https://github.com/qt/qtbase/blob/68ae776e73881cbc160cd747e401631452e7f659/src/gui/kernel/qguiapplication.cpp#L2702

       

      Minimum reproducible example provided in WindowsDPI_FixedSize.zip

       

      Note: In cases where windows are not a fixed size there always seems to be a minor difference in actualGeometry vs. lastReportedGeometry on a DPI change.

      Worth investigating on its own

      Attachments

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

        Activity

          People

            sorvig Morten Sørvig
            ctummon Cathal Tummon
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes