0

I have reimplemented the hoverEnterEvent but for some reason it is not called :-( My method is very simple at this point:

void LinteItem::hoverEnterEvent(QGraphicsSceneHoverEvent * event) { qDebug("Mouse hovered"); QGraphicsItem::hoverEnterEvent(event); } 

I have set mouseTracking on the view. I'm able to place new LinteItems using mouseMove etc so I know the tracking works.

I have the following in the constructor:

setFlags(QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemSendsGeometryChanges); setAcceptHoverEvents(true); 

Any idea why I do not receive the events? I'm using Qt 5.5 btw

1 Answer 1

6

It should work if your overriding custom QGraphicsView mouse event handlers call the original handlers of the base class, for example

void CustomGraphicsView::mouseMoveEvent(QMouseEvent *event) { // do something... // send the event to graphics scene and items QGraphicsView::mouseMoveEvent(event); } 
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks yes. It does :-)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.