diff options
-rw-r--r-- | src/declarative/graphicsitems/qmlgraphicstext.cpp | 13 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qmlgraphicstext_p_p.h | 2 |
2 files changed, 12 insertions, 3 deletions
diff --git a/src/declarative/graphicsitems/qmlgraphicstext.cpp b/src/declarative/graphicsitems/qmlgraphicstext.cpp index ab2f9a3..409fa3a 100644 --- a/src/declarative/graphicsitems/qmlgraphicstext.cpp +++ b/src/declarative/graphicsitems/qmlgraphicstext.cpp @@ -554,6 +554,7 @@ void QmlGraphicsTextPrivate::updateSize() else doc->setTextWidth(doc->idealWidth()); // ### Text does not align if width is not set (QTextDoc bug) dy -= (int)doc->size().height(); + cachedLayoutSize = doc->size().toSize(); } int yoff = 0; @@ -769,7 +770,7 @@ void QmlGraphicsText::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidg { Q_D(QmlGraphicsText); - if (d->cache || d->richText || d->style != Normal) { + if (d->cache || d->style != Normal) { d->checkImgCache(); if (d->imgCache.isNull()) return; @@ -846,7 +847,15 @@ void QmlGraphicsText::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidg p->save(); p->setClipRect(boundingRect(), Qt::IntersectClip); } - d->drawWrappedText(p, QPointF(0,y), false); + if (d->richText) { + QAbstractTextDocumentLayout::PaintContext context; + context.palette.setColor(QPalette::Text, d->color); + p->translate(0, y); + d->doc->documentLayout()->draw(p, context); + p->translate(0, -y); + } else { + d->drawWrappedText(p, QPointF(0,y), false); + } if (needClip) p->restore(); } diff --git a/src/declarative/graphicsitems/qmlgraphicstext_p_p.h b/src/declarative/graphicsitems/qmlgraphicstext_p_p.h index 46d2d0e..f67d57c 100644 --- a/src/declarative/graphicsitems/qmlgraphicstext_p_p.h +++ b/src/declarative/graphicsitems/qmlgraphicstext_p_p.h @@ -75,7 +75,7 @@ public: dirty(true), wrap(false), richText(false), singleline(false), cache(true), doc(0), format(QmlGraphicsText::AutoText) { -#ifdef QML_NO_TEXT_CACHE +#if defined(QML_NO_TEXT_CACHE) cache = false; #endif } |