diff options
author | Mitch Curtis <mitch.curtis@qt.io> | 2018-06-21 09:30:54 +0200 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@qt.io> | 2018-06-21 07:55:28 +0000 |
commit | d5fbbddd7794265f24d392d33c4874ac756cb9c9 (patch) | |
tree | ae39ab04ad28498316ad69066b605a6270056749 | |
parent | 6cf6594aa7bb6cdb84d0fca9df6c099b14d2affc (diff) |
QQuickSpinBox: Fix "function expressions as statements" warning
Surround the function with parentheses as suggested:
QWARN : tst_Snippets::verify(qtquickcontrols2-spinbox-custom) Warning: Using function expressions as statements in scripts is not compliant with the ECMAScript specification:
"function(value, locale) { return Number(value).toLocaleString(locale, ..."
This will throw a syntax error in Qt 5.12. If you want a function expression, surround it by parentheses.
Change-Id: I39df9af9b3dc62ffaf6fcba071c04c8933698c07
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
-rw-r--r-- | src/quicktemplates2/qquickspinbox.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/quicktemplates2/qquickspinbox.cpp b/src/quicktemplates2/qquickspinbox.cpp index 08c59cca..f1361330 100644 --- a/src/quicktemplates2/qquickspinbox.cpp +++ b/src/quicktemplates2/qquickspinbox.cpp @@ -619,7 +619,7 @@ QJSValue QQuickSpinBox::textFromValue() const if (!d->textFromValue.isCallable()) { QQmlEngine *engine = qmlEngine(this); if (engine) - d->textFromValue = engine->evaluate(QStringLiteral("function(value, locale) { return Number(value).toLocaleString(locale, 'f', 0); }")); + d->textFromValue = engine->evaluate(QStringLiteral("(function(value, locale) { return Number(value).toLocaleString(locale, 'f', 0); })")); } return d->textFromValue; } |