summaryrefslogtreecommitdiffstats
path: root/src/declarative/util/qmllistmodel.cpp
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2009-09-10 00:19:33 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2009-09-10 00:19:33 (GMT)
commita250db23c96fc1ec47ea4d19d62a19cad7c50b46 (patch)
tree640237f325d4a734ecc42c042812a497c7a1f190 /src/declarative/util/qmllistmodel.cpp
parentd3bd0567fbc16263fcb181d58529e6d7aeee1bbd (diff)
downloadQt-a250db23c96fc1ec47ea4d19d62a19cad7c50b46.zip
Qt-a250db23c96fc1ec47ea4d19d62a19cad7c50b46.tar.gz
Qt-a250db23c96fc1ec47ea4d19d62a19cad7c50b46.tar.bz2
Report custom parse errors verbosely.
Diffstat (limited to 'src/declarative/util/qmllistmodel.cpp')
-rw-r--r--src/declarative/util/qmllistmodel.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/declarative/util/qmllistmodel.cpp b/src/declarative/util/qmllistmodel.cpp
index f988d81..19499a1 100644
--- a/src/declarative/util/qmllistmodel.cpp
+++ b/src/declarative/util/qmllistmodel.cpp
@@ -634,7 +634,7 @@ void QmlListModel::set(int index, const QString& property, const QVariant& value
class QmlListModelParser : public QmlCustomParser
{
public:
- QByteArray compile(const QList<QmlCustomParserProperty> &, bool *ok);
+ QByteArray compile(const QList<QmlCustomParserProperty> &);
bool compileProperty(const QmlCustomParserProperty &prop, QList<ListInstruction> &instr, QByteArray &data);
void setCustomData(QObject *, const QByteArray &);
};
@@ -659,8 +659,14 @@ bool QmlListModelParser::compileProperty(const QmlCustomParserProperty &prop, QL
QList<QmlCustomParserProperty> props = node.properties();
for(int jj = 0; jj < props.count(); ++jj) {
const QmlCustomParserProperty &nodeProp = props.at(jj);
- if(nodeProp.name() == "")
+ if (nodeProp.name() == "") {
+ error(nodeProp, QLatin1String("Cannot use default property in ListModel"));
return false;
+ }
+ if (nodeProp.name() == "id") {
+ error(nodeProp, QLatin1String("Cannot use reserved \"id\" property in ListModel"));
+ return false;
+ }
ListInstruction li;
int ref = data.count();
@@ -706,21 +712,19 @@ bool QmlListModelParser::compileProperty(const QmlCustomParserProperty &prop, QL
return true;
}
-QByteArray QmlListModelParser::compile(const QList<QmlCustomParserProperty> &customProps, bool *ok)
+QByteArray QmlListModelParser::compile(const QList<QmlCustomParserProperty> &customProps)
{
- *ok = true;
QList<ListInstruction> instr;
QByteArray data;
for(int ii = 0; ii < customProps.count(); ++ii) {
const QmlCustomParserProperty &prop = customProps.at(ii);
if(prop.name() != "") { // isn't default property
- *ok = false;
+ error(prop, QLatin1String("Cannot use default property"));
return QByteArray();
}
if(!compileProperty(prop, instr, data)) {
- *ok = false;
return QByteArray();
}
}