mc360pro mc360pro - 1 month ago 17
C++ Question

Select Disabled Actions in QMenu via Stylesheet

In my project I customized a QMenu using stylesheets to have the color and spacing attributes I want. However, upon doing so, disabled actions no longer look any different from enabled actions.





As you can see, the disabled actions look the exact same as enabled ones, and I can't seem to figure out a way to select disabled actions via stylesheets.

Here is my current stylesheet for the QMenu

QMenu{width: 115px; background: #373f49; color: #bfbfbf; margin: 0px;}
QMenu::item{padding: 4px 18px 4px 30px; border: 0px solid transparent; margin: 0px;}
QMenu::icon{margin-left: 10px;}
QMenu::item:selected{background: #47505c; color: #fff;}

Thanks for your time.


Use the disabled selector: QMenu::item:disabled{background: #ffffff; color: #000000;} enter image description here