Hi
I have a QRectF defined for drawing a rect and draw text inside of this visible rect.
painter.fillRect(rect, bgColor);
painter.
drawText(rect, Qt
::AlignRight,
QString("A string"));
painter.fillRect(rect, bgColor);
painter.drawText(rect, Qt::AlignRight, QString("A string"));
To copy to clipboard, switch view to plain text mode
So instead of manually position the text I just reuse the same QRectF as for filling the Rect and align using the Qt::AlignRight. However, I would like to make a small padding (1-2 pixels) from the right-aligned text and the edge of the visible rect.
Obviously I can do this by manually making the rect for drawText a couple of pixels shorter than the fillRect rect. However, before doing this I just want to make sure there aren't any cleaner way of defining padding when using drawText?
Any ideas? Appreciate any answer, even it its just to confirm that I have to do this manually.
Bookmarks