mc360pro mc360pro - 1 year ago 168
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.

Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download