hello, i'm creating an application with QMenu's, and i want to apply a stylesheet to a single QAction item, but QAction has not setStyleSheet method, how can i apply a custom style to a SINGLE QAction?
hello, i'm creating an application with QMenu's, and i want to apply a stylesheet to a single QAction item, but QAction has not setStyleSheet method, how can i apply a custom style to a SINGLE QAction?
does anybody know?
A QAction has no visible representation, i.e. it is not a QWidget, so applying a style to it directly makes little sense. You would have to address this through a stylesheet on the QToolbar or QMenu
What effect are you trying to achieve for a particular entry on a menu?
set a different background for a single QAction, something to "highlight" the QAction, something to emphasize it
or is it posible to assign an id to QActio as in html? maybe setting the style for QMenu:item#singleitemid works, but i don't how to set the object's id
You set the QAction's objectName() with setObjectName() (see QObject). I'm not sure the QAction is the object that the :item subcontrol refers to though.
Yep it is. Try: QAction::data.
unfortunately QAction::setObjectName() didn't work for setting the style for the single QAction, but thanks anyway...
and why data()? i read documentation but i don't understant the QVariant class and how can i use it, could you explain me please?
or another alternative?
Bookmarks