KPublicTransport

vehiclelayoutquerymodel.h
1/*
2 SPDX-FileCopyrightText: 2019 Volker Krause <vkrause@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#ifndef KPUBLICTRANSPORT_VEHICLELAYOUTQUERYMODEL_H
8#define KPUBLICTRANSPORT_VEHICLELAYOUTQUERYMODEL_H
9
10#include "kpublictransport_export.h"
11#include "abstractquerymodel.h"
12
13#include <KPublicTransport/Platform>
14#include <KPublicTransport/Stopover>
15#include <KPublicTransport/Vehicle>
16#include <KPublicTransport/VehicleLayoutRequest>
17
18namespace KPublicTransport {
19
20class VehicleLayoutQueryModelPrivate;
21
22/** Model for retrieving vehicle and platform layout query results. */
23class KPUBLICTRANSPORT_EXPORT VehicleLayoutQueryModel : public AbstractQueryModel
24{
25 Q_OBJECT
26 Q_PROPERTY(KPublicTransport::VehicleLayoutRequest request READ request WRITE setRequest NOTIFY requestChanged)
27
28 /** The vehicle for which this model shows its sections. */
29 Q_PROPERTY(KPublicTransport::Vehicle vehicle READ vehicle NOTIFY contentChanged)
30 /** The platform this vehicle is departing from. */
31 Q_PROPERTY(KPublicTransport::Platform platform READ platform NOTIFY contentChanged)
32 /** The departure this vehicle layout belongs to. */
33 Q_PROPERTY(KPublicTransport::Stopover stopover READ stopover NOTIFY contentChanged)
34
35public:
36 explicit VehicleLayoutQueryModel(QObject *parent = nullptr);
37 ~VehicleLayoutQueryModel() override;
38
39 VehicleLayoutRequest request() const;
40 void setRequest(const VehicleLayoutRequest &req);
41
42 Vehicle vehicle() const;
43 Platform platform() const;
44 Stopover stopover() const;
45
46 enum Roles {
47 VehicleSectionRole = Qt::UserRole
48 };
49 Q_ENUM(Roles)
50
51 int rowCount(const QModelIndex &parent = {}) const override;
52 QVariant data(const QModelIndex &index, int role) const override;
53 QHash<int, QByteArray> roleNames() const override;
54Q_SIGNALS:
55 void requestChanged();
56 void contentChanged();
57
58private:
59 friend class VehicleLayoutQueryModelPrivate;
60 Q_DECLARE_PRIVATE(VehicleLayoutQueryModel)
61};
62
63}
64
65#endif // KPUBLICTRANSPORT_VEHICLELAYOUTQUERYMODEL_H
Common base class for query models, do not use directly.
Information about the layout of a station platform.
Definition platform.h:45
Information about an arrival and/or departure of a vehicle at a stop area.
Definition stopover.h:26
Model for retrieving vehicle and platform layout query results.
Describes a query for vehicle layout information.
Information about the vehicle used on a journey.
Definition vehicle.h:159
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.