summaryrefslogtreecommitdiffstats
path: root/src/corelib/text/qlocale.cpp
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@qt.io>2020-06-08 17:34:42 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2020-06-10 17:19:33 +0000
commit8728901f18e8bcc2c6551955fd30481f01e19159 (patch)
tree0f09b3e5f016d11317fca7d4e260fd97f0b03923 /src/corelib/text/qlocale.cpp
parent6e38c96fa0434b93a509c3540c7130a6cedd70f9 (diff)
Doc: Improve documentation for QLocale::FormatType
LongFormat and ShortFormat are not limited to day and month names. Different locales might also use numbers for months instead of strings, so the example is a bit misleading. Instead of extending the enum description even more there's now examples in the dateFormat(), timeFormat(), dateTimeFormat() functions. Task-number: QTBUG-83841 Change-Id: Icea2cbce7e9505d706a2171e7d1f4486abdb20be Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit 732c670590ae87b549ef0377d918bcb05e25fae4) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/corelib/text/qlocale.cpp')
-rw-r--r--src/corelib/text/qlocale.cpp29
1 files changed, 20 insertions, 9 deletions
diff --git a/src/corelib/text/qlocale.cpp b/src/corelib/text/qlocale.cpp
index 31ebe3c8ba..006b86e158 100644
--- a/src/corelib/text/qlocale.cpp
+++ b/src/corelib/text/qlocale.cpp
@@ -2058,7 +2058,7 @@ QString QLocale::toString(const QDate &date, QStringView format) const
/*!
Returns a localized string representation of the given \a date according
- to the specified \a format.
+ to the specified \a format (see dateFormat()).
\note Some locales may use formats that limit the range of years they can
represent.
@@ -2215,7 +2215,7 @@ QString QLocale::toString(const QDateTime &dateTime, QStringView format, QCalend
\since 4.4
Returns a localized string representation of the given \a dateTime according
- to the specified \a format.
+ to the specified \a format (see dateTimeFormat()).
\note Some locales may use formats that limit the range of years they can
represent.
@@ -2244,7 +2244,7 @@ QString QLocale::toString(const QDateTime &dateTime, FormatType format) const
/*!
Returns a localized string representation of the given \a time in the
- specified \a format.
+ specified \a format (see timeFormat()).
*/
QString QLocale::toString(const QTime &time, FormatType format) const
@@ -2272,8 +2272,9 @@ QString QLocale::toString(const QTime &time, FormatType format) const
Returns the date format used for the current locale.
- If \a format is LongFormat the format will be a long version.
- Otherwise it uses a shorter version.
+ If \a format is LongFormat, the format will be elaborate, otherwise it will be short.
+ For example, LongFormat for the \c{en_US} locale is \c{dddd, MMMM d, yyyy},
+ ShortFormat is \c{M/d/yy}.
\sa QDate::toString(), QDate::fromString()
*/
@@ -2310,8 +2311,9 @@ QString QLocale::dateFormat(FormatType format) const
Returns the time format used for the current locale.
- If \a format is LongFormat the format will be a long version.
- Otherwise it uses a shorter version.
+ If \a format is LongFormat, the format will be elaborate, otherwise it will be short.
+ For example, LongFormat for the \c{en_US} locale is \c{h:mm:ss AP t},
+ ShortFormat is \c{h:mm AP}.
\sa QTime::toString(), QTime::fromString()
*/
@@ -2348,8 +2350,9 @@ QString QLocale::timeFormat(FormatType format) const
Returns the date time format used for the current locale.
- If \a format is ShortFormat the format will be a short version.
- Otherwise it uses a longer version.
+ If \a format is LongFormat, the format will be elaborate, otherwise it will be short.
+ For example, LongFormat for the \c{en_US} locale is \c{dddd, MMMM d, yyyy h:mm:ss AP t},
+ ShortFormat is \c{M/d/yy h:mm AP}.
\sa QDateTime::toString(), QDateTime::fromString()
*/
@@ -2862,6 +2865,10 @@ QList<QLocale::Country> QLocale::countriesForLanguage(Language language)
Returns the localized name of \a month, in the format specified
by \a type.
+ For example, if the locale is \c en_US and \a month is 1,
+ \l LongFormat will return \c January. \l ShortFormat \c Jan,
+ and \l NarrowFormat \c J.
+
\sa dayName(), standaloneMonthName()
*/
QString QLocale::monthName(int month, FormatType type) const
@@ -2892,6 +2899,10 @@ QString QLocale::standaloneMonthName(int month, FormatType type) const
Monday, 2 represents Tuesday and so on), in the format specified
by \a type.
+ For example, if the locale is \c en_US and \a day is 1,
+ \l LongFormat will return \c Monday, \l ShortFormat \c Mon,
+ and \l NarrowFormat \c M.
+
\sa monthName(), standaloneDayName()
*/
QString QLocale::dayName(int day, FormatType type) const