diff options
author | Lars Knoll <lars.knoll@qt.io> | 2019-12-11 12:47:39 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2020-04-01 09:29:26 +0100 |
commit | 66f06a930da0114f62a5470e778182c50117ad27 (patch) | |
tree | 0c6ab19aea2142838c7237090aace3c02bc4a6d7 /src | |
parent | 098d2edb07e08da6485fee4efbea72f43ddc766e (diff) |
Make QLocale(QString) explicit
We should not implicitly convert a QString to a QLocale object. It can
easily create unwanted side effects.
Change-Id: I7bd9b4a4e4512c0e60176ee4d241d172f00fdc32
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/text/qlocale.h | 2 | ||||
-rw-r--r-- | src/corelib/time/qtimezoneprivate_icu.cpp | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/corelib/text/qlocale.h b/src/corelib/text/qlocale.h index 3f1a8f2679..ca2b5a007f 100644 --- a/src/corelib/text/qlocale.h +++ b/src/corelib/text/qlocale.h @@ -941,7 +941,7 @@ public: Q_FLAG(DataSizeFormats) QLocale(); - QLocale(const QString &name); + explicit QLocale(const QString &name); QLocale(Language language, Country country = AnyCountry); QLocale(Language language, Script script, Country country); QLocale(const QLocale &other); diff --git a/src/corelib/time/qtimezoneprivate_icu.cpp b/src/corelib/time/qtimezoneprivate_icu.cpp index 8a92bbb387..33518994d1 100644 --- a/src/corelib/time/qtimezoneprivate_icu.cpp +++ b/src/corelib/time/qtimezoneprivate_icu.cpp @@ -347,9 +347,9 @@ QString QIcuTimeZonePrivate::abbreviation(qint64 atMSecsSinceEpoch) const { // TODO No ICU API, use short name instead if (isDaylightTime(atMSecsSinceEpoch)) - return displayName(QTimeZone::DaylightTime, QTimeZone::ShortName, QString()); + return displayName(QTimeZone::DaylightTime, QTimeZone::ShortName, QLocale()); else - return displayName(QTimeZone::StandardTime, QTimeZone::ShortName, QString()); + return displayName(QTimeZone::StandardTime, QTimeZone::ShortName, QLocale()); } int QIcuTimeZonePrivate::offsetFromUtc(qint64 atMSecsSinceEpoch) const |