0
votes

I have created my own custom QGraphicsLineItem. The custom graphics line item will rotate and resize when mouse is clicked on the end points of line.

The problem is that the line is not easily selectable and movable. The mouse press event is not getting detected easily. I have put debug statement in my mousePressEvent but it gets called very randomly. I have set the falgs for selectable and movable.

I did not reimplement the boundingRect() and shape() but calling the parent QGraphicsLineItem's methods inside my custom line item. Could you please let me know the problem why the mouse press event is not getting detected easily on a single click on either end points of the line item?

1

1 Answers

-1
votes

I did not reimplement the boundingRect() and shape()

this will your problem. the mouseEvent of QGraphicsItem is bound to the boundingregion you defined in boundingRect(). shape() is not required .