PDA

View Full Version : QGraphicsRectItem not receiving hoverevents



hellozee
18th July 2018, 11:05
I have extended both QGraphicsScene (https://github.com/eyeon/Fixture/blob/463cb531df3c1d1114d5ac48ad36c95cfe9c6370/src/model/drawing.cpp) and QGraphicsView (https://github.com/eyeon/Fixture/blob/463cb531df3c1d1114d5ac48ad36c95cfe9c6370/src/widgets/paintwidget.cpp), and at the same time overwritten the QGraphicsScene mousePress, mouseMove and mouseRelease events.
Now this events are handled by my transform tool (https://github.com/eyeon/Fixture/blob/463cb531df3c1d1114d5ac48ad36c95cfe9c6370/src/tools/transform.cpp) class which is also responsible for drawing a bounding rectangle (https://github.com/eyeon/Fixture/blob/463cb531df3c1d1114d5ac48ad36c95cfe9c6370/src/tools/components/boundingrectitem.cpp). Doing manual resizing seems like a trivial task, but I am unable to override the hover events of the bounding rectangle class even after doing setAcceptHoverEvents(true); inside the derived QGraphicsRectItem.

Is my approach a correct one? If yes where am I most probably going wrong, if not what should be a better approach? Another thing which came to my mind is, should I install an eventfilter for doing such stuff?