From 37b0988dcebb6a44a2e50194e78540bf4dd71bc0 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 3f83aee..fad6c3b2 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -2438,8 +2438,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 From ffd6720bacb5f1a9146384debf0cb82377650c43 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 22 Sep 2010 12:39:58 +0200 Subject: Fix C++0x initializer lists tests. It was using the wrong macro Reviewed-by: Thierry --- src/corelib/tools/qvector.h | 2 +- tests/auto/qlist/tst_qlist.cpp | 2 +- tests/auto/qvector/tst_qvector.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h index 7eee33d..c16aefb 100644 --- a/src/corelib/tools/qvector.h +++ b/src/corelib/tools/qvector.h @@ -439,7 +439,7 @@ QVector::QVector(int asize, const T &t) template QVector::QVector(std::initializer_list args) { - p = malloc(args.size()); + d = malloc(args.size()); d->ref = 1; d->alloc = d->size = args.size(); d->sharable = true; diff --git a/tests/auto/qlist/tst_qlist.cpp b/tests/auto/qlist/tst_qlist.cpp index 9f6b4a5..14b8057 100644 --- a/tests/auto/qlist/tst_qlist.cpp +++ b/tests/auto/qlist/tst_qlist.cpp @@ -666,7 +666,7 @@ void tst_QList::testSTLIterators() const void tst_QList::initializeList() const { -#ifdef QT_CXX0X_INITIALIZERLIST +#ifdef Q_COMPILER_INITIALIZER_LISTS QList v1{2,3,4}; QCOMPARE(v1, QList() << 2 << 3 << 4); QCOMPARE(v1, (QList{2,3,4})); diff --git a/tests/auto/qvector/tst_qvector.cpp b/tests/auto/qvector/tst_qvector.cpp index d8dfacf..a04ce60 100644 --- a/tests/auto/qvector/tst_qvector.cpp +++ b/tests/auto/qvector/tst_qvector.cpp @@ -837,7 +837,7 @@ void tst_QVector::QTBUG6416_reserve() void tst_QVector::initializeList() { -#ifdef QT_CXX0X_INITIALIZERLIST +#ifdef Q_COMPILER_INITIALIZER_LISTS QVector v1{2,3,4}; QCOMPARE(v1, QVector() << 2 << 3 << 4); QCOMPARE(v1, (QVector{2,3,4})); -- cgit v0.12