Reputation: 1378
I'm trying to catch mouse events in a transparent QDeclarativeItem, wrap it around all the other elements in QML and log information about mouse events in the whole program. mouseMoveEvents(QGraphicsSceneMouseEvent *) however is executed only when mousePressEvent(QGraphicsSceneMouseEvent *) is implemented and mouse button is pressed.
In a QWidget I would sovle this by calling setMouseTracking(true).
How to do this in a QDeclarativeItem?
Upvotes: 1
Views: 261
Reputation: 1378
Solved this by using hoverMoveEvent(QGraphicsSceneHoverEvent *) and setting setAcceptHoverEvents(true). It works the same way as mouseMoveEvent, but is being called when mouse button is not pressed too.
Upvotes: 1