summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@nokia.com>2012-08-30 16:58:47 +0200
committerQt by Nokia <qt-info@nokia.com>2012-08-31 01:16:56 +0200
commitc2907968ed7eac9c8ee6b7615e57271476215dd4 (patch)
tree4a90e9924afe70fd02734d3123368a6d65f6b18c /src/corelib/tools
parent2e7f06c9bcae5bcaefb99750aabd5bb860948e77 (diff)
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 <frederik.gladhorn@nokia.com>
Diffstat (limited to 'src/corelib/tools')
-rw-r--r--src/corelib/tools/qdatetime_p.h13
1 files changed, 13 insertions, 0 deletions
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<SectionNode> sectionNodes;