22 QPointF pos(position->pixelPoint());
23 QTransform transform = painter->transform();
24 transform.translate(pos.x(), pos.y());
25 if (!qFuzzyIsNull(mRotation)) transform.rotate(mRotation);
27 QRect textRect = painter->fontMetrics().boundingRect(
28 0, 0, 0, 0, Qt::TextDontClip | mTextAlignment, mText);
29 QRect textBoxRect = textRect.adjusted(-mPadding.left(), -mPadding.top(),
30 mPadding.right(), mPadding.bottom());
32 QPointF(0, 0), textBoxRect,
34 textRect.moveTopLeft(textPos.toPoint() +
35 QPoint(mPadding.left(), mPadding.top()));
36 textBoxRect.moveTopLeft(textPos.toPoint());
37 qreal clipPadF =
mainPen().widthF();
38 int clipPad = (int)clipPadF;
40 textBoxRect.adjusted(-clipPad, -clipPad, clipPad, clipPad);
41 if (transform.mapRect(boundingRect)
42 .intersects(painter->transform().mapRect(clipRect()))) {
43 painter->setTransform(transform);
44 if ((
mainBrush().style() != Qt::NoBrush &&
46 (
mainPen().style() != Qt::NoPen &&
mainPen().color().alpha() != 0)) {
49 painter->drawRect(textBoxRect);
51 painter->setBrush(Qt::NoBrush);
54 doc.drawContents(painter);