Special tooltip does not work in menu
Unsolved
General and Desktop
-
Hi,
I'm trying to display an animated gif as a tooltip, so I've create a widget for that and override
event function.switch (event->type()) { case QEvent::ToolTip: { QWidget* pWidget = dynamic_cast<QWidget*>(receiver); QAction* pAction = dynamic_cast<QAction*>(receiver); QHelpEvent *pHelpEvent = static_cast<QHelpEvent *>(event); if((pHelpEvent != nullptr) && ((pWidget != nullptr) || (pAction != nullptr))) { QString sTooltip; if(pWidget) { sTooltip = pWidget->toolTip(); } else if(pAction) { sTooltip = pAction->toolTip(); } if(customTooltip(sTooltip, pHelpEvent)) return true; } } break; case QEvent::Leave: case QEvent::HoverLeave: { QWidget* pWidget = dynamic_cast<QWidget*>(receiver); QAction* pAction = dynamic_cast<QAction*>(receiver); QString sTooltip; if(pWidget) { sTooltip = pWidget->toolTip(); } else if(pAction) { sTooltip = pAction->toolTip(); } if(sTooltip.startsWith("@")) { m_tooltip.onStop(); } } break;
if the reciever tooltip starts with '@', I display a gif otherwise I display the tooltip as usual.
My problem is:- For a QAction in toolbar, my special gif widget is displayed instead of classic tooltip but for a QAction in submenu the classic
tooltip is displayed, I don't know why.
Do you have an idea ?
Thanks (sorry for my english) - For a QAction in toolbar, my special gif widget is displayed instead of classic tooltip but for a QAction in submenu the classic