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
qgeomaneuver.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 QGEOMANEUVER_H
6#define QGEOMANEUVER_H
7
8#include <QtCore/QObject>
9#include <QtCore/qshareddata.h>
10#include <QtLocation/qlocationglobal.h>
11#include <QtQml/qqml.h>
12
13QT_BEGIN_NAMESPACE
14
15class QString;
16class QGeoCoordinate;
17class QGeoManeuverPrivate;
18QT_DECLARE_QSDP_SPECIALIZATION_DTOR_WITH_EXPORT(QGeoManeuverPrivate, Q_LOCATION_EXPORT)
19
20class Q_LOCATION_EXPORT QGeoManeuver
21{
22 Q_GADGET
23 QML_VALUE_TYPE(routeManeuver)
24 QML_STRUCTURED_VALUE
25
26 Q_PROPERTY(bool valid READ isValid CONSTANT)
27 Q_PROPERTY(QGeoCoordinate position READ position CONSTANT)
28 Q_PROPERTY(QString instructionText READ instructionText CONSTANT)
29 Q_PROPERTY(InstructionDirection direction READ direction CONSTANT)
30 Q_PROPERTY(int timeToNextInstruction READ timeToNextInstruction CONSTANT)
31 Q_PROPERTY(qreal distanceToNextInstruction READ distanceToNextInstruction CONSTANT)
32 Q_PROPERTY(QGeoCoordinate waypoint READ waypoint CONSTANT)
33 Q_PROPERTY(QVariantMap extendedAttributes READ extendedAttributes CONSTANT)
34
35public:
36 enum InstructionDirection {
37 NoDirection,
38 DirectionForward,
39 DirectionBearRight,
40 DirectionLightRight,
41 DirectionRight,
42 DirectionHardRight,
43 DirectionUTurnRight,
44 DirectionUTurnLeft,
45 DirectionHardLeft,
46 DirectionLeft,
47 DirectionLightLeft,
48 DirectionBearLeft
49 };
50 Q_ENUM(InstructionDirection)
51
52 QGeoManeuver();
53 QGeoManeuver(const QGeoManeuver &other) noexcept;
54 QGeoManeuver(QGeoManeuver &&other) noexcept = default;
55 ~QGeoManeuver();
56
57 QGeoManeuver &operator= (const QGeoManeuver &other);
58 QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QGeoManeuver)
59
60 void swap(QGeoManeuver &other) noexcept { d_ptr.swap(other.d_ptr); }
61
62 friend inline bool operator==(const QGeoManeuver &lhs, const QGeoManeuver &rhs) noexcept
63 { return lhs.isEqual(rhs); }
64 friend inline bool operator!=(const QGeoManeuver &lhs, const QGeoManeuver &rhs) noexcept
65 { return !lhs.isEqual(rhs); }
66
67 bool isValid() const;
68
69 void setPosition(const QGeoCoordinate &position);
70 QGeoCoordinate position() const;
71
72 void setInstructionText(const QString &instructionText);
73 QString instructionText() const;
74
75 void setDirection(InstructionDirection direction);
76 InstructionDirection direction() const;
77
78 void setTimeToNextInstruction(int secs);
79 int timeToNextInstruction() const;
80
81 void setDistanceToNextInstruction(qreal distance);
82 qreal distanceToNextInstruction() const;
83
84 void setWaypoint(const QGeoCoordinate &coordinate);
85 QGeoCoordinate waypoint() const;
86
87 void setExtendedAttributes(const QVariantMap &extendedAttributes);
88 QVariantMap extendedAttributes() const;
89
90private:
91 QSharedDataPointer<QGeoManeuverPrivate> d_ptr;
92
93 bool isEqual(const QGeoManeuver &other) const;
94};
95
97
98QT_END_NAMESPACE
99
100Q_DECLARE_METATYPE(QGeoManeuver)
101Q_DECLARE_METATYPE(QGeoManeuver::InstructionDirection)
102
103#endif
\inmodule QtLocation