Search code examples
qttreeviewpyqttooltip

PyQt: how to display a treeview or other complex widget as tooltip


I'm working on a PyQt project. I have a map with points on it (The map is a QGraphicsScene and my points are QGraphicsEllipseItem). I would like to display some informations on the points when they receive a hover event. The information will be: a picture, some text and a treeview fill with data. I don't want to open a new window, I want it to float over the map exactly how a tooltip will do.

I don't know how to do it, I can't find any widget who fill my needs.

Thank you for any help !


Solution

  • Create a new widget/window with windowflag Qt::ToolTip. According to the docs Qt's tooltips are nothing else. http://doc.qt.io/qt-5/qt.html#WindowType-enum