From 97523204736eec58bac46f8894bffc190314fd85 Mon Sep 17 00:00:00 2001 From: Tasuku Suzuki Date: Sat, 11 Feb 2023 23:01:03 +0900 Subject: [PATCH] Fix build with -no-feature-qml-locale Pick-to: 6.5 Change-Id: I1e275c6258218f20b6ccb662d4af310f97163248 Reviewed-by: Ulf Hermann --- src/quicktemplates/qquickspinbox.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/quicktemplates/qquickspinbox.cpp b/src/quicktemplates/qquickspinbox.cpp index 62d382590f..5d98514746 100644 --- a/src/quicktemplates/qquickspinbox.cpp +++ b/src/quicktemplates/qquickspinbox.cpp @@ -10,7 +10,9 @@ #include #include +#if QT_CONFIG(qml_locale) #include +#endif #include #include @@ -155,8 +157,11 @@ void QQuickSpinBoxPrivate::updateValue() int val = 0; QQmlEngine *engine = qmlEngine(q); if (engine && valueFromText.isCallable()) { + QJSValue loc; +#if QT_CONFIG(qml_locale) QV4::ExecutionEngine *v4 = QQmlEnginePrivate::getV4Engine(engine); - QJSValue loc = QJSValuePrivate::fromReturnedValue(QQmlLocale::wrap(v4, locale)); + loc = QJSValuePrivate::fromReturnedValue(QQmlLocale::wrap(v4, locale)); +#endif val = valueFromText.call(QJSValueList() << text.toString() << loc).toInt(); } else { val = locale.toInt(text.toString()); @@ -223,8 +228,11 @@ void QQuickSpinBoxPrivate::updateDisplayText(bool modified) QString text; QQmlEngine *engine = qmlEngine(q); if (engine && textFromValue.isCallable()) { + QJSValue loc; +#if QT_CONFIG(qml_locale) QV4::ExecutionEngine *v4 = QQmlEnginePrivate::getV4Engine(engine); - QJSValue loc = QJSValuePrivate::fromReturnedValue(QQmlLocale::wrap(v4, locale)); + loc = QJSValuePrivate::fromReturnedValue(QQmlLocale::wrap(v4, locale)); +#endif text = textFromValue.call(QJSValueList() << value << loc).toString(); } else { text = locale.toString(value);