From 7a6befdf2572f09fbffc81122c0f0f1b30265af4 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Tue, 13 Dec 2011 12:37:10 +1000 Subject: [PATCH] Support in styled text. Task-number: QTBUG-23105 Change-Id: I15968c43fd0797b94584f110c6aeca06eca832b7 Reviewed-by: Yann Bodson --- src/quick/util/qdeclarativestyledtext.cpp | 5 +++++ .../tst_qdeclarativestyledtext.cpp | 1 + 2 files changed, 6 insertions(+), 0 deletions(-) diff --git a/src/quick/util/qdeclarativestyledtext.cpp b/src/quick/util/qdeclarativestyledtext.cpp index 1c7ca5f..2f79fad 100644 --- a/src/quick/util/qdeclarativestyledtext.cpp +++ b/src/quick/util/qdeclarativestyledtext.cpp @@ -253,6 +253,9 @@ bool QDeclarativeStyledTextPrivate::parseTag(const QChar *&ch, const QString &te if (!hasNewLine) textOut.append(QChar::LineSeparator); } + } else if (char0 == QLatin1Char('s')) { + if (tag == QLatin1String("strong")) + format.setFontWeight(QFont::Bold); } else if (char0 == QLatin1Char('u')) { if (tagLength == 1) format.setFontUnderline(true); @@ -384,6 +387,8 @@ bool QDeclarativeStyledTextPrivate::parseCloseTag(const QChar *&ch, const QStrin return true; } else if (tag == QLatin1String("font")) { return true; + } else if (tag == QLatin1String("strong")) { + return true; } else if (tag == QLatin1String("ol")) { if (!listStack.isEmpty()) { listStack.pop(); diff --git a/tests/auto/qtquick2/qdeclarativestyledtext/tst_qdeclarativestyledtext.cpp b/tests/auto/qtquick2/qdeclarativestyledtext/tst_qdeclarativestyledtext.cpp index b09c333..2c5c66f 100644 --- a/tests/auto/qtquick2/qdeclarativestyledtext/tst_qdeclarativestyledtext.cpp +++ b/tests/auto/qtquick2/qdeclarativestyledtext/tst_qdeclarativestyledtext.cpp @@ -65,6 +65,7 @@ void tst_qdeclarativestyledtext::textOutput_data() QTest::newRow("bold") << "bold" << "bold"; QTest::newRow("italic") << "italic" << "italic"; + QTest::newRow("strong") << "strong" << "strong"; QTest::newRow("missing >") << "text") << "text") << "text<" << "text"; -- 1.7.2.5