6#include <QtCore/private/qabstractitemmodel_p.h>
7#include <QtCore/qdatetime.h>
40 QDate firstDayOfMonthDate(
y,
m, 1);
41 int difference = ((firstDayOfMonthDate.dayOfWeek() - l.
firstDayOfWeek()) + 7) % 7;
47 for (
int i = 0;
i < 6; ++
i)
48 weekNumbers[
i] = firstDayOfMonthDate.addDays(
i * 7 - difference).weekNumber();
51 emit q->dataChanged(
q->index(0, 0),
q->index(5, 0));
84 if (
d->year !=
year) {
85 d->init(
d->month,
year,
d->locale);
110 if (index < 0 || index > 5)
112 return d->weekNumbers[
index];
118 if (weekNumber < d->weekNumbers[0] || weekNumber >
d->weekNumbers[5])
120 return weekNumber -
d->weekNumbers[0];
127 if (weekNumber != -1)
142 QHash<int, QByteArray> roles;
149#include "moc_qquickweeknumbermodel_p.cpp"
QObject * parent() const
Returns a pointer to the parent object.
\inmodule QtCore \reentrant
int month() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
int year() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
static QDate currentDate()
Returns the system clock's current date.
Qt::DayOfWeek firstDayOfWeek() const
static QDate calculateFirst(int month, int year, const QLocale &locale)
QQuickWeekNumberModelPrivate()
void init(int month, int year, const QLocale &locale=QLocale())
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Returns the number of rows under the given parent.
QQuickWeekNumberModel(QObject *parent=nullptr)
QHash< int, QByteArray > roleNames() const override
void setLocale(const QLocale &locale)
QVariant data(const QModelIndex &index, int role) const override
Returns the data stored under the given role for the item referred to by the index.
Q_INVOKABLE int indexOf(int weekNumber) const
Q_INVOKABLE int weekNumberAt(int index) const
Combined button and popup list for selecting options.
#define QByteArrayLiteral(str)
GLdouble GLdouble GLdouble GLdouble q