diff options
author | Matthew Vogt <matthew.vogt@nokia.com> | 2012-08-28 15:00:42 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-08-28 08:25:31 +0200 |
commit | 5162fa11a5cb9dc80cf9c373d342f9cffee8d2c1 (patch) | |
tree | 1ea6b4dba48ed8f4857aef6499afb3f3f2e6b9db | |
parent | 0cae9f87c8ed351f605ccb31e3dda3143028a484 (diff) |
-rw-r--r-- | src/qml/qml/qqmlpropertycache.cpp | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/src/qml/qml/qqmlpropertycache.cpp b/src/qml/qml/qqmlpropertycache.cpp index 528e3afdcd..a4dbada008 100644 --- a/src/qml/qml/qqmlpropertycache.cpp +++ b/src/qml/qml/qqmlpropertycache.cpp @@ -935,8 +935,14 @@ QQmlPropertyData *QQmlPropertyCache::findProperty(StringCache::ConstIterator it, StringCache::ConstIterator end = stringCache.end(); if (it != end) { + QQmlPropertyData *result = it.value().second; + + // If there exists a typed property (not a function or signal handler), of the + // right name available to the specified context, we need to return that + // property rather than any subsequent override + if (vmemo && context && !contextHasNoExtensions(context)) { - // Find the highest property offset known to the supplied context + // Find the meta-object that corresponds to the supplied context do { if (vmemo->ctxt == context) break; @@ -945,14 +951,28 @@ QQmlPropertyData *QQmlPropertyCache::findProperty(StringCache::ConstIterator it, } while (vmemo); } - do { - // Is this property available to this context? - const StringCache::mapped_type &property(it.value()); - if (!vmemo || (property.first < maximumIndexForProperty(property.second, vmemo))) - return ensureResolved(property.second); + if (vmemo) { + // Ensure that the property we resolve to is accessible from this meta-object + do { + const StringCache::mapped_type &property(it.value()); + + if (property.first < maximumIndexForProperty(property.second, vmemo)) { + // This property is available in the specified context + if (property.second->isFunction() || property.second->isSignalHandler()) { + // Prefer the earlier resolution + } else { + // Prefer the typed property to any previous property found + result = property.second; + } + break; + } + + // See if there is a better candidate + it = stringCache.findNext(it); + } while (it != end); + } - it = stringCache.findNext(it); - } while (it != end); + return ensureResolved(result); } return 0; |