QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
GeoTagImageModel.h
Go to the documentation of this file.
1#pragma once
2
3#include <QtCore/QAbstractListModel>
4#include <QtPositioning/QGeoCoordinate>
5#include <QtQmlIntegration/QtQmlIntegration>
6
9class GeoTagImageModel : public QAbstractListModel
10{
11 Q_OBJECT
12 QML_ELEMENT
13
14 Q_PROPERTY(int count READ count NOTIFY countChanged)
15
16public:
24 Q_ENUM(Status)
25
34
35 explicit GeoTagImageModel(QObject *parent = nullptr);
36 ~GeoTagImageModel() override;
37
38 // QAbstractListModel interface
39 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
40 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
41 QHash<int, QByteArray> roleNames() const override;
42
43 int count() const { return rowCount(); }
44
45 // Model manipulation
46 void clear();
47 void addImage(const QString &filePath);
48 void setStatus(int index, Status status, const QString &errorMessage = QString());
49 void setCoordinate(int index, const QGeoCoordinate &coordinate);
50 void setStatusByPath(const QString &filePath, Status status, const QString &errorMessage = QString());
51
52 // Batch operations
53 void setAllStatus(Status status);
54
55signals:
57
58private:
59 struct ImageInfo {
60 QString filePath;
61 QString fileName;
62 Status status = Pending;
63 QString errorMessage;
64 QGeoCoordinate coordinate;
65 };
66
67 QList<ImageInfo> _images;
68
69 static QString statusToString(Status status);
70};
Model for displaying geotagging image status in QML.
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
void setAllStatus(Status status)
void setStatusByPath(const QString &filePath, Status status, const QString &errorMessage=QString())
void setCoordinate(int index, const QGeoCoordinate &coordinate)
void setStatus(int index, Status status, const QString &errorMessage=QString())
int rowCount(const QModelIndex &parent=QModelIndex()) const override
~GeoTagImageModel() override
void addImage(const QString &filePath)
QHash< int, QByteArray > roleNames() const override