Changeset View
Changeset View
Standalone View
Standalone View
src/lib/marble/declarative/RouteRelationModel.h
- This file was added.
1 | // | ||||
---|---|---|---|---|---|
2 | // This file is part of the Marble Virtual Globe. | ||||
3 | // | ||||
4 | // This program is free software licensed under the GNU LGPL. You can | ||||
5 | // find a copy of this license in LICENSE.txt in the top directory of | ||||
6 | // the source code. | ||||
7 | // | ||||
8 | // Copyright 2017 Sergey Popov <sergobot@protonmail.com> | ||||
9 | // | ||||
10 | | ||||
11 | #ifndef MARBLE_DECLARATIVE_ROUTERELATIONMODEL_H | ||||
12 | #define MARBLE_DECLARATIVE_ROUTERELATIONMODEL_H | ||||
13 | | ||||
14 | #include <QAbstractListModel> | ||||
15 | #include <QVector> | ||||
16 | | ||||
17 | #include "GeoDataRelation.h" | ||||
18 | | ||||
19 | namespace Marble { | ||||
20 | | ||||
21 | class RouteRelationModel : public QAbstractListModel | ||||
22 | { | ||||
23 | Q_OBJECT | ||||
24 | public: | ||||
25 | enum RelationRoles { | ||||
26 | RelationName = Qt::UserRole + 1 | ||||
27 | }; | ||||
28 | | ||||
29 | RouteRelationModel(QObject* parent = 0); | ||||
30 | | ||||
31 | void setRelations(const QVector<const Marble::GeoDataRelation*> &relations); | ||||
32 | | ||||
33 | int rowCount(const QModelIndex & parent = QModelIndex()) const; | ||||
34 | | ||||
35 | QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const; | ||||
36 | | ||||
37 | protected: | ||||
38 | QHash<int, QByteArray> roleNames() const; | ||||
39 | | ||||
40 | private: | ||||
41 | QVector<const Marble::GeoDataRelation*> m_relations; | ||||
42 | }; | ||||
43 | | ||||
44 | } | ||||
45 | | ||||
46 | #endif // ROUTERELATIONMODEL |