Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qgeoroute.h
Go to the documentation of this file.
1// Copyright (C) 2015 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5#ifndef QGEOROUTE_H
6#define QGEOROUTE_H
7
8#include <QtLocation/QGeoRouteRequest>
9
10#include <QtCore/QObject>
11#include <QtCore/QExplicitlySharedDataPointer>
12#include <QtCore/QList>
13
14#include "QtQml/qqml.h"
15
16QT_BEGIN_NAMESPACE
17
18class QGeoCoordinate;
19class QGeoRectangle;
20class QGeoRouteSegment;
21
22class QGeoRoutePrivate;
23QT_DECLARE_QESDP_SPECIALIZATION_DTOR_WITH_EXPORT(QGeoRoutePrivate, Q_LOCATION_EXPORT)
24class Q_LOCATION_EXPORT QGeoRoute
25{
26 Q_GADGET
27 QML_VALUE_TYPE(route)
28 QML_STRUCTURED_VALUE
29
30 Q_PROPERTY(QString routeId READ routeId CONSTANT)
31 Q_PROPERTY(QGeoRectangle bounds READ bounds CONSTANT)
32 Q_PROPERTY(int travelTime READ travelTime CONSTANT)
33 Q_PROPERTY(qreal distance READ distance CONSTANT)
34 Q_PROPERTY(QList<QGeoCoordinate> path READ path WRITE setPath)
35 Q_PROPERTY(QList<QGeoRoute> routeLegs READ routeLegs CONSTANT)
36 Q_PROPERTY(QVariantMap extendedAttributes READ extendedAttributes CONSTANT)
37 Q_PROPERTY(int legIndex READ legIndex CONSTANT)
38 Q_PROPERTY(QGeoRoute overallRoute READ overallRoute CONSTANT)
39 Q_PROPERTY(qsizetype segmentsCount READ segmentsCount CONSTANT)
40 Q_PROPERTY(QList<QGeoRouteSegment> segments READ segments CONSTANT)
41
42public:
43 QGeoRoute();
44 QGeoRoute(const QGeoRoute &other) noexcept;
45 QGeoRoute(QGeoRoute &&other) noexcept = default;
46 ~QGeoRoute();
47
48 QGeoRoute &operator=(const QGeoRoute &other) noexcept;
49 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QGeoRoute)
50
51 void swap(QGeoRoute &other) noexcept { d_ptr.swap(other.d_ptr); }
52
53 friend inline bool operator==(const QGeoRoute &lhs, const QGeoRoute &rhs) noexcept
54 { return lhs.isEqual(rhs); }
55 friend inline bool operator!=(const QGeoRoute &lhs, const QGeoRoute &rhs) noexcept
56 { return !lhs.isEqual(rhs); }
57
58 void setRouteId(const QString &id);
59 QString routeId() const;
60
61 void setRequest(const QGeoRouteRequest &request);
62 QGeoRouteRequest request() const;
63
64 void setBounds(const QGeoRectangle &bounds);
65 QGeoRectangle bounds() const;
66
67 void setFirstRouteSegment(const QGeoRouteSegment &routeSegment);
68 QGeoRouteSegment firstRouteSegment() const;
69 qsizetype segmentsCount() const;
70 QList<QGeoRouteSegment> segments() const;
71
72 void setTravelTime(int secs);
73 int travelTime() const;
74
75 void setDistance(qreal distance);
76 qreal distance() const;
77
78 void setTravelMode(QGeoRouteRequest::TravelMode mode);
79 QGeoRouteRequest::TravelMode travelMode() const;
80
81 void setPath(const QList<QGeoCoordinate> &path);
82 QList<QGeoCoordinate> path() const;
83
84 void setRouteLegs(const QList<QGeoRoute> &legs);
85 QList<QGeoRoute> routeLegs() const;
86
87 void setExtendedAttributes(const QVariantMap &extendedAttributes);
88 QVariantMap extendedAttributes() const;
89
90 void setLegIndex(int idx);
91 int legIndex() const;
92
93 void setOverallRoute(const QGeoRoute &route);
94 QGeoRoute overallRoute() const;
95
96protected:
97 QExplicitlySharedDataPointer<QGeoRoutePrivate> &d();
98 const QExplicitlySharedDataPointer<QGeoRoutePrivate> &const_d() const;
99
100private:
101 QExplicitlySharedDataPointer<QGeoRoutePrivate> d_ptr;
102 bool isEqual(const QGeoRoute &other) const noexcept;
103
104 friend class QDeclarativeGeoRoute;
105 friend class QGeoRoutePrivate;
106};
107
108QT_END_NAMESPACE
109
110#endif
\inmodule QtLocation
Definition qgeoroute.h:25
Combined button and popup list for selecting options.