diff options
author | Bea Lam <bea.lam@nokia.com> | 2010-02-25 05:50:34 (GMT) |
---|---|---|
committer | Bea Lam <bea.lam@nokia.com> | 2010-02-25 05:50:34 (GMT) |
commit | 4c5292a36360821a3ba4a7bc4532688dff7b7ae9 (patch) | |
tree | 969d79e3860c1709d307479320ab0a648639aa48 | |
parent | 410dd39d7294cd0c9e46e01f839c137482d9fc5d (diff) | |
parent | d022acd47350f61d3959b076d7bc92df86015b16 (diff) | |
download | Qt-4c5292a36360821a3ba4a7bc4532688dff7b7ae9.zip Qt-4c5292a36360821a3ba4a7bc4532688dff7b7ae9.tar.gz Qt-4c5292a36360821a3ba4a7bc4532688dff7b7ae9.tar.bz2 |
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-qml
6 files changed, 45 insertions, 47 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 8fc3b56..00f37b9 100644 --- a/src/declarative/qml/qdeclarativemetaproperty.cpp +++ b/src/declarative/qml/qdeclarativemetaproperty.cpp @@ -264,13 +264,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. @@ -290,13 +288,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(); @@ -305,11 +303,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) @@ -317,7 +313,7 @@ QDeclarativeMetaPropertyPrivate::propertyCategory() const else return QDeclarativeMetaProperty::Normal; } else { - return QDeclarativeMetaProperty::InvalidProperty; + return QDeclarativeMetaProperty::InvalidCategory; } } @@ -446,7 +442,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); diff --git a/tests/auto/declarative/qdeclarativelistreference/tst_qdeclarativelistreference.cpp b/tests/auto/declarative/qdeclarativelistreference/tst_qdeclarativelistreference.cpp index 5c6ceef..fdcb98a 100644 --- a/tests/auto/declarative/qdeclarativelistreference/tst_qdeclarativelistreference.cpp +++ b/tests/auto/declarative/qdeclarativelistreference/tst_qdeclarativelistreference.cpp @@ -547,10 +547,10 @@ void tst_qdeclarativelistreference::engineTypes() QVERIFY(o); QDeclarativeMetaProperty p1(o, QLatin1String("myList")); - QVERIFY(p1.propertyCategory() == QDeclarativeMetaProperty::Normal); + QVERIFY(p1.propertyTypeCategory() == QDeclarativeMetaProperty::Normal); QDeclarativeMetaProperty p2(o, QLatin1String("myList"), engine.rootContext()); - QVERIFY(p2.propertyCategory() == QDeclarativeMetaProperty::List); + QVERIFY(p2.propertyTypeCategory() == QDeclarativeMetaProperty::List); QVariant v = p2.read(); QVERIFY(v.userType() == qMetaTypeId<QDeclarativeListReference>()); QDeclarativeListReference ref = qvariant_cast<QDeclarativeListReference>(v); diff --git a/tests/auto/declarative/qdeclarativemetaproperty/tst_qdeclarativemetaproperty.cpp b/tests/auto/declarative/qdeclarativemetaproperty/tst_qdeclarativemetaproperty.cpp index be2aede..f2ed341 100644 --- a/tests/auto/declarative/qdeclarativemetaproperty/tst_qdeclarativemetaproperty.cpp +++ b/tests/auto/declarative/qdeclarativemetaproperty/tst_qdeclarativemetaproperty.cpp @@ -157,7 +157,7 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty() QCOMPARE(prop.isResettable(), false); QCOMPARE(prop.isValid(), false); QCOMPARE(prop.object(), (QObject *)0); - QCOMPARE(prop.propertyCategory(), QDeclarativeMetaProperty::InvalidProperty); + QCOMPARE(prop.propertyTypeCategory(), QDeclarativeMetaProperty::InvalidCategory); QCOMPARE(prop.propertyType(), 0); QCOMPARE(prop.propertyTypeName(), (const char *)0); QVERIFY(prop.property().name() == 0); @@ -251,7 +251,7 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty_object() QCOMPARE(prop.isResettable(), false); QCOMPARE(prop.isValid(), false); QCOMPARE(prop.object(), (QObject *)0); - QCOMPARE(prop.propertyCategory(), QDeclarativeMetaProperty::InvalidProperty); + QCOMPARE(prop.propertyTypeCategory(), QDeclarativeMetaProperty::InvalidCategory); QCOMPARE(prop.propertyType(), 0); QCOMPARE(prop.propertyTypeName(), (const char *)0); QVERIFY(prop.property().name() == 0); @@ -298,7 +298,7 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty_object() QCOMPARE(prop.isResettable(), false); QCOMPARE(prop.isValid(), true); QCOMPARE(prop.object(), &dobject); - QCOMPARE(prop.propertyCategory(), QDeclarativeMetaProperty::Normal); + QCOMPARE(prop.propertyTypeCategory(), QDeclarativeMetaProperty::Normal); QCOMPARE(prop.propertyType(), (int)QVariant::Int); QCOMPARE(prop.propertyTypeName(), "int"); QCOMPARE(QString(prop.property().name()), QString("defaultProperty")); @@ -352,7 +352,7 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty_object_string() QCOMPARE(prop.isResettable(), false); QCOMPARE(prop.isValid(), false); QCOMPARE(prop.object(), (QObject *)0); - QCOMPARE(prop.propertyCategory(), QDeclarativeMetaProperty::InvalidProperty); + QCOMPARE(prop.propertyTypeCategory(), QDeclarativeMetaProperty::InvalidCategory); QCOMPARE(prop.propertyType(), 0); QCOMPARE(prop.propertyTypeName(), (const char *)0); QVERIFY(prop.property().name() == 0); @@ -399,7 +399,7 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty_object_string() QCOMPARE(prop.isResettable(), false); QCOMPARE(prop.isValid(), true); QCOMPARE(prop.object(), &dobject); - QCOMPARE(prop.propertyCategory(), QDeclarativeMetaProperty::Normal); + QCOMPARE(prop.propertyTypeCategory(), QDeclarativeMetaProperty::Normal); QCOMPARE(prop.propertyType(), (int)QVariant::Int); QCOMPARE(prop.propertyTypeName(), "int"); QCOMPARE(QString(prop.property().name()), QString("defaultProperty")); @@ -448,7 +448,7 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty_object_string() QCOMPARE(prop.isResettable(), false); QCOMPARE(prop.isValid(), true); QCOMPARE(prop.object(), &dobject); - QCOMPARE(prop.propertyCategory(), QDeclarativeMetaProperty::InvalidProperty); + QCOMPARE(prop.propertyTypeCategory(), QDeclarativeMetaProperty::InvalidCategory); QCOMPARE(prop.propertyType(), 0); QCOMPARE(prop.propertyTypeName(), (const char *)0); QCOMPARE(prop.property().name(), (const char *)0); @@ -549,7 +549,7 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty_object_context() QCOMPARE(prop.isResettable(), false); QCOMPARE(prop.isValid(), false); QCOMPARE(prop.object(), (QObject *)0); - QCOMPARE(prop.propertyCategory(), QDeclarativeMetaProperty::InvalidProperty); + QCOMPARE(prop.propertyTypeCategory(), QDeclarativeMetaProperty::InvalidCategory); QCOMPARE(prop.propertyType(), 0); QCOMPARE(prop.propertyTypeName(), (const char *)0); QVERIFY(prop.property().name() == 0); @@ -596,7 +596,7 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty_object_context() QCOMPARE(prop.isResettable(), false); QCOMPARE(prop.isValid(), true); QCOMPARE(prop.object(), &dobject); - QCOMPARE(prop.propertyCategory(), QDeclarativeMetaProperty::Normal); + QCOMPARE(prop.propertyTypeCategory(), QDeclarativeMetaProperty::Normal); QCOMPARE(prop.propertyType(), (int)QVariant::Int); QCOMPARE(prop.propertyTypeName(), "int"); QCOMPARE(QString(prop.property().name()), QString("defaultProperty")); @@ -650,7 +650,7 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty_object_string_context() QCOMPARE(prop.isResettable(), false); QCOMPARE(prop.isValid(), false); QCOMPARE(prop.object(), (QObject *)0); - QCOMPARE(prop.propertyCategory(), QDeclarativeMetaProperty::InvalidProperty); + QCOMPARE(prop.propertyTypeCategory(), QDeclarativeMetaProperty::InvalidCategory); QCOMPARE(prop.propertyType(), 0); QCOMPARE(prop.propertyTypeName(), (const char *)0); QVERIFY(prop.property().name() == 0); @@ -697,7 +697,7 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty_object_string_context() QCOMPARE(prop.isResettable(), false); QCOMPARE(prop.isValid(), true); QCOMPARE(prop.object(), &dobject); - QCOMPARE(prop.propertyCategory(), QDeclarativeMetaProperty::Normal); + QCOMPARE(prop.propertyTypeCategory(), QDeclarativeMetaProperty::Normal); QCOMPARE(prop.propertyType(), (int)QVariant::Int); QCOMPARE(prop.propertyTypeName(), "int"); QCOMPARE(QString(prop.property().name()), QString("defaultProperty")); @@ -746,7 +746,7 @@ void tst_qdeclarativemetaproperty::qmlmetaproperty_object_string_context() QCOMPARE(prop.isResettable(), false); QCOMPARE(prop.isValid(), true); QCOMPARE(prop.object(), &dobject); - QCOMPARE(prop.propertyCategory(), QDeclarativeMetaProperty::InvalidProperty); + QCOMPARE(prop.propertyTypeCategory(), QDeclarativeMetaProperty::InvalidCategory); QCOMPARE(prop.propertyType(), 0); QCOMPARE(prop.propertyTypeName(), (const char *)0); QCOMPARE(prop.property().name(), (const char *)0); @@ -1288,14 +1288,14 @@ void tst_qdeclarativemetaproperty::copy() QCOMPARE(property->name(), QString("defaultProperty")); QCOMPARE(property->read(), QVariant(10)); QCOMPARE(property->type(), QDeclarativeMetaProperty::Property); - QCOMPARE(property->propertyCategory(), QDeclarativeMetaProperty::Normal); + QCOMPARE(property->propertyTypeCategory(), QDeclarativeMetaProperty::Normal); QCOMPARE(property->propertyType(), (int)QVariant::Int); QDeclarativeMetaProperty p1(*property); QCOMPARE(p1.name(), QString("defaultProperty")); QCOMPARE(p1.read(), QVariant(10)); QCOMPARE(p1.type(), QDeclarativeMetaProperty::Property); - QCOMPARE(p1.propertyCategory(), QDeclarativeMetaProperty::Normal); + QCOMPARE(p1.propertyTypeCategory(), QDeclarativeMetaProperty::Normal); QCOMPARE(p1.propertyType(), (int)QVariant::Int); QDeclarativeMetaProperty p2(&object, QLatin1String("url")); @@ -1304,7 +1304,7 @@ void tst_qdeclarativemetaproperty::copy() QCOMPARE(p2.name(), QString("defaultProperty")); QCOMPARE(p2.read(), QVariant(10)); QCOMPARE(p2.type(), QDeclarativeMetaProperty::Property); - QCOMPARE(p2.propertyCategory(), QDeclarativeMetaProperty::Normal); + QCOMPARE(p2.propertyTypeCategory(), QDeclarativeMetaProperty::Normal); QCOMPARE(p2.propertyType(), (int)QVariant::Int); delete property; property = 0; @@ -1312,13 +1312,13 @@ void tst_qdeclarativemetaproperty::copy() QCOMPARE(p1.name(), QString("defaultProperty")); QCOMPARE(p1.read(), QVariant(10)); QCOMPARE(p1.type(), QDeclarativeMetaProperty::Property); - QCOMPARE(p1.propertyCategory(), QDeclarativeMetaProperty::Normal); + QCOMPARE(p1.propertyTypeCategory(), QDeclarativeMetaProperty::Normal); QCOMPARE(p1.propertyType(), (int)QVariant::Int); QCOMPARE(p2.name(), QString("defaultProperty")); QCOMPARE(p2.read(), QVariant(10)); QCOMPARE(p2.type(), QDeclarativeMetaProperty::Property); - QCOMPARE(p2.propertyCategory(), QDeclarativeMetaProperty::Normal); + QCOMPARE(p2.propertyTypeCategory(), QDeclarativeMetaProperty::Normal); QCOMPARE(p2.propertyType(), (int)QVariant::Int); } |