QDate::shortMonthName: remove faulty month test
QLocale already takes care of validating the month inputs, so no need to spend cycles and binary size for the invalid case. This commit also removes the check from QDate::longMonthName and the day name functions so that all functions remain similar. Task-number: QTBUG-61399 Change-Id: Ia53158e207a94bf49489fffd14c7bd8b121dd132 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
parent
fffbdb4c37
commit
e7f962d271
@ -645,13 +645,11 @@ int QDate::weekNumber(int *yearNumber) const
|
||||
|
||||
QString QDate::shortMonthName(int month, QDate::MonthNameType type)
|
||||
{
|
||||
if (month >= 1 || month <= 12) {
|
||||
switch (type) {
|
||||
case QDate::DateFormat:
|
||||
return QLocale::system().monthName(month, QLocale::ShortFormat);
|
||||
case QDate::StandaloneFormat:
|
||||
return QLocale::system().standaloneMonthName(month, QLocale::ShortFormat);
|
||||
}
|
||||
switch (type) {
|
||||
case QDate::DateFormat:
|
||||
return QLocale::system().monthName(month, QLocale::ShortFormat);
|
||||
case QDate::StandaloneFormat:
|
||||
return QLocale::system().standaloneMonthName(month, QLocale::ShortFormat);
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
@ -689,13 +687,11 @@ QString QDate::shortMonthName(int month, QDate::MonthNameType type)
|
||||
|
||||
QString QDate::longMonthName(int month, MonthNameType type)
|
||||
{
|
||||
if (month >= 1 && month <= 12) {
|
||||
switch (type) {
|
||||
case QDate::DateFormat:
|
||||
return QLocale::system().monthName(month, QLocale::LongFormat);
|
||||
case QDate::StandaloneFormat:
|
||||
return QLocale::system().standaloneMonthName(month, QLocale::LongFormat);
|
||||
}
|
||||
switch (type) {
|
||||
case QDate::DateFormat:
|
||||
return QLocale::system().monthName(month, QLocale::LongFormat);
|
||||
case QDate::StandaloneFormat:
|
||||
return QLocale::system().standaloneMonthName(month, QLocale::LongFormat);
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
@ -728,13 +724,11 @@ QString QDate::longMonthName(int month, MonthNameType type)
|
||||
|
||||
QString QDate::shortDayName(int weekday, MonthNameType type)
|
||||
{
|
||||
if (weekday >= 1 && weekday <= 7) {
|
||||
switch (type) {
|
||||
case QDate::DateFormat:
|
||||
return QLocale::system().dayName(weekday, QLocale::ShortFormat);
|
||||
case QDate::StandaloneFormat:
|
||||
return QLocale::system().standaloneDayName(weekday, QLocale::ShortFormat);
|
||||
}
|
||||
switch (type) {
|
||||
case QDate::DateFormat:
|
||||
return QLocale::system().dayName(weekday, QLocale::ShortFormat);
|
||||
case QDate::StandaloneFormat:
|
||||
return QLocale::system().standaloneDayName(weekday, QLocale::ShortFormat);
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
@ -767,13 +761,11 @@ QString QDate::shortDayName(int weekday, MonthNameType type)
|
||||
|
||||
QString QDate::longDayName(int weekday, MonthNameType type)
|
||||
{
|
||||
if (weekday >= 1 && weekday <= 7) {
|
||||
switch (type) {
|
||||
case QDate::DateFormat:
|
||||
return QLocale::system().dayName(weekday, QLocale::LongFormat);
|
||||
case QDate::StandaloneFormat:
|
||||
return QLocale::system().standaloneDayName(weekday, QLocale::LongFormat);
|
||||
}
|
||||
switch (type) {
|
||||
case QDate::DateFormat:
|
||||
return QLocale::system().dayName(weekday, QLocale::LongFormat);
|
||||
case QDate::StandaloneFormat:
|
||||
return QLocale::system().standaloneDayName(weekday, QLocale::LongFormat);
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user