summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml
diff options
context:
space:
mode:
authorBea Lam <bea.lam@nokia.com>2010-02-03 00:01:13 (GMT)
committerBea Lam <bea.lam@nokia.com>2010-02-03 00:04:03 (GMT)
commit17d0ed5af4922645a268b6550742fb521d459c8e (patch)
tree43f4077630bd896da88715dec894392c63ac666b /src/declarative/qml
parent35a211cd95e0d09ef0b547b57f01f0a9ff41da2f (diff)
downloadQt-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/declarative/qml')
-rw-r--r--src/declarative/qml/qmlcompiler.cpp5
1 files changed, 4 insertions, 1 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 &&