summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gui/text/qstatictext.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/gui/text/qstatictext.cpp b/src/gui/text/qstatictext.cpp
index 1fabf12..d685cd9 100644
--- a/src/gui/text/qstatictext.cpp
+++ b/src/gui/text/qstatictext.cpp
@@ -553,12 +553,14 @@ void QStaticTextPrivate::paintText(const QPointF &pos, QPainter *p)
} else {
QTextDocument document;
document.setDefaultFont(font);
+ document.setDocumentMargin(0.0);
document.setHtml(text);
- QRectF rect = maximumSize.isValid() ? QRectF(pos, maximumSize) : QRectF();
+ QPointF adjustedPos = pos - QPointF(0, QFontMetricsF(font).ascent());
+ QRectF rect = maximumSize.isValid() ? QRectF(adjustedPos, maximumSize) : QRectF();
document.adjustSize();
p->save();
- p->translate(pos);
+ p->translate(adjustedPos);
document.drawContents(p, rect);
p->restore();
actualSize = document.size();