QmlDesigner: Adjust regular expression

This is a heuristic to detect expressions and we should
require at least a single "." to distinguish true/false and simple
string literals.
The implcit binding detection is not ideal, because there are still false
positives.

Task-number: QDS-12888
Change-Id: I23b5dd44ff3150f6d5a4ec94bd7a19b5e2117f5b
Reviewed-by: Henning Gründl <henning.gruendl@qt.io>
(cherry picked from commit 8f58dc6de9)
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Thomas Hartmann
2024-06-05 17:14:47 +02:00
parent 9bab9a6a3e
commit 5ad657ff2c

View File

@@ -203,7 +203,7 @@ bool isBindingExpression(const QVariant &value)
if (value.metaType().id() != QMetaType::QString) if (value.metaType().id() != QMetaType::QString)
return false; return false;
QRegularExpression regexp("^[a-z_]\\w*|^[A-Z]\\w*\\.{1}([a-z_]\\w*\\.?)+"); QRegularExpression regexp("^[a-zA-Z_]\\w*\\.{1}([a-z_]\\w*\\.?)+");
QRegularExpressionMatch match = regexp.match(value.toString()); QRegularExpressionMatch match = regexp.match(value.toString());
return match.hasMatch(); return match.hasMatch();
} }