How to enable mouse tracking for QGraphicsItem?
-
wrote on 16 Sept 2020, 12:17 last edited by
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.
wrote on 21 Sept 2020, 07:33 last edited by@SGaist yes, hovering will be okay too. I just didn't think that constant mouse tracking is such a problem.
2/3