summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorKai Köhne <kai.koehne@qt.io>2022-01-05 08:44:50 +0100
committerKai Köhne <kai.koehne@qt.io>2022-01-06 07:58:44 +0100
commit17eb0f2d8a84eb54e6e4fbfa981ca3bae8c7e919 (patch)
tree9958074c08b8d74099efdbadc58036e2ac826b2a /src/widgets
parent93c1f481abb43c33c53fca703a83a19d208b68df (diff)
Keep original text for text/plain mime data
For historical reasons, QTextDocument[Fragment]::toPlainText replaces nbsp character (U+00A0) with a normal space, and U+2029, and U+2028 characters with a line feed character. This behavior differs from native (plain) text editors. It also creates an asymetry, because the characters in question can be pasted into the document, but not copied out of it. Use the newly introduced QTextDocumentFragment::toRawText() to avoid this conversion. [ChangeLog][QtGui][Drag&Drop] Special characters like &nbsp; are now preserved in the text/plain part of the clipboard when copied from a QTextEdit or QLineEdit. Fixes: QTBUG-99572 Change-Id: If01a5dd98127a59be15a425dc029c7303bce18f1 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/widgets/qwidgettextcontrol.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/widgets/widgets/qwidgettextcontrol.cpp b/src/widgets/widgets/qwidgettextcontrol.cpp
index 8c849ddbae..ef1158b8ce 100644
--- a/src/widgets/widgets/qwidgettextcontrol.cpp
+++ b/src/widgets/widgets/qwidgettextcontrol.cpp
@@ -3498,7 +3498,7 @@ void QTextEditMimeData::setup() const
that->setData(QLatin1String("application/vnd.oasis.opendocument.text"), buffer.data());
}
#endif
- that->setText(fragment.toPlainText());
+ that->setText(fragment.toRawText());
fragment = QTextDocumentFragment();
}