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
11namespace Marble {
12 class RouteRequest;
13 class Routing;
14}
15
16class RouteRequestModel : public QAbstractListModel
17{
19
20 Q_PROPERTY( Marble::Routing* routing READ routing WRITE setRouting NOTIFY routingChanged )
21 Q_PROPERTY( int count READ rowCount NOTIFY rowCountChanged )
22
23public:
24 enum RouteRequestModelRoles {
25 LongitudeRole = Qt::UserRole+1,
26 LatitudeRole = Qt::UserRole+2
27 };
28
29 /** Constructor */
30 explicit RouteRequestModel( QObject *parent = nullptr );
31
32 /** Destructor */
33 ~RouteRequestModel() override;
34
35 // Model querying
36
37 /** Overload of QAbstractListModel */
38 int rowCount ( const QModelIndex &parent = QModelIndex() ) const override;
39
40 /** Overload of QAbstractListModel */
41 QHash<int, QByteArray> roleNames() const override;
42
43 /** Overload of QAbstractListModel */
44 QVariant headerData ( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const override;
45
46 /** Overload of QAbstractListModel */
47 QVariant data ( const QModelIndex &index, int role = Qt::DisplayRole ) const override;
48
49 Marble::Routing *routing();
50
51public Q_SLOTS:
52 void setRouting( Marble::Routing *routing );
53
54 void setPosition ( int index, qreal longitude, qreal latitude );
55
57 void routingChanged();
58 void rowCountChanged();
59
60private Q_SLOTS:
61 void updateMap();
62
63 void updateData( int index );
64
65 void updateAfterRemoval( int index );
66
67 void updateAfterAddition( int index );
68
69private:
70 Marble::RouteRequest* m_request;
71 Marble::Routing *m_routing;
72 QHash<int, QByteArray> m_roleNames;
73};
74
75#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
T qobject_cast(QObject *object)
UserRole
Orientation
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:18:17 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.