spawn9997
26th June 2009, 23:52
Hello all,
I am looking for a way to obtain the outline, shape(), of several QGraphicsItems that may or may not be overlapping. They are all children of a single QGraphicsItem for which I currently am drawing the boundingRect(). I computed this rectangle from the union of all of the boundingRect() of the child items; so I figured, instead of this large square I can somehow get the shape of all of the child items combined.
If the group of items looks like attached pic (someItemSet.png),
then I want my shape to look like this attached pic (someSetShape.png).
For simplicity, assume squares of the same size that do not change. It does not have to be so perfect or curvy, that is just how I drew it in Gimp; but, it could form any shape based on the data for the items.
I know about QPainterPath and QPainterPathStroker but can't quite come up with the algorithm. Maybe I'm too tired or maybe it is because of Friday. :D
any general suggestions?
JW
I am looking for a way to obtain the outline, shape(), of several QGraphicsItems that may or may not be overlapping. They are all children of a single QGraphicsItem for which I currently am drawing the boundingRect(). I computed this rectangle from the union of all of the boundingRect() of the child items; so I figured, instead of this large square I can somehow get the shape of all of the child items combined.
If the group of items looks like attached pic (someItemSet.png),
then I want my shape to look like this attached pic (someSetShape.png).
For simplicity, assume squares of the same size that do not change. It does not have to be so perfect or curvy, that is just how I drew it in Gimp; but, it could form any shape based on the data for the items.
I know about QPainterPath and QPainterPathStroker but can't quite come up with the algorithm. Maybe I'm too tired or maybe it is because of Friday. :D
any general suggestions?
JW