[Solved] Making a QRect that surrounds other QRects
-
Is there a quick way to create a
QRect
that surrounds other, specified,QRect
items?Context: I have to implement the
boundingRect()
method in aQGraphicsItem
class. The class contains two things: AQPainterPath
for a symbol and aQRect
for text that goes next to the symbol. In theboundingRect()
method I need to return aQRect
that surrounds the two.Do I need to calculate the position and the size of the rectangle manually or is there some easy magic way of doing this?
-
@Joel-Bodenmann said:
QRectF QRectF::united ( const QRectF & rectangle ) const
-
@Joel-Bodenmann said:
Just do not be confused. You need QRectF not QRect
virtual QRectF boundingRect () const = 0 -
That's exactly what I have been looking for! I definitely searched for the wrong terms.
Thank you for your help. Very appreciated.