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

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2: Important 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)

      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.

       

        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
        For Gerrit Dashboard: QTBUG-130704
        # Subject Branch Project Status CR V

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

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes