QQmlPropertyCache: adapt qQmlPropertyCacheCreate

... to make good use of QL1S

Change-Id: I7c3ac1cefb30bee9baa31a3f8ec08f5f57eb5d5b
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
This commit is contained in:
Anton Kudryavtsev 2016-11-20 19:53:42 +03:00 committed by Anton Kudryavtsev
parent fbfc433dae
commit 13cf5f02ce
1 changed files with 8 additions and 9 deletions

View File

@ -978,7 +978,8 @@ int QQmlPropertyCache::originalClone(QObject *object, int index)
return index;
}
static QQmlPropertyData qQmlPropertyCacheCreate(const QMetaObject *metaObject, const QStringRef &property)
template<typename T>
static QQmlPropertyData qQmlPropertyCacheCreate(const QMetaObject *metaObject, const T& propertyName)
{
Q_ASSERT(metaObject);
@ -995,8 +996,6 @@ static QQmlPropertyData qQmlPropertyCacheCreate(const QMetaObject *metaObject, c
// These indices don't apply to gadgets, so don't block them.
const bool preventDestruction = metaObject->superClass() || metaObject == &QObject::staticMetaObject;
const QByteArray propertyName = property.toUtf8();
int methodCount = metaObject->methodCount();
for (int ii = methodCount - 1; ii >= 0; --ii) {
if (preventDestruction && (ii == destroyedIdx1 || ii == destroyedIdx2 || ii == deleteLaterIdx))
@ -1038,19 +1037,19 @@ static QQmlPropertyData qQmlPropertyCacheCreate(const QMetaObject *metaObject, c
return rv;
}
static inline QQmlPropertyData qQmlPropertyCacheCreate(const QMetaObject *metaObject, const QString &property)
static inline const char *qQmlPropertyCacheToString(QLatin1String string)
{
return qQmlPropertyCacheCreate(metaObject, QStringRef(&property));
return string.data();
}
static inline const QStringRef &qQmlPropertyCacheToString(const QStringRef &string)
static inline QByteArray qQmlPropertyCacheToString(const QStringRef &string)
{
return string;
return string.toUtf8();
}
static inline QString qQmlPropertyCacheToString(const QV4::String *string)
static inline QByteArray qQmlPropertyCacheToString(const QV4::String *string)
{
return string->toQString();
return string->toQString().toUtf8();
}
template<typename T>