diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-05-15 12:56:21 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-05-15 12:56:47 (GMT) |
commit | 5be67ef5ad9b2f6020ffe47eecc9fd3338957bb7 (patch) | |
tree | 3d2422fe01d518848a0a2df0639a199abd756be4 /src/declarative/qml/qmlcustomparser.cpp | |
parent | f3aa702372e749b707ce1d6746dfc2e2aba31306 (diff) | |
download | Qt-5be67ef5ad9b2f6020ffe47eecc9fd3338957bb7.zip Qt-5be67ef5ad9b2f6020ffe47eecc9fd3338957bb7.tar.gz Qt-5be67ef5ad9b2f6020ffe47eecc9fd3338957bb7.tar.bz2 |
Implement SetProperties as a custom parser
This will allow us to remove all "Assign*" style instructions from the QML compiler and have it depend only on static data.
Diffstat (limited to 'src/declarative/qml/qmlcustomparser.cpp')
-rw-r--r-- | src/declarative/qml/qmlcustomparser.cpp | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/src/declarative/qml/qmlcustomparser.cpp b/src/declarative/qml/qmlcustomparser.cpp index e864df9..a60f783 100644 --- a/src/declarative/qml/qmlcustomparser.cpp +++ b/src/declarative/qml/qmlcustomparser.cpp @@ -120,6 +120,7 @@ QmlCustomParserNodePrivate::fromObject(QmlParser::Object *root) return rootNode; } +#include <QtCore/qdebug.h> QmlCustomParserProperty QmlCustomParserNodePrivate::fromProperty(QmlParser::Property *p) { @@ -127,20 +128,23 @@ QmlCustomParserNodePrivate::fromProperty(QmlParser::Property *p) prop.d->name = p->name; prop.d->isList = (p->values.count() > 1); - for(int ii = 0; ii < p->values.count(); ++ii) { - Value *v = p->values.at(ii); + if (p->value) { + QmlCustomParserNode node = fromObject(p->value); + QList<QmlCustomParserProperty> props = node.properties(); + for (int ii = 0; ii < props.count(); ++ii) + prop.d->values << QVariant::fromValue(props.at(ii)); + } else { + for(int ii = 0; ii < p->values.count(); ++ii) { + Value *v = p->values.at(ii); + + if(v->object) { + QmlCustomParserNode node = fromObject(v->object); + prop.d->values << QVariant::fromValue(node); + } else { + prop.d->values << QVariant::fromValue(v->value); + } - // We skip fetched properties for now - if(v->object && v->object->type == -1) - continue; - - if(v->object) { - QmlCustomParserNode node = fromObject(v->object); - prop.d->values << QVariant::fromValue(node); - } else { - prop.d->values << QVariant::fromValue(v->primitive()); } - } return prop; |