diff options
Diffstat (limited to 'src/controls/Private/qquickcalendarmodel.cpp')
-rw-r--r-- | src/controls/Private/qquickcalendarmodel.cpp | 51 |
1 files changed, 27 insertions, 24 deletions
diff --git a/src/controls/Private/qquickcalendarmodel.cpp b/src/controls/Private/qquickcalendarmodel.cpp index bc222c07..64d52f95 100644 --- a/src/controls/Private/qquickcalendarmodel.cpp +++ b/src/controls/Private/qquickcalendarmodel.cpp @@ -1,34 +1,37 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Quick Controls module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL3$ +** $QT_BEGIN_LICENSE:LGPL$ ** 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. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://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 +** Foundation and appearing in the file LICENSE.LGPL3 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. +** will be met: https://www.gnu.org/licenses/lgpl-3.0.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. +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** @@ -76,7 +79,7 @@ QT_BEGIN_NAMESPACE [03][04][05][06][07][08][09] */ -QQuickCalendarModel::QQuickCalendarModel(QObject *parent) : +QQuickCalendarModel1::QQuickCalendarModel1(QObject *parent) : QAbstractListModel(parent) { } @@ -87,7 +90,7 @@ QQuickCalendarModel::QQuickCalendarModel(QObject *parent) : We store all of the days in the month of visibleDate, as well as any days in the previous or following month if there is enough space. */ -QDate QQuickCalendarModel::visibleDate() const +QDate QQuickCalendarModel1::visibleDate() const { return mVisibleDate; } @@ -99,7 +102,7 @@ QDate QQuickCalendarModel::visibleDate() const visible date, the visible date is changed and populateFromVisibleDate() called. */ -void QQuickCalendarModel::setVisibleDate(const QDate &date) +void QQuickCalendarModel1::setVisibleDate(const QDate &date) { if (date != mVisibleDate && date.isValid()) { const QDate previousDate = mVisibleDate; @@ -134,7 +137,7 @@ void QQuickCalendarModel::setVisibleDate(const QDate &date) [30][31][01][02][03][04][05] ... */ -QLocale QQuickCalendarModel::locale() const +QLocale QQuickCalendarModel1::locale() const { return mLocale; } @@ -142,7 +145,7 @@ QLocale QQuickCalendarModel::locale() const /*! Sets the locale to \a locale. */ -void QQuickCalendarModel::setLocale(const QLocale &locale) +void QQuickCalendarModel1::setLocale(const QLocale &locale) { if (locale != mLocale) { Qt::DayOfWeek previousFirstDayOfWeek = mLocale.firstDayOfWeek(); @@ -156,19 +159,19 @@ void QQuickCalendarModel::setLocale(const QLocale &locale) } } -QVariant QQuickCalendarModel::data(const QModelIndex &index, int role) const +QVariant QQuickCalendarModel1::data(const QModelIndex &index, int role) const { if (role == DateRole) return mVisibleDates.at(index.row()); return QVariant(); } -int QQuickCalendarModel::rowCount(const QModelIndex &) const +int QQuickCalendarModel1::rowCount(const QModelIndex &) const { return mVisibleDates.isEmpty() ? 0 : weeksOnACalendarMonth * daysInAWeek; } -QHash<int, QByteArray> QQuickCalendarModel::roleNames() const +QHash<int, QByteArray> QQuickCalendarModel1::roleNames() const { QHash<int, QByteArray> names; names[DateRole] = QByteArrayLiteral("date"); @@ -178,7 +181,7 @@ QHash<int, QByteArray> QQuickCalendarModel::roleNames() const /*! Returns the date at \a index, or an invalid date if \a index is invalid. */ -QDate QQuickCalendarModel::dateAt(int index) const +QDate QQuickCalendarModel1::dateAt(int index) const { return index >= 0 && index < mVisibleDates.size() ? mVisibleDates.at(index) : QDate(); } @@ -186,7 +189,7 @@ QDate QQuickCalendarModel::dateAt(int index) const /*! Returns the index for \a date, or -1 if \a date is outside of our range. */ -int QQuickCalendarModel::indexAt(const QDate &date) +int QQuickCalendarModel1::indexAt(const QDate &date) { if (mVisibleDates.size() == 0 || date < mFirstVisibleDate || date > mLastVisibleDate) return -1; @@ -201,7 +204,7 @@ int QQuickCalendarModel::indexAt(const QDate &date) Returns the week number for the first day of the week corresponding to \a row, or -1 if \a row is outside of our range. */ -int QQuickCalendarModel::weekNumberAt(int row) const +int QQuickCalendarModel1::weekNumberAt(int row) const { const int index = row * daysInAWeek; const QDate date = dateAt(index); @@ -220,7 +223,7 @@ int QQuickCalendarModel::weekNumberAt(int row) const shown doesn't change, but the days displayed do. The \a previousDate parameter is ignored when \a force is true. */ -void QQuickCalendarModel::populateFromVisibleDate(const QDate &previousDate, bool force) +void QQuickCalendarModel1::populateFromVisibleDate(const QDate &previousDate, bool force) { // We don't need to populate if the year and month haven't changed. if (!force && mVisibleDate.year() == previousDate.year() && mVisibleDate.month() == previousDate.month()) |