summaryrefslogtreecommitdiffstats
path: root/src/controls/Private/qquickcalendarmodel_p.h
diff options
context:
space:
mode:
authorOleg Yadrov <oleg.yadrov@qt.io>2017-12-11 16:25:45 -0200
committerMitch Curtis <mitch.curtis@qt.io>2017-12-15 09:42:37 +0000
commit15c909f4170450cdbe01218a0d7cbea55b70fae5 (patch)
tree2d6488db691b6f006327510ae358f2e33b06c148 /src/controls/Private/qquickcalendarmodel_p.h
parent37592ad9c6df35bdd37609569963fe7361cdad85 (diff)
Calendar: fix bug when NaN is displayed instead of date
I fixed a similar issue last year on the JavaScript side: 094ad30c94a72784449f43ef06d2172d644ab0fd At this time the same thing has been happening in C++. See QTBUG-54559 and the patch for a detailed explanation of the issue. In short, the problem with Calendar is that internally it uses QDate which does not keep information about time, whereas in the JavaScript world date is always combined with time. So, QDate(2017-10-15) is valid, but when during QDate -> JS Date transformation we add time to it (which defaults to midnight (00:00)), it becomes invalid in time zones where the Daylight Saving Time -> Standard Time transition takes place at midnight. To avoid switching the entire QQuickCalendarModel1 to using QDateTime, I modified its date(...) and dateAt(...) methods to return QDateTime with the time part always set to 12:00. That transformation required more changes in QQuickRangedDate1, because Calendar::selectedDate internally is QQuickRangedDate1::selectedDate, and I also had to fix "selected" property binding in the Base Calendar Style as it did take into account the time part of the date, which resulted in wrong behavior with my changes. Task-number: QTBUG-64068 Change-Id: Ia2f7703ff4e5811ef79438c97739da1d8001a7f5 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Diffstat (limited to 'src/controls/Private/qquickcalendarmodel_p.h')
-rw-r--r--src/controls/Private/qquickcalendarmodel_p.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/controls/Private/qquickcalendarmodel_p.h b/src/controls/Private/qquickcalendarmodel_p.h
index cb47c5766..99ae94236 100644
--- a/src/controls/Private/qquickcalendarmodel_p.h
+++ b/src/controls/Private/qquickcalendarmodel_p.h
@@ -75,7 +75,7 @@ public:
QHash<int, QByteArray> roleNames() const Q_DECL_OVERRIDE;
- Q_INVOKABLE QDate dateAt(int index) const;
+ Q_INVOKABLE QDateTime dateAt(int index) const;
Q_INVOKABLE int indexAt(const QDate &visibleDate);
Q_INVOKABLE int weekNumberAt(int row) const;