How to enable mouse tracking for QGraphicsItem?
-
I have multiple QGraphicsItem set in QGraphicsScene. I want mouseMoveEvent (QGraphicsSceneMouseMoveEvent *event) for these objects to trigger without mousePressEvent(). A documentation clearly says that this behavior is realised by setting setMouseTracking(true) for the widget.
But the problem is that I don't see any QWidget object inside QGraphicsItem and QGraphicsScene. Where should I put setMouseTracking? Any help will be appreciated. -
Hi,
You can have something similar using the hovering related methods. See QGraphicsItem setAcceptHoverEvents for more details.
-
Hi,
You can have something similar using the hovering related methods. See QGraphicsItem setAcceptHoverEvents for more details.
@SGaist yes, hovering will be okay too. I just didn't think that constant mouse tracking is such a problem.