From c671e66802b75b511ad85347c70f6193134d81ca Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Mon, 18 Jan 2016 17:14:17 +0100 Subject: QDateTimeParser: mediate QLocale's meddling via a setter. The former has (for now) nothing private, so QLocale got away with setting its .defaultLocale explicitly; provide a setter method by which it can do that, to allow scope for later encapsulation. Change-Id: I77fc5fc8f868fc7cf8d51eb1c5d18926c61cbf78 Reviewed-by: Marc Mutz --- src/corelib/tools/qdatetimeparser_p.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/corelib/tools/qdatetimeparser_p.h') diff --git a/src/corelib/tools/qdatetimeparser_p.h b/src/corelib/tools/qdatetimeparser_p.h index 257cb6e2cc..d6c4d615db 100644 --- a/src/corelib/tools/qdatetimeparser_p.h +++ b/src/corelib/tools/qdatetimeparser_p.h @@ -218,6 +218,7 @@ public: FieldInfo fieldInfo(int index) const; + void setDefaultLocale(const QLocale &loc) { defaultLocale = loc; } virtual QDateTime getMinimum() const; virtual QDateTime getMaximum() const; virtual int cursorPosition() const { return -1; } -- cgit v1.2.3 From fd5720af2cb1e641c433c73fd977c8ba9d278305 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Wed, 20 Jan 2016 09:42:34 +0100 Subject: QDateTimeParser: new Section mask values simplify code. Various |s of existing section flags were used repeatedly; naming these masks makes the relevant code easier to read. In QDateTimeEdit, add a comment to make clear that its Section enum is based on QDTP's. Change-Id: Ifd8364cd396a6d0d5ed7ae7dc4d31690f77edd30 Reviewed-by: Marc Mutz --- src/corelib/tools/qdatetimeparser_p.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/corelib/tools/qdatetimeparser_p.h') diff --git a/src/corelib/tools/qdatetimeparser_p.h b/src/corelib/tools/qdatetimeparser_p.h index d6c4d615db..90c6a8acba 100644 --- a/src/corelib/tools/qdatetimeparser_p.h +++ b/src/corelib/tools/qdatetimeparser_p.h @@ -114,14 +114,20 @@ public: MinuteSection = 0x00008, Hour12Section = 0x00010, Hour24Section = 0x00020, - TimeSectionMask = (AmPmSection|MSecSection|SecondSection|MinuteSection|Hour12Section|Hour24Section), + HourSectionMask = (Hour12Section | Hour24Section), + TimeSectionMask = (MSecSection | SecondSection | MinuteSection | + HourSectionMask | AmPmSection), + DaySection = 0x00100, MonthSection = 0x00200, YearSection = 0x00400, YearSection2Digits = 0x00800, + YearSectionMask = YearSection | YearSection2Digits, DayOfWeekSectionShort = 0x01000, DayOfWeekSectionLong = 0x02000, - DateSectionMask = (DaySection|MonthSection|YearSection|YearSection2Digits|DayOfWeekSectionShort|DayOfWeekSectionLong), + DayOfWeekSectionMask = DayOfWeekSectionShort | DayOfWeekSectionLong, + DaySectionMask = DaySection | DayOfWeekSectionMask, + DateSectionMask = DaySectionMask | MonthSection | YearSectionMask, Internal = 0x10000, FirstSection = 0x20000 | Internal, @@ -132,7 +138,7 @@ public: FirstSectionIndex = -2, LastSectionIndex = -3, CalendarPopupIndex = -4 - }; // duplicated from qdatetimeedit.h + }; // extending qdatetimeedit.h's equivalent Q_DECLARE_FLAGS(Sections, Section) struct Q_CORE_EXPORT SectionNode { -- cgit v1.2.3