1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QQUICKDAYOFWEEKMODEL_P_H
5#define QQUICKDAYOFWEEKMODEL_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtCore/qabstractitemmodel.h>
19#include <QtCore/qlocale.h>
20#include <QtQml/qqml.h>
21#include <QtCore/private/qglobal_p.h>
22
23QT_BEGIN_NAMESPACE
24
25class QQuickDayOfWeekModelPrivate;
26
27class QQuickDayOfWeekModel : public QAbstractListModel
28{
29 Q_OBJECT
30 Q_PROPERTY(QLocale locale READ locale WRITE setLocale NOTIFY localeChanged FINAL)
31 Q_PROPERTY(int count READ rowCount CONSTANT FINAL)
32
33public:
34 explicit QQuickDayOfWeekModel(QObject *parent = nullptr);
35
36 QLocale locale() const;
37 void setLocale(const QLocale &locale);
38
39 Q_INVOKABLE int dayAt(int index) const;
40
41 enum {
42 DayRole = Qt::UserRole + 1,
43 LongNameRole,
44 ShortNameRole,
45 NarrowNameRole
46 };
47
48 QHash<int, QByteArray> roleNames() const override;
49 QVariant data(const QModelIndex &index, int role) const override;
50 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
51
52Q_SIGNALS:
53 void localeChanged();
54
55private:
56 Q_DISABLE_COPY(QQuickDayOfWeekModel)
57 Q_DECLARE_PRIVATE(QQuickDayOfWeekModel)
58};
59
60QT_END_NAMESPACE
61
62QML_DECLARE_TYPE(QQuickDayOfWeekModel)
63
64#endif // QQUICKDAYOFWEEKMODEL_P_H
65

source code of qtdeclarative/src/quicktemplates/qquickdayofweekmodel_p.h