Marble

RouteRequestModel.h
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2011 Dennis Nienhüser <nienhueser@kde.org>
4//
5
6#ifndef MARBLE_ROUTEREQUESTMODEL_H
7#define MARBLE_ROUTEREQUESTMODEL_H
8
9#include <QAbstractListModel>
10#include <qqmlregistration.h>
11
12namespace Marble
13{
14class RouteRequest;
15class Routing;
16}
17
18class RouteRequestModel : public QAbstractListModel
19{
21 QML_ELEMENT
22
23 Q_PROPERTY(Marble::Routing *routing READ routing WRITE setRouting NOTIFY routingChanged)
24
25public:
26 enum RouteRequestModelRoles {
27 LongitudeRole = Qt::UserRole + 1,
28 LatitudeRole = Qt::UserRole + 2
29 };
30
31 /** Constructor */
32 explicit RouteRequestModel(QObject *parent = nullptr);
33
34 /** Destructor */
35 ~RouteRequestModel() override;
36
37 // Model querying
38
39 /** Overload of QAbstractListModel */
40 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
41
42 /** Overload of QAbstractListModel */
43 QHash<int, QByteArray> roleNames() const override;
44
45 /** Overload of QAbstractListModel */
46 QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
47
48 /** Overload of QAbstractListModel */
49 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
50
51 Marble::Routing *routing();
52
53public Q_SLOTS:
54 void setRouting(Marble::Routing *routing);
55
56 void setPosition(int index, qreal longitude, qreal latitude, const QString &name);
57
58 void reverse();
59
61 void routingChanged();
62
63private Q_SLOTS:
64 void updateMap();
65
66 void updateData(int index);
67
68 void updateAfterRemoval(int index);
69
70 void updateAfterAddition(int index);
71
72private:
73 Marble::RouteRequest *m_request = nullptr;
74 Marble::Routing *m_routing = nullptr;
75};
76
77#endif // MARBLE_ROUTEREQUESTMODEL_H
Points to be included in a route.
Binds a QML item to a specific geodetic location in screen coordinates.
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const const override
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
Q_SIGNALSQ_SIGNALS
Q_SLOTSQ_SLOTS
QObject * parent() const const
UserRole
Orientation
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 8 2024 12:02:42 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.