PDA

View Full Version : Change the background color for the QAction's of QMenu



qt_developer
16th April 2013, 13:01
Hi all,

I've placed this css code in the styleSheet property of the QMenu object:



QAction
{
background-color: red;
}


But the color hasn't changed. Is it possible to change the background color?

Kind regards.

Santosh Reddy
16th April 2013, 13:15
Apply stylesheet to QMenu (not QAction).

QMenu
{
background-color: red;
}


QAction is not a QWidget, i.e. it does not have visual re-presentation so stylesheets do not apply to it.

qt_developer
16th April 2013, 14:40
But this code applies to all the options in QMenu. Is it possible that applies only to one option?

Kind regards.

Santosh Reddy
16th April 2013, 15:07
No you can only apply to the QMenu as a whole (i.e. all the options), individual action/item styles is not possible.

qt_developer
16th April 2013, 15:30
Ok.

Best regards!