Skip to content
Snippets Groups Projects
Commit 699ff228 authored by Thomas Hartmann's avatar Thomas Hartmann
Browse files

QmlDesigner.Model: check ids for qml keywords

ids are now checked if they are a qml keyword
parent 2e80355e
No related branches found
No related tags found
No related merge requests found
......@@ -160,6 +160,15 @@ QString ModelNode::validId()
return id();
}
static bool idIsQmlKeyWord(const QString& id)
{
QStringList keywords;
keywords << "import" << "property" << "signal"
<< "as" << "on" << "list";
return keywords.contains(id);
}
static bool idContainsWrongLetter(const QString& id)
{
static QRegExp idExpr(QLatin1String("[a-z][a-zA-Z0-9_]*"));
......@@ -168,7 +177,7 @@ static bool idContainsWrongLetter(const QString& id)
bool ModelNode::isValidId(const QString &id)
{
return id.isEmpty() || !idContainsWrongLetter(id);
return id.isEmpty() || (!idContainsWrongLetter(id) && !idIsQmlKeyWord(id));
}
void ModelNode::setId(const QString& id)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment