diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2019-08-04 20:19:21 +0300 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2019-08-05 13:30:56 +0300 |
commit | d88c6a1690d1d725e4436537546b3d5681ee4a9f (patch) | |
tree | 98343163298cc13ddd9b40015ceb5275566e5390 /src/remoteobjects/qremoteobjectsource.cpp | |
parent | d71556d50498548a6b765c6c7bb9d997813fc7f3 (diff) |
Annual QStringLiteral sweep
It makes little sense to use QStringLiteral in the following
situations:
- for comparison to a QString, because operator==, startsWith(),
indexOf() etc are overloaded for QLatin1String.
- for strings which are immediately appended to, or which are
appended or prepended to other strings.
because no dynamic memory allocation is saved by doing so. But if
the only advantage of QStringLiteral does not apply, all its
disadvantages dominate, to wit: injection of calls to the QString
dtor, non-sharability of data between C strings and QStringLiterals
and among QStringLiterals, and doubled storage requirements.
Fix by replacing QStringLiteral with QLatin1String, or char16_t
literals, whichever is more fitting.
Also use new QLatin1String::arg() more.
Change-Id: I55d05783889f521001a1cb8dedd276d0a183882f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/remoteobjects/qremoteobjectsource.cpp')
-rw-r--r-- | src/remoteobjects/qremoteobjectsource.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/remoteobjects/qremoteobjectsource.cpp b/src/remoteobjects/qremoteobjectsource.cpp index 310b35f..d497edd 100644 --- a/src/remoteobjects/qremoteobjectsource.cpp +++ b/src/remoteobjects/qremoteobjectsource.cpp @@ -454,7 +454,7 @@ DynamicApiMap::DynamicApiMap(QObject *object, const QMetaObject *metaObject, con if (typeName.isNull()) { typeName = QString::fromLatin1(propertyMeta->className()); // TODO better way to ensure we have consistent typenames between source/replicas? - if (typeName.endsWith(QStringLiteral("Source"))) + if (typeName.endsWith(QLatin1String("Source"))) typeName.chop(6); } |