aboutsummaryrefslogtreecommitdiffstats
path: root/src/calendar
diff options
context:
space:
mode:
Diffstat (limited to 'src/calendar')
-rw-r--r--src/calendar/calendar.pri19
-rw-r--r--src/calendar/calendar.pro14
-rw-r--r--src/calendar/qquickabstractcalendarview.cpp255
-rw-r--r--src/calendar/qquickabstractcalendarview_p.h101
-rw-r--r--src/calendar/qquickabstractdayofweekrow.cpp87
-rw-r--r--src/calendar/qquickabstractdayofweekrow_p.h73
-rw-r--r--src/calendar/qquickabstractweeknumbercolumn.cpp113
-rw-r--r--src/calendar/qquickabstractweeknumbercolumn_p.h83
-rw-r--r--src/calendar/qquickcalendarmodel.cpp195
-rw-r--r--src/calendar/qquickcalendarmodel_p.h96
-rw-r--r--src/calendar/qquickdayofweekmodel.cpp123
-rw-r--r--src/calendar/qquickdayofweekmodel_p.h83
-rw-r--r--src/calendar/qquickmonthmodel.cpp224
-rw-r--r--src/calendar/qquickmonthmodel_p.h102
-rw-r--r--src/calendar/qquickweeknumbermodel.cpp182
-rw-r--r--src/calendar/qquickweeknumbermodel_p.h91
-rw-r--r--src/calendar/qtquickcalendarglobal_p.h56
17 files changed, 1897 insertions, 0 deletions
diff --git a/src/calendar/calendar.pri b/src/calendar/calendar.pri
new file mode 100644
index 00000000..67267388
--- /dev/null
+++ b/src/calendar/calendar.pri
@@ -0,0 +1,19 @@
+INCLUDEPATH += $$PWD
+
+HEADERS += \
+ $$PWD/qquickabstractcalendarview_p.h \
+ $$PWD/qquickabstractdayofweekrow_p.h \
+ $$PWD/qquickabstractweeknumbercolumn_p.h \
+ $$PWD/qquickcalendarmodel_p.h \
+ $$PWD/qquickdayofweekmodel_p.h \
+ $$PWD/qquickmonthmodel_p.h \
+ $$PWD/qquickweeknumbermodel_p.h
+
+SOURCES += \
+ $$PWD/qquickabstractcalendarview.cpp \
+ $$PWD/qquickabstractdayofweekrow.cpp \
+ $$PWD/qquickabstractweeknumbercolumn.cpp \
+ $$PWD/qquickcalendarmodel.cpp \
+ $$PWD/qquickdayofweekmodel.cpp \
+ $$PWD/qquickmonthmodel.cpp \
+ $$PWD/qquickweeknumbermodel.cpp
diff --git a/src/calendar/calendar.pro b/src/calendar/calendar.pro
new file mode 100644
index 00000000..e1f3af78
--- /dev/null
+++ b/src/calendar/calendar.pro
@@ -0,0 +1,14 @@
+TARGET = QtQuickCalendar
+MODULE = quickcalendar
+CONFIG += internal_module
+
+QT += quick
+QT += core-private gui-private qml-private quick-private quickcontrols-private
+
+DEFINES += QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_ASCII
+
+HEADERS += \
+ $$PWD/qtquickcalendarglobal_p.h
+
+include(calendar.pri)
+load(qt_module)
diff --git a/src/calendar/qquickabstractcalendarview.cpp b/src/calendar/qquickabstractcalendarview.cpp
new file mode 100644
index 00000000..c076cc0c
--- /dev/null
+++ b/src/calendar/qquickabstractcalendarview.cpp
@@ -0,0 +1,255 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Calendar module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickabstractcalendarview_p.h"
+#include "qquickmonthmodel_p.h"
+
+#include <QtGui/qstylehints.h>
+#include <QtGui/qguiapplication.h>
+#include <QtQuickControls/private/qquickabstractcontainer_p_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickAbstractCalendarViewPrivate : public QQuickAbstractContainerPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickAbstractCalendarView)
+
+public:
+ QQuickAbstractCalendarViewPrivate() : pressTimer(0), pressedItem(Q_NULLPTR), model(Q_NULLPTR) { }
+
+ QQuickItem *cellAt(const QPoint &pos) const;
+ QDate dateOf(QQuickItem *cell) const;
+
+ void updatePress(const QPoint &pos);
+ void clearPress(bool clicked);
+
+ static void setContextProperty(QQuickItem *item, const QString &name, const QVariant &value);
+
+ QString title;
+ QVariant source;
+ QDate pressedDate;
+ int pressTimer;
+ QQuickItem *pressedItem;
+ QQuickMonthModel *model;
+};
+
+QQuickItem *QQuickAbstractCalendarViewPrivate::cellAt(const QPoint &pos) const
+{
+ Q_Q(const QQuickAbstractCalendarView);
+ if (contentItem) {
+ QPointF mapped = q->mapToItem(contentItem, pos);
+ return contentItem->childAt(mapped.x(), mapped.y());
+ }
+ return Q_NULLPTR;
+}
+
+QDate QQuickAbstractCalendarViewPrivate::dateOf(QQuickItem *cell) const
+{
+ if (contentItem)
+ return model->dateAt(contentItem->childItems().indexOf(cell));
+ return QDate();
+}
+
+void QQuickAbstractCalendarViewPrivate::updatePress(const QPoint &pos)
+{
+ Q_Q(QQuickAbstractCalendarView);
+ clearPress(false);
+ pressedItem = cellAt(pos);
+ setContextProperty(pressedItem, QStringLiteral("pressed"), true);
+ pressedDate = dateOf(pressedItem);
+ if (pressedDate.isValid())
+ emit q->pressed(pressedDate);
+}
+
+void QQuickAbstractCalendarViewPrivate::clearPress(bool clicked)
+{
+ Q_Q(QQuickAbstractCalendarView);
+ setContextProperty(pressedItem, QStringLiteral("pressed"), false);
+ if (pressedDate.isValid()) {
+ emit q->released(pressedDate);
+ if (clicked)
+ emit q->clicked(pressedDate);
+ }
+ pressedDate = QDate();
+ pressedItem = Q_NULLPTR;
+}
+
+void QQuickAbstractCalendarViewPrivate::setContextProperty(QQuickItem *item, const QString &name, const QVariant &value)
+{
+ QQmlContext *context = qmlContext(item);
+ if (context && context->isValid()) {
+ context = context->parentContext();
+ if (context && context->isValid())
+ context->setContextProperty(name, value);
+ }
+}
+
+QQuickAbstractCalendarView::QQuickAbstractCalendarView(QQuickItem *parent) :
+ QQuickAbstractContainer(*(new QQuickAbstractCalendarViewPrivate), parent)
+{
+ Q_D(QQuickAbstractCalendarView);
+ setFlag(ItemIsFocusScope);
+ setActiveFocusOnTab(true);
+ setAcceptedMouseButtons(Qt::LeftButton);
+
+ d->model = new QQuickMonthModel(this);
+ d->source = QVariant::fromValue(d->model);
+ connect(d->model, &QQuickMonthModel::monthChanged, this, &QQuickAbstractCalendarView::monthChanged);
+ connect(d->model, &QQuickMonthModel::yearChanged, this, &QQuickAbstractCalendarView::yearChanged);
+ connect(d->model, &QQuickMonthModel::localeChanged, this, &QQuickAbstractCalendarView::localeChanged);
+ connect(d->model, &QQuickMonthModel::titleChanged, this, &QQuickAbstractCalendarView::titleChanged);
+}
+
+int QQuickAbstractCalendarView::month() const
+{
+ Q_D(const QQuickAbstractCalendarView);
+ return d->model->month();
+}
+
+void QQuickAbstractCalendarView::setMonth(int month)
+{
+ Q_D(QQuickAbstractCalendarView);
+ d->model->setMonth(month);
+}
+
+int QQuickAbstractCalendarView::year() const
+{
+ Q_D(const QQuickAbstractCalendarView);
+ return d->model->year();
+}
+
+void QQuickAbstractCalendarView::setYear(int year)
+{
+ Q_D(QQuickAbstractCalendarView);
+ d->model->setYear(year);
+}
+
+QLocale QQuickAbstractCalendarView::locale() const
+{
+ Q_D(const QQuickAbstractCalendarView);
+ return d->model->locale();
+}
+
+void QQuickAbstractCalendarView::setLocale(const QLocale &locale)
+{
+ Q_D(QQuickAbstractCalendarView);
+ d->model->setLocale(locale);
+}
+
+QVariant QQuickAbstractCalendarView::source() const
+{
+ Q_D(const QQuickAbstractCalendarView);
+ return d->source;
+}
+
+void QQuickAbstractCalendarView::setSource(const QVariant &source)
+{
+ Q_D(QQuickAbstractCalendarView);
+ if (d->source != source) {
+ d->source = source;
+ emit sourceChanged();
+ }
+}
+
+QString QQuickAbstractCalendarView::title() const
+{
+ Q_D(const QQuickAbstractCalendarView);
+ if (d->title.isNull())
+ return d->model->title();
+ return d->title;
+}
+
+void QQuickAbstractCalendarView::setTitle(const QString &title)
+{
+ Q_D(QQuickAbstractCalendarView);
+ if (d->title != title) {
+ d->title = title;
+ emit titleChanged();
+ }
+}
+
+void QQuickAbstractCalendarView::componentComplete()
+{
+ Q_D(QQuickAbstractCalendarView);
+ QQuickAbstractContainer::componentComplete();
+ if (d->contentItem) {
+ foreach (QQuickItem *child, d->contentItem->childItems()) {
+ if (!child->inherits("QQuickRepeater"))
+ d->setContextProperty(child, QStringLiteral("pressed"), false);
+ }
+ }
+}
+
+void QQuickAbstractCalendarView::mousePressEvent(QMouseEvent *event)
+{
+ Q_D(QQuickAbstractCalendarView);
+ d->updatePress(event->pos());
+ if (d->pressedDate.isValid())
+ d->pressTimer = startTimer(qGuiApp->styleHints()->mousePressAndHoldInterval());
+ event->accept();
+}
+
+void QQuickAbstractCalendarView::mouseMoveEvent(QMouseEvent *event)
+{
+ Q_D(QQuickAbstractCalendarView);
+ d->updatePress(event->pos());
+ event->accept();
+}
+
+void QQuickAbstractCalendarView::mouseReleaseEvent(QMouseEvent *event)
+{
+ Q_D(QQuickAbstractCalendarView);
+ d->clearPress(true);
+ event->accept();
+}
+
+void QQuickAbstractCalendarView::mouseUngrabEvent()
+{
+ Q_D(QQuickAbstractCalendarView);
+ d->clearPress(false);
+}
+
+void QQuickAbstractCalendarView::timerEvent(QTimerEvent *event)
+{
+ Q_D(QQuickAbstractCalendarView);
+ if (event->timerId() == d->pressTimer) {
+ if (d->pressedDate.isValid())
+ emit pressAndHold(d->pressedDate);
+ killTimer(d->pressTimer);
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/calendar/qquickabstractcalendarview_p.h b/src/calendar/qquickabstractcalendarview_p.h
new file mode 100644
index 00000000..ac55b234
--- /dev/null
+++ b/src/calendar/qquickabstractcalendarview_p.h
@@ -0,0 +1,101 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Calendar module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKABSTRACTCALENDARVIEW_P_H
+#define QQUICKABSTRACTCALENDARVIEW_P_H
+
+#include <QtQuickCalendar/private/qtquickcalendarglobal_p.h>
+#include <QtQuickControls/private/qquickabstractcontainer_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickAbstractCalendarViewPrivate;
+
+class Q_QUICKCALENDAR_EXPORT QQuickAbstractCalendarView : public QQuickAbstractContainer
+{
+ Q_OBJECT
+ Q_PROPERTY(int month READ month WRITE setMonth NOTIFY monthChanged FINAL)
+ Q_PROPERTY(int year READ year WRITE setYear NOTIFY yearChanged FINAL)
+ Q_PROPERTY(QLocale locale READ locale WRITE setLocale NOTIFY localeChanged FINAL)
+ Q_PROPERTY(QVariant source READ source WRITE setSource NOTIFY sourceChanged FINAL)
+ Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged FINAL)
+
+public:
+ explicit QQuickAbstractCalendarView(QQuickItem *parent = Q_NULLPTR);
+
+ int month() const;
+ void setMonth(int month);
+
+ int year() const;
+ void setYear(int year);
+
+ QLocale locale() const;
+ void setLocale(const QLocale &locale);
+
+ QVariant source() const;
+ void setSource(const QVariant &source);
+
+ QString title() const;
+ void setTitle(const QString &title);
+
+Q_SIGNALS:
+ void monthChanged();
+ void yearChanged();
+ void localeChanged();
+ void sourceChanged();
+ void titleChanged();
+
+ void pressed(const QDate &date);
+ void released(const QDate &date);
+ void clicked(const QDate &date);
+ void pressAndHold(const QDate &date);
+
+protected:
+ void componentComplete() Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseUngrabEvent() Q_DECL_OVERRIDE;
+ void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE;
+
+private:
+ Q_DISABLE_COPY(QQuickAbstractCalendarView)
+ Q_DECLARE_PRIVATE(QQuickAbstractCalendarView)
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKABSTRACTCALENDARVIEW_P_H
diff --git a/src/calendar/qquickabstractdayofweekrow.cpp b/src/calendar/qquickabstractdayofweekrow.cpp
new file mode 100644
index 00000000..0d2830de
--- /dev/null
+++ b/src/calendar/qquickabstractdayofweekrow.cpp
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Calendar module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickabstractdayofweekrow_p.h"
+#include "qquickdayofweekmodel_p.h"
+
+#include <QtQuickControls/private/qquickabstractcontainer_p_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickAbstractDayOfWeekRowPrivate : public QQuickAbstractContainerPrivate
+{
+public:
+ QVariant source;
+ QQuickDayOfWeekModel *model;
+};
+
+QQuickAbstractDayOfWeekRow::QQuickAbstractDayOfWeekRow(QQuickItem *parent) :
+ QQuickAbstractContainer(*(new QQuickAbstractDayOfWeekRowPrivate), parent)
+{
+ Q_D(QQuickAbstractDayOfWeekRow);
+ d->model = new QQuickDayOfWeekModel(this);
+ d->source = QVariant::fromValue(d->model);
+ connect(d->model, &QQuickDayOfWeekModel::localeChanged, this, &QQuickAbstractDayOfWeekRow::localeChanged);
+}
+
+QLocale QQuickAbstractDayOfWeekRow::locale() const
+{
+ Q_D(const QQuickAbstractDayOfWeekRow);
+ return d->model->locale();
+}
+
+void QQuickAbstractDayOfWeekRow::setLocale(const QLocale &locale)
+{
+ Q_D(QQuickAbstractDayOfWeekRow);
+ d->model->setLocale(locale);
+}
+
+QVariant QQuickAbstractDayOfWeekRow::source() const
+{
+ Q_D(const QQuickAbstractDayOfWeekRow);
+ return d->source;
+}
+
+void QQuickAbstractDayOfWeekRow::setSource(const QVariant &source)
+{
+ Q_D(QQuickAbstractDayOfWeekRow);
+ if (d->source != source) {
+ d->source = source;
+ emit sourceChanged();
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/calendar/qquickabstractdayofweekrow_p.h b/src/calendar/qquickabstractdayofweekrow_p.h
new file mode 100644
index 00000000..68dbe6fa
--- /dev/null
+++ b/src/calendar/qquickabstractdayofweekrow_p.h
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Calendar module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKABSTRACTDAYOFWEEKROW_P_H
+#define QQUICKABSTRACTDAYOFWEEKROW_P_H
+
+#include <QtQuickCalendar/private/qtquickcalendarglobal_p.h>
+#include <QtQuickControls/private/qquickabstractcontainer_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickAbstractDayOfWeekRowPrivate;
+
+class Q_QUICKCALENDAR_EXPORT QQuickAbstractDayOfWeekRow : public QQuickAbstractContainer
+{
+ Q_OBJECT
+ Q_PROPERTY(QLocale locale READ locale WRITE setLocale NOTIFY localeChanged FINAL)
+ Q_PROPERTY(QVariant source READ source WRITE setSource NOTIFY sourceChanged FINAL)
+
+public:
+ explicit QQuickAbstractDayOfWeekRow(QQuickItem *parent = Q_NULLPTR);
+
+ QLocale locale() const;
+ void setLocale(const QLocale &locale);
+
+ QVariant source() const;
+ void setSource(const QVariant &source);
+
+Q_SIGNALS:
+ void localeChanged();
+ void sourceChanged();
+
+private:
+ Q_DISABLE_COPY(QQuickAbstractDayOfWeekRow)
+ Q_DECLARE_PRIVATE(QQuickAbstractDayOfWeekRow)
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKABSTRACTDAYOFWEEKROW_P_H
diff --git a/src/calendar/qquickabstractweeknumbercolumn.cpp b/src/calendar/qquickabstractweeknumbercolumn.cpp
new file mode 100644
index 00000000..9357c0cf
--- /dev/null
+++ b/src/calendar/qquickabstractweeknumbercolumn.cpp
@@ -0,0 +1,113 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Calendar module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickabstractweeknumbercolumn_p.h"
+#include "qquickweeknumbermodel_p.h"
+
+#include <QtQuickControls/private/qquickabstractcontainer_p_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickAbstractWeekNumberColumnPrivate : public QQuickAbstractContainerPrivate
+{
+public:
+ QVariant source;
+ QQuickWeekNumberModel *model;
+};
+
+QQuickAbstractWeekNumberColumn::QQuickAbstractWeekNumberColumn(QQuickItem *parent) :
+ QQuickAbstractContainer(*(new QQuickAbstractWeekNumberColumnPrivate), parent)
+{
+ Q_D(QQuickAbstractWeekNumberColumn);
+ d->model = new QQuickWeekNumberModel(this);
+ d->source = QVariant::fromValue(d->model);
+ connect(d->model, &QQuickWeekNumberModel::monthChanged, this, &QQuickAbstractWeekNumberColumn::monthChanged);
+ connect(d->model, &QQuickWeekNumberModel::yearChanged, this, &QQuickAbstractWeekNumberColumn::yearChanged);
+ connect(d->model, &QQuickWeekNumberModel::localeChanged, this, &QQuickAbstractWeekNumberColumn::localeChanged);
+}
+
+int QQuickAbstractWeekNumberColumn::month() const
+{
+ Q_D(const QQuickAbstractWeekNumberColumn);
+ return d->model->month();
+}
+
+void QQuickAbstractWeekNumberColumn::setMonth(int month)
+{
+ Q_D(QQuickAbstractWeekNumberColumn);
+ d->model->setMonth(month);
+}
+
+int QQuickAbstractWeekNumberColumn::year() const
+{
+ Q_D(const QQuickAbstractWeekNumberColumn);
+ return d->model->year();
+}
+
+void QQuickAbstractWeekNumberColumn::setYear(int year)
+{
+ Q_D(QQuickAbstractWeekNumberColumn);
+ d->model->setYear(year);
+}
+
+QLocale QQuickAbstractWeekNumberColumn::locale() const
+{
+ Q_D(const QQuickAbstractWeekNumberColumn);
+ return d->model->locale();
+}
+
+void QQuickAbstractWeekNumberColumn::setLocale(const QLocale &locale)
+{
+ Q_D(QQuickAbstractWeekNumberColumn);
+ d->model->setLocale(locale);
+}
+
+QVariant QQuickAbstractWeekNumberColumn::source() const
+{
+ Q_D(const QQuickAbstractWeekNumberColumn);
+ return d->source;
+}
+
+void QQuickAbstractWeekNumberColumn::setSource(const QVariant &source)
+{
+ Q_D(QQuickAbstractWeekNumberColumn);
+ if (d->source != source) {
+ d->source = source;
+ emit sourceChanged();
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/calendar/qquickabstractweeknumbercolumn_p.h b/src/calendar/qquickabstractweeknumbercolumn_p.h
new file mode 100644
index 00000000..ab5ec096
--- /dev/null
+++ b/src/calendar/qquickabstractweeknumbercolumn_p.h
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Calendar module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKABSTRACTWEEKNUMBERCOLUMN_P_H
+#define QQUICKABSTRACTWEEKNUMBERCOLUMN_P_H
+
+#include <QtQuickCalendar/private/qtquickcalendarglobal_p.h>
+#include <QtQuickControls/private/qquickabstractcontainer_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickAbstractWeekNumberColumnPrivate;
+
+class Q_QUICKCALENDAR_EXPORT QQuickAbstractWeekNumberColumn : public QQuickAbstractContainer
+{
+ Q_OBJECT
+ Q_PROPERTY(int month READ month WRITE setMonth NOTIFY monthChanged FINAL)
+ Q_PROPERTY(int year READ year WRITE setYear NOTIFY yearChanged FINAL)
+ Q_PROPERTY(QLocale locale READ locale WRITE setLocale NOTIFY localeChanged FINAL)
+ Q_PROPERTY(QVariant source READ source WRITE setSource NOTIFY sourceChanged FINAL)
+
+public:
+ explicit QQuickAbstractWeekNumberColumn(QQuickItem *parent = Q_NULLPTR);
+
+ int month() const;
+ void setMonth(int month);
+
+ int year() const;
+ void setYear(int year);
+
+ QLocale locale() const;
+ void setLocale(const QLocale &locale);
+
+ QVariant source() const;
+ void setSource(const QVariant &source);
+
+Q_SIGNALS:
+ void monthChanged();
+ void yearChanged();
+ void localeChanged();
+ void sourceChanged();
+
+private:
+ Q_DISABLE_COPY(QQuickAbstractWeekNumberColumn)
+ Q_DECLARE_PRIVATE(QQuickAbstractWeekNumberColumn)
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKABSTRACTWEEKNUMBERCOLUMN_P_H
diff --git a/src/calendar/qquickcalendarmodel.cpp b/src/calendar/qquickcalendarmodel.cpp
new file mode 100644
index 00000000..c1386ed0
--- /dev/null
+++ b/src/calendar/qquickcalendarmodel.cpp
@@ -0,0 +1,195 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Calendar module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickcalendarmodel_p.h"
+
+#include <QtCore/private/qabstractitemmodel_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickCalendarModelPrivate : public QAbstractItemModelPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickCalendarModel)
+
+public:
+ QQuickCalendarModelPrivate() : complete(false),
+ from(1,1,1), to(275759, 9, 25), count(0)
+ {
+ }
+
+ static int getCount(const QDate& from, const QDate &to);
+
+ void populate(const QDate &from, const QDate &to, bool force = false);
+
+ bool complete;
+ QDate from;
+ QDate to;
+ int count;
+};
+
+int QQuickCalendarModelPrivate::getCount(const QDate& from, const QDate &to)
+{
+ QDate f(from.year(), from.month(), 1);
+ QDate t(to.year(), to.month(), to.daysInMonth());
+ QDate r = QDate(1, 1, 1).addDays(f.daysTo(t));
+ int years = r.year() - 1;
+ int months = r.month() - 1;
+ return 12 * years + months + (r.day() / t.day());
+}
+
+void QQuickCalendarModelPrivate::populate(const QDate &f, const QDate &t, bool force)
+{
+ Q_Q(QQuickCalendarModel);
+ if (!force && f == from && t == to)
+ return;
+
+ int c = getCount(from, to);
+ if (c != count) {
+ q->beginResetModel();
+ count = c;
+ q->endResetModel();
+ emit q->countChanged();
+ } else {
+ emit q->dataChanged(q->index(0, 0), q->index(c - 1, 0));
+ }
+}
+
+QQuickCalendarModel::QQuickCalendarModel(QObject *parent) :
+ QAbstractListModel(*(new QQuickCalendarModelPrivate), parent)
+{
+}
+
+QDate QQuickCalendarModel::from() const
+{
+ Q_D(const QQuickCalendarModel);
+ return d->from;
+}
+
+void QQuickCalendarModel::setFrom(const QDate &from)
+{
+ Q_D(QQuickCalendarModel);
+ if (d->from != from) {
+ if (d->complete)
+ d->populate(from, d->to);
+ d->from = from;
+ emit fromChanged();
+ }
+}
+
+QDate QQuickCalendarModel::to() const
+{
+ Q_D(const QQuickCalendarModel);
+ return d->to;
+}
+
+void QQuickCalendarModel::setTo(const QDate &to)
+{
+ Q_D(QQuickCalendarModel);
+ if (d->to != to) {
+ if (d->complete)
+ d->populate(d->from, to);
+ d->to = to;
+ emit fromChanged();
+ }
+}
+
+int QQuickCalendarModel::monthAt(int index) const
+{
+ Q_D(const QQuickCalendarModel);
+ return d->from.addMonths(index).month();
+}
+
+int QQuickCalendarModel::yearAt(int index) const
+{
+ Q_D(const QQuickCalendarModel);
+ return d->from.addMonths(index).year();
+}
+
+int QQuickCalendarModel::indexOf(const QDate &date) const
+{
+ return indexOf(date.year(), date.month());
+}
+
+int QQuickCalendarModel::indexOf(int year, int month) const
+{
+ Q_D(const QQuickCalendarModel);
+ return d->getCount(d->from, QDate(year, month, 1)) - 1;
+}
+
+QVariant QQuickCalendarModel::data(const QModelIndex &index, int role) const
+{
+ Q_D(const QQuickCalendarModel);
+ if (index.isValid() && index.row() < d->count) {
+ switch (role) {
+ case MonthRole:
+ return monthAt(index.row());
+ case YearRole:
+ return yearAt(index.row());
+ default:
+ break;
+ }
+ }
+ return QVariant();
+}
+
+int QQuickCalendarModel::rowCount(const QModelIndex &parent) const
+{
+ Q_D(const QQuickCalendarModel);
+ if (!parent.isValid())
+ return d->count;
+ return 0;
+}
+
+QHash<int, QByteArray> QQuickCalendarModel::roleNames() const
+{
+ QHash<int, QByteArray> roles;
+ roles[MonthRole] = QByteArrayLiteral("month");
+ roles[YearRole] = QByteArrayLiteral("year");
+ return roles;
+}
+
+void QQuickCalendarModel::classBegin()
+{
+}
+
+void QQuickCalendarModel::componentComplete()
+{
+ Q_D(QQuickCalendarModel);
+ d->complete = true;
+ d->populate(d->from, d->to, true);
+}
+
+QT_END_NAMESPACE
diff --git a/src/calendar/qquickcalendarmodel_p.h b/src/calendar/qquickcalendarmodel_p.h
new file mode 100644
index 00000000..e5a650f8
--- /dev/null
+++ b/src/calendar/qquickcalendarmodel_p.h
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Calendar module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKCALENDARMODEL_P_H
+#define QQUICKCALENDARMODEL_P_H
+
+#include <QtCore/qabstractitemmodel.h>
+#include <QtCore/qdatetime.h>
+#include <QtQml/qqmlparserstatus.h>
+#include <QtQuickCalendar/private/qtquickcalendarglobal_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickCalendarModelPrivate;
+
+class Q_QUICKCALENDAR_EXPORT QQuickCalendarModel : public QAbstractListModel, public QQmlParserStatus
+{
+ Q_OBJECT
+ Q_INTERFACES(QQmlParserStatus)
+ Q_PROPERTY(QDate from READ from WRITE setFrom NOTIFY fromChanged FINAL)
+ Q_PROPERTY(QDate to READ to WRITE setTo NOTIFY toChanged FINAL)
+ Q_PROPERTY(int count READ rowCount NOTIFY countChanged)
+
+public:
+ explicit QQuickCalendarModel(QObject *parent = Q_NULLPTR);
+
+ QDate from() const;
+ void setFrom(const QDate &from);
+
+ QDate to() const;
+ void setTo(const QDate &to);
+
+ Q_INVOKABLE int monthAt(int index) const;
+ Q_INVOKABLE int yearAt(int index) const;
+ Q_INVOKABLE int indexOf(const QDate &date) const;
+ Q_INVOKABLE int indexOf(int year, int month) const;
+
+ enum {
+ MonthRole,
+ YearRole
+ };
+
+ QHash<int, QByteArray> roleNames() const Q_DECL_OVERRIDE;
+ QVariant data(const QModelIndex &index, int role) const Q_DECL_OVERRIDE;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
+
+Q_SIGNALS:
+ void fromChanged();
+ void toChanged();
+ void countChanged();
+
+protected:
+ void classBegin() Q_DECL_OVERRIDE;
+ void componentComplete() Q_DECL_OVERRIDE;
+
+private:
+ Q_DISABLE_COPY(QQuickCalendarModel)
+ Q_DECLARE_PRIVATE(QQuickCalendarModel)
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKCALENDARMODEL_P_H
diff --git a/src/calendar/qquickdayofweekmodel.cpp b/src/calendar/qquickdayofweekmodel.cpp
new file mode 100644
index 00000000..7f75f784
--- /dev/null
+++ b/src/calendar/qquickdayofweekmodel.cpp
@@ -0,0 +1,123 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Calendar module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickdayofweekmodel_p.h"
+
+#include <QtCore/private/qabstractitemmodel_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickDayOfWeekModelPrivate : public QAbstractItemModelPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickDayOfWeekModel)
+
+public:
+ QLocale locale;
+};
+
+QQuickDayOfWeekModel::QQuickDayOfWeekModel(QObject *parent) :
+ QAbstractListModel(*(new QQuickDayOfWeekModelPrivate), parent)
+{
+}
+
+QLocale QQuickDayOfWeekModel::locale() const
+{
+ Q_D(const QQuickDayOfWeekModel);
+ return d->locale;
+}
+
+void QQuickDayOfWeekModel::setLocale(const QLocale &locale)
+{
+ Q_D(QQuickDayOfWeekModel);
+ if (d->locale != locale) {
+ bool changed = d->locale.firstDayOfWeek() != locale.firstDayOfWeek();
+ d->locale = locale;
+ emit localeChanged();
+ if (changed)
+ emit dataChanged(index(0, 0), index(6, 0));
+ }
+}
+
+int QQuickDayOfWeekModel::dayAt(int index) const
+{
+ Q_D(const QQuickDayOfWeekModel);
+ int day = d->locale.firstDayOfWeek() + index;
+ if (day > 7)
+ day -= 7;
+ if (day == 7)
+ day = 0; // Qt::Sunday = 7, but Sunday is 0 in JS Date
+ return day;
+}
+
+QVariant QQuickDayOfWeekModel::data(const QModelIndex &index, int role) const
+{
+ Q_D(const QQuickDayOfWeekModel);
+ if (index.isValid() && index.row() < 7) {
+ int day = dayAt(index.row());
+ switch (role) {
+ case DayRole:
+ return day;
+ case LongNameRole:
+ return d->locale.standaloneDayName(day == 0 ? Qt::Sunday : day, QLocale::LongFormat);
+ case ShortNameRole:
+ return d->locale.standaloneDayName(day == 0 ? Qt::Sunday : day, QLocale::ShortFormat);
+ case NarrowNameRole:
+ return d->locale.standaloneDayName(day == 0 ? Qt::Sunday : day, QLocale::NarrowFormat);
+ default:
+ break;
+ }
+ }
+ return QVariant();
+}
+
+int QQuickDayOfWeekModel::rowCount(const QModelIndex &parent) const
+{
+ if (parent.isValid())
+ return 0;
+ return 7;
+}
+
+QHash<int, QByteArray> QQuickDayOfWeekModel::roleNames() const
+{
+ QHash<int, QByteArray> roles;
+ roles[DayRole] = QByteArrayLiteral("day");
+ roles[LongNameRole] = QByteArrayLiteral("longName");
+ roles[ShortNameRole] = QByteArrayLiteral("shortName");
+ roles[NarrowNameRole] = QByteArrayLiteral("narrowName");
+ return roles;
+}
+
+QT_END_NAMESPACE
diff --git a/src/calendar/qquickdayofweekmodel_p.h b/src/calendar/qquickdayofweekmodel_p.h
new file mode 100644
index 00000000..776444a3
--- /dev/null
+++ b/src/calendar/qquickdayofweekmodel_p.h
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Calendar module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKDAYOFWEEKMODEL_P_H
+#define QQUICKDAYOFWEEKMODEL_P_H
+
+#include <QtCore/qabstractitemmodel.h>
+#include <QtCore/qlocale.h>
+#include <QtQuickCalendar/private/qtquickcalendarglobal_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickDayOfWeekModelPrivate;
+
+class Q_QUICKCALENDAR_EXPORT QQuickDayOfWeekModel : public QAbstractListModel
+{
+ Q_OBJECT
+ Q_PROPERTY(QLocale locale READ locale WRITE setLocale NOTIFY localeChanged FINAL)
+ Q_PROPERTY(int count READ rowCount CONSTANT FINAL)
+
+public:
+ explicit QQuickDayOfWeekModel(QObject *parent = Q_NULLPTR);
+
+ QLocale locale() const;
+ void setLocale(const QLocale &locale);
+
+ Q_INVOKABLE int dayAt(int index) const;
+
+ enum {
+ DayRole = Qt::UserRole + 1,
+ LongNameRole,
+ ShortNameRole,
+ NarrowNameRole
+ };
+
+ QHash<int, QByteArray> roleNames() const Q_DECL_OVERRIDE;
+ QVariant data(const QModelIndex &index, int role) const Q_DECL_OVERRIDE;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
+
+Q_SIGNALS:
+ void localeChanged();
+
+private:
+ Q_DISABLE_COPY(QQuickDayOfWeekModel)
+ Q_DECLARE_PRIVATE(QQuickDayOfWeekModel)
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKDAYOFWEEKMODEL_P_H
diff --git a/src/calendar/qquickmonthmodel.cpp b/src/calendar/qquickmonthmodel.cpp
new file mode 100644
index 00000000..61185d57
--- /dev/null
+++ b/src/calendar/qquickmonthmodel.cpp
@@ -0,0 +1,224 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Calendar module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickmonthmodel_p.h"
+
+#include <QtCore/private/qabstractitemmodel_p.h>
+
+namespace {
+ static const int daysInAWeek = 7;
+ static const int weeksOnACalendarMonth = 6;
+ static const int daysOnACalendarMonth = daysInAWeek * weeksOnACalendarMonth;
+}
+
+QT_BEGIN_NAMESPACE
+
+class QQuickMonthModelPrivate : public QAbstractItemModelPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickMonthModel)
+
+public:
+ QQuickMonthModelPrivate() : dates(daysOnACalendarMonth)
+ {
+ QDate date = QDate::currentDate();
+ month = date.month();
+ year = date.year();
+ }
+
+ bool populate(int month, int year, const QLocale &locale, bool force = false);
+
+ int month;
+ int year;
+ QString title;
+ QLocale locale;
+ QVector<QDate> dates;
+};
+
+bool QQuickMonthModelPrivate::populate(int m, int y, const QLocale &l, bool force)
+{
+ Q_Q(QQuickMonthModel);
+ if (!force && m == month && y == year && l.firstDayOfWeek() == locale.firstDayOfWeek())
+ return false;
+
+ // The actual first (1st) day of the month.
+ QDate firstDayOfMonthDate(y, m, 1);
+ int difference = ((firstDayOfMonthDate.dayOfWeek() - l.firstDayOfWeek()) + 7) % 7;
+ // The first day to display should never be the 1st of the month, as we want some days from
+ // the previous month to be visible.
+ if (difference == 0)
+ difference += 7;
+ QDate firstDateToDisplay = firstDayOfMonthDate.addDays(-difference);
+
+ for (int i = 0; i < daysOnACalendarMonth; ++i)
+ dates[i] = firstDateToDisplay.addDays(i);
+
+ q->setTitle(l.standaloneMonthName(m) + QStringLiteral(" ") + QString::number(y));
+
+ return true;
+}
+
+QQuickMonthModel::QQuickMonthModel(QObject *parent) :
+ QAbstractListModel(*(new QQuickMonthModelPrivate), parent)
+{
+ Q_D(QQuickMonthModel);
+ d->populate(d->month, d->year, d->locale, true);
+}
+
+int QQuickMonthModel::month() const
+{
+ Q_D(const QQuickMonthModel);
+ return d->month;
+}
+
+void QQuickMonthModel::setMonth(int month)
+{
+ Q_D(QQuickMonthModel);
+ if (d->month != month) {
+ if (d->populate(month, d->year, d->locale))
+ emit dataChanged(index(0, 0), index(daysOnACalendarMonth - 1, 0));
+ d->month = month;
+ emit monthChanged();
+ }
+}
+
+int QQuickMonthModel::year() const
+{
+ Q_D(const QQuickMonthModel);
+ return d->year;
+}
+
+void QQuickMonthModel::setYear(int year)
+{
+ Q_D(QQuickMonthModel);
+ if (d->year != year) {
+ if (d->populate(d->month, year, d->locale))
+ emit dataChanged(index(0, 0), index(daysOnACalendarMonth - 1, 0));
+ d->year = year;
+ emit yearChanged();
+ }
+}
+
+QLocale QQuickMonthModel::locale() const
+{
+ Q_D(const QQuickMonthModel);
+ return d->locale;
+}
+
+void QQuickMonthModel::setLocale(const QLocale &locale)
+{
+ Q_D(QQuickMonthModel);
+ if (d->locale != locale) {
+ if (d->populate(d->month, d->year, locale))
+ emit dataChanged(index(0, 0), index(daysOnACalendarMonth - 1, 0));
+ d->locale = locale;
+ emit localeChanged();
+ }
+}
+
+QString QQuickMonthModel::title() const
+{
+ Q_D(const QQuickMonthModel);
+ return d->title;
+}
+
+void QQuickMonthModel::setTitle(const QString &title)
+{
+ Q_D(QQuickMonthModel);
+ if (d->title != title) {
+ d->title = title;
+ emit titleChanged();
+ }
+}
+
+QDate QQuickMonthModel::dateAt(int index) const
+{
+ Q_D(const QQuickMonthModel);
+ return d->dates.value(index);
+}
+
+int QQuickMonthModel::indexOf(const QDate &date) const
+{
+ Q_D(const QQuickMonthModel);
+ if (date < d->dates.first() || date > d->dates.last())
+ return -1;
+ return qMax(qint64(0), d->dates.first().daysTo(date));
+}
+
+QVariant QQuickMonthModel::data(const QModelIndex &index, int role) const
+{
+ Q_D(const QQuickMonthModel);
+ if (index.isValid() && index.row() < daysOnACalendarMonth) {
+ const QDate date = d->dates.at(index.row());
+ switch (role) {
+ case DateRole:
+ return date;
+ case DayRole:
+ return date.day();
+ case TodayRole:
+ return date == QDate::currentDate();
+ case WeekNumberRole:
+ return date.weekNumber();
+ case MonthRole:
+ return date.month();
+ case YearRole:
+ return date.year();
+ default:
+ break;
+ }
+ }
+ return QVariant();
+}
+
+int QQuickMonthModel::rowCount(const QModelIndex &parent) const
+{
+ if (parent.isValid())
+ return 0;
+ return daysOnACalendarMonth;
+}
+
+QHash<int, QByteArray> QQuickMonthModel::roleNames() const
+{
+ QHash<int, QByteArray> roles;
+ roles[DateRole] = QByteArrayLiteral("date");
+ roles[DayRole] = QByteArrayLiteral("day");
+ roles[TodayRole] = QByteArrayLiteral("today");
+ roles[WeekNumberRole] = QByteArrayLiteral("weekNumber");
+ roles[MonthRole] = QByteArrayLiteral("month");
+ roles[YearRole] = QByteArrayLiteral("year");
+ return roles;
+}
+
+QT_END_NAMESPACE
diff --git a/src/calendar/qquickmonthmodel_p.h b/src/calendar/qquickmonthmodel_p.h
new file mode 100644
index 00000000..22720cc8
--- /dev/null
+++ b/src/calendar/qquickmonthmodel_p.h
@@ -0,0 +1,102 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Calendar module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKMONTHMODEL_P_H
+#define QQUICKMONTHMODEL_P_H
+
+#include <QtCore/qabstractitemmodel.h>
+#include <QtCore/qdatetime.h>
+#include <QtCore/qlocale.h>
+#include <QtQuickCalendar/private/qtquickcalendarglobal_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickMonthModelPrivate;
+
+class Q_QUICKCALENDAR_EXPORT QQuickMonthModel : public QAbstractListModel
+{
+ Q_OBJECT
+ Q_PROPERTY(int month READ month WRITE setMonth NOTIFY monthChanged FINAL)
+ Q_PROPERTY(int year READ year WRITE setYear NOTIFY yearChanged FINAL)
+ Q_PROPERTY(QLocale locale READ locale WRITE setLocale NOTIFY localeChanged FINAL)
+ Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged FINAL)
+ Q_PROPERTY(int count READ rowCount CONSTANT FINAL)
+
+public:
+ explicit QQuickMonthModel(QObject *parent = Q_NULLPTR);
+
+ int month() const;
+ void setMonth(int month);
+
+ int year() const;
+ void setYear(int year);
+
+ QLocale locale() const;
+ void setLocale(const QLocale &locale);
+
+ QString title() const;
+ void setTitle(const QString &title);
+
+ Q_INVOKABLE QDate dateAt(int index) const;
+ Q_INVOKABLE int indexOf(const QDate &date) const;
+
+ enum {
+ DateRole = Qt::UserRole + 1,
+ DayRole,
+ TodayRole,
+ WeekNumberRole,
+ MonthRole,
+ YearRole
+ };
+
+ QHash<int, QByteArray> roleNames() const Q_DECL_OVERRIDE;
+ QVariant data(const QModelIndex &index, int role) const Q_DECL_OVERRIDE;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
+
+Q_SIGNALS:
+ void monthChanged();
+ void yearChanged();
+ void localeChanged();
+ void titleChanged();
+
+private:
+ Q_DISABLE_COPY(QQuickMonthModel)
+ Q_DECLARE_PRIVATE(QQuickMonthModel)
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKMONTHMODEL_P_H
diff --git a/src/calendar/qquickweeknumbermodel.cpp b/src/calendar/qquickweeknumbermodel.cpp
new file mode 100644
index 00000000..34d66202
--- /dev/null
+++ b/src/calendar/qquickweeknumbermodel.cpp
@@ -0,0 +1,182 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Calendar module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickweeknumbermodel_p.h"
+
+#include <QtCore/private/qabstractitemmodel_p.h>
+#include <QtCore/qdatetime.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickWeekNumberModelPrivate : public QAbstractItemModelPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickWeekNumberModel)
+
+public:
+ QQuickWeekNumberModelPrivate()
+ {
+ QDate date = QDate::currentDate();
+ month = date.month();
+ year = date.year();
+ first = calculateFirst(month, year, locale);
+ }
+
+ void init(int month, int year, const QLocale &locale = QLocale());
+ static int calculateFirst(int month, int year, const QLocale &locale);
+
+ int month;
+ int year;
+ int first;
+ QLocale locale;
+};
+
+void QQuickWeekNumberModelPrivate::init(int m, int y, const QLocale &l)
+{
+ Q_Q(QQuickWeekNumberModel);
+ if (m == month && y == year && l.firstDayOfWeek() == locale.firstDayOfWeek())
+ return;
+
+ first = calculateFirst(m, y, l);
+
+ emit q->dataChanged(q->index(0, 0), q->index(5, 0));
+}
+
+int QQuickWeekNumberModelPrivate::calculateFirst(int month, int year, const QLocale &locale)
+{
+ // The actual first (1st) day of the month.
+ QDate firstDayOfMonthDate(year, month, 1);
+ int difference = ((firstDayOfMonthDate.dayOfWeek() - locale.firstDayOfWeek()) + 7) % 7;
+ // The first day to display should never be the 1st of the month, as we want some days from
+ // the previous month to be visible.
+ if (difference == 0)
+ difference += 7;
+ return firstDayOfMonthDate.addDays(-difference).weekNumber();
+}
+
+QQuickWeekNumberModel::QQuickWeekNumberModel(QObject *parent) :
+ QAbstractListModel(*(new QQuickWeekNumberModelPrivate), parent)
+{
+}
+
+int QQuickWeekNumberModel::month() const
+{
+ Q_D(const QQuickWeekNumberModel);
+ return d->month;
+}
+
+void QQuickWeekNumberModel::setMonth(int month)
+{
+ Q_D(QQuickWeekNumberModel);
+ if (d->month != month) {
+ d->init(month, d->year, d->locale);
+ d->month = month;
+ emit monthChanged();
+ }
+}
+
+int QQuickWeekNumberModel::year() const
+{
+ Q_D(const QQuickWeekNumberModel);
+ return d->year;
+}
+
+void QQuickWeekNumberModel::setYear(int year)
+{
+ Q_D(QQuickWeekNumberModel);
+ if (d->year != year) {
+ d->init(d->month, year, d->locale);
+ d->year = year;
+ emit yearChanged();
+ }
+}
+
+QLocale QQuickWeekNumberModel::locale() const
+{
+ Q_D(const QQuickWeekNumberModel);
+ return d->locale;
+}
+
+void QQuickWeekNumberModel::setLocale(const QLocale &locale)
+{
+ Q_D(QQuickWeekNumberModel);
+ if (d->locale != locale) {
+ d->init(d->month, d->year, locale);
+ d->locale = locale;
+ emit localeChanged();
+ }
+}
+
+int QQuickWeekNumberModel::weekNumberAt(int index) const
+{
+ Q_D(const QQuickWeekNumberModel);
+ if (index < 0 || index > 5)
+ return -1;
+ return d->first + index;
+}
+
+int QQuickWeekNumberModel::indexOf(int weekNumber) const
+{
+ Q_D(const QQuickWeekNumberModel);
+ if (weekNumber < d->first || weekNumber > d->first + 6)
+ return -1;
+ return weekNumber - d->first;
+}
+
+QVariant QQuickWeekNumberModel::data(const QModelIndex &index, int role) const
+{
+ if (role == WeekNumberRole) {
+ int weekNumber = weekNumberAt(index.row());
+ if (weekNumber != -1)
+ return weekNumber;
+ }
+ return QVariant();
+}
+
+int QQuickWeekNumberModel::rowCount(const QModelIndex &parent) const
+{
+ if (parent.isValid())
+ return 0;
+ return 6;
+}
+
+QHash<int, QByteArray> QQuickWeekNumberModel::roleNames() const
+{
+ QHash<int, QByteArray> roles;
+ roles[WeekNumberRole] = QByteArrayLiteral("weekNumber");
+ return roles;
+}
+
+QT_END_NAMESPACE
diff --git a/src/calendar/qquickweeknumbermodel_p.h b/src/calendar/qquickweeknumbermodel_p.h
new file mode 100644
index 00000000..d64da352
--- /dev/null
+++ b/src/calendar/qquickweeknumbermodel_p.h
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Calendar module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKWEEKNUMBERMODEL_P_H
+#define QQUICKWEEKNUMBERMODEL_P_H
+
+#include <QtCore/qabstractitemmodel.h>
+#include <QtCore/qlocale.h>
+#include <QtQuickCalendar/private/qtquickcalendarglobal_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickWeekNumberModelPrivate;
+
+class Q_QUICKCALENDAR_EXPORT QQuickWeekNumberModel : public QAbstractListModel
+{
+ Q_OBJECT
+ Q_PROPERTY(int month READ month WRITE setMonth NOTIFY monthChanged FINAL)
+ Q_PROPERTY(int year READ year WRITE setYear NOTIFY yearChanged FINAL)
+ Q_PROPERTY(QLocale locale READ locale WRITE setLocale NOTIFY localeChanged FINAL)
+ Q_PROPERTY(int count READ rowCount CONSTANT FINAL)
+
+public:
+ explicit QQuickWeekNumberModel(QObject *parent = Q_NULLPTR);
+
+ int month() const;
+ void setMonth(int month);
+
+ int year() const;
+ void setYear(int year);
+
+ QLocale locale() const;
+ void setLocale(const QLocale &locale);
+
+ Q_INVOKABLE int weekNumberAt(int index) const;
+ Q_INVOKABLE int indexOf(int weekNumber) const;
+
+ enum {
+ WeekNumberRole = Qt::UserRole + 1
+ };
+
+ QHash<int, QByteArray> roleNames() const Q_DECL_OVERRIDE;
+ QVariant data(const QModelIndex &index, int role) const Q_DECL_OVERRIDE;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
+
+Q_SIGNALS:
+ void monthChanged();
+ void yearChanged();
+ void localeChanged();
+
+private:
+ Q_DISABLE_COPY(QQuickWeekNumberModel)
+ Q_DECLARE_PRIVATE(QQuickWeekNumberModel)
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKWEEKNUMBERMODEL_P_H
diff --git a/src/calendar/qtquickcalendarglobal_p.h b/src/calendar/qtquickcalendarglobal_p.h
new file mode 100644
index 00000000..8f04361e
--- /dev/null
+++ b/src/calendar/qtquickcalendarglobal_p.h
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Calendar module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QTQUICKCALENDARGLOBAL_P_H
+#define QTQUICKCALENDARGLOBAL_P_H
+
+#include <QtCore/qglobal.h>
+
+QT_BEGIN_NAMESPACE
+
+#ifndef QT_STATIC
+# if defined(QT_BUILD_QUICKCALENDAR_LIB)
+# define Q_QUICKCALENDAR_EXPORT Q_DECL_EXPORT
+# else
+# define Q_QUICKCALENDAR_EXPORT Q_DECL_IMPORT
+# endif
+#else
+# define Q_QUICKCALENDAR_EXPORT
+#endif
+
+QT_END_NAMESPACE
+
+#endif // QTQUICKCALENDARGLOBAL_P_H