diff options
author | Mitch Curtis <mitch.curtis@nokia.com> | 2012-08-29 12:58:35 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-09-05 21:06:51 +0200 |
commit | 903903147924641a84e62432037b006c6bf541b7 (patch) | |
tree | b28a75a14b67ab7b092f2689e32868e8ca396aaa /src/widgets/widgets/qdatetimeedit.cpp | |
parent | 2b562b756401da02017ec937fd2716dd6b9863d3 (diff) |
Fix QDateEdit displaying day as a number for short and long day formats
When 2 (February) is entered as the month for (e.g.) 31/Jan/2000 (which
is following the format: "dd/MMM/yyyy"), the day is corrected to 29 but
displayed as its numerical value instead of its short (or long) name.
Task-number: QTBUG-27036 QTBUG-19091
Change-Id: I558ee13b224707d22b26c2ec2c045f96118bd5a1
Reviewed-by: Mitch Curtis <mitch.curtis@nokia.com>
Reviewed-by: aavit <qt_aavit@ovi.com>
Diffstat (limited to 'src/widgets/widgets/qdatetimeedit.cpp')
-rw-r--r-- | src/widgets/widgets/qdatetimeedit.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/widgets/widgets/qdatetimeedit.cpp b/src/widgets/widgets/qdatetimeedit.cpp index b339e041cb..82edb4bba5 100644 --- a/src/widgets/widgets/qdatetimeedit.cpp +++ b/src/widgets/widgets/qdatetimeedit.cpp @@ -2046,7 +2046,7 @@ QDateTime QDateTimeEditPrivate::stepBy(int sectionIndex, int steps, bool test) c // doesn't mean that we hit the floor in the other if (steps > 0) { setDigit(v, sectionIndex, min); - if (!(sn.type & (DaySection|DayOfWeekSection)) && sections & DateSectionMask) { + if (!(sn.type & (DaySection|DayOfWeekSectionShort|DayOfWeekSectionLong)) && sections & DateSectionMask) { const int daysInMonth = v.date().daysInMonth(); if (v.date().day() < oldDay && v.date().day() < daysInMonth) { const int adds = qMin(oldDay, daysInMonth); @@ -2061,7 +2061,7 @@ QDateTime QDateTimeEditPrivate::stepBy(int sectionIndex, int steps, bool test) c } } else { setDigit(v, sectionIndex, max); - if (!(sn.type & (DaySection|DayOfWeekSection)) && sections & DateSectionMask) { + if (!(sn.type & (DaySection|DayOfWeekSectionShort|DayOfWeekSectionLong)) && sections & DateSectionMask) { const int daysInMonth = v.date().daysInMonth(); if (v.date().day() < oldDay && v.date().day() < daysInMonth) { const int adds = qMin(oldDay, daysInMonth); @@ -2079,7 +2079,7 @@ QDateTime QDateTimeEditPrivate::stepBy(int sectionIndex, int steps, bool test) c setDigit(v, sectionIndex, (steps > 0 ? localmax : localmin)); } } - if (!test && oldDay != v.date().day() && !(sn.type & (DaySection|DayOfWeekSection))) { + if (!test && oldDay != v.date().day() && !(sn.type & (DaySection|DayOfWeekSectionShort|DayOfWeekSectionLong))) { // this should not happen when called from stepEnabled cachedDay = qMax<int>(oldDay, cachedDay); } @@ -2247,7 +2247,8 @@ QDateTimeEdit::Section QDateTimeEditPrivate::convertToPublic(QDateTimeParser::Se case MSecSection: return QDateTimeEdit::MSecSection; case SecondSection: return QDateTimeEdit::SecondSection; case MinuteSection: return QDateTimeEdit::MinuteSection; - case DayOfWeekSection: + case DayOfWeekSectionShort: + case DayOfWeekSectionLong: case DaySection: return QDateTimeEdit::DaySection; case MonthSection: return QDateTimeEdit::MonthSection; case YearSection2Digits: @@ -2274,7 +2275,7 @@ QDateTimeEdit::Sections QDateTimeEditPrivate::convertSections(QDateTimeParser::S ret |= QDateTimeEdit::HourSection; if (s & QDateTimeParser::AmPmSection) ret |= QDateTimeEdit::AmPmSection; - if (s & (QDateTimeParser::DaySection|QDateTimeParser::DayOfWeekSection)) + if (s & (QDateTimeParser::DaySection|QDateTimeParser::DayOfWeekSectionShort|QDateTimeParser::DayOfWeekSectionLong)) ret |= QDateTimeEdit::DaySection; if (s & QDateTimeParser::MonthSection) ret |= QDateTimeEdit::MonthSection; |