diff options
| author | Ulf Hermann <ulf.hermann@qt.io> | 2023-01-17 17:13:08 +0100 |
|---|---|---|
| committer | Ulf Hermann <ulf.hermann@qt.io> | 2024-03-02 10:28:44 +0100 |
| commit | ccbfa4458357a1c49b6c192b96ef9440cdbaf397 (patch) | |
| tree | be8d18e85b683371e5caf4c7169cabbf604ed939 /src/qml/jsruntime/qv4engine.cpp | |
| parent | 5a85b92dd3f5bc0b7f0a753986d23a944fe2ab24 (diff) | |
QtQml: Make QLocale an actual value type
We want to be accessible to qmllint and other QML tooling. To this end,
make all legal invocations of its methods properly typed invokables.
Keep two QQmlV4Function overloads to produce error messages if the
methods are called with the wrong parameters. We have to do this because
JavaScript is more liberal in its argument coercion than the methods
would like.
Un-deprecate QJSNumberCoercion::isInteger() since it's actually quite
practical here.
Pick-to: 6.7
Fixes: QTBUG-112366
Change-Id: I016e5edc47efaade44461c504c1b3e2b1b829b58
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4engine.cpp')
| -rw-r--r-- | src/qml/jsruntime/qv4engine.cpp | 17 |
1 files changed, 0 insertions, 17 deletions
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp index 7e61e0c22d..6f91712bb4 100644 --- a/src/qml/jsruntime/qv4engine.cpp +++ b/src/qml/jsruntime/qv4engine.cpp @@ -1631,10 +1631,6 @@ static QVariant toVariant(const QV4::Value &value, QMetaType metaType, JSToQVari return str.at(0); return str; } -#if QT_CONFIG(qml_locale) - if (const QV4::QQmlLocaleData *ld = value.as<QV4::QQmlLocaleData>()) - return *ld->d()->locale; -#endif if (const QV4::DateObject *d = value.as<DateObject>()) { // NOTE: since we convert QTime to JS Date, // round trip will change the variant type (to QDateTime)! @@ -1864,10 +1860,6 @@ QV4::ReturnedValue ExecutionEngine::fromData( return QV4::JsonObject::fromJsonObject(this, *reinterpret_cast<const QJsonObject *>(ptr)); case QMetaType::QJsonArray: return QV4::JsonObject::fromJsonArray(this, *reinterpret_cast<const QJsonArray *>(ptr)); -#if QT_CONFIG(qml_locale) - case QMetaType::QLocale: - return QQmlLocale::wrap(this, *reinterpret_cast<const QLocale*>(ptr)); -#endif case QMetaType::QPixmap: case QMetaType::QImage: // Scarce value types @@ -2668,15 +2660,6 @@ bool ExecutionEngine::metaTypeFromJS(const Value &value, QMetaType metaType, voi } break; } -#if QT_CONFIG(qml_locale) - case QMetaType::QLocale: { - if (const QV4::QQmlLocaleData *l = value.as<QQmlLocaleData>()) { - *reinterpret_cast<QLocale *>(data) = *l->d()->locale; - return true; - } - break; - } -#endif default: break; } |
