[Solved] Making a QRect that surrounds other QRects
-
wrote on 11 Sept 2015, 21:14 last edited by Joel Bodenmann 9 Dec 2015, 10:02
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?
-
wrote on 11 Sept 2015, 21:29 last edited by
@Joel-Bodenmann said:
QRectF QRectF::united ( const QRectF & rectangle ) const
-
wrote on 11 Sept 2015, 21:48 last edited by
@Joel-Bodenmann said:
Just do not be confused. You need QRectF not QRect
virtual QRectF boundingRect () const = 0 -
wrote on 12 Sept 2015, 01:14 last edited by
That's exactly what I have been looking for! I definitely searched for the wrong terms.
Thank you for your help. Very appreciated.
4/4