Reputation:
I have a toolbar or there are several QActions. I would like to change the color of the QAction when it is selected so that the user can see the chosen action.
The problem is that QAction is not a QWidget so we can not use stylesheet. Is there a way to get around this problem? Or would it be better to declare QPushButton instead of QAction in my toolbar?
I would like, for example, that if I click on a QAction it is pushed against the others. I have 6 QAction declared in my toolbar.
Upvotes: 1
Views: 2890
Reputation: 244282
You have to checkeable
the QAction
with:
your_action->setCheckable(true)
or using Qt Designer
and then set qss with QToolButton:
QToolButton:checked {background-color: red; }
Upvotes: 1