diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-10-02 14:08:03 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-10-05 02:40:51 (GMT) |
commit | b2c1ddf00ba2c3395dbfca417540153ea173a870 (patch) | |
tree | 41e2e226ff3e766a42a4cb2ec82a0ac20fe53f98 /src/declarative/qml/qmlpropertycache.cpp | |
parent | 43d3c9127e36b8f3134a173736d63140b381899f (diff) | |
download | Qt-b2c1ddf00ba2c3395dbfca417540153ea173a870.zip Qt-b2c1ddf00ba2c3395dbfca417540153ea173a870.tar.gz Qt-b2c1ddf00ba2c3395dbfca417540153ea173a870.tar.bz2 |
Use QMetaObject::indexOfProperty()
This is both more efficient, and allows the creation of dynamic
properties.
Diffstat (limited to 'src/declarative/qml/qmlpropertycache.cpp')
-rw-r--r-- | src/declarative/qml/qmlpropertycache.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/declarative/qml/qmlpropertycache.cpp b/src/declarative/qml/qmlpropertycache.cpp index 300bbf6..63ce00c 100644 --- a/src/declarative/qml/qmlpropertycache.cpp +++ b/src/declarative/qml/qmlpropertycache.cpp @@ -111,14 +111,10 @@ QmlPropertyCache::Data QmlPropertyCache::create(const QMetaObject *metaObject, QmlPropertyCache::Data rv; - int propCount = metaObject->propertyCount(); - for (int ii = propCount - 1; ii >= 0; --ii) { - QMetaProperty p = metaObject->property(ii); - QString propName = QLatin1String(p.name()); - if (propName == property) { - rv.load(p); - return rv; - } + int idx = metaObject->indexOfProperty(property.toUtf8()); + if (idx != -1) { + rv.load(metaObject->property(idx)); + return rv; } int methodCount = metaObject->methodCount(); |