File indexing completed on 2024-11-24 04:50:38

0001 // SPDX-FileCopyrightText: 2021 Claudio Cambra <claudio.cambra@gmail.com>
0002 // SPDX-License-Identifier: LGPL-2.1-or-later
0003 
0004 #pragma once
0005 
0006 #include <QAbstractListModel>
0007 #include <QList>
0008 
0009 class TimeZoneListModel : public QAbstractListModel
0010 {
0011     Q_OBJECT
0012 
0013 public:
0014     enum Roles { IdRole = Qt::UserRole + 1 };
0015     Q_ENUM(Roles)
0016 
0017     explicit TimeZoneListModel(QObject *parent = nullptr);
0018     ~TimeZoneListModel() override = default;
0019 
0020     QVariant data(const QModelIndex &idx, int role) const override;
0021     QHash<int, QByteArray> roleNames() const override;
0022     int rowCount(const QModelIndex &parent = {}) const override;
0023 
0024     Q_INVOKABLE int getTimeZoneRow(const QByteArray &timeZone);
0025 
0026 private:
0027     QList<QByteArray> m_timeZones;
0028 };