diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2019-12-02 16:38:31 +0100 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2019-12-05 07:31:30 +0000 |
commit | ab7f591a6b18a0a2a03b760fbd6a7fbb53189c72 (patch) | |
tree | 0124b56839350bb882523651bd5cfd30022038a5 /src/qml/qml/qqmllocale_p.h | |
parent | 6ad3445f1e159d9beea936b66d267dcaacdc5d6c (diff) |
Locale: expose NumberOptions to QML
As we want to specify how DoubleValidator and fromLocaleString handle
number separators, we need to expose NumberOptions to QML.
The referenced bug report is still unsolved, as we we still lack a method
to change DoubleValidator's behavior and NumberOptions does not have a
value to ignore occurrences of separators at arbitray places.
Task-number: QTBUG-75110
Change-Id: I81f48439114cad12e0e977bab09b0aa4e240fbab
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml/qml/qqmllocale_p.h')
-rw-r--r-- | src/qml/qml/qqmllocale_p.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/qml/qml/qqmllocale_p.h b/src/qml/qml/qqmllocale_p.h index 10e0dfcc38..1d6fdb12a7 100644 --- a/src/qml/qml/qqmllocale_p.h +++ b/src/qml/qml/qqmllocale_p.h @@ -131,6 +131,16 @@ public: Saturday = Qt::Saturday }; Q_ENUM(DayOfWeek) + enum NumberOptions { + DefaultNumberOptions = QLocale::DefaultNumberOptions, + OmitGroupSeparator = QLocale::OmitGroupSeparator, + RejectGroupSeparator = QLocale::RejectGroupSeparator, + OmitLeadingZeroInExponent = QLocale::OmitLeadingZeroInExponent, + RejectLeadingZeroInExponent = QLocale::RejectLeadingZeroInExponent, + IncludeTrailingZeroesAfterDot = QLocale::IncludeTrailingZeroesAfterDot, + RejectTrailingZeroesAfterDot = QLocale::RejectTrailingZeroesAfterDot + }; + Q_ENUM(NumberOptions) static QV4::ReturnedValue locale(QV4::ExecutionEngine *engine, const QString &localeName); static QV4::ReturnedValue wrap(QV4::ExecutionEngine *engine, const QLocale &locale); @@ -200,6 +210,9 @@ struct QQmlLocaleData : public QV4::Object static QV4::ReturnedValue method_get_exponential(const QV4::FunctionObject *, const QV4::Value *thisObject, const QV4::Value *argv, int argc); static QV4::ReturnedValue method_get_amText(const QV4::FunctionObject *, const QV4::Value *thisObject, const QV4::Value *argv, int argc); static QV4::ReturnedValue method_get_pmText(const QV4::FunctionObject *, const QV4::Value *thisObject, const QV4::Value *argv, int argc); + + static QV4::ReturnedValue method_get_numberOptions(const QV4::FunctionObject *, const QV4::Value *thisObject, const QV4::Value *argv, int argc); + static QV4::ReturnedValue method_set_numberOptions(const QV4::FunctionObject *, const QV4::Value *thisObject, const QV4::Value *argv, int argc); }; } |