Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Special tooltip does not work in menu

Special tooltip does not work in menu

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 384 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Roy44R Offline
    Roy44R Offline
    Roy44
    wrote on last edited by
    #1

    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)

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved