diff options
Diffstat (limited to 'src/gui/text/qtexthtmlparser.cpp')
-rw-r--r-- | src/gui/text/qtexthtmlparser.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/gui/text/qtexthtmlparser.cpp b/src/gui/text/qtexthtmlparser.cpp index 5169c0325a..929db40e5d 100644 --- a/src/gui/text/qtexthtmlparser.cpp +++ b/src/gui/text/qtexthtmlparser.cpp @@ -861,7 +861,8 @@ QString QTextHtmlParser::parseWord() ++pos; while (pos < len) { QChar c = txt.at(pos++); - if (c == QLatin1Char('\'')) + // Allow for escaped single quotes as they may be part of the string + if (c == QLatin1Char('\'') && (txt.length() > 1 && txt.at(pos - 2) != QLatin1Char('\\'))) break; else word += c; @@ -1504,7 +1505,16 @@ void QTextHtmlParser::applyAttributes(const QStringList &attributes) n -= 3; node->charFormat.setProperty(QTextFormat::FontSizeAdjustment, n); } else if (key == QLatin1String("face")) { - node->charFormat.setFontFamily(value); + if (value.contains(QLatin1Char(','))) { + const QStringList values = value.split(QLatin1Char(',')); + QStringList families; + for (const QString &family : values) + families << family.trimmed(); + node->charFormat.setFontFamilies(families); + node->charFormat.setFontFamily(families.at(0)); + } else { + node->charFormat.setFontFamily(value); + } } else if (key == QLatin1String("color")) { QColor c; c.setNamedColor(value); if (!c.isValid()) @@ -1543,7 +1553,7 @@ void QTextHtmlParser::applyAttributes(const QStringList &attributes) if (key == QLatin1String("href")) node->charFormat.setAnchorHref(value); else if (key == QLatin1String("name")) - node->charFormat.setAnchorName(value); + node->charFormat.setAnchorNames({value}); break; case Html_img: if (key == QLatin1String("src") || key == QLatin1String("source")) { @@ -1683,7 +1693,7 @@ void QTextHtmlParser::applyAttributes(const QStringList &attributes) node->charFormat.setToolTip(value); } else if (key == QLatin1String("id")) { node->charFormat.setAnchor(true); - node->charFormat.setAnchorName(value); + node->charFormat.setAnchorNames({value}); } } |