aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml
diff options
context:
space:
mode:
authorAlberto Mardegan <alberto.mardegan@canonical.com>2013-05-24 10:46:39 +0300
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-05-31 15:09:46 +0200
commit84627464eb11ca1149d46946b12e3c82eb54a8bf (patch)
treed0148982345e8c05a5c08c42cc12f396bcba2b01 /src/qml
parentd818575966e2e2000fe2b7ee390c620f595d9825 (diff)
Fallback to QMetaObject for properties not in QQmlPropertyCache
QQmlOpenMetaObject does not update the QQmlPropertyCache when new properties are added, meaning that the QQmlPropertyCache might not contain all of the dynamic properties of an object. Therefore, make QQmlPropertyCache fallback to reading the QMetaObject when a property is not found. Task-number: QTBUG-31226 Change-Id: I760aaa155b1952f6f52ab9ce173fb9547f8e34a6 Reviewed-by: Alan Alpert <aalpert@blackberry.com>
Diffstat (limited to 'src/qml')
-rw-r--r--src/qml/qml/qqmlpropertycache.cpp11
-rw-r--r--src/qml/qml/v8/qv8qobjectwrapper.cpp2
2 files changed, 10 insertions, 3 deletions
diff --git a/src/qml/qml/qqmlpropertycache.cpp b/src/qml/qml/qqmlpropertycache.cpp
index b1ffc9a2d5..dee9f26c80 100644
--- a/src/qml/qml/qqmlpropertycache.cpp
+++ b/src/qml/qml/qqmlpropertycache.cpp
@@ -1328,8 +1328,14 @@ QQmlPropertyData qQmlPropertyCacheCreate(const QMetaObject *metaObject, const QS
rv.load(p);
return rv;
} else {
- while (cmo && cmo->propertyOffset() >= idx)
+ bool changed = false;
+ while (cmo && cmo->propertyOffset() >= idx) {
cmo = cmo->superClass();
+ changed = true;
+ }
+ /* If the "cmo" variable didn't change, set it to 0 to
+ * avoid running into an infinite loop */
+ if (!changed) cmo = 0;
}
} else {
cmo = 0;
@@ -1395,7 +1401,8 @@ qQmlPropertyCacheProperty(QQmlEngine *engine, QObject *obj, const T &name,
if (cache) {
rv = cache->property(name, obj, context);
- } else {
+ }
+ if (!rv) {
local = qQmlPropertyCacheCreate(obj->metaObject(), qQmlPropertyCacheToString(name));
if (local.isValid())
rv = &local;
diff --git a/src/qml/qml/v8/qv8qobjectwrapper.cpp b/src/qml/qml/v8/qv8qobjectwrapper.cpp
index 0336457027..53f70ad132 100644
--- a/src/qml/qml/v8/qv8qobjectwrapper.cpp
+++ b/src/qml/qml/v8/qv8qobjectwrapper.cpp
@@ -524,7 +524,7 @@ v8::Handle<v8::Value> QV8QObjectWrapper::GetProperty(QV8Engine *engine, QObject
QQmlData *ddata = QQmlData::get(object, false);
if (ddata && ddata->propertyCache)
result = ddata->propertyCache->property(property, object, context);
- else
+ if (!result)
result = QQmlPropertyCache::property(engine->engine(), object, property, context, local);
}