Marble

PositionSource.h
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2011 Dennis Nienhüser <nienhueser@kde.org>
4//
5
6#ifndef MARBLE_DECLARATIVE_POSITIONSOURCE_H
7#define MARBLE_DECLARATIVE_POSITIONSOURCE_H
8
9#include "Coordinate.h"
10#include "MarbleQuickItem.h"
11
12#include <QObject>
13#include <qqmlintegration.h>
14
15namespace Marble
16{
17
18class MarbleQuickItem;
19
20class PositionSource : public QObject
21{
23 QML_ELEMENT
24
25 Q_PROPERTY(MarbleQuickItem *map READ map WRITE setMap NOTIFY mapChanged)
26 Q_PROPERTY(bool active READ active WRITE setActive NOTIFY activeChanged)
27 Q_PROPERTY(QString source READ source WRITE setSource NOTIFY sourceChanged)
28 Q_PROPERTY(bool hasPosition READ hasPosition NOTIFY hasPositionChanged)
29 Q_PROPERTY(Coordinate *position READ position NOTIFY positionChanged)
30 Q_PROPERTY(qreal speed READ speed NOTIFY speedChanged)
31
32public:
33 explicit PositionSource(QObject *parent = nullptr);
34 ~PositionSource();
35
36 bool active() const;
37
38 void setActive(bool active);
39
40 QString source() const;
41
42 void setSource(const QString &source);
43
44 bool hasPosition() const;
45
46 Coordinate *position();
47
48 MarbleQuickItem *map();
49
50 void setMap(MarbleQuickItem *map);
51
52 qreal speed() const;
53
55 void mapChanged();
56
57 void activeChanged();
58
59 void sourceChanged();
60
61 void hasPositionChanged();
62
63 void positionChanged();
64
65 void speedChanged();
66
67private Q_SLOTS:
68 void updatePosition();
69
70private:
71 void start();
72
73 bool m_active;
74
75 QString m_source;
76
77 bool m_hasPosition;
78
79 Coordinate m_position;
80
81 QPointer<MarbleQuickItem> m_marbleQuickItem;
82
83 qreal m_speed;
84};
85
86}
87
88#endif
Represents a coordinate with the properties of a name and coordinates.
Definition Coordinate.h:19
Binds a QML item to a specific geodetic location in screen coordinates.
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
Q_SIGNALSQ_SIGNALS
Q_SLOTSQ_SLOTS
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 8 2024 12:02:42 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.