Note: when you change a text of an action, the appropriate button will recreate the tooltip. You can use an event filter for a button to process the tooltip event.
When you change an action (text, enabling state...) a QToolButton updates a tooltip. In this case you need to prevent the tooltip appearance permanently:
Why it happens
When you add an action on a toolbar:
QToolButton
QToolButton::setDefaultAction
passing the action as an argument.setToolTip(action->toolTip());
action->toolTip()
returns whethertooltip
or if the tooltip is empty it returnstext
. Thus you'll always have some tooltip on the button.What to do
Using the explanation above you can think of lots of ways to solve the problem.
For example, when
QToolbar
is created (and possibly shown) usetoolbar->findChildren<QToolButton*>
to find the buttons:Note: when you change a text of an action, the appropriate button will recreate the tooltip. You can use an event filter for a button to process the tooltip event.
EDIT: added an example:
Ui
contains a toolbar with an action.When you change an action (text, enabling state...) a
QToolButton
updates a tooltip. In this case you need to prevent the tooltip appearance permanently: