KPublicTransport

pathmodel.h
1/*
2 SPDX-FileCopyrightText: 2021 Volker Krause <vkrause@kde.org>
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
16namespace 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 */
22class KPUBLICTRANSPORT_EXPORT PathModel : public QAbstractListModel
23{
24 Q_OBJECT
25 Q_PROPERTY(KPublicTransport::Path path READ path WRITE setPath)
26
27public:
28 explicit PathModel(QObject *parent = nullptr);
29 ~PathModel() override;
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
43private:
44 Path m_path;
45};
46
47}
48
49#endif // KPUBLICTRANSPORT_PATHMODEL_H
Model representing a KPublicTransport::Path.
Definition pathmodel.h:23
A path followed by any kind of location change.
Definition path.h:113
Query operations and data types for accessing realtime public transport information from online servi...
UserRole
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:59:57 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.