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

Styling of QMenu via CSS is broken for checkable menu items

    XMLWordPrintable

    Details

    • Platform/s:
      All
    • Commits:
      b568e931490a7751120dfed1f0bc53f2a4b4192a (qt/qtbase/5.12)

      Description

      If a QMenu is styled with the fllowing CSS code from the Qt documentation https://doc.qt.io/qt-5/stylesheet-examples.html then it looks good for all Qt Versions from Qt 4.0 - Qt 5.11.

       
      QMenu {
          background-color: white;
          margin: 2px; /* some spacing around the menu */
      }

      QMenu::item  {
          padding: 2px 25px 2px 20px;
          border: 1px solid transparent; /* reserve space for selection border */
      }

       

      With the current Qt version 5.12.2 this is broken:

      The picture shows that the styling is broken for checkable QActions with an Icon. If an Action with an Icon is checkable, then the menu should show the Icon but now the menu shows the checkmark plus the icon.

      The attached test case shows this problem.

      While this looks like a "Somewhat Important" bug that will never be fixed like any other "Somewhat Important" bug, it is a little bit more serious because I have not found any workaround for this problem so far. That means, any Qt application that uses stylesheets seriously (like our QmixElements software) is affected by this problem.

        Attachments

        1. 5.12.2.png
          5.12.2.png
          14 kB
        2. image-2019-03-25-10-31-07-326.png
          image-2019-03-25-10-31-07-326.png
          5 kB
        3. image-2019-04-03-14-45-36-108.png
          image-2019-04-03-14-45-36-108.png
          41 kB
        4. MenuItemStylingTest.zip
          3 kB
        5. QmixElements.png
          QmixElements.png
          86 kB
        6. Qt_5.12.2.png
          Qt_5.12.2.png
          7 kB
        7. Qt_5.9.2.png
          Qt_5.9.2.png
          6 kB
        8. Qt5.9.2.png
          Qt5.9.2.png
          15 kB
        9. Qt5.9.2.png
          Qt5.9.2.png
          15 kB
        10. WindowsStyle.png
          WindowsStyle.png
          11 kB

          Issue Links

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

            Activity

              People

              Assignee:
              chehrlic Christian Ehrlicher
              Reporter:
              ukindler Uwe Kindler
              Votes:
              4 Vote for this issue
              Watchers:
              10 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes