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