QToolButton not receiving ToolTip events
-
Somehow widgets aren't getting tool tip events.
I've used
setToolTip(...)onQActionthat go into aQToolBar(although IIRC the default would set the tooltip to the actiontext).The tool tips never show up.
I checked a few things with an event filter - the
QToolBarand theQToolButtonnever seem to receiveQEvent::ToolTipevents.I can copy
action->toolTip()toaction->setStatusTip( action->toolTip() )and they show up as status tips.I do see
QEvent::EnterandQEvent::HoverMoveevents.. so I could, in principal use those to fire off tool tips. But I'd like to understand why I'm not gettingQEvent::ToolTipon my widgets.Any ideas? Any place to start debugging?
-
What does
action->associatedWidgets()return? QActions aren't widgets themselves but this will tell you what widget(s) the action is associated with. -
Hi,
Can you provide a minimal compilable example that shows that behaviour ?
-
What does
action->associatedWidgets()return? QActions aren't widgets themselves but this will tell you what widget(s) the action is associated with.@mchinand said in QToolButton not receiving ToolTip events:
action->associatedWidgets()
The actions are giving:
action: "Player" QToolBar action: "Player" QToolButtonShould they also have an associated widget of the
MainWindow?@SGaist said in QToolButton not receiving ToolTip events:
Can you provide a minimal compilable example that shows that behaviour ?
I wish. Likely if I had a minimal example, I'd have figured out the problem, sorry.
-
Then I would recommend making one to help you find the issue.
We do not have enough information to guess what is going on.
You may have an event filter somewhere or maybe some strange interaction with a style you are using etc.
The other way is to make your application barebones and only keep the code related directly to the tooltips to see if it's working and if so, gradually add back the rest until it fails.
-
Then I would recommend making one to help you find the issue.
We do not have enough information to guess what is going on.
You may have an event filter somewhere or maybe some strange interaction with a style you are using etc.
The other way is to make your application barebones and only keep the code related directly to the tooltips to see if it's working and if so, gradually add back the rest until it fails.
@SGaist said in QToolButton not receiving ToolTip events:
You may have an event filter somewhere or maybe some strange interaction with a style you are using etc.
Just to be clear, those would be the most likely issues to prevent a ToolTip event, yes?
Thanks.
-
For now, I'm just fudging it - I installed an event filter for
QEvent::Enter:Not great, but it works:
if (event->type() == QEvent::Enter) { QWidget* target = qobject_cast<QWidget*>(object); QEnterEvent* ee = dynamic_cast<QEnterEvent*>(event); if (target && ee) { QToolTip::showText(ee->globalPos(), target->toolTip(), target); return true; } } return false;