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

Styling of QMenu via CSS is broken for checkable menu items



    • All
    • b568e931490a7751120dfed1f0bc53f2a4b4192a (qt/qtbase/5.12)


      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.


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

        Issue Links

          For Gerrit Dashboard: QTBUG-74655
          # Subject Branch Project Status CR V



              chehrlic Christian Ehrlicher
              ukindler Uwe Kindler
              4 Vote for this issue
              10 Start watching this issue



                Gerrit Reviews

                  There are no open Gerrit changes