diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2012-03-16 10:31:53 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-03-21 01:10:52 +0100 |
commit | 16c192831164c9ed9a8a4601936bb32fdba645ac (patch) | |
tree | e823222a1824c76a3db2a3cbb915d6e1fa8417d6 /src/qml/qml/qqmlpropertycache.cpp | |
parent | 37cd29b2ff024f27f84ef6214ff5403603d522f2 (diff) |
Support unregistered Qt namespace enums in QML methods.
This brings the support in line with signal handlers, which should allow
us to reuse the implementation there when appropriate. Also adds tests
for both registered and unregisted Qt namespace enums.
Change-Id: I366846626fc44d6d99b51e93fc9e3cb948c748f9
Reviewed-by: Chris Adams <christopher.adams@nokia.com>
Diffstat (limited to 'src/qml/qml/qqmlpropertycache.cpp')
-rw-r--r-- | src/qml/qml/qqmlpropertycache.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/qml/qml/qqmlpropertycache.cpp b/src/qml/qml/qqmlpropertycache.cpp index 9ff79a1956..318044a25b 100644 --- a/src/qml/qml/qqmlpropertycache.cpp +++ b/src/qml/qml/qqmlpropertycache.cpp @@ -682,7 +682,13 @@ QStringList QQmlPropertyCache::propertyNames() const return keys; } -static int EnumType(const QMetaObject *meta, const QByteArray &str) +struct StaticQtMetaObject : public QObject +{ + static const QMetaObject *get() + { return &static_cast<StaticQtMetaObject*> (0)->staticQtMetaObject; } +}; + +static int EnumType(const QMetaObject *metaobj, const QByteArray &str) { QByteArray scope; QByteArray name; @@ -693,6 +699,11 @@ static int EnumType(const QMetaObject *meta, const QByteArray &str) } else { name = str; } + const QMetaObject *meta; + if (scope == "Qt") + meta = StaticQtMetaObject::get(); + else + meta = metaobj; for (int i = meta->enumeratorCount() - 1; i >= 0; --i) { QMetaEnum m = meta->enumerator(i); if ((m.name() == name) && (scope.isEmpty() || (m.scope() == scope))) |