KPublicTransport

pathmodel.h
1 /*
2  SPDX-FileCopyrightText: 2021 Volker Krause <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #ifndef KPUBLICTRANSPORT_PATHMODEL_H
8 #define KPUBLICTRANSPORT_PATHMODEL_H
9 
10 #include "kpublictransport_export.h"
11 
12 #include <KPublicTransport/Path>
13 
14 #include <QAbstractListModel>
15 
16 namespace KPublicTransport {
17 
18 /** Model representing a KPublicTransport::Path.
19  * Each row is a KPublicTransport::PathSection, the model computes
20  * additional information such as turn directions for each section.
21  */
22 class KPUBLICTRANSPORT_EXPORT PathModel : public QAbstractListModel
23 {
24  Q_OBJECT
25  Q_PROPERTY(KPublicTransport::Path path READ path WRITE setPath)
26 
27 public:
28  explicit PathModel(QObject *parent = nullptr);
29  ~PathModel();
30 
31  enum Role {
32  PathSectionRole = Qt::UserRole,
33  TurnDirectionRole,
34  };
35 
36  Path path() const;
37  void setPath(const Path &path);
38 
39  int rowCount(const QModelIndex &parent = {}) const override;
40  QVariant data(const QModelIndex &index, int role) const override;
41  QHash<int, QByteArray> roleNames() const override;
42 
43 private:
44  Path m_path;
45 };
46 
47 }
48 
49 #endif // KPUBLICTRANSPORT_PATHMODEL_H
Query operations and data types for accessing realtime public transport information from online servi...
Definition: attribution.cpp:16
Definition: location.h:16
UserRole
A path followed by any kind of location change.
Definition: path.h:88
Model representing a KPublicTransport::Path.
Definition: pathmodel.h:22
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sat Oct 23 2021 23:05:21 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.