File indexing completed on 2025-04-27 04:04:21
0001 /* 0002 * SPDX-FileCopyrightText: (C) 2014 Vishesh Handa <vhanda@kde.org> 0003 * SPDX-FileCopyrightText: (C) 2017 Atul Sharma <atulsharma406@gmail.com> 0004 * 0005 * SPDX-License-Identifier: LGPL-2.1-or-later 0006 */ 0007 0008 #ifndef IMAGELOCATIONMODEL_H 0009 #define IMAGELOCATIONMODEL_H 0010 0011 #include <QAbstractListModel> 0012 #include <QGeoLocation> 0013 #include <QStringList> 0014 0015 #include "types.h" 0016 0017 class ImageLocationModel : public QAbstractListModel 0018 { 0019 Q_OBJECT 0020 Q_PROPERTY(Types::LocationGroup group READ group WRITE setGroup NOTIFY groupChanged) 0021 public: 0022 explicit ImageLocationModel(QObject *parent = nullptr); 0023 0024 QHash<int, QByteArray> roleNames() const override; 0025 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; 0026 int rowCount(const QModelIndex &parent = QModelIndex()) const override; 0027 0028 Types::LocationGroup group() const; 0029 void setGroup(Types::LocationGroup group); 0030 0031 signals: 0032 void groupChanged(); 0033 0034 private slots: 0035 void slotPopulate(); 0036 0037 private: 0038 Types::LocationGroup m_group; 0039 QList<QPair<QByteArray, QString>> m_locations; 0040 }; 0041 0042 #endif // IMAGELOCATIONMODEL_H