Mouse event propagation in QGraphicsScene
-
Hi everybody,
what my situation :
I have two QGraphicsRectItem placed inside a QGraphicsScene. I've set the acceptHoverEvents flag to true. Then I'm able to manage the hoverEnterEvent or hoverLeaveEvent for the two QGaphicsRectItem when I passed the mouse cursor over the rectangles. OK, perfect, I'm pround of me.But I need to have such events even if the left mouse button is clicked. And with the mouse button pressed the hover events are not generated.
My question is how to have hoverEnterEvent for QGraphicsRectItem in any case, and especially when the mouse button is pressed.
Thank you.Foufy
-
Where is the left button clicked before you move the mouse? Inside or outside the scene?
In some cases, when you left click and hold while on an item or widget, that item or widget will grab the mouse, so it can track mouse moves even as they leave that respective item.
In general, mouse events are first delivered to the QGraphicsView (on QWidget level), then forwareded to the QGraphicsScene, then translated into QGraphics*-Event types, and then delivered to the correct items. So you could try catching the events on Scene or View level. You could also look for MouseMove events instead of Hover