How to add a stylesheet to a QAction item from a QMenu?
Unsolved
General and Desktop
-
I'm trying to create a stylesheet to a QAction inside a QMenu item, and I've tried a lot, but can't to work.
I want to change the QAction text property, for the QMenu it worked alright.
This is how I did with the menu ```
QMenu#qmSelf {
qproperty-title:"MAIN MENU";
}This how I tried with the action
QAction#qaUSER{
qproperty-text:"USER";
} -
Hi, welcome to devnet.
Stylesheets only apply to widgets. QAction is not a widget. You could probably hack it with QActionWidget and for example a label, but that's gonna be tricky.
It's a very unusual thing to set text via stylesheets. They are really meant to define the looks, not the content. You're missing out on many text related features this way, like localization. Are you sure it's a good idea?