From c2907968ed7eac9c8ee6b7615e57271476215dd4 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Thu, 30 Aug 2012 16:58:47 +0200 Subject: [PATCH] Document the purpose of QDateTimeParser::cachedDay. It's useful to know what this member variable is used for, since there is very little documentation for QDateTimeParser, which makes maintenance yucky. Change-Id: I9ecf5aa5ef0b5d778ceb858c323e3bab1ebaa7dc Reviewed-by: Frederik Gladhorn --- src/corelib/tools/qdatetime_p.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/corelib/tools/qdatetime_p.h b/src/corelib/tools/qdatetime_p.h index fa897121f6..3861a731d9 100644 --- a/src/corelib/tools/qdatetime_p.h +++ b/src/corelib/tools/qdatetime_p.h @@ -254,6 +254,19 @@ public: mutable int currentSectionIndex; Sections display; + /* + This stores the stores the most recently selected day. + It is useful when considering the following scenario: + + 1. Date is: 31/01/2000 + 2. User increments month: 29/02/2000 + 3. User increments month: 31/03/2000 + + At step 1, cachedDay stores 31. At step 2, the 31 is invalid for February, so the cachedDay is not updated. + At step 3, the the month is changed to March, for which 31 is a valid day. Since 29 < 31, the day is set to cachedDay. + This is good for when users have selected their desired day and are scrolling up or down in the month or year section + and do not want smaller months (or non-leap years) to alter the day that they chose. + */ mutable int cachedDay; mutable QString text; QVector sectionNodes;