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

[Regr:6.3.2->6.8.0] QMenu text alignment missing when mixing actions with and without icons

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • 6.8.1, 6.9.0 FF
    • 6.8.0
    • Widgets: Style Sheets
    • None
    • Tested on MacOS 15.0.1 and Windows 11
    • All
    • 44634c58c (dev), 905dfd391 (6.8)

    Description

      In Qt 6.3.2 changing the style of a QMenu with a .qss stylesheet caused the actions inside the menu to be text-aligned when mixing actions with and without icons (see qt6_3_2.png).

      Switching to Qt 6.8.0 removes the alignment of actions inside the menu, causing the offset shown in qt6_8_0.png. This happens if any border or padding is specified for the QMenu::item in the stylesheet. If only a background is specified, the alignment works as in Qt 6.3.2.

      I am attaching a reduced version of the Qt Menus example that was modified to show this behaviour when using Qt 6.3.2 vs Qt 6.8.2. Rightclicking anywhere inside the window will open the menu shown in the images below.

       

      Attachments

        1. menus.zip
          3 kB
        2. qt6-3-2.png
          qt6-3-2.png
          8 kB
        3. qt6-8-0.png
          qt6-8-0.png
          8 kB

        Issue Links

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

          Activity

            People

              chehrlic Christian Ehrlicher
              lsideveloper Artur Möller
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes