Draw a GraphicsItem when hovering over a QPushButton
-
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() {
// ????????
}
@
-
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