summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qstatictext.cpp
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2010-02-22 09:19:12 (GMT)
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2010-02-22 09:19:12 (GMT)
commitdab883be81f6037361e5c870d957686961515f4e (patch)
tree1aa67b8652108c74467da9e4bea411c15d85745c /src/gui/text/qstatictext.cpp
parentf25f7a2a19ba4c21b7a5d9fee02a9ae71c9f60ef (diff)
parent9462e7966b5b7db20249c9cb077f425c631afebf (diff)
downloadQt-dab883be81f6037361e5c870d957686961515f4e.zip
Qt-dab883be81f6037361e5c870d957686961515f4e.tar.gz
Qt-dab883be81f6037361e5c870d957686961515f4e.tar.bz2
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/oslo-staging-2
Diffstat (limited to 'src/gui/text/qstatictext.cpp')
-rw-r--r--src/gui/text/qstatictext.cpp21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/gui/text/qstatictext.cpp b/src/gui/text/qstatictext.cpp
index 9313e65..952d998 100644
--- a/src/gui/text/qstatictext.cpp
+++ b/src/gui/text/qstatictext.cpp
@@ -384,11 +384,11 @@ namespace {
DrawTextItemRecorder(int expectedItemCount, QStaticTextItem *items,
int expectedGlyphCount, QFixedPoint *positionPool, glyph_t *glyphPool)
: m_items(items),
+ m_itemCount(0), m_glyphCount(0),
m_expectedItemCount(expectedItemCount),
m_expectedGlyphCount(expectedGlyphCount),
- m_itemCount(0), m_glyphCount(0),
- m_positionPool(positionPool),
- m_glyphPool(glyphPool)
+ m_glyphPool(glyphPool),
+ m_positionPool(positionPool)
{
}
@@ -530,7 +530,7 @@ namespace {
};
}
-void QStaticTextPrivate::paintText(QPainter *p)
+void QStaticTextPrivate::paintText(const QPointF &pos, QPainter *p)
{
bool preferRichText = textFormat == Qt::RichText
|| (textFormat == Qt::AutoText && Qt::mightBeRichText(text));
@@ -538,13 +538,13 @@ void QStaticTextPrivate::paintText(QPainter *p)
if (!preferRichText) {
if (maximumSize.isValid()) {
QRectF boundingRect;
- p->drawText(QRectF(QPointF(0, 0), maximumSize), Qt::TextWordWrap, text, &boundingRect);
+ p->drawText(QRectF(pos, maximumSize), Qt::TextWordWrap, text, &boundingRect);
actualSize = boundingRect.size();
needsClipRect = boundingRect.width() > maximumSize.width()
|| boundingRect.height() > maximumSize.height();
} else {
- p->drawText(0, 0, text);
+ p->drawText(pos, text);
needsClipRect = false;
QFontMetrics fm(font);
@@ -555,9 +555,12 @@ void QStaticTextPrivate::paintText(QPainter *p)
document.setDefaultFont(font);
document.setHtml(text);
- QRectF rect = maximumSize.isValid() ? QRectF(QPointF(0, 0), maximumSize) : QRectF();
+ QRectF rect = maximumSize.isValid() ? QRectF(pos, maximumSize) : QRectF();
document.adjustSize();
+ p->save();
+ p->translate(pos);
document.drawContents(p, rect);
+ p->restore();
actualSize = document.size();
needsClipRect = maximumSize.isValid()
&& (actualSize.width() > maximumSize.width()
@@ -581,7 +584,7 @@ void QStaticTextPrivate::init()
painter.setFont(font);
painter.setTransform(matrix);
- paintText(&painter);
+ paintText(QPointF(0, 0), &painter);
}
@@ -605,7 +608,7 @@ void QStaticTextPrivate::init()
painter.setFont(font);
painter.setTransform(matrix);
- paintText(&painter);
+ paintText(QPointF(0, 0), &painter);
}
}