aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4object.cpp
diff options
context:
space:
mode:
authorAnton Kudryavtsev <anton.kudryavtsev@vk.team>2023-09-13 15:46:18 +0300
committerAnton Kudryavtsev <anton.kudryavtsev@vk.team>2023-09-15 13:04:18 +0300
commitdf66aa688c471980ab664401ecf387ada9b61e3d (patch)
tree964f14c0bba227ca20d90a2ac8cc1b726d049727 /src/qml/jsruntime/qv4object.cpp
parentcc2de22ec2f90bc47f97ab4f9190c37942f6302c (diff)
qml: replace fromLatin with _L1
to improve readability and reduce allocations Change-Id: I1ffe10d6a14fb9cc09dd438cca84f4a1d74b8cb8 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4object.cpp')
-rw-r--r--src/qml/jsruntime/qv4object.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/qml/jsruntime/qv4object.cpp b/src/qml/jsruntime/qv4object.cpp
index 19058195bc..f96b8f724b 100644
--- a/src/qml/jsruntime/qv4object.cpp
+++ b/src/qml/jsruntime/qv4object.cpp
@@ -20,6 +20,7 @@
#include <stdint.h>
using namespace QV4;
+using namespace Qt::Literals::StringLiterals;
Q_LOGGING_CATEGORY(lcJavaScriptGlobals, "qt.qml.js.globals")
@@ -179,16 +180,16 @@ void Object::defineAccessorProperty(StringOrSymbol *name, VTable::Call getter, V
QV4::Scope scope(v4);
ScopedProperty p(scope);
QString n = name->toQString();
- if (!n.isEmpty() && n.at(0) == QLatin1Char('@'))
- n = QChar::fromLatin1('[') + QStringView{n}.mid(1) + QChar::fromLatin1(']');
+ if (!n.isEmpty() && n.at(0) == '@'_L1)
+ n = '['_L1 + QStringView{n}.mid(1) + ']'_L1;
if (getter) {
- ScopedString getName(scope, v4->newString(QString::fromLatin1("get ") + n));
+ ScopedString getName(scope, v4->newString("get "_L1 + n));
p->setGetter(ScopedFunctionObject(scope, FunctionObject::createBuiltinFunction(v4, getName, getter, 0)));
} else {
p->setGetter(nullptr);
}
if (setter) {
- ScopedString setName(scope, v4->newString(QString::fromLatin1("set ") + n));
+ ScopedString setName(scope, v4->newString("set "_L1 + n));
p->setSetter(ScopedFunctionObject(scope, FunctionObject::createBuiltinFunction(v4, setName, setter, 0)));
} else {
p->setSetter(nullptr);