Getting the bounding rectangle
I have implemented the following code
Code:
QRectF rect
(0,
0, height
(), Margin
);
painter->save();
painter->translate(50,0);
painter->rotate(90);
painter->drawText(rect,Qt::AlignCenter | Qt::AlignTop,str);
strBoundingRect = painter->boundingRect(rect,Qt::AlignCenter,str);
painter->restore();
However, using the above code return in strBoundingRect the initial bounding rectangle of the QString str and not the one that corresponds to the rotated and translated painter.
Can you give me an example on how can I obtain the bounding rectangle taking also into account both translation and rotation?
Thanks in advance...
Re: Getting the bounding rectangle
Rotate and translate the received bounding rect.
Code:
QTransform t;
t.rotate(...);
t.translate(...);
QRect transformed
= t.
mapRect(r
);