summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qtexthtmlparser.cpp
diff options
context:
space:
mode:
authorAnton Kudryavtsev <a.kudryavtsev@netris.ru>2016-07-05 16:25:40 +0300
committerAnton Kudryavtsev <a.kudryavtsev@netris.ru>2016-07-06 18:30:26 +0000
commit5dc739ba9b09326bf113bb7f4ce9aa45fe671c6b (patch)
treee005532014558c0e387cbcc6e800896d615ab8c7 /src/gui/text/qtexthtmlparser.cpp
parent802c31bdbd4cd8d9a94bbd02ad1955d648682be7 (diff)
Replace QString::trimmed() with QStringRef::trimmed()
... where it's possible. Reduce allocations. Change-Id: I023adfd316f94948fe50749f60bf55748dca56e2 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/gui/text/qtexthtmlparser.cpp')
-rw-r--r--src/gui/text/qtexthtmlparser.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/gui/text/qtexthtmlparser.cpp b/src/gui/text/qtexthtmlparser.cpp
index 103a208c26..50df8daa5e 100644
--- a/src/gui/text/qtexthtmlparser.cpp
+++ b/src/gui/text/qtexthtmlparser.cpp
@@ -1418,16 +1418,16 @@ static bool setFloatAttribute(qreal *destination, const QString &value)
return ok;
}
-static void setWidthAttribute(QTextLength *width, QString value)
+static void setWidthAttribute(QTextLength *width, const QString &valueStr)
{
bool ok = false;
- qreal realVal = value.toDouble(&ok);
+ qreal realVal = valueStr.toDouble(&ok);
if (ok) {
*width = QTextLength(QTextLength::FixedLength, realVal);
} else {
- value = value.trimmed();
+ QStringRef value = QStringRef(&valueStr).trimmed();
if (!value.isEmpty() && value.endsWith(QLatin1Char('%'))) {
- value.chop(1);
+ value.truncate(value.size() - 1);
realVal = value.toDouble(&ok);
if (ok)
*width = QTextLength(QTextLength::PercentageLength, realVal);