aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2011-12-13 12:37:10 +1000
committerQt by Nokia <qt-info@nokia.com>2011-12-14 04:47:06 +0100
commit7a6befdf2572f09fbffc81122c0f0f1b30265af4 (patch)
tree37aed04b2dec514e5803f9ce84a334d2a81849e3
parent2a3990fc4125eeb0c73eaae05450789717dfd045 (diff)
Support <strong> in styled text.
Task-number: QTBUG-23105 Change-Id: I15968c43fd0797b94584f110c6aeca06eca832b7 Reviewed-by: Yann Bodson <yann.bodson@nokia.com>
-rw-r--r--src/quick/util/qdeclarativestyledtext.cpp5
-rw-r--r--tests/auto/qtquick2/qdeclarativestyledtext/tst_qdeclarativestyledtext.cpp1
2 files changed, 6 insertions, 0 deletions
diff --git a/src/quick/util/qdeclarativestyledtext.cpp b/src/quick/util/qdeclarativestyledtext.cpp
index 1c7ca5fbfd..2f79fad9a2 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 b09c33302e..2c5c66f280 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") << "<b>bold</b>" << "bold";
QTest::newRow("italic") << "<b>italic</b>" << "italic";
+ QTest::newRow("strong") << "<strong>strong</strong>" << "strong";
QTest::newRow("missing >") << "<b>text</b" << "text";
QTest::newRow("missing b>") << "<b>text</" << "text";
QTest::newRow("missing /b>") << "<b>text<" << "text";