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

QCombobox poppup position is wrong when using High DPI and Qt::HighDpiScaleFactorRoundingPolicy::RoundPreferFloor

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.3.0
    • Widgets: Layout
    • None
    • Windows 10, High DPI display, scaling at 250% (fractional)
    • Windows

    Description

      Took me a while to isolate the issue into a MCVE, but I finally figured it out and hosted a very short code sample with explanations and images in the README here: https://github.com/jmarrec/QtTestbed/tree/main/Test-Combobox-Popup-Issue

      Here's the bottom line:

      1. Combobox popup position issue
      • Windows 10 (21H2) (Mac is not affected)
      • High DPI display
      • Set Display Scaling to 250% (fractional)
      • Use `QApplicationn:setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::RoundPreferFloor)`
      • Move the main window to the left of the screen: popup is ok, it aligns (see Image *left.png*)
      • Move the main window to the right of the screen: it gets an offset that gets worse and worse (see *right.png*)
      • Now try with 200% scaling: it works fine (see *right_200pct.png*)

      Note:

      • if I start the application at 200%, then switch to 250% while it's running, then it works fine
      • If I use `Qt::HighDpiScaleFactorRoundingPolicy::PassThrough` at 250% it doesn't exhibit the issue

      Attachments

        1. right.png
          right.png
          144 kB
        2. right_200pct.png
          right_200pct.png
          99 kB
        3. left.png
          left.png
          88 kB

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            jmarrec Julien Marrec
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: