17#ifndef TIMEZONEMODEL_H
18#define TIMEZONEMODEL_H
22#include <QAbstractListModel>
24class TimeZoneLocationModel:
public QAbstractListModel
27 Q_PROPERTY(
bool listUpdating READ listUpdating NOTIFY listUpdatingChanged)
28 Q_PROPERTY(QString filter READ filter WRITE setFilter NOTIFY filterChanged)
29 Q_PROPERTY(QString country READ country WRITE setCountry NOTIFY countryChanged)
33 explicit TimeZoneLocationModel(QObject *parent =
nullptr);
34 ~TimeZoneLocationModel();
37 TimeZoneRole = Qt::UserRole + 1,
46 int rowCount(
const QModelIndex &parent = QModelIndex())
const override;
47 QVariant data(
const QModelIndex &index,
int role = Qt::DisplayRole)
const override;
48 QHash<int, QByteArray> roleNames()
const override;
50 bool listUpdating()
const;
52 QString filter()
const;
53 void setFilter(
const QString &filter);
55 QString country()
const;
56 void setCountry(
const QString &country);
59 void listUpdatingChanged();
61 void countryChanged(
const QString &country);
64 void setModel(
const QList<GeonamesCity *> &locations);
65 void setListUpdating(
bool listUpdating);
66 static void filterFinished(GObject *source_object,
74 GCancellable *m_cancellable;
75 QHash<int, QByteArray> m_roleNames;
76 QList<GeonamesCity *> m_locations;
77 QList<GeonamesCity *> m_countryLocations;