Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How to implement boundingRect and shape methods for a custom QGraphicLineItem item
jeevan_reddy last edited by
How to implement boundingRect and shape methods for a custom qgraphicline item, so that the item is easily selected when mouse is clicked on the item end points? Currently the custom line item is not receiving the mouse press events consistently. The mouse press is happening only randomly. I need to click on the line end points inorder to rotate and resize the line item.
Please find my cureent implementation
const int adjustment = 5;
QRectF rect = boundingRect();
path.addRect(rect.adjusted(-adjustment, -adjustment, adjustment, adjustment));