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
qgeoroutesegment.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 QGEOROUTESEGMENT_H
6#define QGEOROUTESEGMENT_H
7
8#include <QtCore/QObject>
9#include <QtCore/QExplicitlySharedDataPointer>
10#include <QtCore/QList>
11#include <QtLocation/qlocationglobal.h>
12#include <QtQml/qqml.h>
13
14QT_BEGIN_NAMESPACE
15
16class QGeoCoordinate;
17class QGeoManeuver;
18class QGeoRouteSegmentPrivate;
19
20QT_DECLARE_QESDP_SPECIALIZATION_DTOR_WITH_EXPORT(QGeoRouteSegmentPrivate, Q_LOCATION_EXPORT)
21class Q_LOCATION_EXPORT QGeoRouteSegment
22{
23 Q_GADGET
24 QML_VALUE_TYPE(routeSegment)
25 QML_STRUCTURED_VALUE
26
27 Q_PROPERTY(int travelTime READ travelTime CONSTANT)
28 Q_PROPERTY(qreal distance READ distance CONSTANT)
29 Q_PROPERTY(QList<QGeoCoordinate> path READ path CONSTANT)
30 Q_PROPERTY(QGeoManeuver maneuver READ maneuver CONSTANT)
31public:
32 QGeoRouteSegment();
33 QGeoRouteSegment(const QGeoRouteSegment &other) noexcept;
34 QGeoRouteSegment(QGeoRouteSegment &&other) noexcept = default;
35 ~QGeoRouteSegment();
36
37 QGeoRouteSegment &operator=(const QGeoRouteSegment &other) noexcept;
38 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QGeoRouteSegment)
39
40 void swap(QGeoRouteSegment &other) noexcept { d_ptr.swap(other.d_ptr); }
41
42 friend inline bool operator ==(const QGeoRouteSegment &lhs, const QGeoRouteSegment &rhs) noexcept
43 { return lhs.isEqual(rhs); }
44 friend inline bool operator !=(const QGeoRouteSegment &lhs, const QGeoRouteSegment &rhs) noexcept
45 { return !lhs.isEqual(rhs); }
46
47 bool isValid() const;
48 bool isLegLastSegment() const;
49
50 void setNextRouteSegment(const QGeoRouteSegment &routeSegment);
51 QGeoRouteSegment nextRouteSegment() const;
52
53 void setTravelTime(int secs);
54 int travelTime() const;
55
56 void setDistance(qreal distance);
57 qreal distance() const;
58
59 void setPath(const QList<QGeoCoordinate> &path);
60 QList<QGeoCoordinate> path() const;
61
62 void setManeuver(const QGeoManeuver &maneuver);
63 QGeoManeuver maneuver() const;
64
65private:
66 QExplicitlySharedDataPointer<QGeoRouteSegmentPrivate> d_ptr;
67 QGeoRouteSegment(QExplicitlySharedDataPointer<QGeoRouteSegmentPrivate> &&dd);
68
69 bool isEqual(const QGeoRouteSegment &other) const noexcept;
70
71 friend class QGeoRouteSegmentPrivate;
72};
73
74QT_END_NAMESPACE
75
76#endif
\inmodule QtLocation
\inmodule QtLocation
Definition qgeoroute.h:25
Combined button and popup list for selecting options.