diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2010-02-24 00:03:48 (GMT) |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2010-02-24 00:03:48 (GMT) |
commit | 1ec06a42b2b18b850b5ede133d1c23a00e6dbe21 (patch) | |
tree | e7ad90c3c2beed5437acf820a5bc72b8325042d9 /src/declarative | |
parent | 5ca4a7da103002e5ca0d9924d5a65a45f7309d29 (diff) | |
parent | e26db74521e063a1513731eb14581d93a3d77481 (diff) | |
download | Qt-1ec06a42b2b18b850b5ede133d1c23a00e6dbe21.zip Qt-1ec06a42b2b18b850b5ede133d1c23a00e6dbe21.tar.gz Qt-1ec06a42b2b18b850b5ede133d1c23a00e6dbe21.tar.bz2 |
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-qml
Diffstat (limited to 'src/declarative')
-rw-r--r-- | src/declarative/util/qmlstyledtext.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/declarative/util/qmlstyledtext.cpp b/src/declarative/util/qmlstyledtext.cpp index 1f31214..6d01e3c 100644 --- a/src/declarative/util/qmlstyledtext.cpp +++ b/src/declarative/util/qmlstyledtext.cpp @@ -111,6 +111,8 @@ QmlStyledText::~QmlStyledText() void QmlStyledText::parse(const QString &string, QTextLayout &layout) { + if (string.isEmpty()) + return; QmlStyledText styledText(string, layout); styledText.d->parse(); } @@ -142,8 +144,10 @@ void QmlStyledTextPrivate::parse() ++ch; if (*ch == slash) { ++ch; - if (parseCloseTag(ch, text)) - formatStack.pop(); + if (parseCloseTag(ch, text)) { + if (formatStack.count()) + formatStack.pop(); + } } else { QTextCharFormat format; if (formatStack.count()) @@ -164,7 +168,8 @@ void QmlStyledTextPrivate::parse() } else { ++textLength; } - ++ch; + if (!ch->isNull()) + ++ch; } if (textLength) drawText.append(QStringRef(&text, textStart, textLength)); @@ -191,20 +196,15 @@ bool QmlStyledTextPrivate::parseTag(const QChar *&ch, const QString &textIn, QSt QStringRef tag(&textIn, tagStart, tagLength); const QChar char0 = tag.at(0); if (char0 == QLatin1Char('b')) { - if (tagLength == 1) { + if (tagLength == 1) format.setFontWeight(QFont::Bold); - return true; - } else if (tagLength == 2 && tag.at(1) == QLatin1Char('r')) { + else if (tagLength == 2 && tag.at(1) == QLatin1Char('r')) textOut.append(QChar(QChar::LineSeparator)); - return true; - } } else if (char0 == QLatin1Char('i')) { - if (tagLength == 1) { + if (tagLength == 1) format.setFontItalic(true); - return true; - } } - return false; + return true; } else if (ch->isSpace()) { // may have params. QStringRef tag(&textIn, tagStart, tagLength); |