diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-04-07 03:27:23 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-04-07 04:26:45 (GMT) |
commit | b3beb6ded506f1701b68642d981c63295bc6c6a2 (patch) | |
tree | 24eadcd6d3c1e1796ab142bd6b059f07f04f238c /src/declarative | |
parent | 60c9d955918dde759ac038ff73c7767d62add3b7 (diff) | |
download | Qt-b3beb6ded506f1701b68642d981c63295bc6c6a2.zip Qt-b3beb6ded506f1701b68642d981c63295bc6c6a2.tar.gz Qt-b3beb6ded506f1701b68642d981c63295bc6c6a2.tar.bz2 |
Disallow nested elements in ListModel
QTBUG-6082
Diffstat (limited to 'src/declarative')
-rw-r--r-- | src/declarative/qml/qdeclarativecustomparser.cpp | 3 | ||||
-rw-r--r-- | src/declarative/util/qdeclarativelistmodel.cpp | 7 |
2 files changed, 9 insertions, 1 deletions
diff --git a/src/declarative/qml/qdeclarativecustomparser.cpp b/src/declarative/qml/qdeclarativecustomparser.cpp index 8b6ee7c..1a97315 100644 --- a/src/declarative/qml/qdeclarativecustomparser.cpp +++ b/src/declarative/qml/qdeclarativecustomparser.cpp @@ -108,6 +108,9 @@ QDeclarativeCustomParserNodePrivate::fromObject(QDeclarativeParser::Object *root rootNode.d->properties << fromProperty(p); } + if (root->defaultProperty) + rootNode.d->properties << fromProperty(root->defaultProperty); + return rootNode; } diff --git a/src/declarative/util/qdeclarativelistmodel.cpp b/src/declarative/util/qdeclarativelistmodel.cpp index ec23bb2..28bd852 100644 --- a/src/declarative/util/qdeclarativelistmodel.cpp +++ b/src/declarative/util/qdeclarativelistmodel.cpp @@ -622,6 +622,11 @@ bool QDeclarativeListModelParser::compileProperty(const QDeclarativeCustomParser QDeclarativeCustomParserNode node = qvariant_cast<QDeclarativeCustomParserNode>(value); + if (node.name() != "ListElement") { + error(node, QDeclarativeListModel::tr("ListElement: cannot contain nested elements")); + return false; + } + { ListInstruction li; li.type = ListInstruction::Push; @@ -633,7 +638,7 @@ bool QDeclarativeListModelParser::compileProperty(const QDeclarativeCustomParser for(int jj = 0; jj < props.count(); ++jj) { const QDeclarativeCustomParserProperty &nodeProp = props.at(jj); if (nodeProp.name() == "") { - error(nodeProp, QDeclarativeListModel::tr("ListElement: cannot use default property")); + error(nodeProp, QDeclarativeListModel::tr("ListElement: cannot contain nested elements")); return false; } if (nodeProp.name() == "id") { |