From 22ee6863458885c900e8294a44bd782acbdd8201 Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Wed, 22 Sep 2010 10:11:41 +0200 Subject: Keep other text format with QTextOption::SuppressColors tag on Setting the QTextOption::SuppressColors tag on a QTextDocument breaks all text format, not just colors. This patch fix this by selectively ignoring color properties in the format and keeping other properties. Task-number: QTBUG-13090 Reviewed-by: Eskil --- src/gui/text/qtextlayout.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index f432b7e..a7f619e 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -2219,8 +2219,12 @@ void QTextLine::draw(QPainter *p, const QPointF &pos, const QTextLayout::FormatR QTextCharFormat format; if (eng->hasFormats() || selection) { - if (!suppressColors) - format = eng->format(&si); + format = eng->format(&si); + if (suppressColors) { + format.clearForeground(); + format.clearBackground(); + format.clearProperty(QTextFormat::TextUnderlineColor); + } if (selection) format.merge(selection->format); -- cgit v0.12