PDA

View Full Version : Howto catch Hoover Events with mouse over a QPainter Polygon/Polyline..?



Astronomy
25th June 2012, 20:50
Hi,

I'm drawing rects with QPainter. I want to create a tooltip or show a widget, if i hoover with the mouse over the painted rect. The class of QPainter does not seem to have any hoover events.

Any ideas would be welcome.
thanx Astronomy



static const QPointF points[4] = {
QPointF(10.0, 80.0),
QPointF(20.0, 10.0),
QPointF(80.0, 30.0),
QPointF(90.0, 70.0)
};


QPainter p;
p.begin(this);
p.setPen(Qt::black);
p.drawPolygon(points, 4);
p.end();

ChrisW67
25th June 2012, 23:18
The QWidget or QGraphicsItem that you are drawing on has the event handlers.

sonulohani
26th June 2012, 11:50
QGraphicsSceneHoverEvent (http://doc.qt.nokia.com/4.7-snapshot/qgraphicsscenehoverevent.html)

Astronomy
28th June 2012, 15:44
ok thanx,
i'll dig in there.

greetz A.