summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiang Jiang <jiang.jiang@nokia.com>2010-09-22 08:11:41 (GMT)
committerJiang Jiang <jiang.jiang@nokia.com>2010-09-22 08:58:15 (GMT)
commit22ee6863458885c900e8294a44bd782acbdd8201 (patch)
tree4260c69ce7d49feb99fa7997c4922b53431ef1d9
parent6da6b7099d4e0b49329793e4b90703ec3d868048 (diff)
downloadQt-22ee6863458885c900e8294a44bd782acbdd8201.zip
Qt-22ee6863458885c900e8294a44bd782acbdd8201.tar.gz
Qt-22ee6863458885c900e8294a44bd782acbdd8201.tar.bz2
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
-rw-r--r--src/gui/text/qtextlayout.cpp8
1 files 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);