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

QMenu has sizing issues on multi screen systems (again/regression)

    XMLWordPrintable

Details

    • Windows
    • 8c0153a52 (dev), 9e7f1f3e5 (6.5)

    Description

      There is a risk that this is more (behavior related) issues, but the bottom line is that QMenu has some size issues. I have been unable to boil the observed bugs down to a simple code example, but the system with two screens (with different dpi) appears to be central to reproduce (see attached qtdiag.txt) and problems can be seen in Qt Creator

      a) Typically a first-show issue (when shown on the)

      b) Not as easy to get as (a), but it is still common. The menu are shown on the same screen (without anything happening in between). However, there is a mismatch in size and spacing. (13 items in Build menu matches 16 items in edit menu - despite the more separator items in the latter).

      Regarding point (b), I have in another program tracked down a strange behavior in QSize QWindowsVistaStyle::sizeFromContents ( qwindowsvistastyle.cpp ).

          case CT_MenuItem: {
              ..... (code) ....
              const QSizeF size = themeSize.size() * QWindowsStylePrivate::nativeMetricScaleFactor(widget);
      

      Here the result of themeSize.size() is not consistent for same items which would be expected. However, it appears not to be the codepath for Qt Creator is in. Therefore, I suspect the QMenu somehow can catch some wrong screen/state mismatch.

      PS:
      I found a way to reproduce an issue a bit similar to (b). Open attached 'trivial' example menuSizeIssue.zip (in Creator). The program starts where the mouse is. If the menu starts on the low high dpi display there is nearly no space between the items in the menus. If the menu starts on the high dpi display there is (too) much space between the items. In both situations the situation does not change on space when moving it to the other screen.

      Attachments

        1. image-2023-04-17-11-06-01-688.png
          image-2023-04-17-11-06-01-688.png
          61 kB
        2. image-2023-04-17-11-10-52-091.png
          image-2023-04-17-11-10-52-091.png
          159 kB
        3. menuSizeIssue.zip
          2 kB
        4. qtbug112911.zip
          2 kB
        5. qtdiag.txt
          10 kB
        6. screenshot-1.png
          screenshot-1.png
          27 kB
        7. screenshot-2.png
          screenshot-2.png
          7 kB
        8. screenshot-3.png
          screenshot-3.png
          7 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            tmartsum Thorbjørn Lund Martsum
            tmartsum Thorbjørn Lund Martsum
            Votes:
            1 Vote for this issue
            Watchers:
            10 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes