Revert "QTextDocumentPrivate::plainText: simplify code"
This reverts commit a83a818791.
Reason for revert: It's causing asserts, solution to fix is unclear
Change-Id: I33ef760a9402c096d3d7487e777c3ccdbb626d39
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
bb10
parent
b637607789
commit
96e3d06b6f
|
|
@ -1305,10 +1305,14 @@ void QTextDocumentPrivate::adjustDocumentChangesAndCursors(int from, int addedOr
|
|||
QString QTextDocumentPrivate::plainText() const
|
||||
{
|
||||
QString result;
|
||||
result.reserve(length());
|
||||
const auto view = QStringView(text);
|
||||
for (auto f : *this)
|
||||
result += view.sliced(f->stringPosition, f->size_array[0]);
|
||||
result.resize(length());
|
||||
const QChar *text_unicode = text.unicode();
|
||||
QChar *data = result.data();
|
||||
for (QTextDocumentPrivate::FragmentIterator it = begin(); it != end(); ++it) {
|
||||
const QTextFragmentData *f = *it;
|
||||
::memcpy(data, text_unicode + f->stringPosition, f->size_array[0] * sizeof(QChar));
|
||||
data += f->size_array[0];
|
||||
}
|
||||
// remove trailing block separator
|
||||
result.chop(1);
|
||||
return result;
|
||||
|
|
|
|||
Loading…
Reference in New Issue