diff options
author | Erik Verbruggen <erik.verbruggen@nokia.com> | 2009-06-30 11:17:19 (GMT) |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@nokia.com> | 2009-06-30 11:17:19 (GMT) |
commit | 028a6a00c5653c6dc0641b215287e33b8312d7a7 (patch) | |
tree | 0f6bd7787282043b9a765392917a8578b98c4d12 /src | |
parent | f55c5b5552cf2ca620d02ff553116ae62061f8b5 (diff) | |
download | Qt-028a6a00c5653c6dc0641b215287e33b8312d7a7.zip Qt-028a6a00c5653c6dc0641b215287e33b8312d7a7.tar.gz Qt-028a6a00c5653c6dc0641b215287e33b8312d7a7.tar.bz2 |
Fixes for the dynamic properties in the QML DOM.
Diffstat (limited to 'src')
-rw-r--r-- | src/declarative/qml/qmldom.cpp | 31 | ||||
-rw-r--r-- | 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<QmlDomDynamicProperty> 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 <QtCore/qlist.h> #include <QtCore/qshareddata.h> -#include <QtCore/qvariant.h> #include <QtDeclarative/qmlerror.h> QT_BEGIN_HEADER @@ -124,7 +123,7 @@ public: bool isValid() const; QByteArray propertyName() const; - QVariant::Type propertyType() const; + int propertyType() const; bool isDefaultProperty() const; |