diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-08-06 05:50:49 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-08-06 05:50:49 (GMT) |
commit | 3270c41c1e1f78b403a4d587d726203520eb707b (patch) | |
tree | bf1cd48bbfcf7d49cec742254be20b87375d1bca /src/declarative/qml/qmlmetaproperty.cpp | |
parent | 28a8c6b02e52bce8b2ac14961997b9c2cc0e01fd (diff) | |
download | Qt-3270c41c1e1f78b403a4d587d726203520eb707b.zip Qt-3270c41c1e1f78b403a4d587d726203520eb707b.tar.gz Qt-3270c41c1e1f78b403a4d587d726203520eb707b.tar.bz2 |
Add a QmlMetaType::typeCategory() method
QmlMetaProperty was calling isObject(), isList() and isQmlList() to determine
its property category, resulting in acquiring and releasing three locks (one
for each call). This call allows QmlMetaProperty to do the same with only
one lock.
Diffstat (limited to 'src/declarative/qml/qmlmetaproperty.cpp')
-rw-r--r-- | src/declarative/qml/qmlmetaproperty.cpp | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/src/declarative/qml/qmlmetaproperty.cpp b/src/declarative/qml/qmlmetaproperty.cpp index c445599..09ca872 100644 --- a/src/declarative/qml/qmlmetaproperty.cpp +++ b/src/declarative/qml/qmlmetaproperty.cpp @@ -310,14 +310,23 @@ QmlMetaPropertyPrivate::propertyCategory() const category = QmlMetaProperty::Normal; else if (type == qMetaTypeId<QmlBinding *>()) category = QmlMetaProperty::Bindable; - else if (QmlMetaType::isList(type)) - category = QmlMetaProperty::List; - else if (QmlMetaType::isQmlList(type)) - category = QmlMetaProperty::QmlList; - else if (QmlMetaType::isObject(type)) - category = QmlMetaProperty::Object; - else - category = QmlMetaProperty::Normal; + else { + QmlMetaType::TypeCategory tc = QmlMetaType::typeCategory(type); + switch(tc) { + case QmlMetaType::Object: + category = QmlMetaProperty::Object; + break; + case QmlMetaType::QmlList: + category = QmlMetaProperty::QmlList; + break; + case QmlMetaType::List: + category = QmlMetaProperty::List; + break; + case QmlMetaType::Unknown: + category = QmlMetaProperty::Normal; + break; + } + } } return category; } |