aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKai Uwe Broulik <kde@privat.broulik.de>2015-05-27 10:52:59 +0200
committerKai Uwe Broulik <kde@privat.broulik.de>2015-07-03 14:47:14 +0000
commit8b205fd05dcdc4a0e7ec6b25429f691a0a9099fe (patch)
treef3f5f3526fa03e0f475535215ebb7502a44c3fb2 /src
parenta3f686cf7cc14ff481b972b1170a7ff76d0e0fd0 (diff)
Improve support for HTML entities in StyledText
This adds support for the non-breaking space character (&nbsp;) and properly handling entities that do not end with a semicolon, such as a stray ampersand in a text. Change-Id: I2f157c9aa651b27511809d5a47ac07660949a290 Task-number: QTBUG-44869 Task-number: QTBUG-31816 Task-number: QTBUG-33368 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r--src/quick/util/qquickstyledtext.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/quick/util/qquickstyledtext.cpp b/src/quick/util/qquickstyledtext.cpp
index 5efe65ef44..6ed32c10e2 100644
--- a/src/quick/util/qquickstyledtext.cpp
+++ b/src/quick/util/qquickstyledtext.cpp
@@ -542,6 +542,12 @@ void QQuickStyledTextPrivate::parseEntity(const QChar *&ch, const QString &textI
textOut += QChar(38);
else if (entity == QLatin1String("quot"))
textOut += QChar(34);
+ else if (entity == QLatin1String("nbsp"))
+ textOut += QChar(QChar::Nbsp);
+ return;
+ } else if (*ch == QLatin1Char(' ')) {
+ QStringRef entity(&textIn, entityStart - 1, entityLength + 1);
+ textOut += entity + *ch;
return;
}
++entityLength;