Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
699ff228
Commit
699ff228
authored
Sep 27, 2010
by
Thomas Hartmann
Browse files
QmlDesigner.Model: check ids for qml keywords
ids are now checked if they are a qml keyword
parent
2e80355e
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/plugins/qmldesigner/designercore/model/modelnode.cpp
View file @
699ff228
...
...
@@ -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
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment