diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativetextlayout.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativetextlayout.cpp b/src/declarative/graphicsitems/qdeclarativetextlayout.cpp index 14a41c05..1eea36eb 100644 --- a/src/declarative/graphicsitems/qdeclarativetextlayout.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextlayout.cpp @@ -237,7 +237,10 @@ class DrawTextItemDevice: public QPaintDevice struct InertTextPainter { InertTextPainter() - : device(true, true), painter(&device) {} + : device(true, true), painter(&device) + { + painter.setPen(QPen(QColor())); // explicitly invalid color. + } DrawTextItemDevice device; QPainter painter; @@ -373,11 +376,19 @@ void QDeclarativeTextLayout::draw(QPainter *painter, const QPointF &p) QPen oldPen = priv->state->pen; QColor currentColor = oldPen.color(); + QColor defaultColor = currentColor; for (int ii = 0; ii < itemCount; ++ii) { QStaticTextItem &item = d->items[ii]; if (item.color.isValid() && currentColor != item.color) { + // up-edge of a <font color="">text</font> tag + // we set the painter pen to the text item's specified color. painter->setPen(item.color); currentColor = item.color; + } else if (!item.color.isValid() && currentColor != defaultColor) { + // down-edge of a <font color="">text</font> tag + // we reset the painter pen back to the default color. + currentColor = defaultColor; + painter->setPen(currentColor); } priv->extended->drawStaticTextItem(&item); |