KPublicTransport

vehiclelayoutquerymodel.h
1 /*
2  SPDX-FileCopyrightText: 2019 Volker Krause <[email protected]>
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 
18 namespace KPublicTransport {
19 
20 class VehicleLayoutQueryModelPrivate;
21 
22 /** Model for retrieving vehicle and platform layout query results. */
23 class 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 
35 public:
36  explicit VehicleLayoutQueryModel(QObject *parent = nullptr);
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;
54 Q_SIGNALS:
55  void requestChanged();
56  void contentChanged();
57 
58 private:
59  friend class VehicleLayoutQueryModelPrivate;
60  Q_DECLARE_PRIVATE(VehicleLayoutQueryModel)
61 };
62 
63 }
64 
65 #endif // KPUBLICTRANSPORT_VEHICLELAYOUTQUERYMODEL_H
Query operations and data types for accessing realtime public transport information from online servi...
Definition: attribution.cpp:16
Definition: location.h:16
UserRole
Information about the vehicle used on a journey.
Definition: vehicle.h:140
Describes a query for vehicle layout information.
Information about an arrival and/or departure of a vehicle at a stop area.
Definition: stopover.h:25
Information about the layout of a station platform.
Definition: platform.h:44
Model for retrieving vehicle and platform layout query results.
Common base class for query models, do not use directly.
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.