diff options
author | Bea Lam <bea.lam@nokia.com> | 2010-02-03 00:01:13 (GMT) |
---|---|---|
committer | Bea Lam <bea.lam@nokia.com> | 2010-02-03 00:04:03 (GMT) |
commit | 17d0ed5af4922645a268b6550742fb521d459c8e (patch) | |
tree | 43f4077630bd896da88715dec894392c63ac666b /src | |
parent | 35a211cd95e0d09ef0b547b57f01f0a9ff41da2f (diff) | |
download | Qt-17d0ed5af4922645a268b6550742fb521d459c8e.zip Qt-17d0ed5af4922645a268b6550742fb521d459c8e.tar.gz Qt-17d0ed5af4922645a268b6550742fb521d459c8e.tar.bz2 |
Disallow ids that start with uppercase letters and update docs and
examples accordingly.
Task-number: QT-2786
Diffstat (limited to 'src')
-rw-r--r-- | src/declarative/qml/qmlcompiler.cpp | 5 | ||||
-rw-r--r-- | src/declarative/util/qmllistmodel.cpp | 4 |
2 files changed, 6 insertions, 3 deletions
diff --git a/src/declarative/qml/qmlcompiler.cpp b/src/declarative/qml/qmlcompiler.cpp index bb7abf3..c6a5d82 100644 --- a/src/declarative/qml/qmlcompiler.cpp +++ b/src/declarative/qml/qmlcompiler.cpp @@ -115,7 +115,7 @@ QList<QmlError> QmlCompiler::errors() const /*! Returns true if \a val is a legal object id, false otherwise. - Legal ids must start with a letter or underscore, and contain only + Legal ids must start with a lower-case letter or underscore, and contain only letters, numbers and underscores. */ bool QmlCompiler::isValidId(const QString &val) @@ -123,6 +123,9 @@ bool QmlCompiler::isValidId(const QString &val) if (val.isEmpty()) return false; + if (val.at(0).isLetter() && !val.at(0).isLower()) + return false; + QChar u(QLatin1Char('_')); for (int ii = 0; ii < val.count(); ++ii) if (val.at(ii) != u && diff --git a/src/declarative/util/qmllistmodel.cpp b/src/declarative/util/qmllistmodel.cpp index 8c70539..0b19574 100644 --- a/src/declarative/util/qmllistmodel.cpp +++ b/src/declarative/util/qmllistmodel.cpp @@ -161,10 +161,10 @@ static void dump(ModelNode *node, int ind); id: fruitDelegate Item { width: 200; height: 50 - Text { id: Name; text: name } + Text { id: name; text: name } Text { text: '$'+cost; anchors.right: parent.right } Row { - anchors.top: Name.bottom + anchors.top: name.bottom spacing: 5 Text { text: "Attributes:" } Repeater { |