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

Padding problems in QMenu with proxy style

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 5.15.0
    • Fix Version/s: None
    • Component/s: Widgets: Style Sheets
    • Labels:
      None
    • Platform/s:
      Windows

      Description

      There has been a change in a styled QMenu on Windows after Qt 5,11,3 that has broken the layout of our menus. I've attached a sample program that shows the difference,

      On 'menus_5_11_3' you can see how the menus used to look.  

      We're using a proxy style with custom graphics for the menu Indicator. I've tried to include the relevant parts in my example. 

      Starting with Qt 5.12.0 the padding seems to be applied after the checkbox. See 'menus_5_15_0'. This is how it looks in the current version. 

      If you take out the padding, the menus look like 'menus_5_15_0_no_padding'. To achieve that, comment out the QMenu::item styling in stylesheet.qss.

      Here it looks like the space for the custom indicator is not correctly reserved. You can see that the checkbox in 'menu 2' is really small. In 'menu 1' the size is ok but only because the reserved space seems to be dermined by the QAction with a custom icon.

       

      I've not been able to find a workaround to get the behavior of 5.11.3 and prior back. It seems to be caused by the changes made for  QTBUG-66380.

      When I revert the changes in qstylesheetstyle.cpp made for this ticket, I get the old behavior back. I've attached those changes as 'menus.diff' for reference.

        Attachments

        1. menubug.zip
          11 kB
        2. menus_5_11_3.png
          menus_5_11_3.png
          11 kB
        3. menus_5_15_0_no_padding.png
          menus_5_15_0_no_padding.png
          12 kB
        4. menus_5_15_0.png
          menus_5_15_0.png
          12 kB
        5. menus.diff
          5 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            qt.team.quick.subscriptions Qt Quick and Widgets Team
            Reporter:
            mkeller Markus Keller
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes