Support <strong> in styled text.
authorMartin Jones <martin.jones@nokia.com>
Tue, 13 Dec 2011 02:37:10 +0000 (12:37 +1000)
committerQt by Nokia <qt-info@nokia.com>
Wed, 14 Dec 2011 03:47:06 +0000 (04:47 +0100)
Task-number: QTBUG-23105

Change-Id: I15968c43fd0797b94584f110c6aeca06eca832b7
Reviewed-by: Yann Bodson <yann.bodson@nokia.com>

src/quick/util/qdeclarativestyledtext.cpp
tests/auto/qtquick2/qdeclarativestyledtext/tst_qdeclarativestyledtext.cpp

index 1c7ca5f..2f79fad 100644 (file)
@@ -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();
index b09c333..2c5c66f 100644 (file)
@@ -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";