I have derived a class from QGraphicsRectItem that draw a rect on the screen. Simple enough.

I have enabled selection on this item and the normal dotted frame appears over the displayed rect. Now I want to highlight this rect when selected so I would like to place a selection border around the item's rect.

From what I have read about QGraphicsItems, they should only draw within the boundingRect. I have overridden the boundingRect method and tried to adjust the rect by 1, but as you guess that did not quite work since the QGraphicsRectItem uses the scene's coordinate system. The transform of the item does not seem to help since its type is always TxNone.

The paint event seems to be the only time when I can get a decent transform for the item. Do I need to save that and then apply it in the boundingRect method?

All I want to do is add a few pixels around the QGraphicsRectItem.