Convert QML CalendarModel to C++ QQuickCalendarModel.
authorMitch Curtis <mitch.curtis@digia.com>
Tue, 14 Jan 2014 15:53:59 +0000 (16:53 +0100)
committerMitch Curtis <mitch.curtis@digia.com>
Fri, 17 Jan 2014 09:43:33 +0000 (10:43 +0100)
commit22b25716e3e5b61ba79e615b7f956f972aa6ad00
treeb6420372735ae17f9c21254a3d3abbda8885d54e
parentdfb401ea27b4bb5a9ab430cdeacb47256fc69451
Convert QML CalendarModel to C++ QQuickCalendarModel.

This makes the model property private. The motivation behind this is:

1) We don't want to expose C++ classes in Qt Quick Controls.
2) Given 1), an alternative that allows users to use their own custom
   models for the Calendar involves:
   - Making the model property a var that accepts any type of model
     that provides a DateRole.
   - Having two functions in Calendar: indexAt(date) and dateAt(index),
     which any custom models have to implement if they use a different
     indexing system than QQuickCalendarModel's.
   - Forcing the user to populate their own dates. This shouldn't
     happen, as the code to do it is almost always going to be the same.
   It ends up being ugly. Instead, if users want to integrate things
   like events into their Calendar, they should store their own model
   for that separately; the styling code supports this. An example
   demonstrating this will be added later.

Change-Id: I79ffb354ac26b42882f3352df4342d3fa1203832
Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
13 files changed:
src/controls/Calendar.qml
src/controls/CalendarHeaderModel.qml
src/controls/CalendarModel.qml [deleted file]
src/controls/Private/DateUtils.js
src/controls/Private/private.pri
src/controls/Private/qquickcalendarmodel.cpp [new file with mode: 0644]
src/controls/Private/qquickcalendarmodel_p.h [new file with mode: 0644]
src/controls/Private/qquickrangeddate_p.h
src/controls/Styles/Base/CalendarStyle.qml
src/controls/Styles/Desktop/CalendarStyle.qml
src/controls/controls.pro
src/controls/plugin.cpp
tests/auto/controls/data/tst_calendar.qml