2018-03-11 11:49:38 +00:00
|
|
|
#ifndef RECENTLOCATIONSMODEL_HXX
|
|
|
|
#define RECENTLOCATIONSMODEL_HXX
|
|
|
|
|
|
|
|
#include <QAbstractListModel>
|
2018-03-19 00:36:49 +00:00
|
|
|
#include <QVariantList>
|
2018-03-11 11:49:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
class RecentLocationsModel : public QAbstractListModel
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
RecentLocationsModel(QObject* pr = nullptr);
|
|
|
|
|
|
|
|
QVariant data(const QModelIndex &index, int role) const override;
|
|
|
|
|
|
|
|
int rowCount(const QModelIndex &parent) const override;
|
|
|
|
|
|
|
|
QHash<int, QByteArray> roleNames() const override;
|
|
|
|
|
|
|
|
QVariantMap mostRecent() const;
|
|
|
|
|
|
|
|
void insert(QVariant location);
|
|
|
|
|
|
|
|
void saveToSettings();
|
|
|
|
|
|
|
|
Q_INVOKABLE QVariantMap locationAt(int index) const;
|
|
|
|
private:
|
|
|
|
QVariantList m_data;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // RECENTLOCATIONSMODEL_HXX
|