Increasing the selection area for a qgraphicsPathitem
Hi all
I am having a problem with my QGraphicView framework. I want to select an QGraphcsPathItem by clicking on an an area surrounding the item. This area is +5 pixels on all sides on the item's bounding rect. I did the following:
Quote:
QRectF boundingRect() const
{ return QGraphicsItem::boundingRect().adjusted(-5, -5, +5, +5); }
bool contains(const QPointF &point) const
{ return boundingRect().contains(point); }
The mouse click on the area surrounding the boundingRect is received by the item. I checked this by subclassing the mousePressEvent(). But the item is not getting selected this way. The item is a pathItem. So would it only get selected if clicked on the path?
Thanks
Arjun
Re: Increasing the selection area for a qgraphicsPathitem
I think you must reimplement QGraphicsItem::shape() and return a path containing the bounding rect.