summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gui/text/qtextdocument.cpp19
-rw-r--r--src/gui/text/qtextdocument.h1
2 files changed, 20 insertions, 0 deletions
diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp
index 07aec6f019..61bab2dbfd 100644
--- a/src/gui/text/qtextdocument.cpp
+++ b/src/gui/text/qtextdocument.cpp
@@ -1145,9 +1145,28 @@ void QTextDocument::setMetaInformation(MetaInformation info, const QString &stri
}
/*!
+ Returns the raw text contained in the document without any
+ formatting information. If you want formatting information
+ use a QTextCursor instead.
+
+ \since 5.9
+ \sa toPlainText()
+*/
+QString QTextDocument::toRawText() const
+{
+ Q_D(const QTextDocument);
+ return d->plainText();
+}
+
+/*!
Returns the plain text contained in the document. If you want
formatting information use a QTextCursor instead.
+ This function returns the same as toRawText(), but will replace
+ some unicode characters, such as line separators and non-breaking
+ spaces, with ASCII alternatives. If you need the precise contents
+ of the document, use toRawText() instead.
+
\note Embedded objects, such as images, are represented by a
Unicode value U+FFFC (OBJECT REPLACEMENT CHARACTER).
diff --git a/src/gui/text/qtextdocument.h b/src/gui/text/qtextdocument.h
index 1888088f0d..c2761a39b9 100644
--- a/src/gui/text/qtextdocument.h
+++ b/src/gui/text/qtextdocument.h
@@ -151,6 +151,7 @@ public:
void setHtml(const QString &html);
#endif
+ QString toRawText() const;
QString toPlainText() const;
void setPlainText(const QString &text);