diff options
author | J-P Nurmi <jpnurmi@theqtcompany.com> | 2015-09-23 20:01:40 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@theqtcompany.com> | 2015-09-25 16:30:47 +0000 |
commit | d703de8752e07cb12e8ce2e2a05d608f2b26425a (patch) | |
tree | 828ef61dd89e13c9af7896e0e63a935ebd68c4ac /src/imports/calendar/qquickcalendarmodel.cpp | |
parent | e085574cd87c0faf99a79fee755a678347fcb540 (diff) |
Initial QtQuick.Calendar docs
The overview is still missing.
Change-Id: I081f1684b64fc8b95f59844b8373293523181266
Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
Diffstat (limited to 'src/imports/calendar/qquickcalendarmodel.cpp')
-rw-r--r-- | src/imports/calendar/qquickcalendarmodel.cpp | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/src/imports/calendar/qquickcalendarmodel.cpp b/src/imports/calendar/qquickcalendarmodel.cpp index c1386ed0..39e0c118 100644 --- a/src/imports/calendar/qquickcalendarmodel.cpp +++ b/src/imports/calendar/qquickcalendarmodel.cpp @@ -40,6 +40,29 @@ QT_BEGIN_NAMESPACE +/*! + \qmltype CalendarModel + \inherits QAbstractListModel + \instantiates QQuickCalendarModel + \inqmlmodule QtQuick.Calendar + \brief A calendar model. + + CalendarModel provides a way of creating a range of CalendarView + instances. It is typically used as a model for a ListView that uses + CalendarView as a delegate. + + \snippet calendarmodel/qtquickcalendar2-calendarmodel.qml 1 + + In addition to the \c index property, a list of model data roles + are available in the context of each delegate: + \table + \row \li \b model.month : int \li The number of the month + \row \li \b model.year : int \li The number of the year + \endtable + + \sa CalendarView +*/ + class QQuickCalendarModelPrivate : public QAbstractItemModelPrivate { Q_DECLARE_PUBLIC(QQuickCalendarModel) @@ -92,6 +115,11 @@ QQuickCalendarModel::QQuickCalendarModel(QObject *parent) : { } +/*! + \qmlproperty date QtQuick.Calendar::CalendarModel::from + + This property holds the start date. +*/ QDate QQuickCalendarModel::from() const { Q_D(const QQuickCalendarModel); @@ -109,6 +137,11 @@ void QQuickCalendarModel::setFrom(const QDate &from) } } +/*! + \qmlproperty date QtQuick.Calendar::CalendarModel::to + + This property holds the end date. +*/ QDate QQuickCalendarModel::to() const { Q_D(const QQuickCalendarModel); @@ -126,23 +159,43 @@ void QQuickCalendarModel::setTo(const QDate &to) } } +/*! + \qmlmethod int QtQuick.Calendar::CalendarModel::monthAt(int index) + + Returns the month number at the specified model \a index. +*/ int QQuickCalendarModel::monthAt(int index) const { Q_D(const QQuickCalendarModel); return d->from.addMonths(index).month(); } +/*! + \qmlmethod int QtQuick.Calendar::CalendarModel::yearAt(int index) + + Returns the year number at the specified model \a index. +*/ int QQuickCalendarModel::yearAt(int index) const { Q_D(const QQuickCalendarModel); return d->from.addMonths(index).year(); } +/*! + \qmlmethod int QtQuick.Calendar::CalendarModel::indexOf(Date date) + + Returns the model index of the specified \a date. +*/ int QQuickCalendarModel::indexOf(const QDate &date) const { return indexOf(date.year(), date.month()); } +/*! + \qmlmethod int QtQuick.Calendar::CalendarModel::indexOf(int year, int month) + + Returns the model index of the specified \a year and \a month. +*/ int QQuickCalendarModel::indexOf(int year, int month) const { Q_D(const QQuickCalendarModel); |