File indexing completed on 2024-04-28 04:40:44

0001 /*
0002  *   SPDX-FileCopyrightText: 2019 David Edmundson <davidedmundson@kde.org>
0003  *
0004  *   SPDX-License-Identifier: LGPL-2.0-or-later
0005  */
0006 
0007 #pragma once
0008 
0009 #include <QAbstractListModel>
0010 
0011 /// Display the number of months in a year.
0012 class YearModel : public QAbstractListModel
0013 {
0014     Q_OBJECT
0015     Q_PROPERTY(int year READ year WRITE setYear NOTIFY yearChanged)
0016 
0017 public:
0018     explicit YearModel(QObject *parent = nullptr);
0019     ~YearModel();
0020 
0021     int year() const;
0022     void setYear(int year);
0023 
0024     int rowCount(const QModelIndex &parent) const override;
0025     QVariant data(const QModelIndex &index, int role) const override;
0026 
0027 Q_SIGNALS:
0028     void yearChanged();
0029 
0030 private:
0031     int m_year;
0032 };