Marble

Bookmarks.h
1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 //
3 // SPDX-FileCopyrightText: 2012 Dennis Nienhüser <[email protected]>
4 //
5 
6 #ifndef MARBLE_DECLARATIVE_BOOKMARKS_H
7 #define MARBLE_DECLARATIVE_BOOKMARKS_H
8 
9 #include <QObject>
10 #include <QSortFilterProxyModel>
11 #include <GeoDataTreeModel.h>
12 #include "Placemark.h"
13 
14 namespace Marble {
15 
16 class MarbleQuickItem;
17 
18 class BookmarksModel: public QSortFilterProxyModel
19 {
20  Q_OBJECT
21  Q_PROPERTY( int count READ count NOTIFY countChanged )
22 
23 public:
24  explicit BookmarksModel( QObject *parent = nullptr );
25 
26  int count() const;
27 
28 public Q_SLOTS:
29  qreal longitude( int index ) const;
30 
31  qreal latitude( int index ) const;
32 
33  QString name( int index ) const;
34 
35 Q_SIGNALS:
36  void countChanged();
37 };
38 
39 class Bookmarks : public QObject
40 {
41  Q_OBJECT
42 
43  Q_PROPERTY( Marble::MarbleQuickItem* map READ map WRITE setMap NOTIFY mapChanged)
44  Q_PROPERTY( BookmarksModel* model READ model NOTIFY modelChanged )
45 
46 public:
47  explicit Bookmarks( QObject* parent = nullptr );
48 
49  MarbleQuickItem* map();
50 
51  void setMap(MarbleQuickItem *widget );
52 
53  BookmarksModel* model();
54 
55  Q_INVOKABLE bool isBookmark( qreal longitude, qreal latitude ) const;
56 
57  Q_INVOKABLE Placemark* placemark(int index);
58 
59 public Q_SLOTS:
60  void addBookmark(Placemark *placemark, const QString &folder );
61  void removeBookmark( qreal longitude, qreal latitude );
62  void updateBookmarkDocument();
63 
64 Q_SIGNALS:
65  void mapChanged();
66 
67  void modelChanged();
68 
69 private:
70  MarbleQuickItem* m_marbleQuickItem;
71  BookmarksModel* m_proxyModel;
72  GeoDataTreeModel m_treeModel;
73 };
74 
75 }
76 
77 #endif
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
Q_SLOTSQ_SLOTS
const QList< QKeySequence > & addBookmark()
Binds a QML item to a specific geodetic location in screen coordinates.
Q_INVOKABLEQ_INVOKABLE
Q_SIGNALSQ_SIGNALS
QString name(StandardShortcut id)
QFuture< void > map(Sequence &sequence, MapFunctor function)
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Oct 2 2023 03:52:07 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.