diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2020-01-28 16:26:49 +0100 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2020-01-30 09:51:44 +0100 |
commit | c5f78add12b7d33926631b6df79599df18f65068 (patch) | |
tree | 08a895aa76440a4b267b1f6f500ea11e2722e19d /tests/auto/qml/qqmlqt/data | |
parent | e080f48f905be597b1a645f1641b2b06553df6a2 (diff) |
Reduce Qt Declarative's use of QDateTime's locale-dependent APIs
[ChangeLog][QtQml] Qt.formatDateTime, Qt.formatDate and Qt.formatTime
now support formatting according to a locale and an optional locale
format type. If locale dependent formatting is desired, this method
should be used instead of the locale-related DateFormat enum members.
Fixes: QTBUG-81631
Change-Id: I971231644ebbeaccbf54dd8f036adf4d31547301
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmlqt/data')
-rw-r--r-- | tests/auto/qml/qqmlqt/data/formattingLocale.qml | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlqt/data/formattingLocale.qml b/tests/auto/qml/qqmlqt/data/formattingLocale.qml new file mode 100644 index 0000000000..9da349b101 --- /dev/null +++ b/tests/auto/qml/qqmlqt/data/formattingLocale.qml @@ -0,0 +1,12 @@ +import QtQml 2.15 + +QtObject { + required property var myDateTime + required property var myDate + property var myTime + + property string dateTimeString: Qt.formatDateTime(myDateTime, Qt.locale("de_DE"), Locale.NarrowFormat) + property string dateString: Qt.formatDate(myDate, Qt.locale("de_DE")) + + function invalidUsage() { Qt.formatTime(myTime, null, "hello") } +} |