QmlDesigner: Fix regular expression

We have to use a non capturing group for the optional 'Id'.

Change-Id: I59431d78908a16f571febdf14c57bfe079ca6817
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Thomas Hartmann
2016-07-29 14:08:48 +02:00
committed by Tim Jenssen
parent ecbd1fa408
commit 7c3f61f819

View File

@@ -189,7 +189,7 @@ bool QmlObjectNode::isTranslatableText(const PropertyName &name) const
if (modelNode().metaInfo().isValid() && modelNode().metaInfo().hasProperty(name))
if (modelNode().metaInfo().propertyTypeName(name) == "QString" || modelNode().metaInfo().propertyTypeName(name) == "string") {
if (modelNode().hasBindingProperty(name)) {
static QRegExp regularExpressionPatter(QLatin1String("qsTr(|Id)\\((\".*\")\\)"));
static QRegExp regularExpressionPatter(QLatin1String("qsTr(?:|Id)\\((\".*\")\\)"));
return regularExpressionPatter.exactMatch(modelNode().bindingProperty(name).expression());
}
@@ -202,7 +202,7 @@ bool QmlObjectNode::isTranslatableText(const PropertyName &name) const
QString QmlObjectNode::stripedTranslatableText(const PropertyName &name) const
{
if (modelNode().hasBindingProperty(name)) {
static QRegExp regularExpressionPatter(QLatin1String("qsTr(|Id)\\(\"(.*)\"\\)"));
static QRegExp regularExpressionPatter(QLatin1String("qsTr(?:|Id)\\(\"(.*)\"\\)"));
if (regularExpressionPatter.exactMatch(modelNode().bindingProperty(name).expression()))
return regularExpressionPatter.cap(1);
} else {