diff options
Diffstat (limited to 'src/gui/text/qtextdocumentfragment.cpp')
-rw-r--r-- | src/gui/text/qtextdocumentfragment.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/gui/text/qtextdocumentfragment.cpp b/src/gui/text/qtextdocumentfragment.cpp index 1b6e76c2017..5797d1a68b4 100644 --- a/src/gui/text/qtextdocumentfragment.cpp +++ b/src/gui/text/qtextdocumentfragment.cpp @@ -16,6 +16,7 @@ #include <qbytearray.h> #include <qdatastream.h> #include <qdatetime.h> +#include <QtCore/private/qstringiterator_p.h> QT_BEGIN_NAMESPACE @@ -582,8 +583,11 @@ bool QTextHtmlImporter::appendNodeText() QString textToInsert; textToInsert.reserve(text.size()); - for (QChar ch : text) { - if (ch.isSpace() + QStringIterator it(text); + while (it.hasNext()) { + char32_t ch = it.next(); + + if (QChar::isSpace(ch) && ch != QChar::Nbsp && ch != QChar::ParagraphSeparator) { @@ -646,12 +650,12 @@ bool QTextHtmlImporter::appendNodeText() format.setAnchor(true); format.setAnchorNames(namedAnchors); - cursor.insertText(ch, format); + cursor.insertText(QString::fromUcs4(&ch, 1), format); namedAnchors.clear(); format.clearProperty(QTextFormat::IsAnchor); format.clearProperty(QTextFormat::AnchorName); } else { - textToInsert += ch; + textToInsert += QChar::fromUcs4(ch); } } } |