summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2010-04-19 07:09:06 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2010-04-19 07:09:06 (GMT)
commit58bf0fc6b1f1815c4f22762c39c4374fd17beb4e (patch)
treea91643a12d62a0474fe203b6d5fe7c2a8fbafe7e /src
parent4223acff70de3036c5b7d75bccaec0c540c23556 (diff)
parent698a39fc699c3f8d6b7e28e10a8e3048fed274bd (diff)
downloadQt-58bf0fc6b1f1815c4f22762c39c4374fd17beb4e.zip
Qt-58bf0fc6b1f1815c4f22762c39c4374fd17beb4e.tar.gz
Qt-58bf0fc6b1f1815c4f22762c39c4374fd17beb4e.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
Diffstat (limited to 'src')
-rw-r--r--src/declarative/qml/qdeclarativeobjectscriptclass.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
index a27d19d..a194354 100644
--- a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
+++ b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
@@ -463,12 +463,21 @@ QStringList QDeclarativeObjectScriptClass::propertyNames(Object *object)
cache = ddata->propertyCache;
if (!cache) {
cache = enginePrivate->cache(obj);
- if (cache && ddata) { cache->addref(); ddata->propertyCache = cache; }
+ if (cache) {
+ if (ddata) { cache->addref(); ddata->propertyCache = cache; }
+ } else {
+ // Not cachable - fall back to QMetaObject (eg. dynamic meta object)
+ // XXX QDeclarativeOpenMetaObject has a cache, so this is suboptimal.
+ // XXX This is a workaround for QTBUG-9420.
+ const QMetaObject *mo = obj->metaObject();
+ QStringList r;
+ int pc = mo->propertyCount();
+ int po = mo->propertyOffset();
+ for (int i=po; i<pc; ++i)
+ r += QString::fromUtf8(mo->property(i).name());
+ return r;
+ }
}
-
- if (!cache)
- return QStringList();
-
return cache->propertyNames();
}