diff options
author | Anton Kudryavtsev <antkudr@mail.ru> | 2017-04-15 20:52:37 +0300 |
---|---|---|
committer | Anton Kudryavtsev <antkudr@mail.ru> | 2017-04-18 11:43:37 +0000 |
commit | fc8d503321faffa1638a8bfa161d0784e2e1325b (patch) | |
tree | 7c4eee6f1f92d2b059f34edd617abf25a8fba2cd /src | |
parent | 495f8f12ec17ece5708407ef09ece89887ea73bc (diff) |
QQuickText: optimize updateLayout()
QString::replace(QChar, QChar) was fixed in c12f42e91b146109cc9ee5d050928672776ca1ee
So no need to use pre-condition.
Change-Id: I98eadfc89350194832b229afe061dc0bd01f1bc9
Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/quick/items/qquicktext.cpp | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/src/quick/items/qquicktext.cpp b/src/quick/items/qquicktext.cpp index 1720377046..c8bc76aef8 100644 --- a/src/quick/items/qquicktext.cpp +++ b/src/quick/items/qquicktext.cpp @@ -274,15 +274,9 @@ void QQuickTextPrivate::updateLayout() elideLayout->clearFormats(); QString tmp = text; multilengthEos = tmp.indexOf(QLatin1Char('\x9c')); - if (multilengthEos != -1) { + if (multilengthEos != -1) tmp = tmp.mid(0, multilengthEos); - tmp.replace(QLatin1Char('\n'), QChar::LineSeparator); - } else if (tmp.contains(QLatin1Char('\n'))) { - // Replace always does a detach. Checking for the new line character first - // means iterating over those items again if found but prevents a realloc - // otherwise. - tmp.replace(QLatin1Char('\n'), QChar::LineSeparator); - } + tmp.replace(QLatin1Char('\n'), QChar::LineSeparator); layout.setText(tmp); } textHasChanged = false; |