Marble

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

KDE's Doxygen guidelines are available online.