Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Draw a GraphicsItem when hovering over a QPushButton
Qt 6.12 LTS is out! See what's new in the release blog

Draw a GraphicsItem when hovering over a QPushButton

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.3k Views 1 Watching
  • 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.
  • O Offline
    O Offline
    oracle3001
    wrote on last edited by
    #1

    I want to draw a Graphical Item i.e not a new window, when the user hovers over a QPushButton (which is contained in a standard widget) and disappears when they move the mouse away from it....basically an advanced tooltip, that will display graphics and / or series of widgets...I am keener on some sort on GraphicsItem as I will be able to make it look nicer.

    There will a number of buttons, and I want the same Graphical Item to appear next to each i.e. moving the graphical item around, rather than recreating it each item.

    I have successfully written the code to identify when these events occur, but am now stuck about the best way to achieve the actual "tooltip".

    Test.h
    @
    private slots:
    void tooltip() ;
    void leftTooltip() ;
    @

    Test.cpp
    @
    void Test::tooltip()
    {

    TestButton testButton = qobject_cast<TestButton>(sender());

    if (m_tooltip == 0) // check if first time, and if so create the tooltipWidget
    AdvancedToolTip = createAdvancedToolTipWidget() ;

    // set advanced tool tip text & label values
    // ................

    }

    void Test::leftTooltip()
    {
    AdvancedToolTip ->setVisible(false) ;
    }

    void Test::createAdvancedToolTipWidget() {

    // ????????

    }

    @

    1 Reply Last reply
    0
    • S Offline
      S Offline
      Santosh Reddy
      wrote on last edited by
      #2

      bq. I want to draw a Graphical Item i.e not a new window

      Do you mean QGraphicsItem? You could simple use a QWidget/QFrame

      SS

      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
      • Unsolved