Is it possible to use the same QAction in different contexts and show its title in only one?
Solved
General and Desktop
-
I'm adding the same QAction, already connected to actions, to a QToolBar and to a QMenu. This QAction have a title and an Icon. The problem is that I need the QAction that appears in the QToolbar to show only the icon and not the title, while the QAction that appears in the QMenu show the title and the icon. Is there a way?
-
Hi,
You can use the QToolBar::toolButtonStyle property and set it to
Qt::ToolButtonIconOnly
. -
@leonardo-M-B
I would guess not, else there would be an interface to that. Isn't it simpler just to have twoQAction
s which do the same code rather than trying to find a way to do it with one?
UPDATE Apologies in light of @SGaist's answer. -
Hi,
You can use the QToolBar::toolButtonStyle property and set it to
Qt::ToolButtonIconOnly
.