I'm very experienced with Qt's QGraphicsScene
, but I'm hoping someone can clarify a detail with regard to the boundingRect
and shape
methods for a QGraphicsItem
. As far as I can find, the documentation doesn't address this specific concern.
I have a situation where I need to calculate a shape for many complex paths with the shape including a slight buffer zone to make the paths easier for the user to click on and select. I'm using the QPainterPathStroker
, and it's expensive. I'm currently attempting to delay the shape calculation until the shape method is actually called, and that's helping with the performance.
The situation now is that the bounding rectangle is calculated from the path boundaries plus any pen width, which is correct for enclosing the painted area. However, when the shape
result is calculated, it is larger than the bounding rectangle because the selection buffer zone is larger than the drawing area.
Is that a problem? Is it acceptable that the boundingRect
does NOT enclose the shape
result area? Or do I need to recalculate the boundingRect
when I recalculate the shape
?
Thank you.
Doug McGrath