diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-02-25 05:45:44 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-02-25 05:45:44 (GMT) |
commit | d022acd47350f61d3959b076d7bc92df86015b16 (patch) | |
tree | 7bb53c1c159545b2962413a9de914bfcc2475500 /src/declarative/qml | |
parent | f29a6c8b9fbeb899997c1e4cc2a4be009a231502 (diff) | |
download | Qt-d022acd47350f61d3959b076d7bc92df86015b16.zip Qt-d022acd47350f61d3959b076d7bc92df86015b16.tar.gz Qt-d022acd47350f61d3959b076d7bc92df86015b16.tar.bz2 |
Tweak QDeclarativeMetaProperty type category API
Diffstat (limited to 'src/declarative/qml')
-rw-r--r-- | src/declarative/qml/qdeclarativebinding.cpp | 2 | ||||
-rw-r--r-- | src/declarative/qml/qdeclarativemetaproperty.cpp | 22 | ||||
-rw-r--r-- | src/declarative/qml/qdeclarativemetaproperty.h | 30 | ||||
-rw-r--r-- | src/declarative/qml/qdeclarativemetaproperty_p.h | 2 |
4 files changed, 27 insertions, 29 deletions
diff --git a/src/declarative/qml/qdeclarativebinding.cpp b/src/declarative/qml/qdeclarativebinding.cpp index 5ac5701..bde01ae 100644 --- a/src/declarative/qml/qdeclarativebinding.cpp +++ b/src/declarative/qml/qdeclarativebinding.cpp @@ -128,7 +128,7 @@ void QDeclarativeBinding::update(QDeclarativeMetaProperty::WriteFlags flags) if (!data->updating) { data->updating = true; - if (data->property.propertyCategory() == QDeclarativeMetaProperty::Bindable) { + if (data->property.propertyType() == qMetaTypeId<QDeclarativeBinding *>()) { int idx = data->property.coreIndex(); Q_ASSERT(idx != -1); diff --git a/src/declarative/qml/qdeclarativemetaproperty.cpp b/src/declarative/qml/qdeclarativemetaproperty.cpp index b4e920c..f4c930f 100644 --- a/src/declarative/qml/qdeclarativemetaproperty.cpp +++ b/src/declarative/qml/qdeclarativemetaproperty.cpp @@ -263,13 +263,11 @@ QDeclarativeMetaProperty::QDeclarativeMetaProperty(const QDeclarativeMetaPropert } /*! - \enum QDeclarativeMetaProperty::PropertyCategory + \enum QDeclarativeMetaProperty::PropertyTypeCategory This enum specifies a category of QML property. - \value Unknown The category is unknown. This will never be returned from propertyCategory() - \value InvalidProperty The property is invalid. - \value Bindable The property is a QDeclarativeBinding. + \value InvalidCategory The property is invalid. \value List The property is a QList pointer \value Object The property is a QObject derived type pointer \value Normal The property is none of the above. @@ -289,13 +287,13 @@ QDeclarativeMetaProperty::QDeclarativeMetaProperty(const QDeclarativeMetaPropert /*! Returns the property category. */ -QDeclarativeMetaProperty::PropertyCategory QDeclarativeMetaProperty::propertyCategory() const +QDeclarativeMetaProperty::PropertyTypeCategory QDeclarativeMetaProperty::propertyTypeCategory() const { - return d->propertyCategory(); + return d->propertyTypeCategory(); } -QDeclarativeMetaProperty::PropertyCategory -QDeclarativeMetaPropertyPrivate::propertyCategory() const +QDeclarativeMetaProperty::PropertyTypeCategory +QDeclarativeMetaPropertyPrivate::propertyTypeCategory() const { uint type = q->type(); @@ -304,11 +302,9 @@ QDeclarativeMetaPropertyPrivate::propertyCategory() const } else if (type & QDeclarativeMetaProperty::Property) { int type = propertyType(); if (type == QVariant::Invalid) - return QDeclarativeMetaProperty::InvalidProperty; + return QDeclarativeMetaProperty::InvalidCategory; else if ((uint)type < QVariant::UserType) return QDeclarativeMetaProperty::Normal; - else if (type == qMetaTypeId<QDeclarativeBinding *>()) - return QDeclarativeMetaProperty::Bindable; else if (core.flags & QDeclarativePropertyCache::Data::IsQObjectDerived) return QDeclarativeMetaProperty::Object; else if (core.flags & QDeclarativePropertyCache::Data::IsQList) @@ -316,7 +312,7 @@ QDeclarativeMetaPropertyPrivate::propertyCategory() const else return QDeclarativeMetaProperty::Normal; } else { - return QDeclarativeMetaProperty::InvalidProperty; + return QDeclarativeMetaProperty::InvalidCategory; } } @@ -445,7 +441,7 @@ QDeclarativeMetaProperty &QDeclarativeMetaProperty::operator=(const QDeclarative */ bool QDeclarativeMetaProperty::isWritable() const { - QDeclarativeMetaProperty::PropertyCategory category = propertyCategory(); + QDeclarativeMetaProperty::PropertyTypeCategory category = propertyTypeCategory(); if (!d->object) return false; diff --git a/src/declarative/qml/qdeclarativemetaproperty.h b/src/declarative/qml/qdeclarativemetaproperty.h index dce0b4f..900d1cd 100644 --- a/src/declarative/qml/qdeclarativemetaproperty.h +++ b/src/declarative/qml/qdeclarativemetaproperty.h @@ -63,22 +63,31 @@ class QDeclarativeMetaPropertyPrivate; class Q_DECLARATIVE_EXPORT QDeclarativeMetaProperty { public: - enum PropertyCategory { - Unknown, - InvalidProperty, - Bindable, + enum PropertyTypeCategory { + InvalidCategory, List, Object, Normal }; + + enum Type { Invalid = 0x00, + Property = 0x01, + SignalProperty = 0x02, + Default = 0x08, + ValueTypeProperty = 0x10 + }; + QDeclarativeMetaProperty(); + ~QDeclarativeMetaProperty(); + QDeclarativeMetaProperty(QObject *); - QDeclarativeMetaProperty(QObject *, const QString &); QDeclarativeMetaProperty(QObject *, QDeclarativeContext *); + + QDeclarativeMetaProperty(QObject *, const QString &); QDeclarativeMetaProperty(QObject *, const QString &, QDeclarativeContext *); + QDeclarativeMetaProperty(const QDeclarativeMetaProperty &); QDeclarativeMetaProperty &operator=(const QDeclarativeMetaProperty &); - ~QDeclarativeMetaProperty(); QString name() const; @@ -96,12 +105,6 @@ public: QMetaMethod method() const; - enum Type { Invalid = 0x00, - Property = 0x01, - SignalProperty = 0x02, - Default = 0x08, - ValueTypeProperty = 0x10 }; - Type type() const; bool isProperty() const; bool isDefault() const; @@ -111,9 +114,8 @@ public: bool isValid() const; QObject *object() const; - PropertyCategory propertyCategory() const; - int propertyType() const; + PropertyTypeCategory propertyTypeCategory() const; const char *propertyTypeName() const; bool operator==(const QDeclarativeMetaProperty &) const; diff --git a/src/declarative/qml/qdeclarativemetaproperty_p.h b/src/declarative/qml/qdeclarativemetaproperty_p.h index 5ebd2c5..937cfd7 100644 --- a/src/declarative/qml/qdeclarativemetaproperty_p.h +++ b/src/declarative/qml/qdeclarativemetaproperty_p.h @@ -95,7 +95,7 @@ public: QMetaMethod findSignal(QObject *, const QString &); int propertyType() const; - QDeclarativeMetaProperty::PropertyCategory propertyCategory() const; + QDeclarativeMetaProperty::PropertyTypeCategory propertyTypeCategory() const; QVariant readValueProperty(); bool writeValueProperty(const QVariant &, QDeclarativeMetaProperty::WriteFlags); |