aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlbinding.cpp
diff options
context:
space:
mode:
authorAnton Kudryavtsev <a.kudryavtsev@netris.ru>2016-07-20 14:23:59 +0300
committerAnton Kudryavtsev <a.kudryavtsev@netris.ru>2016-08-09 18:00:36 +0000
commitb11421394b4745253a046461234906feb9c811dc (patch)
tree6c7770fd9c161e44eb3de44de96e6d797f04e2ea /src/qml/qml/qqmlbinding.cpp
parent4fbfbf7fe8e6f8f31b5704a0f8f55415a7284523 (diff)
Qml: optimize string usage
Use QStringBuilder more. Use QString::asprintf instead of arg()'s chain. Use += operator to reserve extra capacity for possible free following append/prepend/+= call. Change-Id: Ib65398b91566994339d2c4bbfaf94e49806b7471 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlbinding.cpp')
-rw-r--r--src/qml/qml/qqmlbinding.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/qml/qml/qqmlbinding.cpp b/src/qml/qml/qqmlbinding.cpp
index 72c7347a68..3b3e23c891 100644
--- a/src/qml/qml/qqmlbinding.cpp
+++ b/src/qml/qml/qqmlbinding.cpp
@@ -378,12 +378,11 @@ Q_NEVER_INLINE bool QQmlBinding::slowWrite(const QQmlPropertyData &core,
QJSValue(QV8Engine::getV4(v8engine), result.asReturnedValue())),
context(), flags);
} else if (isUndefined) {
- QString errorStr = QLatin1String("Unable to assign [undefined] to ");
- if (!QMetaType::typeName(type))
- errorStr += QLatin1String("[unknown property type]");
- else
- errorStr += QLatin1String(QMetaType::typeName(type));
- delayedError()->setErrorDescription(errorStr);
+ const QLatin1String typeName(QMetaType::typeName(type)
+ ? QMetaType::typeName(type)
+ : "[unknown property type]");
+ delayedError()->setErrorDescription(QLatin1String("Unable to assign [undefined] to ")
+ + typeName);
return false;
} else if (const QV4::FunctionObject *f = result.as<QV4::FunctionObject>()) {
if (f->isBinding())
@@ -458,8 +457,7 @@ QString QQmlBinding::expressionIdentifier()
QString url = function->sourceFile();
quint16 lineNumber = function->compiledFunction->location.line;
quint16 columnNumber = function->compiledFunction->location.column;
-
- return url + QLatin1Char(':') + QString::number(lineNumber) + QLatin1Char(':') + QString::number(columnNumber);
+ return url + QString::asprintf(":%u:%u", uint(lineNumber), uint(columnNumber));
}
void QQmlBinding::expressionChanged()