From 028a6a00c5653c6dc0641b215287e33b8312d7a7 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Tue, 30 Jun 2009 13:17:19 +0200 Subject: Fixes for the dynamic properties in the QML DOM. --- src/declarative/qml/qmldom.cpp | 31 +++++++++++++++++-------------- src/declarative/qml/qmldom.h | 3 +-- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/src/declarative/qml/qmldom.cpp b/src/declarative/qml/qmldom.cpp index 053ea14..9015e5c 100644 --- a/src/declarative/qml/qmldom.cpp +++ b/src/declarative/qml/qmldom.cpp @@ -512,40 +512,40 @@ QByteArray QmlDomDynamicProperty::propertyName() const return QByteArray(); } -QVariant::Type QmlDomDynamicProperty::propertyType() const +int QmlDomDynamicProperty::propertyType() const { if (isValid()) { switch (d->property.type) { case QmlParser::Object::DynamicProperty::Bool: - return QVariant::Bool; + return QMetaType::type("bool"); case QmlParser::Object::DynamicProperty::Color: - return QVariant::Color; + return QMetaType::type("QColor"); case QmlParser::Object::DynamicProperty::Date: - return QVariant::Date; + return QMetaType::type("QDateTime"); case QmlParser::Object::DynamicProperty::Int: - return QVariant::Int; + return QMetaType::type("int"); case QmlParser::Object::DynamicProperty::Real: - return QVariant::Double; + return QMetaType::type("double"); case QmlParser::Object::DynamicProperty::String: - return QVariant::String; + return QMetaType::type("QString"); case QmlParser::Object::DynamicProperty::Url: - return QVariant::Url; + return QMetaType::type("QUrl"); case QmlParser::Object::DynamicProperty::Variant: - return QVariant:: + return QMetaType::type("QVariant"); default: - return QVariant::Invalid; + break; } - } else { - return QVariant::Invalid; } + + return -1; } /*! @@ -578,7 +578,7 @@ QmlDomProperty QmlDomDynamicProperty::defaultValue() const { QmlDomProperty rp; - if (isValid()) { + if (isValid() && d->property.defaultValue) { rp.d->property = d->property.defaultValue; rp.d->property->addref(); } @@ -881,8 +881,11 @@ QList QmlDomObject::dynamicProperties() const QmlDomDynamicProperty p; p.d = new QmlDomDynamicPropertyPrivate; p.d->property = d->object->dynamicProperties.at(i); - if (p.d->property.defaultValue) p.d->property.defaultValue->addref(); p.d->valid = true; + + if (p.d->property.defaultValue) + p.d->property.defaultValue->addref(); + properties.append(p); } diff --git a/src/declarative/qml/qmldom.h b/src/declarative/qml/qmldom.h index 1dddb5f..170ef56 100644 --- a/src/declarative/qml/qmldom.h +++ b/src/declarative/qml/qmldom.h @@ -44,7 +44,6 @@ #include #include -#include #include QT_BEGIN_HEADER @@ -124,7 +123,7 @@ public: bool isValid() const; QByteArray propertyName() const; - QVariant::Type propertyType() const; + int propertyType() const; bool isDefaultProperty() const; -- cgit v0.12